From 5bf1470090bfbff3bf25e6d6a66d14f94e144d40 Mon Sep 17 00:00:00 2001 From: Progwml6 Date: Sat, 15 Mar 2014 07:11:06 -0400 Subject: [PATCH] port in everything from 1.6 but labotimizetools(will do that later this weekend) --- resources/assets/tinker/lang/en_US.lang | 28 ++++-- resources/assets/tinker/manuals/materials.xml | 5 +- .../tinker/textures/gui/armorextended.png | Bin 2420 -> 2342 bytes .../textures/items/canister_heart_yellow.png | Bin 0 -> 428 bytes .../tinker/textures/items/food/bacon.png | Bin 0 -> 338 bytes .../tconstruct/client/gui/ToolStationGui.java | 6 +- src/main/java/tconstruct/common/TRecipes.java | 2 +- .../java/tconstruct/items/StrangeFood.java | 5 +- .../tconstruct/items/armor/HeartCanister.java | 2 +- .../java/tconstruct/items/tools/Arrow.java | 4 + .../java/tconstruct/items/tools/BowBase.java | 6 -- .../java/tconstruct/items/tools/Cleaver.java | 2 +- .../java/tconstruct/items/tools/Scythe.java | 67 +++++++++++--- .../java/tconstruct/items/tools/Shortbow.java | 4 + .../library/tools/AbilityHelper.java | 33 ++++--- .../tconstruct/library/tools/HarvestTool.java | 83 +++++++++++++++++ .../tconstruct/library/tools/ToolCore.java | 86 +----------------- .../modifiers/tools/TActiveOmniMod.java | 22 ++++- 18 files changed, 224 insertions(+), 131 deletions(-) create mode 100644 resources/assets/tinker/textures/items/canister_heart_yellow.png create mode 100644 resources/assets/tinker/textures/items/food/bacon.png diff --git a/resources/assets/tinker/lang/en_US.lang b/resources/assets/tinker/lang/en_US.lang index 714592e0..2a76c888 100644 --- a/resources/assets/tinker/lang/en_US.lang +++ b/resources/assets/tinker/lang/en_US.lang @@ -479,7 +479,7 @@ LiquidMetal.Steel.name=Molten Steel LiquidMetal.Glass.name=Molten Glass LiquidMetal.Stone.name=Seared Stone LiquidMetal.Villager.name=Liquified Emerald -LiquidMetal.Cow.name=Blood +LiquidMetal.Cow.name=Blo LiquidMetal.Nickel.name=Molten Nickel LiquidMetal.Silver.name=Molten Silver LiquidMetal.Lead.name=Molten Lead @@ -491,9 +491,14 @@ LiquidMetal.Ender.name=Liquified Ender item.food.apple.diamond.name=Jeweled Apple item.tconstruct.strangefood.edibleslime.name=Gelatinous Slime item.tconstruct.strangefood.edibleblood.name=Coagulated Blood +item.tconstruct.strangefood.bacon.name=Bacon item.tconstruct.canister.empty.name=Empty Canister item.tconstruct.canister.miniheart.red.name=Miniature Red Heart -item.tconstruct.canister.heart.name=Heart Canister +item.tconstruct.canister.red.name=Red Heart Canister +item.tconstruct.canister.miniheart.yellow.name=Miniature Yellow Heart +item.tconstruct.canister.yellow.name=Yellow Heart Canister +item.tconstruct.canister.miniheart.green.name=Miniature Green Heart +item.tconstruct.canister.green.name=Green Heart Canister item.tconstruct.glove.name=Dirtmover Gloves SearedBlock.Table.name=Casting Table @@ -623,8 +628,9 @@ strangefood3.tooltip=It seems edible, but somehow strangefood4.tooltip=it's just not appealing. strangefood5.tooltip=Stretchy food! strangefood6.tooltip=One vampiric appetizer +strangefood7.tooltip=The mysteriously appearing snack hambone1.tooltip=Hambone! -hambone2.tooltip=Usable for Beacon bases +hambone2.tooltip=Usable for Bacon bases metalblock.tooltip=Usable for Beacon bases craftedsoil1.tooltip=Heals Undead craftedsoil2.tooltip=Harmful to Undead @@ -655,11 +661,15 @@ oreberries3.tooltip=Tastes like metal oreberries4.tooltip=Tin Man oreberries5.tooltip=White Chocolate oreberries6.tooltip=Tastes like Creeper -hearthcanister1.tooltip=Crafting Item -hearthcanister2.tooltip=Crafting Item -hearthcanister3.tooltip=Part of low-level Heart Canisters -hearthcanister4.tooltip=Accessory -hearthcanister5.tooltip=Permanent health increase +item.crafting.tooltip=Crafting Item +item.accessory.tooltip=Accessory +canister.tooltip=Permanent health increase +canister.red.tooltip1=Part of low-level Heart Canisters +canister.red.tooltip2=Can be eaten to restore 10 hearts +canister.yellow.tooltip1=Part of mid-level Heart Canisters +canister.yellow.tooltip2=Can be eaten to restore 20 hearts +canister.green.tooltip1=Part of high-level Heart Canisters +canister.green.tooltip2=Can be eaten to restore 30 hearts landmine1.tooltip=everything landmine2.tooltip=mobs, players and redstone landmine3.tooltip=players and redstone @@ -723,3 +733,5 @@ gui.toolstation15=Mining Level: gui.toolstation16=Usage Speed: gui.toolstation17=Modifiers gui.toolstation18=Modifiers remaining: + +attribute.generic.ammo.attackDamage=Average Shot Damage \ No newline at end of file diff --git a/resources/assets/tinker/manuals/materials.xml b/resources/assets/tinker/manuals/materials.xml index 8717d313..87b184f0 100644 --- a/resources/assets/tinker/manuals/materials.xml +++ b/resources/assets/tinker/manuals/materials.xml @@ -11,6 +11,7 @@ By Skyla Table of Contents +Table of Contents Tools ironpick @@ -484,7 +485,8 @@ Class: Ranged Projectile Launcher - Reinforced: 10% chance per level of not using durability - Stonebound: The tool mines faster as it wears out, but does less damage - Jagged: The tool attacks with does more damage as it wears out, but mines slower -- Writable: One extra modifier per piece +- Writable: One extra modifier per piece +- Tasty: Sometimes drops food items @@ -874,6 +876,7 @@ Stackable: Yes Effects: - Allows blocks to be harvested directly +- Scythes modified with Silky act as shears on blocks - Not compatible with Luck or Auto-Smelt Type: Single-use diff --git a/resources/assets/tinker/textures/gui/armorextended.png b/resources/assets/tinker/textures/gui/armorextended.png index ef2ce92ca22604e1e71e784cd21c31c842aa6f0b..be2099c667dad573afccf119c6bef367dd0cb287 100644 GIT binary patch delta 2187 zcmZ8gc|6p67yix|HI_1#C`?9^y(}S;nrTo7smQ*}b!96{b1hxN4>xj6cOuco49&ew zS<6zgyu`g+BHU;!A=}upWx|*l^Ul3}-p}WK-}C1=&v`!2Ip;YXxhHa&7a=7Hag9)i z6%zoEm3G#rT;hfnM{r@PLHl>E1nq8w{e-L`W!oFzF%rcNh598uDmACCMQPijsK*I4 zk-t`a!e5wNm&8`P)tFU$tXcK4MIneJ8{L42jPK1BR^KgkzN0752D^6>zAxp>_S$#H zCK`9ozVg_7Z-`f}c(U{305tGaz{Bm8ZfW|3ahX>9N%>(`Orr){7jD z$>+tz)VFWn=13%qAjV4E`nI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g&r0iZ zM~(d>eG~%NXu;mEKW^O})T0p1l6EINNGo~$`gPg`)t8;D+rQmh zFswG8^(6e8^j7lkUO7YFe-0`=pIV(nA{3~_PP;ORIeI7?r$WQ2#*gKatheHf!Q|Yx z;#|FC0bn+t0?ALt_X@NkQzgs5C~9zAceFTqeoy470s zRrg@WWJ4aL71L#~Z+J9~7qlW#czd?@sL|eCa--+uZ6KygHJCrR18BF{4_Z<07uv-` zePS|%SCxsiI_YgpO)5yVn8}Fh=KSG2FLxFOTG7KK{bdMGmj#oU)4-*4hsRbj)OcS( zCN_Ed5x)3xF$k}tR8>{YX-{_YAGrzYWnfx zYLD{<1TZYAs8EvtS0H>pwG4i={#m0^3I;}LLVbPQ67S2GFWL=5v&+rH!^2faZ&3pd z>HsgRe(Lq>%9esjE2M5*Lv~!HKO>>!)hks>UAQWxK2r0qWxkQlQw_9eM0BuLq$A6S z`l%y{nhnD7*3{<>I0$IgioPa&?O4LNkH|?v$^MatfF@lpoF5{HC&D%Ag(m<$e@P&m zo0}KT2~AB$#6nYD^T_X5ruyR}Q| z99u3dF6J5v&ef}$$?9&TH!~E?^0d*D$n%*y?ivp%O-@c4;NwtDd_I42uan*4>TSzxox!_3>ly&GBHwf9MkQxR(wh57Z37g* zZx2Km9Up6XVu^({S@UBBrFtaRZdx~*x$!suyN+pyXfw5J`-l zd-yIJEZh$R7)Tz{eL<&H!`dv_G5Zkd3r8T#nsnNe>B4}vdt=uI)Fh0*$ghQun!>*r^g^dkIL+5yEksB5SXh{{m|b BDu)07 diff --git a/resources/assets/tinker/textures/items/canister_heart_yellow.png b/resources/assets/tinker/textures/items/canister_heart_yellow.png new file mode 100644 index 0000000000000000000000000000000000000000..8b7ebcdbaefe670073acebece0ece6b4b7bca54e GIT binary patch literal 428 zcmV;d0aN~oP)7-X_^Cap6B?!U&nDQ zZVCXHrb(XXPe;%m+3q^%Vw*VPn(Z(Q0hrI{NGSpEJWp{Mh9Pkr3$1TkO388-0q`aH z?|)!Aol=%1MNzb3qpr=C{PxXxELhGW&STN`Ns 0; for (int xPos = x - 1; xPos <= x + 1; xPos++) { for (int yPos = y - 1; yPos <= y + 1; yPos++) @@ -179,21 +186,55 @@ public class Scythe extends Weapon if (!cancelHarvest) { - Block block = world.getBlock(xPos, yPos, zPos); - if ((block != null)) + Block localBlock = world.getBlock(xPos, yPos, zPos); + int localMeta = world.getBlockMetadata(xPos, yPos, zPos); + float localHardness = localBlock == null ? Float.MAX_VALUE : localBlock.getBlockHardness(world, xPos, yPos, zPos); + if (localBlock != null)// && (block.blockMaterial == Material.leaves || block.isLeaves(world, xPos, yPos, zPos))) { for (int iter = 0; iter < materials.length; iter++) { - if (materials[iter] == block.getMaterial()) + if (materials[iter] == localBlock.getMaterial()) { - int localMeta = world.getBlockMetadata(xPos, yPos, zPos); - WorldHelper.setBlockToAir(world, xPos, yPos, zPos); if (!player.capabilities.isCreativeMode) { - block.onBlockDestroyedByPlayer(world, x, y, z, meta); - block.harvestBlock(world, player, xPos, yPos, zPos, localMeta); - block.onBlockHarvested(world, x, y, z, localMeta, player); - onBlockDestroyed(stack, world, blockB, xPos, yPos, zPos, player); + if (butter && localBlock instanceof IShearable && ((IShearable) localBlock).isShearable(stack, player.worldObj, x, y, z)) + { + ArrayList drops = ((IShearable) localBlock).onSheared(stack, player.worldObj, x, y, z, + EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)); + Random rand = new Random(); + + if (!world.isRemote) + for (ItemStack dropStack : drops) + { + float f = 0.7F; + double d = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; + double d1 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; + double d2 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; + EntityItem entityitem = new EntityItem(player.worldObj, (double) xPos + d, (double) yPos + d1, (double) zPos + d2, dropStack); + entityitem.delayBeforeCanPickup = 10; + player.worldObj.spawnEntityInWorld(entityitem); + } + + if (localHardness > 0f) + onBlockDestroyed(stack, world, localBlock, xPos, yPos, zPos, player); + player.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(localBlock)], 1); + world.setBlockToAir(xPos, yPos, zPos); + } + else + { + if (localBlock.removedByPlayer(world, player, xPos, yPos, zPos)) + { + localBlock.onBlockDestroyedByPlayer(world, xPos, yPos, zPos, localMeta); + } + localBlock.harvestBlock(world, player, xPos, yPos, zPos, localMeta); + localBlock.onBlockHarvested(world, xPos, yPos, zPos, localMeta, player); + if (localHardness > 0f) + onBlockDestroyed(stack, world, localBlock, xPos, yPos, zPos, player); + } + } + else + { + world.setBlockToAir(xPos, yPos, zPos); } } } diff --git a/src/main/java/tconstruct/items/tools/Shortbow.java b/src/main/java/tconstruct/items/tools/Shortbow.java index 88675446..c4c89b53 100644 --- a/src/main/java/tconstruct/items/tools/Shortbow.java +++ b/src/main/java/tconstruct/items/tools/Shortbow.java @@ -8,6 +8,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.StatCollector; import net.minecraft.world.World; import tconstruct.common.TRepo; import cpw.mods.fml.relauncher.Side; @@ -175,6 +176,9 @@ public class Shortbow extends BowBase } } } + list.add(""); + list.add("\u00A79+" + tags.getCompoundTag("InfiTool").getInteger("Attack") + " " + StatCollector.translateToLocalFormatted("attribute.name.generic.attackDamage")); + } public String getBowstringName (int type) diff --git a/src/main/java/tconstruct/library/tools/AbilityHelper.java b/src/main/java/tconstruct/library/tools/AbilityHelper.java index 0374f1eb..ee6c2e57 100644 --- a/src/main/java/tconstruct/library/tools/AbilityHelper.java +++ b/src/main/java/tconstruct/library/tools/AbilityHelper.java @@ -523,22 +523,26 @@ public class AbilityHelper } } + public static void spawnItemAtEntity (Entity entity, ItemStack stack, int delay) + { + if (!entity.worldObj.isRemote) + { + EntityItem entityitem = new EntityItem(entity.worldObj, entity.posX + 0.5D, entity.posY + 0.5D, entity.posZ + 0.5D, stack); + entityitem.delayBeforeCanPickup = delay; + entity.worldObj.spawnEntityInWorld(entityitem); + } + } + public static void spawnItemAtPlayer (EntityPlayer player, ItemStack stack) { - EntityItem entityitem = new EntityItem(player.worldObj, player.posX + 0.5D, player.posY + 0.5D, player.posZ + 0.5D, stack); - player.worldObj.spawnEntityInWorld(entityitem); - if (!(player instanceof FakePlayer)) - entityitem.onCollideWithPlayer(player); - /* - * if (!player.inventory.addItemStackToInventory(stack)) { if - * (!player.worldObj.isRemote) { EntityItem entityitem = new - * EntityItem(player.worldObj, player.posX + 0.5D, player.posY + 0.5D, - * player.posZ + 0.5D, stack); - * player.worldObj.spawnEntityInWorld(entityitem); - * entityitem.onCollideWithPlayer(player); } } else { - * player.worldObj.playSoundAtEntity(player, "random.pop", 0.2F, - * ((random.nextFloat() - random.nextFloat()) * 0.7F + 1.0F) * 2.0F); } - */ + if (!player.worldObj.isRemote) + { + EntityItem entityitem = new EntityItem(player.worldObj, player.posX + 0.5D, player.posY + 0.5D, player.posZ + 0.5D, stack); + player.worldObj.spawnEntityInWorld(entityitem); + if (!(player instanceof FakePlayer)) + entityitem.onCollideWithPlayer(player); + } + } /* Ranged weapons */ @@ -632,4 +636,5 @@ public class AbilityHelper Vec3 vec31 = vec3.addVector((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); return world.func_147447_a(vec3, vec31, par3, !par3, par3); } + } diff --git a/src/main/java/tconstruct/library/tools/HarvestTool.java b/src/main/java/tconstruct/library/tools/HarvestTool.java index fbd40941..367b17c2 100644 --- a/src/main/java/tconstruct/library/tools/HarvestTool.java +++ b/src/main/java/tconstruct/library/tools/HarvestTool.java @@ -5,6 +5,8 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; @@ -194,4 +196,85 @@ public abstract class HarvestTool extends ToolCore protected abstract Material[] getEffectiveMaterials (); protected abstract String getHarvestType (); + + //Right-click + @Override + public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float clickX, float clickY, float clickZ) + { + /*if (world.isRemote) + return true;*/ + + boolean used = false; + int hotbarSlot = player.inventory.currentItem; + int itemSlot = hotbarSlot == 0 ? 8 : hotbarSlot + 1; + ItemStack nearbyStack = null; + + if (hotbarSlot < 8) + { + nearbyStack = player.inventory.getStackInSlot(itemSlot); + if (nearbyStack != null) + { + Item item = nearbyStack.getItem(); + if (item instanceof ItemBlock) + { + int posX = x; + int posY = y; + int posZ = z; + int playerPosX = (int) Math.floor(player.posX); + int playerPosY = (int) Math.floor(player.posY); + int playerPosZ = (int) Math.floor(player.posZ); + if (side == 0) + { + --posY; + } + + if (side == 1) + { + ++posY; + } + + if (side == 2) + { + --posZ; + } + + if (side == 3) + { + ++posZ; + } + + if (side == 4) + { + --posX; + } + + if (side == 5) + { + ++posX; + } + if (posX == playerPosX && (posY == playerPosY || posY == playerPosY + 1 || posY == playerPosY - 1) && posZ == playerPosZ) + { + return false; + } + + used = item.onItemUse(nearbyStack, player, world, x, y, z, side, clickX, clickY, clickZ); + if (nearbyStack.stackSize < 1) + { + nearbyStack = null; + player.inventory.setInventorySlotContents(itemSlot, null); + } + } + } + } + + /* + if (used) //Update client + { + Packet103SetSlot packet = new Packet103SetSlot(player.openContainer.windowId, itemSlot, nearbyStack); + ((EntityPlayerMP)player).playerNetServerHandler.sendPacketToPlayer(packet); + } + */ + + return used; + } } diff --git a/src/main/java/tconstruct/library/tools/ToolCore.java b/src/main/java/tconstruct/library/tools/ToolCore.java index 5e8eb519..4087acb0 100644 --- a/src/main/java/tconstruct/library/tools/ToolCore.java +++ b/src/main/java/tconstruct/library/tools/ToolCore.java @@ -19,6 +19,7 @@ import net.minecraft.item.ItemPotion; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.IIcon; +import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import tconstruct.library.ActiveToolMod; @@ -408,6 +409,10 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem } } } + list.add(""); + int attack = (int) (tags.getCompoundTag("InfiTool").getInteger("Attack") * this.getDamageModifier()); + list.add("\u00A79+" + attack + " " + StatCollector.translateToLocalFormatted("attribute.name.generic.attackDamage")); + } public static String getStyleForType (int type) @@ -674,87 +679,6 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem return 1.0f; } - // Right-click - @Override - public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float clickX, float clickY, float clickZ) - { - /* - * if (world.isRemote) return true; - */ - - boolean used = false; - int hotbarSlot = player.inventory.currentItem; - int itemSlot = hotbarSlot == 0 ? 8 : hotbarSlot + 1; - ItemStack nearbyStack = null; - - if (hotbarSlot < 8) - { - nearbyStack = player.inventory.getStackInSlot(itemSlot); - if (nearbyStack != null) - { - Item item = nearbyStack.getItem(); - if (item instanceof ItemBlock) - { - int posX = x; - int posY = y; - int posZ = z; - int playerPosX = (int) Math.floor(player.posX); - int playerPosY = (int) Math.floor(player.posY); - int playerPosZ = (int) Math.floor(player.posZ); - if (side == 0) - { - --posY; - } - - if (side == 1) - { - ++posY; - } - - if (side == 2) - { - --posZ; - } - - if (side == 3) - { - ++posZ; - } - - if (side == 4) - { - --posX; - } - - if (side == 5) - { - ++posX; - } - if (posX == playerPosX && (posY == playerPosY || posY == playerPosY + 1 || posY == playerPosY - 1) && posZ == playerPosZ) - { - return false; - } - - used = item.onItemUse(nearbyStack, player, world, x, y, z, side, clickX, clickY, clickZ); - if (nearbyStack.stackSize < 1) - { - nearbyStack = null; - player.inventory.setInventorySlotContents(itemSlot, null); - } - } - } - } - - /* - * if (used) //Update client { Packet103SetSlot packet = new - * Packet103SetSlot(player.openContainer.windowId, itemSlot, - * nearbyStack); - * ((EntityPlayerMP)player).playerNetServerHandler.sendPacketToPlayer - * (packet); } - */ - return used; - } - @Override public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player) { diff --git a/src/main/java/tconstruct/modifiers/tools/TActiveOmniMod.java b/src/main/java/tconstruct/modifiers/tools/TActiveOmniMod.java index 72eea31b..076474ec 100644 --- a/src/main/java/tconstruct/modifiers/tools/TActiveOmniMod.java +++ b/src/main/java/tconstruct/modifiers/tools/TActiveOmniMod.java @@ -51,11 +51,13 @@ public class TActiveOmniMod extends ActiveToolMod @Override public boolean beforeBlockBreak (ToolCore tool, ItemStack stack, int x, int y, int z, EntityLivingBase entity) { + NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool"); + baconator(tool, stack, entity, tags); + if (entity instanceof EntityPlayer && ((EntityPlayer) entity).capabilities.isCreativeMode) return false; TRepo.modLapis.midStreamModify(stack, tool); - NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool"); World world = entity.worldObj; Block block = entity.worldObj.getBlock(x, y, z); int meta = world.getBlockMetadata(x, y, z); @@ -150,9 +152,27 @@ public class TActiveOmniMod extends ActiveToolMod public int baseAttackDamage (int earlyModDamage, int damage, ToolCore tool, NBTTagCompound tags, NBTTagCompound toolTags, ItemStack stack, EntityLivingBase player, Entity entity) { TRepo.modLapis.midStreamModify(stack, tool); + baconator(tool, stack, player, tags); return 0; } + private void baconator (ToolCore tool, ItemStack stack, EntityLivingBase entity, NBTTagCompound tags) + { + int bacon = 0; + bacon += tags.getInteger("Head") == 18 ? 1 : 0; + bacon += tags.getInteger("Handle") == 18 ? 1 : 0; + bacon += tags.getInteger("Accessory") == 18 ? 1 : 0; + bacon += tags.getInteger("Extra") == 18 ? 1 : 0; + int chance = tool.getPartAmount() * 100; + if (random.nextInt(chance) < bacon) + { + if (entity instanceof EntityPlayer) + AbilityHelper.spawnItemAtPlayer((EntityPlayer) entity, new ItemStack(TRepo.strangeFood, 1, 2)); + else + AbilityHelper.spawnItemAtEntity(entity, new ItemStack(TRepo.strangeFood, 1, 2), 0); + } + } + @Override public int attackDamage (int modDamage, int currentDamage, ToolCore tool, NBTTagCompound tags, NBTTagCompound toolTags, ItemStack stack, EntityLivingBase player, Entity entity) {