portablejim

TinkersConstruct Tool changes

May 31st, 2013 (edited)
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 5.01 KB | None | 0 0
  1. diff --git a/mods/tinker/tconstruct/items/tools/Hatchet.java b/mods/tinker/tconstruct/items/tools/Hatchet.java
  2. index bf3c584..9fd8246 100644
  3. --- a/mods/tinker/tconstruct/items/tools/Hatchet.java
  4. +++ b/mods/tinker/tconstruct/items/tools/Hatchet.java
  5. @@ -45,7 +45,7 @@ public class Hatchet extends HarvestTool
  6.         if (block != null && block.blockMaterial == Material.leaves)
  7.             return false;
  8.  
  9. -       return AbilityHelper.onBlockChanged(itemstack, world, bID, x, y, z, player, random);
  10. +       return super.onBlockDestroyed(itemstack, world, bID, x, y, z, player);
  11.     }
  12.  
  13.     static Material[] materials = { Material.wood, Material.leaves, Material.vine, Material.circuits, Material.cactus, Material.pumpkin };
  14. diff --git a/mods/tinker/tconstruct/items/tools/LumberAxe.java b/mods/tinker/tconstruct/items/tools/LumberAxe.java
  15. index 635ee89..5c66a31 100644
  16. --- a/mods/tinker/tconstruct/items/tools/LumberAxe.java
  17. +++ b/mods/tinker/tconstruct/items/tools/LumberAxe.java
  18. @@ -64,7 +64,7 @@ public class LumberAxe extends HarvestTool
  19.         if (block != null && block.blockMaterial == Material.leaves)
  20.             return false;
  21.  
  22. -       return AbilityHelper.onBlockChanged(itemstack, world, bID, x, y, z, player, random);
  23. +       return super.onBlockDestroyed(itemstack, world, bID, x, y, z, player);
  24.     }
  25.  
  26.     static Material[] materials = { Material.wood, Material.circuits, Material.cactus, Material.pumpkin };
  27. diff --git a/mods/tinker/tconstruct/library/tools/ToolCore.java b/mods/tinker/tconstruct/library/tools/ToolCore.java
  28. index a2c4935..f3f4b89 100644
  29. --- a/mods/tinker/tconstruct/library/tools/ToolCore.java
  30. +++ b/mods/tinker/tconstruct/library/tools/ToolCore.java
  31. @@ -27,6 +27,8 @@ import net.minecraft.item.crafting.FurnaceRecipes;
  32.  import net.minecraft.nbt.NBTTagCompound;
  33.  import net.minecraft.util.Icon;
  34.  import net.minecraft.world.World;
  35. +import net.minecraftforge.event.ForgeSubscribe;
  36. +import net.minecraftforge.event.entity.player.PlayerEvent;
  37.  import cpw.mods.fml.relauncher.Side;
  38.  import cpw.mods.fml.relauncher.SideOnly;
  39.  
  40. @@ -486,11 +488,14 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox
  41.  
  42.      //Mining
  43.      @Override
  44. -    public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPlayer player)
  45. -    {
  46. -        NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
  47. -        World world = player.worldObj;
  48. -        int bID = player.worldObj.getBlockId(x, y, z);
  49. +    public boolean onBlockDestroyed(ItemStack stack, World world, int bID, int x, int y, int z, EntityLiving player)
  50. +    {
  51. +       if (!AbilityHelper.onBlockChanged(stack, world, bID, x, y, z, player, random))
  52. +       {
  53. +           return false;
  54. +       }
  55. +      
  56. +       NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
  57.          int meta = world.getBlockMetadata(x, y, z);
  58.          Block block = Block.blocksList[bID];
  59.          if (block == null || bID < 1 || bID > 4095)
  60. @@ -505,8 +510,6 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox
  61.              if (result != null)
  62.              {
  63.                  world.setBlockToAir(x, y, z);
  64. -                if (!player.capabilities.isCreativeMode)
  65. -                    onBlockDestroyed(stack, world, bID, x, y, z, player);
  66.                  if (!world.isRemote)
  67.                  {
  68.                      ItemStack spawnme = result.copy();
  69. @@ -522,7 +525,6 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox
  70.  
  71.                      entityitem.delayBeforeCanPickup = 10;
  72.                      world.spawnEntityInWorld(entityitem);
  73. -                    world.playAuxSFX(2001, x, y, z, bID + (meta << 12));
  74.                  }
  75.                  for (int i = 0; i < 6; i++)
  76.                  {
  77. @@ -543,18 +545,36 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox
  78.                      world.spawnParticle("smoke", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
  79.                      world.spawnParticle("flame", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
  80.                  }
  81. -                return true;
  82.              }
  83.          }
  84. -
  85. -        return false;
  86. +        
  87. +        return true;
  88.      }
  89. -
  90. -    @Override
  91. +    
  92. +    @ForgeSubscribe
  93. +    public void vanillaDrop(PlayerEvent.HarvestCheck event){
  94. +       if (event.entityPlayer == null)
  95. +       {
  96. +           return;
  97. +       }
  98. +       ItemStack stack = event.entityPlayer.getCurrentEquippedItem();
  99. +       if (stack == null || !stack.hasTagCompound())
  100. +       {
  101. +           return;
  102. +       }
  103. +       NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
  104. +       if (tags == null)
  105. +       {
  106. +           return;
  107. +       }
  108. +       event.success = !tags.getBoolean("Lava");
  109. +    }
  110. +
  111. +    /*@Override
  112.      public boolean onBlockDestroyed (ItemStack itemstack, World world, int bID, int x, int y, int z, EntityLiving player)
  113.      {
  114.          return AbilityHelper.onBlockChanged(itemstack, world, bID, x, y, z, player, random);
  115. -    }
  116. +    }*/
  117.  
  118.      @Override
  119.      public float getStrVsBlock (ItemStack stack, Block block, int meta)
Add Comment
Please, Sign In to add comment