Allow repairing gem tools and armor in anvil
This commit is contained in:
parent
93e324cc11
commit
548d393820
7 changed files with 144 additions and 36 deletions
|
@ -26,6 +26,8 @@ package techreborn.items.armor;
|
|||
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.events.TRRecipeHandler;
|
||||
|
||||
|
@ -34,8 +36,15 @@ import techreborn.events.TRRecipeHandler;
|
|||
*/
|
||||
public class ItemTRArmour extends ItemArmor {
|
||||
|
||||
String repairOreDict = "";
|
||||
|
||||
public ItemTRArmour(ArmorMaterial material, EntityEquipmentSlot slot) {
|
||||
this(material, slot, "");
|
||||
}
|
||||
|
||||
public ItemTRArmour(ArmorMaterial material, EntityEquipmentSlot slot, String repairOreDict) {
|
||||
super(material, material.getDamageReductionAmount(slot), slot);
|
||||
this.repairOreDict = repairOreDict;
|
||||
if (slot == EntityEquipmentSlot.HEAD)
|
||||
setUnlocalizedName(material.name().toLowerCase() + "Helmet");
|
||||
if (slot == EntityEquipmentSlot.CHEST)
|
||||
|
@ -47,4 +56,12 @@ public class ItemTRArmour extends ItemArmor {
|
|||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
TRRecipeHandler.hideEntry(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
|
||||
if(toRepair.getItem() == this && !repairOreDict.isEmpty()){
|
||||
return ItemUtils.isInputEqual(repairOreDict, repair, false, false, true);
|
||||
}
|
||||
return super.getIsRepairable(toRepair, repair);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,14 +25,32 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.events.TRRecipeHandler;
|
||||
|
||||
public class ItemTRAxe extends ItemAxe {
|
||||
|
||||
String repairOreDict = "";
|
||||
|
||||
public ItemTRAxe(ToolMaterial material) {
|
||||
this(material, "");
|
||||
}
|
||||
|
||||
public ItemTRAxe(ToolMaterial material, String repairOreDict) {
|
||||
super(material, material.getAttackDamage() + 5.75F, (material.getAttackDamage() + 6.75F) * -0.344444F);
|
||||
this.repairOreDict = repairOreDict;
|
||||
setUnlocalizedName(material.name().toLowerCase() + "Axe");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
TRRecipeHandler.hideEntry(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
|
||||
if(toRepair.getItem() == this && !repairOreDict.isEmpty()){
|
||||
return ItemUtils.isInputEqual(repairOreDict, repair, false, false, true);
|
||||
}
|
||||
return super.getIsRepairable(toRepair, repair);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,14 +25,24 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import net.minecraft.item.ItemHoe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.events.TRRecipeHandler;
|
||||
|
||||
public class ItemTRHoe extends ItemHoe {
|
||||
|
||||
String repairOreDict = "";
|
||||
|
||||
public ItemTRHoe(ToolMaterial material) {
|
||||
this(material, "");
|
||||
}
|
||||
|
||||
public ItemTRHoe(ToolMaterial material, String repairOreDict) {
|
||||
super(material);
|
||||
this.repairOreDict = repairOreDict;
|
||||
setUnlocalizedName(material.name().toLowerCase() + "Hoe");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
TRRecipeHandler.hideEntry(this);
|
||||
|
@ -43,4 +53,12 @@ public class ItemTRHoe extends ItemHoe {
|
|||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
|
||||
if(toRepair.getItem() == this && !repairOreDict.isEmpty()){
|
||||
return ItemUtils.isInputEqual(repairOreDict, repair, false, false, true);
|
||||
}
|
||||
return super.getIsRepairable(toRepair, repair);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,14 +25,33 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.events.TRRecipeHandler;
|
||||
|
||||
public class ItemTRPickaxe extends ItemPickaxe {
|
||||
|
||||
String repairOreDict = "";
|
||||
|
||||
|
||||
public ItemTRPickaxe(ToolMaterial material) {
|
||||
this(material, "");
|
||||
}
|
||||
|
||||
public ItemTRPickaxe(ToolMaterial material, String repairOreDict) {
|
||||
super(material);
|
||||
this.repairOreDict = repairOreDict;
|
||||
setUnlocalizedName(material.name().toLowerCase() + "Pickaxe");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
TRRecipeHandler.hideEntry(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
|
||||
if(toRepair.getItem() == this && !repairOreDict.isEmpty()){
|
||||
return ItemUtils.isInputEqual(repairOreDict, repair, true, false, true);
|
||||
}
|
||||
return super.getIsRepairable(toRepair, repair);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,14 +25,32 @@
|
|||
package techreborn.items.tools;
|
||||
|
||||
import net.minecraft.item.ItemSpade;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.events.TRRecipeHandler;
|
||||
|
||||
public class ItemTRSpade extends ItemSpade {
|
||||
|
||||
String repairOreDict = "";
|
||||
|
||||
public ItemTRSpade(ToolMaterial material) {
|
||||
this(material, "");
|
||||
}
|
||||
|
||||
public ItemTRSpade(ToolMaterial material, String repairOreDict) {
|
||||
super(material);
|
||||
this.repairOreDict = repairOreDict;
|
||||
setUnlocalizedName(material.name().toLowerCase() + "Spade");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
TRRecipeHandler.hideEntry(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
|
||||
if(toRepair.getItem() == this && !repairOreDict.isEmpty()){
|
||||
return ItemUtils.isInputEqual(repairOreDict, repair, false, false, true);
|
||||
}
|
||||
return super.getIsRepairable(toRepair, repair);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,15 +24,33 @@
|
|||
|
||||
package techreborn.items.tools;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.client.TechRebornCreativeTabMisc;
|
||||
import techreborn.events.TRRecipeHandler;
|
||||
|
||||
public class ItemTRSword extends ItemSword {
|
||||
|
||||
String repairOreDict = "";
|
||||
|
||||
public ItemTRSword(ToolMaterial material) {
|
||||
this(material, "");
|
||||
}
|
||||
|
||||
public ItemTRSword(ToolMaterial material, String repairOreDict) {
|
||||
super(material);
|
||||
this.repairOreDict = repairOreDict;
|
||||
setUnlocalizedName(material.name().toLowerCase() + "Sword");
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
TRRecipeHandler.hideEntry(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
|
||||
if(toRepair.getItem() == this && !repairOreDict.isEmpty()){
|
||||
return ItemUtils.isInputEqual(repairOreDict, repair, false, false, true);
|
||||
}
|
||||
return super.getIsRepairable(toRepair, repair);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue