Mekanism

Mekanism

111M Downloads

Paxel doesn't pickup blocks correctly - FIX

Opened this issue ยท 3 comments

commented

#1868

Very simple way to fix it!

This code should be added to ItemMekanismPaxel and ItemMekanismPickxe class (To the public boolean canHarvestBlock(Block block, ItemStack stack) boolean):

        if(block == Blocks.anvil)
        {
            return toolMaterial.getHarvestLevel() >= 0;
        }

Before (ItemMekanismPaxel):

package mekanism.tools.item;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;

public class ItemMekanismPaxel extends ItemMekanismTool
{
    public ItemMekanismPaxel(ToolMaterial toolMaterial)
    {
        super(3, toolMaterial, new Block[0]);
    }

    @Override
    public float getDigSpeed(ItemStack stack, Block block, int meta)
    {
        return block != Blocks.bedrock ? efficiencyOnProperMaterial : 1.0F;
    }

    @Override
    public boolean canHarvestBlock(Block block, ItemStack stack)
    {
        if(block == Blocks.obsidian)
        {
            return toolMaterial.getHarvestLevel() == 3;
        }

        if(block == Blocks.diamond_block || block == Blocks.diamond_ore)
        {
            return toolMaterial.getHarvestLevel() >= 2;
        }

        if(block == Blocks.gold_block || block == Blocks.gold_ore)
        {
            return toolMaterial.getHarvestLevel() >= 2;
        }

        if(block == Blocks.iron_block || block == Blocks.iron_ore)
        {
            return toolMaterial.getHarvestLevel() >= 1;
        }

        if(block == Blocks.lapis_block || block == Blocks.lapis_ore)
        {
            return toolMaterial.getHarvestLevel() >= 1;
        }

        if(block == Blocks.redstone_ore || block == Blocks.lit_redstone_ore)
        {
            return toolMaterial.getHarvestLevel() >= 2;
        }

        if(block.getMaterial() == Material.rock)
        {
            return true;
        }

        return block.getMaterial() == Material.iron;
    }
}

After (ItemMekanismPaxel):

package mekanism.tools.item;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;

public class ItemMekanismPaxel extends ItemMekanismTool
{
    public ItemMekanismPaxel(ToolMaterial toolMaterial)
    {
        super(3, toolMaterial, new Block[0]);
    }

    @Override
    public float getDigSpeed(ItemStack stack, Block block, int meta)
    {
        return block != Blocks.bedrock ? efficiencyOnProperMaterial : 1.0F;
    }

    @Override
    public boolean canHarvestBlock(Block block, ItemStack stack)
    {
        if(block == Blocks.obsidian)
        {
            return toolMaterial.getHarvestLevel() == 3;
        }

        if(block == Blocks.diamond_block || block == Blocks.diamond_ore)
        {
            return toolMaterial.getHarvestLevel() >= 2;
        }

        if(block == Blocks.gold_block || block == Blocks.gold_ore)
        {
            return toolMaterial.getHarvestLevel() >= 2;
        }

        if(block == Blocks.iron_block || block == Blocks.iron_ore)
        {
            return toolMaterial.getHarvestLevel() >= 1;
        }

        if(block == Blocks.lapis_block || block == Blocks.lapis_ore)
        {
            return toolMaterial.getHarvestLevel() >= 1;
        }

        if(block == Blocks.redstone_ore || block == Blocks.lit_redstone_ore)
        {
            return toolMaterial.getHarvestLevel() >= 2;
        }

        if(block == Blocks.anvil)
        {
            return toolMaterial.getHarvestLevel() >= 0;
        }

        if(block.getMaterial() == Material.rock)
        {
            return true;
        }

        return block.getMaterial() == Material.iron;
    }
}

=EDIT
I changed harvest level.

commented

shouldn't it be return toolMaterial.getHarvestLevel() >= 0; and not 2? as I believe Stone Wooden picks can be used to mine them. http://minecraft.gamepedia.com/Anvil The wiki says wooden, and in game they can be mined with a wooden pick. (tested 1.7.10 SSP)

-- also I updated the first issue, assumed itemMekanismPickaxe also has the same bug.

commented

Thanks. :)
I've just changed harvest level.

Yes, it should be added also to pickaxe class.

commented

There, should be fixed on master now. I don't suppose you could make pull requests with future fixes you find?