本文整理了Java中net.minecraft.util.math.BlockPos.<init>()
方法的一些代码示例,展示了BlockPos.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BlockPos.<init>()
方法的具体详情如下:
包路径:net.minecraft.util.math.BlockPos
类名称:BlockPos
方法名:<init>
暂无
代码示例来源:origin: EngineHub/WorldEdit
@Override
public BaseBiome getBiome(BlockVector2 position) {
checkNotNull(position);
return new BaseBiome(Biome.getIdForBiome(getWorld().getBiomeForCoordsBody(new BlockPos(position.getBlockX(), 0, position.getBlockZ()))));
}
代码示例来源:origin: EngineHub/WorldEdit
public static BlockPos toBlockPos(BlockVector3 vector) {
return new BlockPos(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ());
}
代码示例来源:origin: EngineHub/WorldEdit
/**
* Set a tile entity at the given location.
*
* @param world the world
* @param position the position
* @param clazz the tile entity class
* @param tag the tag for the tile entity (may be null to not set NBT data)
*/
static void setTileEntity(World world, BlockVector3 position, Class<? extends TileEntity> clazz, @Nullable NBTTagCompound tag) {
checkNotNull(world);
checkNotNull(position);
checkNotNull(clazz);
TileEntity tileEntity = constructTileEntity(world, position, clazz);
if (tileEntity == null) {
return;
}
if (tag != null) {
// Set X, Y, Z
updateForSet(tag, position);
tileEntity.readFromNBT(tag);
}
world.setTileEntity(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()), tileEntity);
}
代码示例来源:origin: EngineHub/WorldEdit
@Override
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
checkNotNull(position);
checkNotNull(biome);
Chunk chunk = getWorld().getChunkFromBlockCoords(new BlockPos(position.getBlockX(), 0, position.getBlockZ()));
if (chunk.isLoaded()) {
chunk.getBiomeArray()[((position.getBlockZ() & 0xF) << 4 | position.getBlockX() & 0xF)] = (byte) biome.getId();
return true;
}
return false;
}
代码示例来源:origin: EngineHub/WorldEdit
/**
* Set a tile entity at the given location using the tile entity ID from
* the tag.
*
* @param world the world
* @param position the position
* @param tag the tag for the tile entity (may be null to do nothing)
*/
static void setTileEntity(World world, BlockVector3 position, @Nullable NBTTagCompound tag) {
if (tag != null) {
updateForSet(tag, position);
TileEntity tileEntity = TileEntity.create(world, tag);
if (tileEntity != null) {
world.setTileEntity(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()), tileEntity);
}
}
}
代码示例来源:origin: EngineHub/WorldEdit
@Override
public <B extends BlockStateHolder<B>> void sendFakeBlock(BlockVector3 pos, B block) {
BlockPos loc = ForgeAdapter.toBlockPos(pos);
if (block == null) {
// TODO
// player.sendBlockChange(loc, player.getWorld().getBlockAt(loc).getBlockData());
} else {
// TODO
// player.sendBlockChange(loc, BukkitAdapter.adapt(block));
if (block instanceof BaseBlock && ((BaseBlock) block).hasNbtData()) {
player.connection.sendPacket(new SPacketUpdateTileEntity(
new BlockPos(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()), 7,
NBTConverter.toNative(((BaseBlock) block).getNbtData()))
);
}
}
}
代码示例来源:origin: EngineHub/WorldEdit
@Override
public BaseBlock getFullBlock(BlockVector3 position) {
BlockPos pos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ());
TileEntity tile = getWorld().getTileEntity(pos);
if (tile != null) {
return getBlock(position).toBaseBlock(NBTConverter.fromNative(TileEntityUtils.copyNbtData(tile)));
} else {
return getBlock(position).toBaseBlock();
}
}
代码示例来源:origin: EngineHub/WorldEdit
@Override
public BlockState getBlock(BlockVector3 position) {
World world = getWorld();
BlockPos pos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ());
IBlockState mcState = world.getBlockState(pos);
BlockType blockType = BlockType.REGISTRY.get(Block.REGISTRY.getNameForObject(mcState.getBlock()).toString());
return blockType.getState(adaptProperties(blockType, mcState.getProperties()));
}
代码示例来源:origin: EngineHub/WorldEdit
BlockPos pos = new BlockPos(x, y, z);
IBlockState old = chunk.getBlockState(pos);
Block mcBlock = Block.getBlockFromName(block.getBlockType().getId());
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
public TileEntity getTile()
{
if( this.isItem )
{
return null;
}
return this.w.getTileEntity( new BlockPos( this.x, this.y, this.z ) );
}
代码示例来源:origin: Vazkii/Botania
public static MultiblockSet makeMultiblockSet() {
Multiblock mb = new Multiblock();
for(BlockPos p : PYLON_LOCATIONS)
mb.addComponent(p.up(), ModBlocks.pylon.getDefaultState().withProperty(BotaniaStateProps.PYLON_VARIANT, PylonVariant.GAIA));
for(int i = 0; i < 3; i++)
for(int j = 0; j < 3; j++)
mb.addComponent(new BeaconComponent(new BlockPos(i - 1, 0, j - 1)));
mb.addComponent(new BeaconBeamComponent(new BlockPos(0, 1, 0)));
mb.setRenderOffset(new BlockPos(0, -1, 0));
return mb.makeSet();
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
@Override
public boolean canBlockSeeTheSky( final int x, final int y, final int z )
{
if( this.range( x, y, z ) )
{
return this.getWorld().canBlockSeeSky( new BlockPos( x, y, z ) );
}
return false;
}
代码示例来源:origin: Vazkii/Botania
public static BlockPos getBoundTile(ItemStack stack) {
int x = ItemNBTHelper.getInt(stack, TAG_BOUND_TILE_X, 0);
int y = ItemNBTHelper.getInt(stack, TAG_BOUND_TILE_Y, -1);
int z = ItemNBTHelper.getInt(stack, TAG_BOUND_TILE_Z, 0);
return new BlockPos(x, y, z);
}
代码示例来源:origin: Vazkii/Botania
public BlockPos getPoolCoords(ItemStack stack) {
int x = ItemNBTHelper.getInt(stack, TAG_POS_X, 0);
int y = ItemNBTHelper.getInt(stack, TAG_POS_Y, -1);
int z = ItemNBTHelper.getInt(stack, TAG_POS_Z, 0);
return new BlockPos(x, y, z);
}
代码示例来源:origin: Vazkii/Botania
@Override
public InvWithLocation getSparkInventory() {
int x = MathHelper.floor(posX);
int y = MathHelper.floor(posY - 1);
int z = MathHelper.floor(posZ);
return InventoryHelper.getInventoryWithLocation(world, new BlockPos(x, y, z), EnumFacing.UP);
}
代码示例来源:origin: Vazkii/Botania
@Override
public void onUsingTick(ItemStack stack, EntityLivingBase player, int time) {
if(!player.world.isRemote) {
if(time != getMaxItemUseDuration(stack) && time % 5 == 0)
breakGrass(player.world, stack, stack.getItemDamage(), new BlockPos(player));
player.world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.BLOCK_NOTE_BASS, SoundCategory.BLOCKS, 1F, 0.001F);
}
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
@Override
public void setBlock( final int x, final int y, final int z, final Block blk )
{
if( this.range( x, y, z ) )
{
this.verticalBits |= 1 << ( y >> 4 );
this.getWorld().setBlockState( new BlockPos( x, y, z ), blk.getDefaultState() );
}
}
代码示例来源:origin: Vazkii/Botania
@Override
public ISparkAttachable getAttachedTile() {
int x = MathHelper.floor(posX);
int y = MathHelper.floor(posY) - 1;
int z = MathHelper.floor(posZ);
TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
if(tile != null && tile instanceof ISparkAttachable)
return (ISparkAttachable) tile;
return null;
}
代码示例来源:origin: Vazkii/Botania
/**
* Returns the multiblock component for the coordinates, adjusted based on the anchor
*/
private MultiblockComponent getComponent(BlockPos pos) {
return multiblock.getComponentForLocation(pos.add(new BlockPos(-anchorPos.getX(), -anchorPos.getY(), -anchorPos.getZ())));
}
}
代码示例来源:origin: Vazkii/Botania
@Override
public void readFromPacketNBT(NBTTagCompound cmp) {
mana = cmp.getInteger(TAG_MANA);
passiveDecayTicks = cmp.getInteger(TAG_PASSIVE_DECAY_TICKS);
int x = cmp.getInteger(TAG_COLLECTOR_X);
int y = cmp.getInteger(TAG_COLLECTOR_Y);
int z = cmp.getInteger(TAG_COLLECTOR_Z);
cachedCollectorCoordinates = y < 0 ? null : new BlockPos(x, y, z);
}
内容来源于网络,如有侵权,请联系作者删除!