Java Code Examples for net.minecraft.block.Block#onPostBlockPlaced()
The following examples show how to use
net.minecraft.block.Block#onPostBlockPlaced() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DroneAIPlace.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
/** * Called to actually place the block, after the location is determined * and all permission checks have been made. * * @param stack The item stack that was used to place the block. This can be changed inside the method. * @param player The player who is placing the block. Can be null if the block is not being placed by a player. * @param side The side the player (or machine) right-clicked on. */ private boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata){ Block block = Block.getBlockFromItem(stack.getItem()); if(!world.setBlock(x, y, z, block, metadata, 3)) { return false; } block.onBlockPlacedBy(world, x, y, z, player, stack); block.onPostBlockPlaced(world, x, y, z, metadata); return true; }
Example 2
Source File: ItemArcaneCake.java From ForbiddenMagic with Do What The F*ck You Want To Public License | 4 votes |
@Override public boolean onItemUse(ItemStack stack, EntityPlayer player, World yWorld, int z, int par5, int par6, int par7, float par8, float par9, float par10) { Block block = yWorld.getBlock(z, par5, par6); if (block == Blocks.snow_layer && (yWorld.getBlockMetadata(z, par5, par6) & 7) < 1) { par7 = 1; } else if (block != Blocks.vine && block != Blocks.tallgrass && block != Blocks.deadbush) { if (par7 == 0) { --par5; } if (par7 == 1) { ++par5; } if (par7 == 2) { --par6; } if (par7 == 3) { ++par6; } if (par7 == 4) { --z; } if (par7 == 5) { ++z; } } if (!player.canPlayerEdit(z, par5, par6, par7, stack)) { return false; } else if (stack.stackSize == 0) { return false; } else { Block cake = ForbiddenBlocks.arcaneCake; if (yWorld.canPlaceEntityOnSide(cake, z, par5, par6, false, par7, (Entity) null, stack)) { int j1 = cake.onBlockPlaced(yWorld, z, par5, par6, par7, par8, par9, par10, 0); if (yWorld.setBlock(z, par5, par6, cake, j1, 3)) { if (yWorld.getBlock(z, par5, par6) == cake) { cake.onBlockPlacedBy(yWorld, z, par5, par6, player, stack); cake.onPostBlockPlaced(yWorld, z, par5, par6, j1); } yWorld.playSoundEffect((double) ((float) z + 0.5F), (double) ((float) par5 + 0.5F), (double) ((float) par6 + 0.5F), block.stepSound.soundName, (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F); --stack.stackSize; } } return true; } }