本文整理了Java中net.minecraft.world.World.getTileEntity()
方法的一些代码示例,展示了World.getTileEntity()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。World.getTileEntity()
方法的具体详情如下:
包路径:net.minecraft.world.World
类名称:World
方法名:getTileEntity
暂无
代码示例来源:origin: EngineHub/WorldEdit
@Override
public boolean clearContainerBlockContents(BlockVector3 position) {
checkNotNull(position);
TileEntity tile = getWorld().getTileEntity(ForgeAdapter.toBlockPos(position));
if ((tile instanceof IInventory)) {
IInventory inv = (IInventory) tile;
int size = inv.getSizeInventory();
for (int i = 0; i < size; i++) {
inv.setInventorySlotContents(i, ItemStack.EMPTY);
}
return true;
}
return false;
}
代码示例来源:origin: Vazkii/Botania
@Override
public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos) {
TileRuneAltar altar = (TileRuneAltar) world.getTileEntity(pos);
return altar.signal;
}
代码示例来源:origin: Vazkii/Botania
@Override
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, BlockPos pos, EnumFacing side) {
TileHourglass tile = (TileHourglass) world.getTileEntity(pos);
tile.lock = !tile.lock;
return false;
}
代码示例来源:origin: Vazkii/Botania
@Override
public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos) {
TileBrewery brew = (TileBrewery) world.getTileEntity(pos);
return brew.signal;
}
代码示例来源: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: Vazkii/Botania
@Override
public void onBurstCollision(IManaBurst burst, World world, BlockPos pos) {
TileEntity tile = world.getTileEntity(pos);
if(tile != null && tile instanceof TilePrism)
((TilePrism) tile).onBurstCollision(burst);
}
代码示例来源:origin: Vazkii/Botania
@Nonnull
@Override
public ItemStack getPickBlock(@Nonnull IBlockState state, RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, EntityPlayer player) {
String name = ((TileSpecialFlower) world.getTileEntity(pos)).subTileName;
return ItemBlockSpecialFlower.ofType(name);
}
代码示例来源:origin: Vazkii/Botania
@Override
public void breakBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state) {
TileSimpleInventory inv = (TileSimpleInventory) world.getTileEntity(pos);
InventoryHelper.dropInventory(inv, world, state, pos);
super.breakBlock(world, pos, state);
}
代码示例来源:origin: Vazkii/Botania
@Override
public void breakBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state) {
TileSimpleInventory inv = (TileSimpleInventory) world.getTileEntity(pos);
InventoryHelper.dropInventory(inv, world, state, pos);
super.breakBlock(world, pos, state);
}
代码示例来源:origin: Vazkii/Botania
@Override
public void fillWithRain(World world, BlockPos pos) {
if(world.rand.nextInt(20) == 1) {
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof TileAltar) {
TileAltar altar = (TileAltar) tile;
if(!altar.hasLava && !altar.hasWater)
altar.setWater(true);
world.updateComparatorOutputLevel(pos, this);
}
}
}
代码示例来源:origin: Vazkii/Botania
@SideOnly(Side.CLIENT)
@Override
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos) {
((TileBrewery) world.getTileEntity(pos)).renderHUD(mc, res);
}
代码示例来源:origin: Vazkii/Botania
@Override
public void onBlockClicked(World world, BlockPos pos, EntityPlayer player) {
if(!world.isRemote) {
TileCorporeaCrystalCube cube = (TileCorporeaCrystalCube) world.getTileEntity(pos);
cube.doRequest(player.isSneaking());
}
}
代码示例来源:origin: Vazkii/Botania
int getCellGeneration(BlockPos pos) {
TileEntity tile = supertile.getWorld().getTileEntity(pos);
if(tile instanceof TileCell)
return ((TileCell) tile).isSameFlower(supertile) ? ((TileCell) tile).getGeneration() : 0;
return -1;
}
代码示例来源:origin: Vazkii/Botania
public static boolean isValidBubbell(World world, BlockPos pos) {
TileEntity tile = world.getTileEntity(pos);
if(tile != null && tile instanceof ISubTileContainer) {
ISubTileContainer container = (ISubTileContainer) tile;
if(container.getSubTile() != null && container.getSubTile() instanceof SubTileBubbell) {
SubTileBubbell bubbell = (SubTileBubbell) container.getSubTile();
return bubbell.mana > COST_PER_TICK;
}
}
return false;
}
代码示例来源: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
@Override
public void breakBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state) {
TileEnchanter enchanter = (TileEnchanter) world.getTileEntity(pos);
if(!enchanter.itemToEnchant.isEmpty()) {
world.spawnEntity(new EntityItem(world, pos.getX(), pos.getY(), pos.getZ(), enchanter.itemToEnchant));
}
world.updateComparatorOutputLevel(pos, state.getBlock());
super.breakBlock(world, pos, state);
}
代码示例来源:origin: Vazkii/Botania
public void tickDispenser() {
BlockPos bind = getBinding();
if(bind != null) {
TileEntity tile = world.getTileEntity(bind);
if(tile instanceof TileEntityDispenser)
world.scheduleUpdate(bind, tile.getBlockType(), tile.getBlockType().tickRate(world));
}
}
代码示例来源:origin: Vazkii/Botania
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase par5EntityLiving, ItemStack par6ItemStack) {
world.setBlockState(pos, state.withProperty(BotaniaStateProps.CARDINALS, par5EntityLiving.getHorizontalFacing().getOpposite()));
if (par6ItemStack.hasDisplayName())
((TileTinyPotato) world.getTileEntity(pos)).name = par6ItemStack.getDisplayName();
}
代码示例来源:origin: Vazkii/Botania
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) {
boolean power = world.getRedstonePowerFromNeighbors(pos) > 0 || world.getRedstonePowerFromNeighbors(pos.up()) > 0;
boolean powered = state.getValue(BotaniaStateProps.POWERED);
if(power && !powered) {
((TileCorporeaRetainer) world.getTileEntity(pos)).fulfilRequest();
world.setBlockState(pos, state.withProperty(BotaniaStateProps.POWERED, true), 4);
} else if(!power && powered)
world.setBlockState(pos, state.withProperty(BotaniaStateProps.POWERED, false), 4);
}
代码示例来源:origin: Vazkii/Botania
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) {
boolean power = world.getRedstonePowerFromNeighbors(pos) > 0 || world.getRedstonePowerFromNeighbors(pos.up()) > 0;
boolean powered = state.getValue(BotaniaStateProps.POWERED);
if(power && !powered) {
TileEntity tile = world.getTileEntity(pos);
if(tile != null && tile instanceof TileCacophonium)
((TileCacophonium) tile).annoyDirewolf();
world.setBlockState(pos, state.withProperty(BotaniaStateProps.POWERED, true), 4);
} else if(!power && powered)
world.setBlockState(pos, state.withProperty(BotaniaStateProps.POWERED, false), 4);
}
内容来源于网络,如有侵权,请联系作者删除!