Posted November 22, 201411 yr I've set the harvest level to 2, but even when I break it with a wooden pick it drops the item. ย public BlockPlasticOre(Material Material) { super(Material); setHardness(3.0F); setCreativeTab(FinancialMod.financialTab); setResistance(5F); setStepSound(Block.soundTypeStone); this.setHarvestLevel("pickaxe", 2); } public Item getItemDropped(int metadata, Random random, int fortune){ return FinancialMod.Plastic; }
November 23, 201411 yr Hi ย Try adding breakpoints to here ForgeHooks.canToolHarvestBlock() ย ย public static boolean canToolHarvestBlock(Block block, int metadata, ItemStack stack) ย ย { ย ย ย ย String tool = block.getHarvestTool(metadata);ย // Breakpoint here ย ย ย ย if (stack == null || tool == null) return false; ย ย ย ย return stack.getItem().getHarvestLevel(stack, tool) >= block.getHarvestLevel(metadata); ย ย } and ForgeHooks::canHarvestBlock() ย ย public static boolean canHarvestBlock(Block block, EntityPlayer player, int metadata) ย ย { ย ย ย ย if (block.getMaterial().isToolNotRequired())ย // Breakpoint here ย ย ย ย { ย ย ย ย ย ย return true; ย ย ย ย } ย ย ย ย ItemStack stack = player.inventory.getCurrentItem(); ย ย ย ย String tool = block.getHarvestTool(metadata); ย ย ย ย if (stack == null || tool == null) ย ย ย ย { ย ย ย ย ย ย return player.canHarvestBlock(block); ย ย ย ย } ย ย ย ย int toolLevel = stack.getItem().getHarvestLevel(stack, tool); ย ย ย ย if (toolLevel < 0) ย ย ย ย { ย ย ย ย ย ย return player.canHarvestBlock(block); ย ย ย ย } ย ย ย ย return toolLevel >= block.getHarvestLevel(metadata); ย ย } ย Then step through the code line by line to see why it lets your tool harvest the block when it shouldn't. ย -TGG
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.