public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityFlowerPot) { Item item = ((TileEntityFlowerPot)tileentity).getFlowerPotItem(); if (item instanceof ItemBlock) { return Block.getBlockFromItem(item).colorMultiplier(worldIn, pos, renderPass); } } return 16777215; }
/** * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks, * beacons, skulls, flowerpot */ public void handleUpdateTileEntity(S35PacketUpdateTileEntity packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos())) { TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos()); int i = packetIn.getTileEntityType(); if (i == 1 && tileentity instanceof TileEntityMobSpawner || i == 2 && tileentity instanceof TileEntityCommandBlock || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner) { tileentity.readFromNBT(packetIn.getNbtCompound()); } } }
/** * Updates the NBTTagCompound metadata of instances of the following * entitytypes: Mob spawners, command blocks, beacons, skulls, flowerpot */ public void handleUpdateTileEntity(S35PacketUpdateTileEntity packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos())) { TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos()); int i = packetIn.getTileEntityType(); if (i == 1 && tileentity instanceof TileEntityMobSpawner || i == 2 && tileentity instanceof TileEntityCommandBlock || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner) { tileentity.readFromNBT(packetIn.getNbtCompound()); } } }
/** * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks, * beacons, skulls, flowerpot */ public void handleUpdateTileEntity(SPacketUpdateTileEntity packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); if (this.gameController.world.isBlockLoaded(packetIn.getPos())) { TileEntity tileentity = this.gameController.world.getTileEntity(packetIn.getPos()); int i = packetIn.getTileEntityType(); boolean flag = i == 2 && tileentity instanceof TileEntityCommandBlock; if (i == 1 && tileentity instanceof TileEntityMobSpawner || flag || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityStructure || i == 8 && tileentity instanceof TileEntityEndGateway || i == 9 && tileentity instanceof TileEntitySign || i == 10 && tileentity instanceof TileEntityShulkerBox) { tileentity.readFromNBT(packetIn.getNbtCompound()); } if (flag && this.gameController.currentScreen instanceof GuiCommandBlock) { ((GuiCommandBlock)this.gameController.currentScreen).updateGui(); } } }
public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) { TileEntityFlowerPot tileentityflowerpot = this.getTileEntity(worldIn, pos); if (tileentityflowerpot != null) { ItemStack itemstack = tileentityflowerpot.getFlowerItemStack(); if (!itemstack.func_190926_b()) { return itemstack; } } return new ItemStack(Items.FLOWER_POT); }
public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) { TileEntityFlowerPot tileentityflowerpot = this.getTileEntity(worldIn, pos); if (tileentityflowerpot != null) { ItemStack itemstack = tileentityflowerpot.getFlowerItemStack(); if (itemstack != null) { return itemstack; } } return new ItemStack(Items.FLOWER_POT); }
@Override public void onReceiveClient(Minecraft client, WorldClient world, EntityPlayerSP player, MessageContext context) { BlockSystem blockSystem = BlockSystems.PROXY.getBlockSystemHandler(world).getBlockSystem(this.blockSystem); if (blockSystem != null) { if (blockSystem.isBlockLoaded(this.pos)) { TileEntity blockEntity = blockSystem.getTileEntity(this.pos); boolean commandBlock = this.type == 2 && blockEntity instanceof TileEntityCommandBlock; if (this.type == 1 && blockEntity instanceof TileEntityMobSpawner || commandBlock || this.type == 3 && blockEntity instanceof TileEntityBeacon || this.type == 4 && blockEntity instanceof TileEntitySkull || this.type == 5 && blockEntity instanceof TileEntityFlowerPot || this.type == 6 && blockEntity instanceof TileEntityBanner || this.type == 7 && blockEntity instanceof TileEntityStructure || this.type == 8 && blockEntity instanceof TileEntityEndGateway || this.type == 9 && blockEntity instanceof TileEntitySign) { blockEntity.readFromNBT(this.data); } else { blockEntity.onDataPacket(client.getConnection().getNetworkManager(), new SPacketUpdateTileEntity(this.pos, this.type, this.data)); } if (commandBlock && client.currentScreen instanceof GuiCommandBlock) { ((GuiCommandBlock) client.currentScreen).updateGui(); } } } }
@Override @SideOnly(Side.CLIENT) public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityFlowerPot) { Item item = ((TileEntityFlowerPot) tileentity).getFlowerPotItem(); if (item instanceof ItemBlock) { return Block.getBlockFromItem(item).colorMultiplier(worldIn, pos, renderPass); } } return 16777215; }
/** * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks, * beacons, skulls, flowerpot */ public void handleUpdateTileEntity(SPacketUpdateTileEntity packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos())) { TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos()); int i = packetIn.getTileEntityType(); boolean flag = i == 2 && tileentity instanceof TileEntityCommandBlock; if (i == 1 && tileentity instanceof TileEntityMobSpawner || flag || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityStructure || i == 8 && tileentity instanceof TileEntityEndGateway || i == 9 && tileentity instanceof TileEntitySign) { tileentity.readFromNBT(packetIn.getNbtCompound()); } else { tileentity.onDataPacket(netManager, packetIn); } if (flag && this.gameController.currentScreen instanceof GuiCommandBlock) { ((GuiCommandBlock)this.gameController.currentScreen).updateGui(); } } }
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { TileEntityFlowerPot tileentityflowerpot = this.getTileEntity(worldIn, pos); if (tileentityflowerpot != null && tileentityflowerpot.getFlowerPotItem() != null) { spawnAsEntity(worldIn, pos, new ItemStack(tileentityflowerpot.getFlowerPotItem(), 1, tileentityflowerpot.getFlowerPotData())); } super.breakBlock(worldIn, pos, state); }
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) { super.onBlockHarvested(worldIn, pos, state, player); if (player.capabilities.isCreativeMode) { TileEntityFlowerPot tileentityflowerpot = this.getTileEntity(worldIn, pos); if (tileentityflowerpot != null) { tileentityflowerpot.setFlowerPotData((Item)null, 0); } } }
/** * Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated */ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { TileEntityFlowerPot tileentityflowerpot = this.getTileEntity(worldIn, pos); if (tileentityflowerpot != null && tileentityflowerpot.getFlowerPotItem() != null) { spawnAsEntity(worldIn, pos, new ItemStack(tileentityflowerpot.getFlowerPotItem(), 1, tileentityflowerpot.getFlowerPotData())); } super.breakBlock(worldIn, pos, state); }
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) { super.onBlockHarvested(worldIn, pos, state, player); if (player.capabilities.isCreativeMode) { TileEntityFlowerPot tileentityflowerpot = this.getTileEntity(worldIn, pos); if (tileentityflowerpot != null) { tileentityflowerpot.func_190614_a(ItemStack.field_190927_a); } } }
@Override public java.util.List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { java.util.List<ItemStack> ret = super.getDrops(world, pos, state, fortune); TileEntityFlowerPot te = world.getTileEntity(pos) instanceof TileEntityFlowerPot ? (TileEntityFlowerPot)world.getTileEntity(pos) : null; if (te != null && te.getFlowerPotItem() != null) ret.add(new ItemStack(te.getFlowerPotItem(), 1, te.getFlowerPotData())); return ret; }
/** * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks, * beacons, skulls, flowerpot */ public void handleUpdateTileEntity(SPacketUpdateTileEntity packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos())) { TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos()); int i = packetIn.getTileEntityType(); boolean flag = i == 2 && tileentity instanceof TileEntityCommandBlock; if (i == 1 && tileentity instanceof TileEntityMobSpawner || flag || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityStructure || i == 8 && tileentity instanceof TileEntityEndGateway || i == 9 && tileentity instanceof TileEntitySign) { tileentity.readFromNBT(packetIn.getNbtCompound()); } else { if(tileentity == null) { LOGGER.error("Received invalid update packet for null tile entity at {} with data: {}", packetIn.getPos(), packetIn.getNbtCompound()); return; } tileentity.onDataPacket(netManager, packetIn); } if (flag && this.gameController.currentScreen instanceof GuiCommandBlock) { ((GuiCommandBlock)this.gameController.currentScreen).updateGui(); } } }
@Override @SideOnly(Side.CLIENT) public Item getItem(World worldIn, BlockPos pos) { TileEntityFlowerPot tileentityflowerpot = this.getTileEntity(worldIn, pos); return tileentityflowerpot != null && tileentityflowerpot.getFlowerPotItem() != null ? tileentityflowerpot.getFlowerPotItem() : Item.getItemFromBlock(MBlocks.ministrapp_flower_pot); }
@Override public int getDamageValue(World worldIn, BlockPos pos) { TileEntityFlowerPot tileentityflowerpot = this.getTileEntity(worldIn, pos); return tileentityflowerpot != null && tileentityflowerpot.getFlowerPotItem() != null ? tileentityflowerpot.getFlowerPotData() : 0; }
@Override public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) { super.onBlockHarvested(worldIn, pos, state, player); if (player.capabilities.isCreativeMode) { TileEntityFlowerPot tileentityflowerpot = this.getTileEntity(worldIn, pos); if (tileentityflowerpot != null) { tileentityflowerpot.setFlowerPotData(null, 0); } } }
@Override public java.util.List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { java.util.List<ItemStack> ret = super.getDrops(world, pos, state, fortune); TileEntityFlowerPot te = world.getTileEntity(pos) instanceof TileEntityFlowerPot ? (TileEntityFlowerPot) world.getTileEntity(pos) : null; if (te != null && te.getFlowerPotItem() != null) ret.add(new ItemStack(te.getFlowerPotItem(), 1, te.getFlowerPotData())); return ret; }
/** * Drops the block items with a specified chance of dropping the specified items */ public void dropBlockAsItemWithChance(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) { super.dropBlockAsItemWithChance(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_); TileEntityFlowerPot var8 = this.func_149929_e(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_); if (var8 != null && var8.func_145965_a() != null) { this.dropBlockAsItem_do(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, new ItemStack(var8.func_145965_a(), 1, var8.func_145966_b())); } }
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) { TileEntityFlowerPot var7 = this.func_149929_e(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_); if (var7 != null && var7.func_145965_a() != null) { this.dropBlockAsItem_do(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, new ItemStack(var7.func_145965_a(), 1, var7.func_145966_b())); } super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); }
/** * Called when the block is attempted to be harvested */ public void onBlockHarvested(World p_149681_1_, int p_149681_2_, int p_149681_3_, int p_149681_4_, int p_149681_5_, EntityPlayer p_149681_6_) { super.onBlockHarvested(p_149681_1_, p_149681_2_, p_149681_3_, p_149681_4_, p_149681_5_, p_149681_6_); if (p_149681_6_.capabilities.isCreativeMode) { TileEntityFlowerPot var7 = this.func_149929_e(p_149681_1_, p_149681_2_, p_149681_3_, p_149681_4_); if (var7 != null) { var7.func_145964_a(Item.getItemById(0), 0); } } }
/** * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks, * beacons, skulls, flowerpot */ public void handleUpdateTileEntity(S35PacketUpdateTileEntity p_147273_1_) { if (this.gameController.theWorld.blockExists(p_147273_1_.func_148856_c(), p_147273_1_.func_148855_d(), p_147273_1_.func_148854_e())) { TileEntity var2 = this.gameController.theWorld.getTileEntity(p_147273_1_.func_148856_c(), p_147273_1_.func_148855_d(), p_147273_1_.func_148854_e()); if (var2 != null) { if (p_147273_1_.func_148853_f() == 1 && var2 instanceof TileEntityMobSpawner) { var2.readFromNBT(p_147273_1_.func_148857_g()); } else if (p_147273_1_.func_148853_f() == 2 && var2 instanceof TileEntityCommandBlock) { var2.readFromNBT(p_147273_1_.func_148857_g()); } else if (p_147273_1_.func_148853_f() == 3 && var2 instanceof TileEntityBeacon) { var2.readFromNBT(p_147273_1_.func_148857_g()); } else if (p_147273_1_.func_148853_f() == 4 && var2 instanceof TileEntitySkull) { var2.readFromNBT(p_147273_1_.func_148857_g()); } else if (p_147273_1_.func_148853_f() == 5 && var2 instanceof TileEntityFlowerPot) { var2.readFromNBT(p_147273_1_.func_148857_g()); } } } }
@ScriptCallable(returnTypes = ReturnType.TABLE) public ItemStack getContents(TileEntityFlowerPot pot) { Item item = pot.getFlowerPotItem(); if (item == null) return null; int data = pot.getFlowerPotData(); return new ItemStack(item, 1, data); }
public void onBlockHarvested(World p_149681_1_, int p_149681_2_, int p_149681_3_, int p_149681_4_, int p_149681_5_, EntityPlayer p_149681_6_) { super.onBlockHarvested(p_149681_1_, p_149681_2_, p_149681_3_, p_149681_4_, p_149681_5_, p_149681_6_); if (p_149681_6_.capabilities.isCreativeMode) { TileEntityFlowerPot tileentityflowerpot = this.func_149929_e(p_149681_1_, p_149681_2_, p_149681_3_, p_149681_4_); if (tileentityflowerpot != null) { tileentityflowerpot.func_145964_a(Item.getItemById(0), 0); } } }
@Override public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) { ArrayList<ItemStack> ret = super.getDrops(world, x, y, z, metadata, fortune); TileEntityFlowerPot te = this.func_149929_e(world, x, y, z); if (te != null && te.getFlowerPotItem() != null) ret.add(new ItemStack(te.getFlowerPotItem(), 1, te.getFlowerPotData())); return ret; }