Cleaned up code dupes

This commit is contained in:
drcrazy 2018-09-04 13:46:51 +03:00
parent a05ba25f31
commit 79ff8ee5b0
25 changed files with 12 additions and 59 deletions

View file

@ -327,5 +327,4 @@ public class TRItems {
TRRecipeHandler.hideEntry(item); TRRecipeHandler.hideEntry(item);
RebornRegistry.registerItem(item); RebornRegistry.registerItem(item);
} }
} }

View file

@ -44,8 +44,7 @@ public class ItemAdvancedChainsaw extends ItemChainsaw {
// 4M FE max charge with 1k charge rate // 4M FE max charge with 1k charge rate
public ItemAdvancedChainsaw() { public ItemAdvancedChainsaw() {
super(ToolMaterial.DIAMOND, "techreborn.advancedChainsaw", ConfigTechReborn.AdvancedChainsawCharge, super(ToolMaterial.DIAMOND, ConfigTechReborn.AdvancedChainsawCharge, 1.0F);
1.0F);
this.cost = 250; this.cost = 250;
this.transferLimit = 1000; this.transferLimit = 1000;
} }

View file

@ -50,7 +50,7 @@ public class ItemAdvancedDrill extends ItemDrill {
// 4M FE max charge with 1k charge rate // 4M FE max charge with 1k charge rate
public ItemAdvancedDrill() { public ItemAdvancedDrill() {
super(ToolMaterial.DIAMOND, "techreborn.advancedDrill", ConfigTechReborn.AdvancedDrillCharge, 2.0F, 10F); super(ToolMaterial.DIAMOND, ConfigTechReborn.AdvancedDrillCharge, 2.0F, 10F);
this.cost = 250; this.cost = 250;
this.transferLimit = 1000; this.transferLimit = 1000;
} }

View file

@ -36,7 +36,7 @@ public class ItemAdvancedJackhammer extends ItemJackhammer {
// 4M FE max charge with 1k charge rate // 4M FE max charge with 1k charge rate
public ItemAdvancedJackhammer() { public ItemAdvancedJackhammer() {
super(ToolMaterial.IRON, "techreborn.advancedJackhammer", ConfigTechReborn.AdvancedJackhammerCharge); super(ToolMaterial.IRON, ConfigTechReborn.AdvancedJackhammerCharge);
this.cost = 250; this.cost = 250;
this.efficiency = 60F; this.efficiency = 60F;
this.transferLimit = 1000; this.transferLimit = 1000;

View file

@ -58,11 +58,10 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo {
public int transferLimit = 100; public int transferLimit = 100;
public boolean isBreaking = false; public boolean isBreaking = false;
public ItemChainsaw(ToolMaterial material, String unlocalizedName, int energyCapacity, float unpoweredSpeed) { public ItemChainsaw(ToolMaterial material, int energyCapacity, float unpoweredSpeed) {
super(material); super(material);
setCreativeTab(TechRebornCreativeTab.instance); setCreativeTab(TechRebornCreativeTab.instance);
setMaxStackSize(1); setMaxStackSize(1);
setTranslationKey(unlocalizedName);
this.maxCharge = energyCapacity; this.maxCharge = energyCapacity;
this.efficiency = unpoweredSpeed; this.efficiency = unpoweredSpeed;

View file

@ -37,7 +37,6 @@ import net.minecraftforge.energy.CapabilityEnergy;
import reborncore.api.power.IEnergyInterfaceTile; import reborncore.api.power.IEnergyInterfaceTile;
import reborncore.common.powerSystem.PowerSystem; import reborncore.common.powerSystem.PowerSystem;
import techreborn.items.ItemTR; import techreborn.items.ItemTR;
import techreborn.utils.TechRebornCreativeTab;
/** /**
* Created by Mark on 20/03/2016. * Created by Mark on 20/03/2016.
@ -45,8 +44,6 @@ import techreborn.utils.TechRebornCreativeTab;
public class ItemDebugTool extends ItemTR { public class ItemDebugTool extends ItemTR {
public ItemDebugTool() { public ItemDebugTool() {
setCreativeTab(TechRebornCreativeTab.instance);
setTranslationKey("techreborn.debug");
} }
@Override @Override

View file

@ -38,7 +38,7 @@ public class ItemDiamondChainsaw extends ItemChainsaw {
// 400k max charge with 1k charge rate // 400k max charge with 1k charge rate
public ItemDiamondChainsaw() { public ItemDiamondChainsaw() {
super(ToolMaterial.DIAMOND, "techreborn.diamondChainsaw", ConfigTechReborn.DiamondChainsawCharge, 1.0F); super(ToolMaterial.DIAMOND, ConfigTechReborn.DiamondChainsawCharge, 1.0F);
this.cost = 250; this.cost = 250;
this.transferLimit = 1000; this.transferLimit = 1000;
} }

View file

@ -38,7 +38,7 @@ public class ItemDiamondDrill extends ItemDrill {
// 400k max charge with 1k charge rate // 400k max charge with 1k charge rate
public ItemDiamondDrill() { public ItemDiamondDrill() {
super(ToolMaterial.DIAMOND, "techreborn.diamondDrill", ConfigTechReborn.DiamondDrillCharge, 0.5F, 15F); super(ToolMaterial.DIAMOND, ConfigTechReborn.DiamondDrillCharge, 0.5F, 15F);
this.cost = 250; this.cost = 250;
this.transferLimit = 1000; this.transferLimit = 1000;
} }

View file

@ -36,7 +36,7 @@ public class ItemDiamondJackhammer extends ItemJackhammer {
// 400k max charge with 1k charge rate // 400k max charge with 1k charge rate
public ItemDiamondJackhammer() { public ItemDiamondJackhammer() {
super(ToolMaterial.DIAMOND, "techreborn.diamondJackhammer", ConfigTechReborn.DiamondJackhammerCharge); super(ToolMaterial.DIAMOND, ConfigTechReborn.DiamondJackhammerCharge);
this.cost = 100; this.cost = 100;
this.efficiency = 16F; this.efficiency = 16F;
this.transferLimit = 1000; this.transferLimit = 1000;

View file

@ -52,12 +52,11 @@ public class ItemDrill extends ItemPickaxe implements IEnergyItemInfo {
public float unpoweredSpeed = 2.0F; public float unpoweredSpeed = 2.0F;
public int transferLimit = 100; public int transferLimit = 100;
public ItemDrill(ToolMaterial material, String unlocalizedName, int energyCapacity, float unpoweredSpeed, float efficiencyOnProperMaterial) { public ItemDrill(ToolMaterial material, int energyCapacity, float unpoweredSpeed, float efficiencyOnProperMaterial) {
super(material); super(material);
this.efficiency = efficiencyOnProperMaterial; this.efficiency = efficiencyOnProperMaterial;
setCreativeTab(TechRebornCreativeTab.instance); setCreativeTab(TechRebornCreativeTab.instance);
setMaxStackSize(1); setMaxStackSize(1);
setTranslationKey(unlocalizedName);
this.maxCharge = energyCapacity; this.maxCharge = energyCapacity;
this.unpoweredSpeed = unpoweredSpeed; this.unpoweredSpeed = unpoweredSpeed;
} }

View file

@ -37,8 +37,6 @@ import reborncore.common.powerSystem.PoweredItemCapabilityProvider;
import reborncore.common.util.ItemUtils; import reborncore.common.util.ItemUtils;
import techreborn.init.TRItems; import techreborn.init.TRItems;
import techreborn.items.ItemTR; import techreborn.items.ItemTR;
import techreborn.utils.TechRebornCreativeTab;
import javax.annotation.Nullable; import javax.annotation.Nullable;
/** /**
@ -50,8 +48,6 @@ public class ItemElectricTreetap extends ItemTR implements IEnergyItemInfo {
public int cost = 20; public int cost = 20;
public ItemElectricTreetap() { public ItemElectricTreetap() {
setTranslationKey("techreborn.electric_treetap");
setCreativeTab(TechRebornCreativeTab.instance);
setMaxStackSize(1); setMaxStackSize(1);
} }

View file

@ -53,13 +53,12 @@ public class ItemJackhammer extends ItemPickaxe implements IEnergyItemInfo {
public int cost = 250; public int cost = 250;
public int transferLimit = 100; public int transferLimit = 100;
public ItemJackhammer(ToolMaterial material, String unlocalizedName, int energyCapacity) { public ItemJackhammer(ToolMaterial material, int energyCapacity) {
super(material); super(material);
efficiency = 20F; efficiency = 20F;
setCreativeTab(TechRebornCreativeTab.instance); setCreativeTab(TechRebornCreativeTab.instance);
setMaxStackSize(1); setMaxStackSize(1);
setMaxDamage(240); setMaxDamage(240);
setTranslationKey(unlocalizedName);
this.maxCharge = energyCapacity; this.maxCharge = energyCapacity;
} }

View file

@ -72,7 +72,6 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo {
setNoRepair(); setNoRepair();
setCreativeTab(TechRebornCreativeTab.instance); setCreativeTab(TechRebornCreativeTab.instance);
setMaxStackSize(1); setMaxStackSize(1);
setTranslationKey("techreborn.nanosaber");
this.addPropertyOverride(new ResourceLocation("techreborn:active"), new IItemPropertyGetter() { this.addPropertyOverride(new ResourceLocation("techreborn:active"), new IItemPropertyGetter() {
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)

View file

@ -68,7 +68,6 @@ public class ItemOmniTool extends ItemPickaxe implements IEnergyItemInfo {
setCreativeTab(TechRebornCreativeTab.instance); setCreativeTab(TechRebornCreativeTab.instance);
setMaxStackSize(1); setMaxStackSize(1);
setMaxDamage(200); setMaxDamage(200);
setTranslationKey("techreborn.omniTool");
} }
// ItemPickaxe // ItemPickaxe

View file

@ -61,7 +61,6 @@ public class ItemRockCutter extends ItemPickaxe implements IEnergyItemInfo {
// 400k FE with 1k FE\t charge rate // 400k FE with 1k FE\t charge rate
public ItemRockCutter() { public ItemRockCutter() {
super(ToolMaterial.DIAMOND); super(ToolMaterial.DIAMOND);
setTranslationKey("techreborn.rockcutter");
setCreativeTab(TechRebornCreativeTab.instance); setCreativeTab(TechRebornCreativeTab.instance);
setMaxStackSize(1); setMaxStackSize(1);
efficiency = 16F; efficiency = 16F;

View file

@ -37,7 +37,7 @@ import techreborn.init.TRItems;
public class ItemSteelChainsaw extends ItemChainsaw { public class ItemSteelChainsaw extends ItemChainsaw {
public ItemSteelChainsaw() { public ItemSteelChainsaw() {
super(ToolMaterial.IRON, "techreborn.steelChainsaw", ConfigTechReborn.SteelChainsawCharge, 0.5F); super(ToolMaterial.IRON, ConfigTechReborn.SteelChainsawCharge, 0.5F);
this.cost = 50; this.cost = 50;
} }

View file

@ -37,7 +37,7 @@ import techreborn.init.TRItems;
public class ItemSteelDrill extends ItemDrill { public class ItemSteelDrill extends ItemDrill {
public ItemSteelDrill() { public ItemSteelDrill() {
super(ToolMaterial.IRON, "techreborn.steelDrill", ConfigTechReborn.SteelDrillCharge, 0.5F, 10F); super(ToolMaterial.IRON, ConfigTechReborn.SteelDrillCharge, 0.5F, 10F);
this.cost = 50; this.cost = 50;
} }

View file

@ -35,7 +35,7 @@ import techreborn.init.TRItems;
public class ItemSteelJackhammer extends ItemJackhammer { public class ItemSteelJackhammer extends ItemJackhammer {
public ItemSteelJackhammer() { public ItemSteelJackhammer() {
super(ToolMaterial.DIAMOND, "techreborn.steelJackhammer", ConfigTechReborn.SteelJackhammerCharge); super(ToolMaterial.DIAMOND, ConfigTechReborn.SteelJackhammerCharge);
this.cost = 50; this.cost = 50;
this.efficiency = 12F; this.efficiency = 12F;
} }

View file

@ -27,7 +27,6 @@ package techreborn.items.tools;
import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import reborncore.common.util.ItemUtils; import reborncore.common.util.ItemUtils;
import techreborn.events.TRRecipeHandler;
import techreborn.utils.TechRebornCreativeTab; import techreborn.utils.TechRebornCreativeTab;
public class ItemTRAxe extends ItemAxe { public class ItemTRAxe extends ItemAxe {
@ -41,9 +40,7 @@ public class ItemTRAxe extends ItemAxe {
public ItemTRAxe(ToolMaterial material, String repairOreDict) { public ItemTRAxe(ToolMaterial material, String repairOreDict) {
super(material, material.getAttackDamage() + 5.75F, (material.getAttackDamage() + 6.75F) * -0.344444F); super(material, material.getAttackDamage() + 5.75F, (material.getAttackDamage() + 6.75F) * -0.344444F);
this.repairOreDict = repairOreDict; this.repairOreDict = repairOreDict;
setTranslationKey(material.name().toLowerCase() + "Axe");
setCreativeTab(TechRebornCreativeTab.instance); setCreativeTab(TechRebornCreativeTab.instance);
TRRecipeHandler.hideEntry(this);
} }
@Override @Override

View file

@ -29,7 +29,6 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.common.util.ItemUtils; import reborncore.common.util.ItemUtils;
import techreborn.events.TRRecipeHandler;
import techreborn.utils.TechRebornCreativeTab; import techreborn.utils.TechRebornCreativeTab;
public class ItemTRHoe extends ItemHoe { public class ItemTRHoe extends ItemHoe {
@ -43,9 +42,7 @@ public class ItemTRHoe extends ItemHoe {
public ItemTRHoe(ToolMaterial material, String repairOreDict) { public ItemTRHoe(ToolMaterial material, String repairOreDict) {
super(material); super(material);
this.repairOreDict = repairOreDict; this.repairOreDict = repairOreDict;
setTranslationKey(material.name().toLowerCase() + "Hoe");
setCreativeTab(TechRebornCreativeTab.instance); setCreativeTab(TechRebornCreativeTab.instance);
TRRecipeHandler.hideEntry(this);
} }
@Override @Override

View file

@ -27,7 +27,6 @@ package techreborn.items.tools;
import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import reborncore.common.util.ItemUtils; import reborncore.common.util.ItemUtils;
import techreborn.events.TRRecipeHandler;
import techreborn.utils.TechRebornCreativeTab; import techreborn.utils.TechRebornCreativeTab;
public class ItemTRPickaxe extends ItemPickaxe { public class ItemTRPickaxe extends ItemPickaxe {
@ -41,9 +40,7 @@ public class ItemTRPickaxe extends ItemPickaxe {
public ItemTRPickaxe(ToolMaterial material, String repairOreDict) { public ItemTRPickaxe(ToolMaterial material, String repairOreDict) {
super(material); super(material);
this.repairOreDict = repairOreDict; this.repairOreDict = repairOreDict;
setTranslationKey(material.name().toLowerCase() + "Pickaxe");
setCreativeTab(TechRebornCreativeTab.instance); setCreativeTab(TechRebornCreativeTab.instance);
TRRecipeHandler.hideEntry(this);
} }
@Override @Override

View file

@ -27,7 +27,6 @@ package techreborn.items.tools;
import net.minecraft.item.ItemSpade; import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import reborncore.common.util.ItemUtils; import reborncore.common.util.ItemUtils;
import techreborn.events.TRRecipeHandler;
import techreborn.utils.TechRebornCreativeTab; import techreborn.utils.TechRebornCreativeTab;
public class ItemTRSpade extends ItemSpade { public class ItemTRSpade extends ItemSpade {
@ -41,9 +40,7 @@ public class ItemTRSpade extends ItemSpade {
public ItemTRSpade(ToolMaterial material, String repairOreDict) { public ItemTRSpade(ToolMaterial material, String repairOreDict) {
super(material); super(material);
this.repairOreDict = repairOreDict; this.repairOreDict = repairOreDict;
setTranslationKey(material.name().toLowerCase() + "Spade");
setCreativeTab(TechRebornCreativeTab.instance); setCreativeTab(TechRebornCreativeTab.instance);
TRRecipeHandler.hideEntry(this);
} }
@Override @Override

View file

@ -27,7 +27,6 @@ package techreborn.items.tools;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword; import net.minecraft.item.ItemSword;
import reborncore.common.util.ItemUtils; import reborncore.common.util.ItemUtils;
import techreborn.events.TRRecipeHandler;
import techreborn.utils.TechRebornCreativeTab; import techreborn.utils.TechRebornCreativeTab;
public class ItemTRSword extends ItemSword { public class ItemTRSword extends ItemSword {
@ -41,9 +40,7 @@ public class ItemTRSword extends ItemSword {
public ItemTRSword(ToolMaterial material, String repairOreDict) { public ItemTRSword(ToolMaterial material, String repairOreDict) {
super(material); super(material);
this.repairOreDict = repairOreDict; this.repairOreDict = repairOreDict;
setTranslationKey(material.name().toLowerCase() + "Sword");
setCreativeTab(TechRebornCreativeTab.instance); setCreativeTab(TechRebornCreativeTab.instance);
TRRecipeHandler.hideEntry(this);
} }
@Override @Override

View file

@ -26,15 +26,12 @@ package techreborn.items.tools;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import techreborn.items.ItemTR; import techreborn.items.ItemTR;
import techreborn.utils.TechRebornCreativeTab;
public class ItemTreeTap extends ItemTR { public class ItemTreeTap extends ItemTR {
public ItemTreeTap() { public ItemTreeTap() {
setMaxStackSize(1); setMaxStackSize(1);
setMaxDamage(20); setMaxDamage(20);
setTranslationKey("techreborn.treetap");
setCreativeTab(TechRebornCreativeTab.instance);
} }

View file

@ -26,16 +26,13 @@ package techreborn.items.tools;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import reborncore.api.IToolHandler; import reborncore.api.IToolHandler;
import techreborn.items.ItemTR; import techreborn.items.ItemTR;
import techreborn.utils.TechRebornCreativeTab;
/** /**
* Created by modmuss50 on 26/02/2016. * Created by modmuss50 on 26/02/2016.
@ -43,20 +40,9 @@ import techreborn.utils.TechRebornCreativeTab;
public class ItemWrench extends ItemTR implements IToolHandler { public class ItemWrench extends ItemTR implements IToolHandler {
public ItemWrench() { public ItemWrench() {
setCreativeTab(TechRebornCreativeTab.instance);
setTranslationKey("techreborn.wrench");
setMaxStackSize(1); setMaxStackSize(1);
} }
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos,
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (!world.isRemote) {
return EnumActionResult.PASS;
}
return EnumActionResult.PASS;
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public boolean isFull3D() { public boolean isFull3D() {