@Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { super.onBlockPlacedBy(worldIn, pos, state, placer, stack); if (stack.hasDisplayName()) { TileEntity tile = worldIn.getTileEntity(pos); if (tile instanceof FeederBlockEntity) { ((FeederBlockEntity) tile).setCustomInventoryName(stack.getDisplayName()); } } }
@Override public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { super.onBlockPlacedBy(world, pos, state, placer, stack); if (!world.isRemote && stack.hasTagCompound()) { TileEntity tileentity = world.getTileEntity(pos); if (tileentity instanceof TileEntityFluidJar) { if (!stack.getTagCompound().hasKey("Empty")) { FluidStack fluid = FluidStack.loadFluidStackFromNBT(stack.getTagCompound()); ((TileEntityFluidJar) tileentity).tank.fillInternal(fluid, true); } } } }
@Override public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { super.onBlockPlacedBy(world, pos, state, placer, stack); IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot(); TileEntity flower = world.getTileEntity(pos); if (world.isRemote) { if (flower instanceof TileEntityFlower) { IFlower f = flowerRoot.getMember(stack); if (f != null) { ((TileEntityFlower) flower).setRender(new FlowerRenderInfo(f, (TileEntityFlower) flower)); } } return; } TileEntity below = world.getTileEntity(pos.down()); if (flower instanceof TileEntityFlower) { if (below instanceof TileEntityFlower) { ((TileEntityFlower) flower).setSection(((TileEntityFlower) below).getSection()); } else { GameProfile owner = (placer instanceof EntityPlayer) ? ((EntityPlayer) placer).getGameProfile() : null; ((TileEntityFlower) flower).create(stack, owner); } } flowerRoot.tryGrowSection(world, pos); }
@Override public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { super.onBlockPlacedBy(world, pos, state, placer, stack); if(!world.isRemote && stack.hasTagCompound() && stack.getTagCompound().hasKey("Items")) { TileEntityBambooCrate tile = Utils.getTileEntity(world, pos, TileEntityBambooCrate.class); if (tile !=null) { NBTTagList tags = stack.getTagCompound().getTagList("Items", 10); tile.inventory = NonNullList.<ItemStack>withSize(tile.getSizeInventory(), ItemStack.EMPTY); for (int i = 0; i < tags.tagCount(); i++) { NBTTagCompound data = tags.getCompoundTagAt(i); int j = data.getByte("Slot") & 255; if (j >= 0 && j < tile.inventory.size()) tile.inventory.set(j, new ItemStack(data)); } } world.notifyBlockUpdate(pos, state, state, 3); } }