@Override public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int side, float textureX, float textureY, float textureZ) { if(!world.isRemote) { if(world.getBlock(x, y, z) instanceof BlockColoured || world.getBlock(x, y, z) instanceof BlockColored || world.getBlock(x, y, z) instanceof BlockStainedGlass || world.getBlock(x, y, z) instanceof BlockStainedGlassPane) { if(world.getBlockMetadata(x, y, z) != this.getDamage(itemstack)) { world.setBlockMetadataWithNotify(x, y, z, this.getDamage(itemstack), 2); player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack)); return true; } else return false; } else if(world.getBlock(x, y, z) instanceof BlockHardenedClay) { world.setBlock(x, y, z, Blocks.stained_hardened_clay, this.getDamage(itemstack), 2); player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack)); return true; } else if(world.getBlock(x, y, z) instanceof BlockGlass) { world.setBlock(x, y, z, Blocks.stained_glass, this.getDamage(itemstack), 2); player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack)); return true; } else if(world.getBlock(x, y, z) == Blocks.glass_pane) { world.setBlock(x, y, z, Blocks.stained_glass_pane, this.getDamage(itemstack), 2); player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack)); return true; } else if(world.getBlock(x, y, z) instanceof BlockWood) { world.setBlock(x, y, z, ModBlocks.woodColoured, this.getDamage(itemstack), 2); player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack)); return true; } else if(world.getBlock(x, y, z) == Blocks.brick_block) { world.setBlock(x, y, z, ModBlocks.brickColoured, this.getDamage(itemstack), 2); player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack)); return true; } } return false; }
private String blockIdToSound(int id) { Block b = Block.blocksList[id]; if (b == null) return "fysiksfun:rubble"; if (b instanceof BlockWood || b instanceof BlockLog) return "fysiksfun:woodCrack"; return "fysiksfun:rubble"; }