Skip to content

Commit

Permalink
Shears break blocks of the designated material
Browse files Browse the repository at this point in the history
  • Loading branch information
IcarussOne committed Oct 6, 2024
1 parent f4da001 commit cc7a38a
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import javax.annotation.Nonnull;

import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemShears;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
Expand All @@ -19,6 +21,22 @@ public ItemNaturaShears(int durability, Ingredient repairMaterial)
this.setMaxDamage(durability);
this.setCreativeTab(Natura.TAB);
}

// Hardcoded blocks...
@Override
public float getDestroySpeed(ItemStack stack, IBlockState state)
{
Material material = state.getMaterial();

if (material != Material.WEB && material != Material.LEAVES)
{
return material == Material.CLOTH ? 5.0F : super.getDestroySpeed(stack, state);
}
else
{
return 15.0F;
}
}

@Override
public boolean getIsRepairable(@Nonnull ItemStack toRepair, @Nonnull ItemStack repair)
Expand Down

0 comments on commit cc7a38a

Please sign in to comment.