public void a( World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List list, Entity entity) { this.a(0.4375F, 0.0F, 0.4375F, 0.5625F, 0.875F, 0.5625F); super.a(world, i, j, k, axisalignedbb, list, entity); this.g(); super.a(world, i, j, k, axisalignedbb, list, entity); }
/** Add all collision boxes of this Block to the list that intersect with the given mask. */ public void addCollisionBoxesToList( World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity) { this.setBlockBounds(0.4375F, 0.0F, 0.4375F, 0.5625F, 0.875F, 0.5625F); super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); this.setBlockBoundsForItemRender(); super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); }
public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) { if (!world.isStatic) { // CraftBukkit start - Drop item in code above, not here // if (!((Boolean) iblockdata.get(BlockSkull.NODROP)).booleanValue()) { if (false) { // CraftBukkit end TileEntity tileentity = world.getTileEntity(blockposition); if (tileentity instanceof TileEntitySkull) { TileEntitySkull tileentityskull = (TileEntitySkull) tileentity; ItemStack itemstack = new ItemStack(Items.SKULL, 1, this.getDropData(world, blockposition)); if (tileentityskull.getSkullType() == 3 && tileentityskull.getGameProfile() != null) { itemstack.setTag(new NBTTagCompound()); NBTTagCompound nbttagcompound = new NBTTagCompound(); GameProfileSerializer.serialize(nbttagcompound, tileentityskull.getGameProfile()); itemstack.getTag().set("SkullOwner", nbttagcompound); } a(world, blockposition, itemstack); } } super.remove(world, blockposition, iblockdata); } }
/** * Arranges the blocks without any constraints. This puts all blocks into a single row. * * @param container the container. * @param g2 the graphics device. * @return The size after the arrangement. */ protected Size2D arrangeNN(BlockContainer container, Graphics2D g2) { double x = 0.0; double width = 0.0; double maxHeight = 0.0; List blocks = container.getBlocks(); int blockCount = blocks.size(); if (blockCount > 0) { Size2D[] sizes = new Size2D[blocks.size()]; for (int i = 0; i < blocks.size(); i++) { Block block = (Block) blocks.get(i); sizes[i] = block.arrange(g2, RectangleConstraint.NONE); width = width + sizes[i].getWidth(); maxHeight = Math.max(sizes[i].height, maxHeight); block.setBounds(new Rectangle2D.Double(x, 0.0, sizes[i].width, sizes[i].height)); x = x + sizes[i].width + this.horizontalGap; } if (blockCount > 1) { width = width + this.horizontalGap * (blockCount - 1); } if (this.verticalAlignment != VerticalAlignment.TOP) { for (int i = 0; i < blocks.size(); i++) { // Block b = (Block) blocks.get(i); if (this.verticalAlignment == VerticalAlignment.CENTER) { // TODO: shift block down by half } else if (this.verticalAlignment == VerticalAlignment.BOTTOM) { // TODO: shift block down to bottom } } } } return new Size2D(width, maxHeight); }
/** * Arranges the blocks without any constraints. This puts all blocks into a single row. * * @param container the container. * @param g2 the graphics device. * @return The size after the arrangement. */ protected Size2D arrangeNN(BlockContainer container, Graphics2D g2) { List blocks = container.getBlocks(); Block b = (Block) blocks.get(0); Size2D s = b.arrange(g2, RectangleConstraint.NONE); b.setBounds(new Rectangle2D.Double(0.0, 0.0, s.width, s.height)); return new Size2D(s.width, s.height); }
/** * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed * (coordinates passed are their own) Args: x, y, z, neighbor blockID */ public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) { super.onNeighborBlockChange(par1World, par2, par3, par4, par5); TileEntityChest var6 = (TileEntityChest) par1World.getBlockTileEntity(par2, par3, par4); if (var6 != null) { var6.updateContainingBlockInfo(); } }
public void doPhysics(World world, int i, int j, int k, int l) { super.doPhysics(world, i, j, k, l); TileEntityChest tileentitychest = (TileEntityChest) world.getTileEntity(i, j, k); if (tileentitychest != null) { tileentitychest.d(); } }
public void func_71863_a( World p_71863_1_, int p_71863_2_, int p_71863_3_, int p_71863_4_, int p_71863_5_) { super.func_71863_a(p_71863_1_, p_71863_2_, p_71863_3_, p_71863_4_, p_71863_5_); TileEntityChest tileentitychest = (TileEntityChest) p_71863_1_.func_72796_p(p_71863_2_, p_71863_3_, p_71863_4_); if (tileentitychest != null) { tileentitychest.func_70321_h(); } }
/** Called when the block is attempted to be harvested */ public void onBlockHarvested( World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) { if (par6EntityPlayer.capabilities.isCreativeMode) { par5 |= 8; par1World.setBlockMetadataWithNotify(par2, par3, par4, par5); } super.onBlockHarvested(par1World, par2, par3, par4, par5, par6EntityPlayer); }
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityBrewingStand) { InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityBrewingStand) tileentity); } super.breakBlock(worldIn, pos, state); }
public void a( World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) { if (entityhuman.abilities.canInstantlyBuild) { iblockdata = iblockdata.set(BlockSkull.NODROP, Boolean.valueOf(true)); world.setTypeAndData(blockposition, iblockdata, 4); } super.a(world, blockposition, iblockdata, entityhuman); }
public TileEntity getChunkBlockTileEntity(int i, int j, int k) { ChunkPosition chunkposition = new ChunkPosition(i, j, k); TileEntity tileentity = (TileEntity) chunkTileEntityMap.get(chunkposition); if (tileentity == null) { int l = getBlockID(i, j, k); if (!Block.isBlockContainer[l]) { return null; } BlockContainer blockcontainer = (BlockContainer) Block.blocksList[l]; blockcontainer.onBlockAdded(worldObj, xPosition * 16 + i, j, zPosition * 16 + k); tileentity = (TileEntity) chunkTileEntityMap.get(chunkposition); } if (tileentity != null && tileentity.func_31006_g()) { chunkTileEntityMap.remove(chunkposition); return null; } else { return tileentity; } }
/** * Arranges the blocks in the container with a fixed width and no height constraint. * * @param container the container. * @param g2 the graphics device. * @param constraint the constraint. * @return The size. */ protected Size2D arrangeFN( BlockContainer container, Graphics2D g2, RectangleConstraint constraint) { List blocks = container.getBlocks(); Block b = (Block) blocks.get(0); Size2D s = b.arrange(g2, RectangleConstraint.NONE); double width = constraint.getWidth(); Rectangle2D bounds = new Rectangle2D.Double((width - s.width) / 2.0, 0.0, s.width, s.height); b.setBounds(bounds); return new Size2D((width - s.width) / 2.0, s.height); }
/** Called by ItemBlocks after a block is set in the world, to allow post-place logic */ public void onBlockPlacedBy( World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { super.onBlockPlacedBy(worldIn, pos, state, placer, stack); if (stack.hasDisplayName()) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityBeacon) { ((TileEntityBeacon) tileentity).setName(stack.getDisplayName()); } } }
@Override public void onBlockAdded(World world, int i, int j, int k) { super.onBlockAdded(world, i, j, k); if (world.isBlockIndirectlyGettingPowered(i, j, k) && world.getBlockMetadata(i, j, k) != 12 && world.getBlockMetadata(i, j, k) != 0 && world.getBlockMetadata(i, j, k) != 15) { onBlockDestroyedByExplosion(world, i, j, k); world.setBlockWithNotify(i, j, k, 0); } }
@Override public void placeBlock( GlowPlayer player, GlowBlockState state, BlockFace face, ItemStack holding, Vector clickedLoc) { super.placeBlock(player, state, face, holding, clickedLoc); MaterialData data = state.getData(); if (data instanceof Chest) { Chest chest = (Chest) data; GlowBlock chestBlock = state.getBlock(); BlockFace normalFacing = getOppositeBlockFace(player.getLocation(), false); Collection<BlockFace> attachedChests = searchChests(chestBlock); if (attachedChests.isEmpty()) { chest.setFacingDirection(normalFacing); state.setData(chest); return; } else if (attachedChests.size() > 1) { GlowServer.logger.warning("Chest placed near two other chests!"); return; } BlockFace otherPart = attachedChests.iterator().next(); GlowBlock otherPartBlock = chestBlock.getRelative(otherPart); BlockState otherPartState = otherPartBlock.getState(); MaterialData otherPartData = otherPartState.getData(); if (otherPartData instanceof Chest) { Chest otherChest = (Chest) otherPartData; BlockFace facing = getFacingDirection(normalFacing, otherChest.getFacing(), otherPart, player); chest.setFacingDirection(facing); state.setData(chest); otherChest.setFacingDirection(facing); otherPartState.setData(otherChest); otherPartState.update(); } else { warnMaterialData(Chest.class, otherPartData); } } else { warnMaterialData(Chest.class, data); } }
/** * Arranges the items in the specified container, subject to the given constraint. * * @param container the container. * @param g2 the graphics device. * @param constraint the constraint. * @return The block size. */ @Override public Size2D arrange(BlockContainer container, Graphics2D g2, RectangleConstraint constraint) { RectangleConstraint contentConstraint = container.toContentConstraint(constraint); Size2D contentSize = null; LengthConstraintType w = contentConstraint.getWidthConstraintType(); LengthConstraintType h = contentConstraint.getHeightConstraintType(); if (w == LengthConstraintType.NONE) { if (h == LengthConstraintType.NONE) { contentSize = arrangeNN(container, g2); } else if (h == LengthConstraintType.FIXED) { throw new RuntimeException("Not implemented."); } else if (h == LengthConstraintType.RANGE) { throw new RuntimeException("Not implemented."); } } else if (w == LengthConstraintType.FIXED) { if (h == LengthConstraintType.NONE) { contentSize = arrangeFN(container, g2, constraint.getWidth()); } else if (h == LengthConstraintType.FIXED) { contentSize = arrangeFF(container, g2, constraint); } else if (h == LengthConstraintType.RANGE) { contentSize = arrangeFR(container, g2, constraint); } } else if (w == LengthConstraintType.RANGE) { if (h == LengthConstraintType.NONE) { throw new RuntimeException("Not implemented."); } else if (h == LengthConstraintType.FIXED) { throw new RuntimeException("Not implemented."); } else if (h == LengthConstraintType.RANGE) { contentSize = arrangeRR(container, constraint.getWidthRange(), constraint.getHeightRange(), g2); } } return new Size2D( container.calculateTotalWidth(contentSize.getWidth()), container.calculateTotalHeight(contentSize.getHeight())); }
public void a(World world, int i, int j, int k, int l) { boolean flag = false; if (this.b) { if (!world.getMaterial(i, j - 1, k).isBuildable()) { flag = true; } } else { int i1 = world.getData(i, j, k); flag = true; if (i1 == 2 && world.getMaterial(i, j, k + 1).isBuildable()) { flag = false; } if (i1 == 3 && world.getMaterial(i, j, k - 1).isBuildable()) { flag = false; } if (i1 == 4 && world.getMaterial(i + 1, j, k).isBuildable()) { flag = false; } if (i1 == 5 && world.getMaterial(i - 1, j, k).isBuildable()) { flag = false; } } if (flag) { this.a_(world, i, j, k, world.getData(i, j, k)); world.e(i, j, k, 0); } super.a(world, i, j, k, l); // CraftBukkit start if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].c()) { CraftWorld craftWorld = ((WorldServer) world).getWorld(); CraftServer server = ((WorldServer) world).getServer(); Block block = craftWorld.getBlockAt(i, j, k); int power = block.getBlockPower(); BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, power, power); server.getPluginManager().callEvent(eventRedstone); } // CraftBukkit end }
@Override public void breakBlock(World world, int x, int y, int z, int i1, int i2) { TileEntityBasicMachine tileEntity = (TileEntityBasicMachine) world.getBlockTileEntity(x, y, z); if (tileEntity != null) { for (int i = 0; i < tileEntity.getSizeInventory(); ++i) { ItemStack slotStack = tileEntity.getStackInSlot(i); if (slotStack != null) { float xRandom = machineRand.nextFloat() * 0.8F + 0.1F; float yRandom = machineRand.nextFloat() * 0.8F + 0.1F; float zRandom = machineRand.nextFloat() * 0.8F + 0.1F; while (slotStack.stackSize > 0) { int j = machineRand.nextInt(21) + 10; if (j > slotStack.stackSize) { j = slotStack.stackSize; } slotStack.stackSize -= j; EntityItem item = new EntityItem( world, (double) ((float) x + xRandom), (double) ((float) y + yRandom), (double) ((float) z + zRandom), new ItemStack(slotStack.itemID, j, slotStack.getItemDamage())); if (slotStack.hasTagCompound()) { item.item.setTagCompound((NBTTagCompound) slotStack.getTagCompound().copy()); } float k = 0.05F; item.motionX = (double) ((float) machineRand.nextGaussian() * k); item.motionY = (double) ((float) machineRand.nextGaussian() * k + 0.2F); item.motionZ = (double) ((float) machineRand.nextGaussian() * k); world.spawnEntityInWorld(item); } } } tileEntity.invalidate(); } super.breakBlock(world, x, y, z, i1, i2); }
public void func_71852_a( World p_71852_1_, int p_71852_2_, int p_71852_3_, int p_71852_4_, int p_71852_5_, int p_71852_6_) { TileEntityChest tileentitychest = (TileEntityChest) p_71852_1_.func_72796_p(p_71852_2_, p_71852_3_, p_71852_4_); if (tileentitychest != null) { for (int i = 0; i < tileentitychest.func_70302_i_(); i++) { ItemStack itemstack = tileentitychest.func_70301_a(i); if (itemstack == null) { continue; } float f = field_72293_a.nextFloat() * 0.8F + 0.1F; float f1 = field_72293_a.nextFloat() * 0.8F + 0.1F; float f2 = field_72293_a.nextFloat() * 0.8F + 0.1F; while (itemstack.field_77994_a > 0) { int j = field_72293_a.nextInt(21) + 10; if (j > itemstack.field_77994_a) { j = itemstack.field_77994_a; } itemstack.field_77994_a -= j; EntityItem entityitem = new EntityItem( p_71852_1_, (float) p_71852_2_ + f, (float) p_71852_3_ + f1, (float) p_71852_4_ + f2, new ItemStack(itemstack.field_77993_c, j, itemstack.func_77960_j())); float f3 = 0.05F; entityitem.field_70159_w = (float) field_72293_a.nextGaussian() * f3; entityitem.field_70181_x = (float) field_72293_a.nextGaussian() * f3 + 0.2F; entityitem.field_70179_y = (float) field_72293_a.nextGaussian() * f3; if (itemstack.func_77942_o()) { entityitem.field_70294_a.func_77982_d( (NBTTagCompound) itemstack.func_77978_p().func_74737_b()); } p_71852_1_.func_72838_d(entityitem); } } } super.func_71852_a(p_71852_1_, p_71852_2_, p_71852_3_, p_71852_4_, p_71852_5_, p_71852_6_); }
public void remove(World world, int i, int j, int k) { TileEntityDispenser tileentitydispenser = (TileEntityDispenser) world.getTileEntity(i, j, k); if (tileentitydispenser != null) { for (int l = 0; l < tileentitydispenser.getSize(); ++l) { ItemStack itemstack = tileentitydispenser.getItem(l); if (itemstack != null) { float f = this.a.nextFloat() * 0.8F + 0.1F; float f1 = this.a.nextFloat() * 0.8F + 0.1F; float f2 = this.a.nextFloat() * 0.8F + 0.1F; while (itemstack.count > 0) { int i1 = this.a.nextInt(21) + 10; if (i1 > itemstack.count) { i1 = itemstack.count; } itemstack.count -= i1; EntityItem entityitem = new EntityItem( world, (double) ((float) i + f), (double) ((float) j + f1), (double) ((float) k + f2), new ItemStack(itemstack.id, i1, itemstack.getData())); if (itemstack.hasTag()) { entityitem.itemStack.setTag((NBTTagCompound) itemstack.getTag().clone()); } float f3 = 0.05F; entityitem.motX = (double) ((float) this.a.nextGaussian() * f3); entityitem.motY = (double) ((float) this.a.nextGaussian() * f3 + 0.2F); entityitem.motZ = (double) ((float) this.a.nextGaussian() * f3); world.addEntity(entityitem); } } } } super.remove(world, i, j, k); }
/** ejects contained items into the world, and notifies neighbours of an update, as appropriate */ public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) { TileEntityChest var7 = (TileEntityChest) par1World.getBlockTileEntity(par2, par3, par4); if (var7 != null) { for (int var8 = 0; var8 < var7.getSizeInventory(); ++var8) { ItemStack var9 = var7.getStackInSlot(var8); if (var9 != null) { float var10 = this.random.nextFloat() * 0.8F + 0.1F; float var11 = this.random.nextFloat() * 0.8F + 0.1F; EntityItem var14; for (float var12 = this.random.nextFloat() * 0.8F + 0.1F; var9.stackSize > 0; par1World.spawnEntityInWorld(var14)) { int var13 = this.random.nextInt(21) + 10; if (var13 > var9.stackSize) { var13 = var9.stackSize; } var9.stackSize -= var13; var14 = new EntityItem( par1World, (double) ((float) par2 + var10), (double) ((float) par3 + var11), (double) ((float) par4 + var12), new ItemStack(var9.itemID, var13, var9.getItemDamage())); float var15 = 0.05F; var14.motionX = (double) ((float) this.random.nextGaussian() * var15); var14.motionY = (double) ((float) this.random.nextGaussian() * var15 + 0.2F); var14.motionZ = (double) ((float) this.random.nextGaussian() * var15); if (var9.hasTagCompound()) { var14.getEntityItem().setTagCompound((NBTTagCompound) var9.getTagCompound().copy()); } } } } } super.breakBlock(par1World, par2, par3, par4, par5, par6); }
public void onBlockPlacedBy( World world, int x, int y, int z, EntityLivingBase player, ItemStack itemstack) { int l = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3; if (l == 0) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); } if (l == 1) { world.setBlockMetadataWithNotify(x, y, z, 5, 2); } if (l == 2) { world.setBlockMetadataWithNotify(x, y, z, 3, 2); } if (l == 3) { world.setBlockMetadataWithNotify(x, y, z, 4, 2); } super.onBlockPlacedBy(world, x, y, z, player, itemstack); }
public void remove(World world, int i, int j, int k, int l, int i1) { TileEntity tileentity = world.getTileEntity(i, j, k); if (tileentity instanceof TileEntityBrewingStand) { TileEntityBrewingStand tileentitybrewingstand = (TileEntityBrewingStand) tileentity; for (int j1 = 0; j1 < tileentitybrewingstand.getSize(); ++j1) { ItemStack itemstack = tileentitybrewingstand.getItem(j1); if (itemstack != null) { float f = this.a.nextFloat() * 0.8F + 0.1F; float f1 = this.a.nextFloat() * 0.8F + 0.1F; float f2 = this.a.nextFloat() * 0.8F + 0.1F; while (itemstack.count > 0) { int k1 = this.a.nextInt(21) + 10; if (k1 > itemstack.count) { k1 = itemstack.count; } itemstack.count -= k1; EntityItem entityitem = new EntityItem( world, (double) ((float) i + f), (double) ((float) j + f1), (double) ((float) k + f2), new ItemStack(itemstack.id, k1, itemstack.getData())); float f3 = 0.05F; entityitem.motX = (double) ((float) this.a.nextGaussian() * f3); entityitem.motY = (double) ((float) this.a.nextGaussian() * f3 + 0.2F); entityitem.motZ = (double) ((float) this.a.nextGaussian() * f3); world.addEntity(entityitem); } } } } super.remove(world, i, j, k, l, i1); }
public void func_71861_g(World p_71861_1_, int p_71861_2_, int p_71861_3_, int p_71861_4_) { super.func_71861_g(p_71861_1_, p_71861_2_, p_71861_3_, p_71861_4_); func_72290_b_(p_71861_1_, p_71861_2_, p_71861_3_, p_71861_4_); int i = p_71861_1_.func_72798_a(p_71861_2_, p_71861_3_, p_71861_4_ - 1); int j = p_71861_1_.func_72798_a(p_71861_2_, p_71861_3_, p_71861_4_ + 1); int k = p_71861_1_.func_72798_a(p_71861_2_ - 1, p_71861_3_, p_71861_4_); int l = p_71861_1_.func_72798_a(p_71861_2_ + 1, p_71861_3_, p_71861_4_); if (i == field_71990_ca) { func_72290_b_(p_71861_1_, p_71861_2_, p_71861_3_, p_71861_4_ - 1); } if (j == field_71990_ca) { func_72290_b_(p_71861_1_, p_71861_2_, p_71861_3_, p_71861_4_ + 1); } if (k == field_71990_ca) { func_72290_b_(p_71861_1_, p_71861_2_ - 1, p_71861_3_, p_71861_4_); } if (l == field_71990_ca) { func_72290_b_(p_71861_1_, p_71861_2_ + 1, p_71861_3_, p_71861_4_); } }
/** ejects contained items into the world, and notifies neighbours of an update, as appropriate */ public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) { if (!par1World.isRemote) { if ((par6 & 8) == 0) { ItemStack var7 = new ItemStack( Item.skull.shiftedIndex, 1, this.getDamageValue(par1World, par2, par3, par4)); TileEntitySkull var8 = (TileEntitySkull) par1World.getBlockTileEntity(par2, par3, par4); if (var8.func_82117_a() == 3 && var8.func_82120_c() != null && var8.func_82120_c().length() > 0) { var7.setTagCompound(new NBTTagCompound()); var7.getTagCompound().setString("SkullOwner", var8.func_82120_c()); } this.dropBlockAsItem_do(par1World, par2, par3, par4, var7); } super.breakBlock(par1World, par2, par3, par4, par5, par6); } }
/** * Arranges the blocks in the container with a fixed width and no height constraint. * * @param container the container. * @param constraint the constraint. * @param g2 the graphics device. * @return The size. */ protected Size2D arrangeFN( BlockContainer container, Graphics2D g2, RectangleConstraint constraint) { List blocks = container.getBlocks(); double width = constraint.getWidth(); double x = 0.0; double y = 0.0; double maxHeight = 0.0; List itemsInRow = new ArrayList(); for (int i = 0; i < blocks.size(); i++) { Block block = (Block) blocks.get(i); Size2D size = block.arrange(g2, RectangleConstraint.NONE); if (x + size.width <= width) { itemsInRow.add(block); block.setBounds(new Rectangle2D.Double(x, y, size.width, size.height)); x = x + size.width + this.horizontalGap; maxHeight = Math.max(maxHeight, size.height); } else { if (itemsInRow.isEmpty()) { // place in this row (truncated) anyway block.setBounds( new Rectangle2D.Double(x, y, Math.min(size.width, width - x), size.height)); x = 0.0; y = y + size.height + this.verticalGap; } else { // start new row itemsInRow.clear(); x = 0.0; y = y + maxHeight + this.verticalGap; maxHeight = size.height; block.setBounds(new Rectangle2D.Double(x, y, Math.min(size.width, width), size.height)); x = size.width + this.horizontalGap; itemsInRow.add(block); } } } return new Size2D(constraint.getWidth(), y + maxHeight); }
/** Called whenever the block is added into the world. Args: world, x, y, z */ public void onBlockAdded(World par1World, int par2, int par3, int par4) { super.onBlockAdded(par1World, par2, par3, par4); this.unifyAdjacentChests(par1World, par2, par3, par4); int var5 = par1World.getBlockId(par2, par3, par4 - 1); int var6 = par1World.getBlockId(par2, par3, par4 + 1); int var7 = par1World.getBlockId(par2 - 1, par3, par4); int var8 = par1World.getBlockId(par2 + 1, par3, par4); if (var5 == this.blockID) { this.unifyAdjacentChests(par1World, par2, par3, par4 - 1); } if (var6 == this.blockID) { this.unifyAdjacentChests(par1World, par2, par3, par4 + 1); } if (var7 == this.blockID) { this.unifyAdjacentChests(par1World, par2 - 1, par3, par4); } if (var8 == this.blockID) { this.unifyAdjacentChests(par1World, par2 + 1, par3, par4); } }
/** * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed * (coordinates passed are their own) Args: x, y, z, neighbor blockID */ public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) { boolean var6 = false; if (this.isFreestanding) { if (!par1World.getBlockMaterial(par2, par3 - 1, par4).isSolid()) { var6 = true; } } else { int var7 = par1World.getBlockMetadata(par2, par3, par4); var6 = true; if (var7 == 2 && par1World.getBlockMaterial(par2, par3, par4 + 1).isSolid()) { var6 = false; } if (var7 == 3 && par1World.getBlockMaterial(par2, par3, par4 - 1).isSolid()) { var6 = false; } if (var7 == 4 && par1World.getBlockMaterial(par2 + 1, par3, par4).isSolid()) { var6 = false; } if (var7 == 5 && par1World.getBlockMaterial(par2 - 1, par3, par4).isSolid()) { var6 = false; } } if (var6) { this.dropBlockAsItem( par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); par1World.setBlockWithNotify(par2, par3, par4, 0); } super.onNeighborBlockChange(par1World, par2, par3, par4, par5); }
public void a(World world, int i, int j, int k) { super.a(world, i, j, k); this.b(world, i, j, k); int l = world.getTypeId(i, j, k - 1); int i1 = world.getTypeId(i, j, k + 1); int j1 = world.getTypeId(i - 1, j, k); int k1 = world.getTypeId(i + 1, j, k); if (l == this.id) { this.b(world, i, j, k - 1); } if (i1 == this.id) { this.b(world, i, j, k + 1); } if (j1 == this.id) { this.b(world, i - 1, j, k); } if (k1 == this.id) { this.b(world, i + 1, j, k); } }