ForgePatch/forge/patches/minecraft_server/net/minecraft/src/ItemTool.java.patch

35 lines
1.2 KiB
Diff
Raw Normal View History

--- ../src_base/minecraft_server/net/minecraft/src/ItemTool.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/ItemTool.java 0000-00-00 00:00:00.000000000 -0000
2012-01-15 19:16:08 +00:00
@@ -1,10 +1,12 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
2012-01-15 19:16:08 +00:00
+
public class ItemTool extends Item
{
private Block blocksEffectiveAgainst[];
- protected float efficiencyOnProperMaterial;
- private int damageVsEntity;
+ public float efficiencyOnProperMaterial;
+ public int damageVsEntity;
protected EnumToolMaterial toolMaterial;
protected ItemTool(int i, int j, EnumToolMaterial enumtoolmaterial, Block ablock[])
2012-01-15 19:16:08 +00:00
@@ -32,6 +34,16 @@
return 1.0F;
}
2012-01-15 19:16:08 +00:00
+ /* FORGE: Overridden to allow custom tool effectiveness */
+ @Override
+ public float getStrVsBlock(ItemStack itemstack, Block block, int md)
+ {
+ if (ForgeHooks.isToolEffective(itemstack, block, md))
+ {
+ return efficiencyOnProperMaterial;
+ }
+ return getStrVsBlock(itemstack,block);
+ }
public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
{
itemstack.damageItem(2, entityliving1);