public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { dropPixie(worldIn, pos); super.breakBlock(worldIn, pos, state); }
@Override public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) { super.neighborChanged(state, world, pos, block, fromPos); this.checkAndDropBlock(world, pos, world.getBlockState(pos)); }
@Override public boolean canPlaceBlockAt(World worldIn, @Nonnull BlockPos pos) { return super.canPlaceBlockAt(worldIn, pos) && Helpers.getASolidFacing(worldIn, pos, EnumFacing.HORIZONTALS, null) != null; }
@Override public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor){ super.onNeighborChange(world, pos, neighbor); if(world instanceof World){ this.neighborsChangedCustom((World)world, pos); } }
@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 boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) { return willHarvest || super.removedByPlayer(state, world, pos, player, false); }
@Override public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) { super.onNeighborChange(world, pos, neighbor); TileEntity tile = world.getTileEntity(pos); if (tile instanceof LogisticsTileGenericSubMultiBlock) { ((LogisticsTileGenericSubMultiBlock) tile).scheduleNeighborChange(); } }
@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 boolean removedByPlayer(World world, EntityPlayer entityPlayer, int x, int y, int z, boolean willHarvest) { if (!world.isRemote) { SimpleNode node = getNode(world, x, y, z); if (node != null) { node.removedByPlayer = (EntityPlayerMP) entityPlayer; } } return super.removedByPlayer(world, entityPlayer, x, y, z, willHarvest); }
@Override public void breakBlock(World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state) { TEToolRack te = Helpers.getTE(worldIn, pos, TEToolRack.class); if (te != null) te.onBreakBlock(); super.breakBlock(worldIn, pos, state); } }
@Override @SuppressWarnings("deprecation") public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock, BlockPos fromPos) { super.neighborChanged(state, world, pos, neighborBlock, fromPos); if (world.isRemote) return; TileBase tile = getTile(world, pos); if (tile != null) tile.onNeighborChanged(); }
@Override public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) { super.onNeighborChange(world, pos, neighbor); if (world instanceof World && ((World) world).isRemote) return; TileBase tile = getTile(world, pos); if (tile != null) tile.onNeighborChanged(); }
@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 boolean canPlaceBlockAt(World world, BlockPos pos) { return super.canPlaceBlockAt(world, pos) && canBlockStay(world, pos); }
@Override @ModDependentMethod(modId = LPConstants.mcmpModID) public boolean removedByPlayer(@Nonnull IBlockState state, World world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player, boolean willHarvest) { Pair<Vec3d, Vec3d> vectors = RayTraceHelper.getRayTraceVectors(player); RayTraceResult hit = collisionRayTrace(state, world, pos, vectors.getLeft(), vectors.getRight()); Optional<TileMultipartContainer> tile = getTile(world, pos); if (hit != null && tile.isPresent() && hit.subHit >= 0) { if (!world.isRemote) { IPartSlot slot = MCMultiPart.slotRegistry.getValue(hit.subHit); boolean canRemove = tile.get().get(slot).map(i -> { if (i.getPart().canPlayerDestroy(i, player)) { i.getPart().onPartHarvested(i, player); if (player == null || !player.capabilities.isCreativeMode) { i.getPart().getDrops(i.getPartWorld(), pos, i, 0).forEach(s -> spawnAsEntity(world, pos, s)); } return true; } else { return false; } }).orElse(true); if (canRemove) tile.get().removePart(slot); } } if(hit != null && hit.subHit == -1) { return super.removedByPlayer(state, world, pos, player, willHarvest); } return false; }
@Override public void breakBlock(World world, @Nonnull BlockPos block, @Nonnull IBlockState state) { if (!world.isRemote) { T tile = getTile(world, block); if (tile != null) tile.broken(); } super.breakBlock(world, block, state); }
@Override public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) { super.neighborChanged(state, worldIn, pos, blockIn, fromPos); TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityPetrifiedWoodChest) { ((TileEntityPetrifiedWoodChest)tileentity).updateContainingBlockInfo(); } }
@Override @ModDependentMethod(modId = LPConstants.mcmpModID) public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) { Block block = mcmpBlockAccess.getBlock(); if (block != null) { block.onNeighborChange(world, pos, neighbor); } else { super.onNeighborChange(world, pos, neighbor); } }
@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); } }
@Override public boolean canPlaceBlockAt(World world, BlockPos pos) { return super.canPlaceBlockAt(world, pos) && this.canBlockStay(world, pos); }