From b9efa7373fefe9cb98aa5f91eba86858abe9240a Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Thu, 23 Oct 2014 00:14:27 +0200 Subject: [PATCH 01/11] Change stencils to be identified by actual IDs because DAMN was that other stuff a pain to use if you wanted to identify one. --- .../library/crafting/StencilBuilder.java | 27 ++++++----- .../java/tconstruct/tools/TinkerTools.java | 48 +++++++++---------- .../tconstruct/tools/ToolProxyClient.java | 9 ++-- .../tconstruct/tools/gui/StencilTableGui.java | 2 +- 4 files changed, 44 insertions(+), 42 deletions(-) diff --git a/src/main/java/tconstruct/library/crafting/StencilBuilder.java b/src/main/java/tconstruct/library/crafting/StencilBuilder.java index 9d5d73b5..9f261dcb 100644 --- a/src/main/java/tconstruct/library/crafting/StencilBuilder.java +++ b/src/main/java/tconstruct/library/crafting/StencilBuilder.java @@ -9,7 +9,7 @@ public class StencilBuilder public static StencilBuilder instance = new StencilBuilder(); public List blanks = new LinkedList(); // i wish ItemStack would support equals so i could use a Set here... - public List stencils = new ArrayList(); + public Map stencils = new TreeMap(); /** * Returns whether the given ItemStack is a blank pattern and therefore usable for stencil crafting. @@ -28,29 +28,32 @@ public class StencilBuilder instance.blanks.add(itemStack); } - public static void registerStencil (Item item, int meta) + public static void registerStencil (int id, Item item, int meta) { - instance.stencils.add(new ItemStack(item, 1, meta)); + registerStencil(id, new ItemStack(item, 1, meta)); } - public static void registerStencil (ItemStack pattern) + public static void registerStencil (int id, ItemStack pattern) { - instance.stencils.add(pattern); + if(instance.stencils.containsKey(id)) + throw new IllegalArgumentException("[TCon API] Stencil ID " + id + " is already occupied by " + instance.stencils.get(id).getDisplayName()); + + instance.stencils.put(id, pattern); } - public static List getStencils () + public static Collection getStencils () { - return instance.stencils; + return instance.stencils.values(); } /** * Returns the index of the given stencil. If no stencil is found, returns -1. */ - public static int getIndex (ItemStack stencil) + public static int getId(ItemStack stencil) { - for (int i = 0; i < instance.stencils.size(); i++) - if (OreDictionary.itemMatches(stencil, getStencil(i), false)) - return i; + for(Map.Entry entry : instance.stencils.entrySet()) + if (OreDictionary.itemMatches(stencil, entry.getValue(), false)) + return entry.getKey(); return -1; } @@ -58,7 +61,7 @@ public class StencilBuilder // returns the stencil with the given index public static ItemStack getStencil (int num) { - if (num >= instance.stencils.size()) + if (!instance.stencils.containsKey(num)) return null; return instance.stencils.get(num).copy(); diff --git a/src/main/java/tconstruct/tools/TinkerTools.java b/src/main/java/tconstruct/tools/TinkerTools.java index 2e9e6a62..3e9097f3 100644 --- a/src/main/java/tconstruct/tools/TinkerTools.java +++ b/src/main/java/tconstruct/tools/TinkerTools.java @@ -897,36 +897,36 @@ public class TinkerTools StencilBuilder.registerBlankStencil(new ItemStack(TinkerTools.blankPattern)); // we register this manually because we want that specific order - StencilBuilder.registerStencil(TinkerTools.woodPattern, 1); // tool rod - StencilBuilder.registerStencil(TinkerTools.woodPattern, 9); // binding - StencilBuilder.registerStencil(TinkerTools.woodPattern, 14); // large tool rod - StencilBuilder.registerStencil(TinkerTools.woodPattern, 15); // large binding + StencilBuilder.registerStencil(0, TinkerTools.woodPattern, 1); // tool rod + StencilBuilder.registerStencil(1, TinkerTools.woodPattern, 9); // binding + StencilBuilder.registerStencil(2, TinkerTools.woodPattern, 14); // large tool rod + StencilBuilder.registerStencil(3, TinkerTools.woodPattern, 15); // large binding - StencilBuilder.registerStencil(TinkerTools.woodPattern, 2); // pickaxe head - StencilBuilder.registerStencil(TinkerTools.woodPattern, 3); // shovel head - StencilBuilder.registerStencil(TinkerTools.woodPattern, 4); // hatchet head - StencilBuilder.registerStencil(TinkerTools.woodPattern, 18); // scythe + StencilBuilder.registerStencil(4, TinkerTools.woodPattern, 2); // pickaxe head + StencilBuilder.registerStencil(5, TinkerTools.woodPattern, 3); // shovel head + StencilBuilder.registerStencil(6, TinkerTools.woodPattern, 4); // hatchet head + StencilBuilder.registerStencil(7, TinkerTools.woodPattern, 18); // scythe - StencilBuilder.registerStencil(TinkerTools.woodPattern, 21); // hammer head - StencilBuilder.registerStencil(TinkerTools.woodPattern, 19); // excavator head - StencilBuilder.registerStencil(TinkerTools.woodPattern, 17); // lumberaxe head - StencilBuilder.registerStencil(TinkerTools.woodPattern, 16); // large plate + StencilBuilder.registerStencil(8, TinkerTools.woodPattern, 21); // hammer head + StencilBuilder.registerStencil(9, TinkerTools.woodPattern, 19); // excavator head + StencilBuilder.registerStencil(10, TinkerTools.woodPattern, 17); // lumberaxe head + StencilBuilder.registerStencil(11, TinkerTools.woodPattern, 16); // large plate - StencilBuilder.registerStencil(TinkerTools.woodPattern, 10); // frying pan - StencilBuilder.registerStencil(TinkerTools.woodPattern, 11); // battlesign - StencilBuilder.registerStencil(TinkerTools.woodPattern, 13); // chisel + StencilBuilder.registerStencil(12, TinkerTools.woodPattern, 10); // frying pan + StencilBuilder.registerStencil(13, TinkerTools.woodPattern, 11); // battlesign + StencilBuilder.registerStencil(14, TinkerTools.woodPattern, 13); // chisel - StencilBuilder.registerStencil(TinkerTools.woodPattern, 12); // knifeblade - StencilBuilder.registerStencil(TinkerTools.woodPattern, 5); // swordblade - StencilBuilder.registerStencil(TinkerTools.woodPattern, 20); // cleaver blade + StencilBuilder.registerStencil(15, TinkerTools.woodPattern, 12); // knifeblade + StencilBuilder.registerStencil(16, TinkerTools.woodPattern, 5); // swordblade + StencilBuilder.registerStencil(17, TinkerTools.woodPattern, 20); // cleaver blade - StencilBuilder.registerStencil(TinkerTools.woodPattern, 8); // crossbar - StencilBuilder.registerStencil(TinkerTools.woodPattern, 7); // small guard - StencilBuilder.registerStencil(TinkerTools.woodPattern, 6); // wide guard + StencilBuilder.registerStencil(18, TinkerTools.woodPattern, 8); // crossbar + StencilBuilder.registerStencil(19, TinkerTools.woodPattern, 7); // small guard + StencilBuilder.registerStencil(20, TinkerTools.woodPattern, 6); // wide guard - StencilBuilder.registerStencil(TinkerTools.woodPattern, 25); // arrow head - StencilBuilder.registerStencil(TinkerTools.woodPattern, 24); // fletchling - StencilBuilder.registerStencil(TinkerTools.woodPattern, 23); // bowstring + StencilBuilder.registerStencil(21, TinkerTools.woodPattern, 25); // arrow head + StencilBuilder.registerStencil(22, TinkerTools.woodPattern, 24); // fletchling + StencilBuilder.registerStencil(23, TinkerTools.woodPattern, 23); // bowstring } public static final class MaterialID diff --git a/src/main/java/tconstruct/tools/ToolProxyClient.java b/src/main/java/tconstruct/tools/ToolProxyClient.java index 06cab492..76701c82 100644 --- a/src/main/java/tconstruct/tools/ToolProxyClient.java +++ b/src/main/java/tconstruct/tools/ToolProxyClient.java @@ -345,16 +345,15 @@ public class ToolProxyClient extends ToolProxyCommon }; int i = 0; - for (ItemStack stack : StencilBuilder.getStencils()) + for (int[] icon : icons) { // spacer - while (icons[i].length == 0) + if(icon.length == 0) { addStencilButton(0, 0, -1); - i++; } - addStencilButton(icons[i][0], icons[i][1], StencilBuilder.getIndex(stack)); - i++; + else + addStencilButton(icon[0], icon[1], i++); } } diff --git a/src/main/java/tconstruct/tools/gui/StencilTableGui.java b/src/main/java/tconstruct/tools/gui/StencilTableGui.java index 31b4384a..ac94c203 100644 --- a/src/main/java/tconstruct/tools/gui/StencilTableGui.java +++ b/src/main/java/tconstruct/tools/gui/StencilTableGui.java @@ -92,7 +92,7 @@ public class StencilTableGui extends GuiContainer ItemStack stack; if (logic.getStackInSlot(1) != null) { - activeButton = StencilBuilder.getIndex(logic.getStackInSlot(1)); + activeButton = StencilBuilder.getId(logic.getStackInSlot(1)); setActiveButton(activeButton); stack = StencilBuilder.getStencil(((GuiButtonStencil) this.buttonList.get(activeButton)).element.stencilIndex); } From ff114eda1bacadcf33bf7bad0851786602c3b543 Mon Sep 17 00:00:00 2001 From: TheVikingWarrior Date: Thu, 23 Oct 2014 22:25:20 +0200 Subject: [PATCH 02/11] Update ToolProxyClient.java --- .../tconstruct/tools/ToolProxyClient.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/tconstruct/tools/ToolProxyClient.java b/src/main/java/tconstruct/tools/ToolProxyClient.java index 76701c82..e1c85fc7 100644 --- a/src/main/java/tconstruct/tools/ToolProxyClient.java +++ b/src/main/java/tconstruct/tools/ToolProxyClient.java @@ -396,34 +396,34 @@ public class ToolProxyClient extends ToolProxyCommon new int[] { 7, 0, 13, 13 }, new int[] { 3, 3, 13, 13 } // Chisel }; - static String[] toolDescriptions = { "gui.toolstation.repair.desc", "gui.toolstation.pickaxe.desc", "The Shovel is a precise digging tool. It is effective on dirt, sand, and snow.\n\nRequired parts:\n- Shovel Head\n- Handle", "The Hatchet is a basic chopping tool. It is effective on wood and leaves.\n\nRequired parts:\n- Axe Head\n- Handle", + static String[] toolDescriptions = { "gui.toolforge2", "gui.toolstation.pickaxe.desc", "gui.toolstation.showel.desc", "toolstation.hatchet.desc", // "The Lumber Axe is a broad chopping tool. It harvests wood in a wide range and can fell entire trees.\n\nRequired parts:\n- Broad Axe Head\n- Handle", // "The Ice Axe is a tool for harvesting ice, mining, and attacking foes.\n\nSpecial Ability:\n- Wall Climb\nNatural Ability:\n- Ice Harvest\nDamage: Moderate\n\nRequired parts:\n- Pickaxe Head\n- Spike\n- Handle", - "The Cutter Mattock is a versatile farming tool. It is effective on wood, dirt, and plants.\n\nSpecial Ability: Hoe\n\nRequired parts:\n- Axe Head\n- Shovel Head\n- Handle", "The Broadsword is a defensive weapon. Blocking cuts damage in half.\n\nSpecial Ability: Block\nDamage: Moderate\nDurability: High\n\nRequired parts:\n- Sword Blade\n- Wide Guard\n- Handle", "The Longsword is an offensive weapon. It is often used for charging into battle at full speed.\n\nNatural Ability:\n- Charge Boost\nSpecial Ability: Lunge\n\nDamage: Moderate\nDurability: Moderate", "The Rapier is a special weapon that relies on quick strikes to defeat foes.\n\nNatural Abilities:\n- Armor Pierce\n- Quick Strike\n- Charge Boost\nSpecial Ability:\n- Backpedal\n\nDamage: Low\nDurability: Low", "The Dagger is a short blade that can be thrown.\n\nSpecial Ability:\n- Throw Item\n\nDamage: Low\nDurability: Moderate\n\nRequired parts:\n- Knife Blade\n- Crossbar\n- Handle", "The Frying is a heavy weapon that uses sheer weight to stun foes.\n\nSpecial Ability: Block\nNatural Ability: Heavy\nShift+rClick: Place Frying Pan\nDamage: Low\nDurability: High\n\nRequired parts:\n- Pan\n- Handle", + "gui.toolstation.mattok.desc", "gui.toolstation.broadsword.desc", "gui.toolstation.longsword.desc", "gui.toolstation.rapier.desc", "gui.toolstation.dagger.desc", "gui.toolstation.fryingpan.desc", // "The Battlesign is an advance in weapon technology worthy of Zombie Pigmen everywhere.\n\nSpecial Ability: Block\nShift-rClick: Place sign\nDamage: Low\nDurability: Average\n\nRequired parts:\n- Board\n- Handle" - "The Battlesign is an advance in weapon technology worthy of Zombie Pigmen everywhere.\n\nSpecial Ability:\nDamage Reflector\n\nNatural Ability: Writable\n\nDamage: Low\nDurability: Average", "The Chisel is a utility tool that carves shapes into blocks.\n\nCrafting Grid:\n- Shape Items\nSpecial Ability: Chisel\nDurability: Average\n\nRequired parts:\n- Chisel Head\n- Handle" }; + "gui.toolstation.battlesign.desc", "" }; void addToolButtons () { // has to be in here so TinkerTools.tool is already initialized - final String[] toolNames = {StatCollector.translateToLocal("gui.toolstation.repair.title"), TinkerTools.pickaxe.getLocalizedToolName(), "Shovel", "Hatchet", + final String[] toolNames = {StatCollector.translateToLocal("gui.toolforge1"), TinkerTools.pickaxe.getLocalizedToolName(), TinkerTools.shovel.getLocalizedToolName(), TinkerTools.hatchet.getLocalizedToolName(), // "Lumber Axe", // "Ice Axe", - "Mattock", "Broadsword", "Longsword", "Rapier", "Dagger", "Frying Pan", "Battlesign", "Chisel" }; + TinkerTools.mattock.getLocalizedToolName(), TinkerTools.broadsword.getLocalizedToolName(), TinkerTools.longsword.getLocalizedToolName(), TinkerTools.rapier.getLocalizedToolName(), TinkerTools.dagger.getLocalizedToolName(), TinkerTools.fryingpan.getLocalizedToolName(), TinkerTools.battlesign.getLocalizedToolName(), TinkerTools.chisel.getLocalizedToolName() }; for (int i = 0; i < toolNames.length; i++) { addToolButton(itemIcons[i][0], itemIcons[i][1], itemIcons[i][2], iconCoords[i * 2], iconCoords[i * 2 + 1], toolNames[i], toolDescriptions[i]); } - addToolButton(3, 9, 1, new int[] { 0, 10, 0, 13 }, new int[] { 3, 3, 3, 13 }, "Shortbow", "The Shortbow is a ranged weapon. It fires arrows quickly and precisely at its foes.\n\nDraw Speed: Quick\n\nRequired parts:\n- Tool Rod\n- Bowstring\n- Tool Rod"); - addToolButton(7, 10, 1, new int[] { 11, 0, 12, 13 }, new int[] { 3, 3, 3, 13 }, "Arrow", "Arrows are projectiles usually fired from bows.\n\nRequired parts:\n- Arrowhead\n- Tool Rod\n- Fletching"); - addTierTwoButton(6, 13, 0, new int[] { 11, 8, 9, 9 }, new int[] { 2, 3, 2, 2 }, "Hammer", "The Hammer is a broad mining tool. It harvests blocks in a wide range and is effective against undead.\n\nNatural Abilities:\nArea of Effect\n- (3x3)\n- Smite\n\nDurability: High"); - addTierTwoButton(5, 11, 0, new int[] { 6, 8, 9, 9 }, new int[] { 2, 3, 2, 3 }, "Lumber Axe", "The Lumber Axe is a broad chopping tool. It can fell entire trees or gather wood in a wide range.\n\nNatural Abilities:\nArea of Effect\n- Fell Trees\n- (3x3x3)\n\nDurability: Average"); - addTierTwoButton(5, 12, 0, new int[] { 10, 8, 9, 9 }, new int[] { 2, 3, 2, 3 }, "Excavator", "The Excavator is a broad digging tool. It harvests soil and snow in a wide range.\n\nNatural Ability:\n- Area of Effect\n- (3x3)\n\nDurability: Average"); - addTierTwoButton(4, 10, 0, new int[] { 8, 8, 9, 8 }, new int[] { 2, 3, 3, 3 }, "Scythe", "The Scythe is a broad reaping tool. It is effective on plants and attacks enemies in a wide range.\n\nNatural Ability:\nArea of Effect\n- (3x3x3)\n\nDurability: Average\nDamage: Low, AoE"); - addTierTwoButton(5, 7, 1, new int[] { 6, 8, 9, 8 }, new int[] { 3, 3, 2, 3 }, "Cleaver", "The Cleaver is a heavy defensive weapon. It has powerful strikes, but is difficult to wield.\n\nSpecial Ability: Block\nNatural Ability:\n- Beheading\n\nDamage: High\nDurability: Average"); - addTierTwoButton(5, 8, 1, new int[] { 6, 8, 6, 9 }, new int[] { 2, 3, 2, 3 }, "Battleaxe", "The Battleaxe is a heavy offensive weapon. It is capable of bringing down small trees and can send foes flying.\n\nSpecial Ability: Block\nNatural Abilities:" + "\n- Knockback\n- Area of Effect\n- (1x9)\n\nDamage: Average\nDurability: Average"); + addToolButton(3, 9, 1, new int[] { 0, 10, 0, 13 }, new int[] { 3, 3, 3, 13 }, TinkerTools.shortbow.getLocalizedToolName(), "gui.toolstation.chisel.desc"); + addToolButton(7, 10, 1, new int[] { 11, 0, 12, 13 }, new int[] { 3, 3, 3, 13 }, TinkerTools.arrow.getLocalizedToolName(), "gui.toolstation.arrow.desc"); + addTierTwoButton(6, 13, 0, new int[] { 11, 8, 9, 9 }, new int[] { 2, 3, 2, 2 }, TinkerTools.hammer.getLocalizedToolName(), "gui.toolstation.hammer.desc"); + addTierTwoButton(5, 11, 0, new int[] { 6, 8, 9, 9 }, new int[] { 2, 3, 2, 3 }, TinkerTools.lumberaxe.getLocalizedToolName(), "gui.toolstation.lumberaxe.desc"); + addTierTwoButton(5, 12, 0, new int[] { 10, 8, 9, 9 }, new int[] { 2, 3, 2, 3 }, TinkerTools.excavator.getLocalizedToolName(), "gui.toolstation.excavator.desc"); + addTierTwoButton(4, 10, 0, new int[] { 8, 8, 9, 8 }, new int[] { 2, 3, 3, 3 }, TinkerTools.scythe.getLocalizedToolName(), "gui.toolstation.scyte.desc"); + addTierTwoButton(5, 7, 1, new int[] { 6, 8, 9, 8 }, new int[] { 3, 3, 2, 3 }, TinkerTools.cleaver.getLocalizedToolName(), "gui.toolstation.cleaver.desc"); + addTierTwoButton(5, 8, 1, new int[] { 6, 8, 6, 9 }, new int[] { 2, 3, 2, 3 }, TinkerTools.battleaxe.getLocalizedToolName(), "gui.toolstation.battleaxe.desc"); } void addToolButton (int slotType, int xButton, int yButton, int[] xIcons, int[] yIcons, String title, String body) From ce9a74b6a69988f659a898dfcec98d7f1cece8bd Mon Sep 17 00:00:00 2001 From: TheVikingWarrior Date: Thu, 23 Oct 2014 22:28:31 +0200 Subject: [PATCH 03/11] Update en_US.lang --- resources/assets/tinker/lang/en_US.lang | 26 ++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/resources/assets/tinker/lang/en_US.lang b/resources/assets/tinker/lang/en_US.lang index f763ad60..89828f22 100644 --- a/resources/assets/tinker/lang/en_US.lang +++ b/resources/assets/tinker/lang/en_US.lang @@ -766,6 +766,27 @@ gui.mining4=Obsidian gui.mining5=Cobalt gui.mining6=Manyullyn +gui.toolstation.pickaxe.desc=The Pickaxe is a precise mining tool. It is effective on stone and ores.\n\nRequired parts:\n- Pickaxe Head\n- Tool Binding\n- Handle +gui.toolstation.showel.desc=The Shovel is a precise digging tool. It is effective on dirt, sand, and snow.\n\nRequired parts:\n- Shovel Head\n- Handle +gui.toolstation.hatchet.desc=The Hatchet is a basic chopping tool. It is effective on wood and leaves.\n\nRequired parts:\n- Axe Head\n- Handle +gui.toolstation.mattok.desc=The Cutter Mattock is a versatile farming tool. It is effective on wood, dirt, and plants.\n\nSpecial Ability: Hoe\n\nRequired parts:\n- Axe Head\n- Shovel Head\n- Handle +gui.toolstation.broadsword.desc=The Broadsword is a defensive weapon. Blocking cuts damage in half.\n\nSpecial Ability: Block\nDamage: Moderate\nDurability: High\n\nRequired parts:\n- Sword Blade\n- Wide Guard\n- Handle +gui.toolstation.longsword.desc=The Longsword is an offensive weapon. It is often used for charging into battle at full speed.\n\nNatural Ability:\n- Charge Boost\nSpecial Ability: Lunge\n\nDamage: Moderate\nDurability: Moderate +gui.toolstation.rapier.desc=The Rapier is a special weapon that relies on quick strikes to defeat foes.\n\nNatural Abilities:\n- Armor Pierce\n- Quick Strike\n- Charge Boost\nSpecial Ability:\n- Backpedal\n\nDamage: Low\nDurability: Low +gui.toolstation.dagger.desc=The Dagger is a short blade that can be thrown.\n\nSpecial Ability:\n- Throw Item\n\nDamage: Low\nDurability: Moderate\n\nRequired parts:\n- Knife Blade\n- Crossbar\n- Handle +gui.toolstation.fryingpan.desc=The Frying Pan is a heavy weapon that uses sheer weight to stun foes.\n\nSpecial Ability: Block\nNatural Ability: Heavy\nShift+rClick: Place Frying Pan\nDamage: Low\nDurability: High\n\nRequired parts:\n- Pan\n- Handle +gui.toolstation.battlesign.desc=The Battlesign is an advance in weapon technology worthy of Zombie Pigmen everywhere.\n\nSpecial Ability:\nDamage Reflector\n\nNatural Ability: Writable\n\nDamage: Low\nDurability: Average +gui.toolstation.chisel.desc=The Chisel is a utility tool that carves shapes into blocks.\n\nCrafting Grid:\n- Shape Items\nSpecial Ability: Chisel\nDurability: Average\n\nRequired parts:\n- Chisel Head\n- Handle +gui.toolstation.shortbow.desc=The Shortbow is a ranged weapon. It fires arrows quickly and precisely at its foes.\n\nDraw Speed: Quick\n\nRequired parts:\n- Tool Rod\n- Bowstring\n- Tool Rod +gui.toolstation.arrow.desc=Arrows are projectiles usually fired from bows.\n\nRequired parts:\n- Arrowhead\n- Tool Rod\n- Fletching +gui.toolstation.hammer.desc=The Hammer is a broad mining tool. It harvests blocks in a wide range and is effective against undead.\n\nNatural Abilities:\nArea of Effect\n- (3x3)\n- Smite\n\nDurability: High +gui.toolstation.lumberaxe.desc=The Lumber Axe is a broad chopping tool. It can fell entire trees or gather wood in a wide range.\n\nNatural Abilities:\nArea of Effect\n- Fell Trees\n- (3x3x3)\n\nDurability: Average +gui.toolstation.excavator.desc=The Excavator is a broad digging tool. It harvests soil and snow in a wide range.\n\nNatural Ability:\n- Area of Effect\n- (3x3)\n\nDurability: Average +gui.toolstation.scyte.desc=The Scythe is a broad reaping tool. It is effective on plants and attacks enemies in a wide range.\n\nNatural Ability:\nArea of Effect\n- (3x3x3)\n\nDurability: Average\nDamage: Low, AoE +gui.toolstation.cleaver.desc=The Cleaver is a heavy defensive weapon. It has powerful strikes, but is difficult to wield.\n\nSpecial Ability: Block\nNatural Ability:\n- Beheading\n\nDamage: High\nDurability: Average +gui.toolstation.battleaxe.desc=The Battleaxe is a heavy offensive weapon. It is capable of bringing down small trees and can send foes flying.\n\nSpecial Ability: Block\nNatural Abilities:" + "\n- Knockback\n- Area of Effect\n- (1x9)\n\nDamage: Average\nDurability: Average + + material.wood=Wood material.wood.display=Wooden material.stone=Stone @@ -863,8 +884,3 @@ tool.arrow=Arrow tool.kingslimeprefix=King Slime # Specific localization like materials #tool.shovel.kingslime=Regret - - -gui.toolstation.repair.title=Repair and Modification -gui.toolstation.repair.desc=The main way to repair or change your tools. Place a tool and a material on the left to get started. -gui.toolstation.pickaxe.desc=The Pickaxe is a precise mining tool. It is effective on stone and ores.\n\nRequired parts:\n- Pickaxe Head\n- Tool Binding\n- Handle From edf30d3a5ce0129381afb27d6b8e5b92d28c67f2 Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Fri, 24 Oct 2014 11:20:28 +0200 Subject: [PATCH 04/11] Flux modified tools now charge properly with the charge rate if CoFHCore is present. WITHOUT breaking blockbreak process. This also fixes moss-repair resetting. --- .../cofh/core/item/IEqualityOverrideItem.java | 9 +++++ .../library/tools/AbilityHelper.java | 14 +++++--- .../tconstruct/library/tools/ToolCore.java | 33 +++++++++++++++++-- 3 files changed, 49 insertions(+), 7 deletions(-) create mode 100644 src/api/java/cofh/core/item/IEqualityOverrideItem.java diff --git a/src/api/java/cofh/core/item/IEqualityOverrideItem.java b/src/api/java/cofh/core/item/IEqualityOverrideItem.java new file mode 100644 index 00000000..c2dc3ac9 --- /dev/null +++ b/src/api/java/cofh/core/item/IEqualityOverrideItem.java @@ -0,0 +1,9 @@ +package cofh.core.item; + +import net.minecraft.item.ItemStack; + +public interface IEqualityOverrideItem { + + public boolean isLastHeldItemEqual(ItemStack current, ItemStack previous); + +} \ No newline at end of file diff --git a/src/main/java/tconstruct/library/tools/AbilityHelper.java b/src/main/java/tconstruct/library/tools/AbilityHelper.java index dc4f7b4e..a33fade3 100644 --- a/src/main/java/tconstruct/library/tools/AbilityHelper.java +++ b/src/main/java/tconstruct/library/tools/AbilityHelper.java @@ -1,6 +1,7 @@ package tconstruct.library.tools; import cofh.api.energy.IEnergyContainerItem; +import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.eventhandler.Event.Result; import java.util.*; import net.minecraft.block.Block; @@ -406,23 +407,24 @@ public class AbilityHelper trueSpeed *= 6; if (energy != -1) { - ToolCore tool = (ToolCore) stack.getItem(); - // first try charging from the hotbar - if (entity instanceof EntityPlayer) + int usage = (int)(trueSpeed * 3.3f); + // first try charging from the hotbar if we don't have CoFHs override + if (equalityOverrideLoaded && entity instanceof EntityPlayer) { + ToolCore tool = (ToolCore) stack.getItem(); // workaround for charging flux-capacitors making tools unusable chargeEnergyFromHotbar(stack, (EntityPlayer) entity, tags); energy = tool.getEnergyStored(stack); } - if (energy < trueSpeed * 2) + if (energy < usage) { if (energy > 0) tags.setInteger("Energy", 0); return false; } - energy -= trueSpeed * 2; + energy -= usage*50; tags.setInteger("Energy", energy); //stack.setItemDamage(1 + (tool.getMaxEnergyStored(stack) - energy) * (stack.getMaxDamage() - 1) / tool.getMaxEnergyStored(stack)); @@ -475,6 +477,8 @@ public class AbilityHelper tags.setInteger("Energy", max - missing); } + private static boolean equalityOverrideLoaded = Loader.isModLoaded("CoFHCore"); // Mods should be loaded far enough before this is ever initialized + public static void breakTool (ItemStack stack, NBTTagCompound tags, Entity entity) { tags.getCompoundTag("InfiTool").setBoolean("Broken", true); diff --git a/src/main/java/tconstruct/library/tools/ToolCore.java b/src/main/java/tconstruct/library/tools/ToolCore.java index 97fb419d..61c42a4c 100644 --- a/src/main/java/tconstruct/library/tools/ToolCore.java +++ b/src/main/java/tconstruct/library/tools/ToolCore.java @@ -1,6 +1,7 @@ package tconstruct.library.tools; import cofh.api.energy.IEnergyContainerItem; +import cofh.core.item.IEqualityOverrideItem; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.*; import java.util.*; @@ -47,8 +48,11 @@ import tconstruct.util.config.PHConstruct; * @see ItemModifier */ -@Optional.Interface(modid = "CoFHLib", iface = "cofh.api.energy.IEnergyContainerItem") -public abstract class ToolCore extends Item implements IEnergyContainerItem, IModifyable +@Optional.InterfaceList({ + @Optional.Interface(modid = "CoFHLib", iface = "cofh.api.energy.IEnergyContainerItem"), + @Optional.Interface(modid = "CoFHCore", iface = "cofh.core.item.IEqualityOverrideItem") +}) +public abstract class ToolCore extends Item implements IEnergyContainerItem, IEqualityOverrideItem, IModifyable { protected Random random = new Random(); protected int damageVsEntity; @@ -923,5 +927,30 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem, IMo // backup return capacity; } + + @Override + @Optional.Method(modid = "CoFHCore") + public boolean isLastHeldItemEqual(ItemStack current, ItemStack previous) { + if(!current.hasTagCompound() || !previous.hasTagCompound()) + return false; + + NBTTagCompound curTags = current.getTagCompound(); + NBTTagCompound prevTags = previous.getTagCompound(); + if(curTags == prevTags) + return true; + if(!curTags.hasKey("InfiTool") || !prevTags.hasKey("InfiTool")) + return false; + + // create copies so we don't modify the original + curTags = (NBTTagCompound) curTags.copy(); + prevTags = (NBTTagCompound) prevTags.copy(); + + curTags.removeTag("Energy"); + prevTags.removeTag("Energy"); + curTags.getCompoundTag("InfiTool").removeTag("Damage"); + prevTags.getCompoundTag("InfiTool").removeTag("Damage"); + + return curTags.equals(prevTags); + } // end of TE support section } From 54590e82b05c0b8b2ddf49124a88e2ebcbc16a77 Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Fri, 24 Oct 2014 11:21:13 +0200 Subject: [PATCH 05/11] Fix a bug in vikings PR? --- src/main/java/tconstruct/tools/ToolProxyClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/tconstruct/tools/ToolProxyClient.java b/src/main/java/tconstruct/tools/ToolProxyClient.java index e1c85fc7..94249f78 100644 --- a/src/main/java/tconstruct/tools/ToolProxyClient.java +++ b/src/main/java/tconstruct/tools/ToolProxyClient.java @@ -409,7 +409,7 @@ public class ToolProxyClient extends ToolProxyCommon final String[] toolNames = {StatCollector.translateToLocal("gui.toolforge1"), TinkerTools.pickaxe.getLocalizedToolName(), TinkerTools.shovel.getLocalizedToolName(), TinkerTools.hatchet.getLocalizedToolName(), // "Lumber Axe", // "Ice Axe", - TinkerTools.mattock.getLocalizedToolName(), TinkerTools.broadsword.getLocalizedToolName(), TinkerTools.longsword.getLocalizedToolName(), TinkerTools.rapier.getLocalizedToolName(), TinkerTools.dagger.getLocalizedToolName(), TinkerTools.fryingpan.getLocalizedToolName(), TinkerTools.battlesign.getLocalizedToolName(), TinkerTools.chisel.getLocalizedToolName() }; + TinkerTools.mattock.getLocalizedToolName(), TinkerTools.broadsword.getLocalizedToolName(), TinkerTools.longsword.getLocalizedToolName(), TinkerTools.rapier.getLocalizedToolName(), TinkerTools.dagger.getLocalizedToolName(), TinkerTools.frypan.getLocalizedToolName(), TinkerTools.battlesign.getLocalizedToolName(), TinkerTools.chisel.getLocalizedToolName() }; for (int i = 0; i < toolNames.length; i++) { From 2aa42a5b8a4dc8667f4e9338e0da681fb480108f Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Fri, 24 Oct 2014 11:37:03 +0200 Subject: [PATCH 06/11] Debugstuff :I --- src/main/java/tconstruct/library/tools/AbilityHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/tconstruct/library/tools/AbilityHelper.java b/src/main/java/tconstruct/library/tools/AbilityHelper.java index a33fade3..3887a1ca 100644 --- a/src/main/java/tconstruct/library/tools/AbilityHelper.java +++ b/src/main/java/tconstruct/library/tools/AbilityHelper.java @@ -424,7 +424,7 @@ public class AbilityHelper return false; } - energy -= usage*50; + energy -= usage; tags.setInteger("Energy", energy); //stack.setItemDamage(1 + (tool.getMaxEnergyStored(stack) - energy) * (stack.getMaxDamage() - 1) / tool.getMaxEnergyStored(stack)); From f734169ad6c6895c38cdbfef5640f160e64bb8de Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Fri, 24 Oct 2014 11:52:19 +0200 Subject: [PATCH 07/11] Flux modifier now requires the tool to have at least charge/1000 durability for the battery to be applicable. --- src/main/java/tconstruct/modifiers/tools/ModFlux.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/tconstruct/modifiers/tools/ModFlux.java b/src/main/java/tconstruct/modifiers/tools/ModFlux.java index 3be1d427..0dff3c1e 100644 --- a/src/main/java/tconstruct/modifiers/tools/ModFlux.java +++ b/src/main/java/tconstruct/modifiers/tools/ModFlux.java @@ -46,6 +46,12 @@ public class ModFlux extends ModBoolean if (foundBattery == null) return false; + int maxEnergy = ((IEnergyContainerItem) foundBattery.getItem()).getMaxEnergyStored(foundBattery); + + // battery too big for our tool? + if(tags.getInteger("TotalDurability") < maxEnergy/1000) // durability needs to be at least 1/1000th of the charge + return false; + // check if we already have a flux modifier if (tags.getBoolean(key)) { From 57c3158ef4c76bc078a1af3b6cb5b0c3634049bf Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Fri, 24 Oct 2014 11:52:39 +0200 Subject: [PATCH 08/11] Reduce increased flux cost per block mined, and fix a derp with the charging. --- src/main/java/tconstruct/library/tools/AbilityHelper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/tconstruct/library/tools/AbilityHelper.java b/src/main/java/tconstruct/library/tools/AbilityHelper.java index 3887a1ca..e0225cf8 100644 --- a/src/main/java/tconstruct/library/tools/AbilityHelper.java +++ b/src/main/java/tconstruct/library/tools/AbilityHelper.java @@ -407,9 +407,9 @@ public class AbilityHelper trueSpeed *= 6; if (energy != -1) { - int usage = (int)(trueSpeed * 3.3f); + int usage = (int)(trueSpeed * 2.8f); // first try charging from the hotbar if we don't have CoFHs override - if (equalityOverrideLoaded && entity instanceof EntityPlayer) + if (!equalityOverrideLoaded && entity instanceof EntityPlayer) { ToolCore tool = (ToolCore) stack.getItem(); // workaround for charging flux-capacitors making tools unusable From 1a486bb38e640a710a8178fabdac24809e9e6266 Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Fri, 24 Oct 2014 12:03:50 +0200 Subject: [PATCH 09/11] Fix localization not working in ToolForge --- src/main/java/tconstruct/tools/gui/ToolForgeGui.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/tconstruct/tools/gui/ToolForgeGui.java b/src/main/java/tconstruct/tools/gui/ToolForgeGui.java index 8229f140..0891860b 100644 --- a/src/main/java/tconstruct/tools/gui/ToolForgeGui.java +++ b/src/main/java/tconstruct/tools/gui/ToolForgeGui.java @@ -57,7 +57,15 @@ public class ToolForgeGui extends ToolStationGui iconX = b.element.iconsX; iconY = b.element.iconsY; title = "\u00A7n" + b.element.title; - body = b.element.body; + body = StatCollector.translateToLocal(b.element.body); + if(body != null) { + int i; + // for some really weird reason replaceAll doesn't find "\\n", but indexOf does. We have to replace manually. + while((i = body.indexOf("\\n")) >= 0) + { + body = body.substring(0, i) + '\n' + body.substring(i+2); + } + } } @Override From 8630e5e7015769b41ac15415b34f75af5fa1b9dd Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Fri, 24 Oct 2014 12:04:13 +0200 Subject: [PATCH 10/11] Fix toolstation localization pr --- resources/assets/tinker/lang/en_US.lang | 2 +- src/main/java/tconstruct/tools/ToolProxyClient.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/assets/tinker/lang/en_US.lang b/resources/assets/tinker/lang/en_US.lang index 89828f22..bcfc1287 100644 --- a/resources/assets/tinker/lang/en_US.lang +++ b/resources/assets/tinker/lang/en_US.lang @@ -769,7 +769,7 @@ gui.mining6=Manyullyn gui.toolstation.pickaxe.desc=The Pickaxe is a precise mining tool. It is effective on stone and ores.\n\nRequired parts:\n- Pickaxe Head\n- Tool Binding\n- Handle gui.toolstation.showel.desc=The Shovel is a precise digging tool. It is effective on dirt, sand, and snow.\n\nRequired parts:\n- Shovel Head\n- Handle gui.toolstation.hatchet.desc=The Hatchet is a basic chopping tool. It is effective on wood and leaves.\n\nRequired parts:\n- Axe Head\n- Handle -gui.toolstation.mattok.desc=The Cutter Mattock is a versatile farming tool. It is effective on wood, dirt, and plants.\n\nSpecial Ability: Hoe\n\nRequired parts:\n- Axe Head\n- Shovel Head\n- Handle +gui.toolstation.mattock.desc=The Cutter Mattock is a versatile farming tool. It is effective on wood, dirt, and plants.\n\nSpecial Ability: Hoe\n\nRequired parts:\n- Axe Head\n- Shovel Head\n- Handle gui.toolstation.broadsword.desc=The Broadsword is a defensive weapon. Blocking cuts damage in half.\n\nSpecial Ability: Block\nDamage: Moderate\nDurability: High\n\nRequired parts:\n- Sword Blade\n- Wide Guard\n- Handle gui.toolstation.longsword.desc=The Longsword is an offensive weapon. It is often used for charging into battle at full speed.\n\nNatural Ability:\n- Charge Boost\nSpecial Ability: Lunge\n\nDamage: Moderate\nDurability: Moderate gui.toolstation.rapier.desc=The Rapier is a special weapon that relies on quick strikes to defeat foes.\n\nNatural Abilities:\n- Armor Pierce\n- Quick Strike\n- Charge Boost\nSpecial Ability:\n- Backpedal\n\nDamage: Low\nDurability: Low diff --git a/src/main/java/tconstruct/tools/ToolProxyClient.java b/src/main/java/tconstruct/tools/ToolProxyClient.java index 94249f78..4322bf01 100644 --- a/src/main/java/tconstruct/tools/ToolProxyClient.java +++ b/src/main/java/tconstruct/tools/ToolProxyClient.java @@ -396,12 +396,12 @@ public class ToolProxyClient extends ToolProxyCommon new int[] { 7, 0, 13, 13 }, new int[] { 3, 3, 13, 13 } // Chisel }; - static String[] toolDescriptions = { "gui.toolforge2", "gui.toolstation.pickaxe.desc", "gui.toolstation.showel.desc", "toolstation.hatchet.desc", + static String[] toolDescriptions = { "gui.toolforge2", "gui.toolstation.pickaxe.desc", "gui.toolstation.showel.desc", "gui.toolstation.hatchet.desc", // "The Lumber Axe is a broad chopping tool. It harvests wood in a wide range and can fell entire trees.\n\nRequired parts:\n- Broad Axe Head\n- Handle", // "The Ice Axe is a tool for harvesting ice, mining, and attacking foes.\n\nSpecial Ability:\n- Wall Climb\nNatural Ability:\n- Ice Harvest\nDamage: Moderate\n\nRequired parts:\n- Pickaxe Head\n- Spike\n- Handle", - "gui.toolstation.mattok.desc", "gui.toolstation.broadsword.desc", "gui.toolstation.longsword.desc", "gui.toolstation.rapier.desc", "gui.toolstation.dagger.desc", "gui.toolstation.fryingpan.desc", + "gui.toolstation.mattock.desc", "gui.toolstation.broadsword.desc", "gui.toolstation.longsword.desc", "gui.toolstation.rapier.desc", "gui.toolstation.dagger.desc", "gui.toolstation.fryingpan.desc", // "The Battlesign is an advance in weapon technology worthy of Zombie Pigmen everywhere.\n\nSpecial Ability: Block\nShift-rClick: Place sign\nDamage: Low\nDurability: Average\n\nRequired parts:\n- Board\n- Handle" - "gui.toolstation.battlesign.desc", "" }; + "gui.toolstation.battlesign.desc", "gui.toolstation.chisel.desc" }; void addToolButtons () { From 2e9e347255ea5e565c3d62bb62329a940dadb5cd Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Fri, 24 Oct 2014 12:36:40 +0200 Subject: [PATCH 11/11] Fix some typos in the toolstation localization strings and simplify the whole localization stuff in code. --- resources/assets/tinker/lang/en_US.lang | 4 +- .../tconstruct/tools/ToolProxyClient.java | 72 +++++++++++-------- 2 files changed, 43 insertions(+), 33 deletions(-) diff --git a/resources/assets/tinker/lang/en_US.lang b/resources/assets/tinker/lang/en_US.lang index bcfc1287..0a0d76f9 100644 --- a/resources/assets/tinker/lang/en_US.lang +++ b/resources/assets/tinker/lang/en_US.lang @@ -767,7 +767,7 @@ gui.mining5=Cobalt gui.mining6=Manyullyn gui.toolstation.pickaxe.desc=The Pickaxe is a precise mining tool. It is effective on stone and ores.\n\nRequired parts:\n- Pickaxe Head\n- Tool Binding\n- Handle -gui.toolstation.showel.desc=The Shovel is a precise digging tool. It is effective on dirt, sand, and snow.\n\nRequired parts:\n- Shovel Head\n- Handle +gui.toolstation.shovel.desc=The Shovel is a precise digging tool. It is effective on dirt, sand, and snow.\n\nRequired parts:\n- Shovel Head\n- Handle gui.toolstation.hatchet.desc=The Hatchet is a basic chopping tool. It is effective on wood and leaves.\n\nRequired parts:\n- Axe Head\n- Handle gui.toolstation.mattock.desc=The Cutter Mattock is a versatile farming tool. It is effective on wood, dirt, and plants.\n\nSpecial Ability: Hoe\n\nRequired parts:\n- Axe Head\n- Shovel Head\n- Handle gui.toolstation.broadsword.desc=The Broadsword is a defensive weapon. Blocking cuts damage in half.\n\nSpecial Ability: Block\nDamage: Moderate\nDurability: High\n\nRequired parts:\n- Sword Blade\n- Wide Guard\n- Handle @@ -782,7 +782,7 @@ gui.toolstation.arrow.desc=Arrows are projectiles usually fired from bows.\n\nRe gui.toolstation.hammer.desc=The Hammer is a broad mining tool. It harvests blocks in a wide range and is effective against undead.\n\nNatural Abilities:\nArea of Effect\n- (3x3)\n- Smite\n\nDurability: High gui.toolstation.lumberaxe.desc=The Lumber Axe is a broad chopping tool. It can fell entire trees or gather wood in a wide range.\n\nNatural Abilities:\nArea of Effect\n- Fell Trees\n- (3x3x3)\n\nDurability: Average gui.toolstation.excavator.desc=The Excavator is a broad digging tool. It harvests soil and snow in a wide range.\n\nNatural Ability:\n- Area of Effect\n- (3x3)\n\nDurability: Average -gui.toolstation.scyte.desc=The Scythe is a broad reaping tool. It is effective on plants and attacks enemies in a wide range.\n\nNatural Ability:\nArea of Effect\n- (3x3x3)\n\nDurability: Average\nDamage: Low, AoE +gui.toolstation.scythe.desc=The Scythe is a broad reaping tool. It is effective on plants and attacks enemies in a wide range.\n\nNatural Ability:\nArea of Effect\n- (3x3x3)\n\nDurability: Average\nDamage: Low, AoE gui.toolstation.cleaver.desc=The Cleaver is a heavy defensive weapon. It has powerful strikes, but is difficult to wield.\n\nSpecial Ability: Block\nNatural Ability:\n- Beheading\n\nDamage: High\nDurability: Average gui.toolstation.battleaxe.desc=The Battleaxe is a heavy offensive weapon. It is capable of bringing down small trees and can send foes flying.\n\nSpecial Ability: Block\nNatural Abilities:" + "\n- Knockback\n- Area of Effect\n- (1x9)\n\nDamage: Average\nDurability: Average diff --git a/src/main/java/tconstruct/tools/ToolProxyClient.java b/src/main/java/tconstruct/tools/ToolProxyClient.java index 4322bf01..76a722cf 100644 --- a/src/main/java/tconstruct/tools/ToolProxyClient.java +++ b/src/main/java/tconstruct/tools/ToolProxyClient.java @@ -28,6 +28,8 @@ import tconstruct.tools.gui.*; import tconstruct.tools.logic.*; import tconstruct.tools.model.*; +import static tconstruct.tools.TinkerTools.*; + public class ToolProxyClient extends ToolProxyCommon { @Override @@ -362,12 +364,10 @@ public class ToolProxyClient extends ToolProxyCommon TConstructClientRegistry.addStencilButton(xButton, yButton, index, "tinker", "textures/gui/icons.png"); } - static int[][] itemIcons = { new int[] { 0, 3, 0 }, // Repair + static int[][] itemIconsT1 = { new int[] { 1, 4, 0 }, // Pickaxe new int[] { 2, 5, 0 }, // Shovel - new int[] { 2, 6, 0 }, // Axe - // new int[] {2, 9, 0}, //Lumber Axe - // new int[] {1, 7, 0}, //Ice Axe + new int[] { 2, 6, 0 }, // Hatchet new int[] { 3, 8, 0 }, // Mattock new int[] { 1, 0, 1 }, // Broadsword new int[] { 1, 1, 1 }, // Longsword @@ -375,55 +375,65 @@ public class ToolProxyClient extends ToolProxyCommon new int[] { 1, 5, 1 }, // Dagger new int[] { 2, 3, 1 }, // Frying pan new int[] { 2, 4, 1 }, // Battlesign - new int[] { 2, 6, 1 } // Chisel + new int[] { 2, 6, 1 } // Chisel }; - static int[][] iconCoords = { new int[] { 0, 1, 2, 13 }, new int[] { 13, 13, 13, 13 }, // Repair + static int[][] iconCoordsT1 = { new int[] { 0, 0, 1, 13 }, new int[] { 2, 3, 3, 13 }, // Pickaxe new int[] { 3, 0, 13, 13 }, new int[] { 2, 3, 13, 13 }, // Shovel - new int[] { 2, 0, 13, 13 }, new int[] { 2, 3, 13, 13 }, // Axe - // new int[] { 6, 0, 13, 13 }, new int[] { 2, 3, 13, 13 }, //Lumber - // Axe - // new int[] { 0, 0, 5, 13 }, new int[] { 2, 3, 3, 13 }, //Ice Axe + new int[] { 2, 0, 13, 13 }, new int[] { 2, 3, 13, 13 }, // Hatchet new int[] { 2, 0, 3, 13 }, new int[] { 2, 3, 2, 13 }, // Mattock new int[] { 1, 0, 2, 13 }, new int[] { 2, 3, 3, 13 }, // Broadsword new int[] { 1, 0, 3, 13 }, new int[] { 2, 3, 3, 13 }, // Longsword new int[] { 1, 0, 4, 13 }, new int[] { 2, 3, 3, 13 }, // Rapier new int[] { 7, 0, 4, 13 }, new int[] { 2, 3, 3, 13 }, // Dagger - new int[] { 4, 0, 13, 13 }, new int[] { 2, 3, 13, 13 }, // Frying - // Pan + new int[] { 4, 0, 13, 13 }, new int[] { 2, 3, 13, 13 }, // Frying Pan new int[] { 5, 0, 13, 13 }, new int[] { 2, 3, 13, 13 }, // Battlesign new int[] { 7, 0, 13, 13 }, new int[] { 3, 3, 13, 13 } // Chisel }; - static String[] toolDescriptions = { "gui.toolforge2", "gui.toolstation.pickaxe.desc", "gui.toolstation.showel.desc", "gui.toolstation.hatchet.desc", - // "The Lumber Axe is a broad chopping tool. It harvests wood in a wide range and can fell entire trees.\n\nRequired parts:\n- Broad Axe Head\n- Handle", - // "The Ice Axe is a tool for harvesting ice, mining, and attacking foes.\n\nSpecial Ability:\n- Wall Climb\nNatural Ability:\n- Ice Harvest\nDamage: Moderate\n\nRequired parts:\n- Pickaxe Head\n- Spike\n- Handle", - "gui.toolstation.mattock.desc", "gui.toolstation.broadsword.desc", "gui.toolstation.longsword.desc", "gui.toolstation.rapier.desc", "gui.toolstation.dagger.desc", "gui.toolstation.fryingpan.desc", - // "The Battlesign is an advance in weapon technology worthy of Zombie Pigmen everywhere.\n\nSpecial Ability: Block\nShift-rClick: Place sign\nDamage: Low\nDurability: Average\n\nRequired parts:\n- Board\n- Handle" - "gui.toolstation.battlesign.desc", "gui.toolstation.chisel.desc" }; + static int[][] itemIconsT2 = { + new int[] { 6, 13, 0, }, // Hammer + new int[] { 5, 11, 0, }, // Lumberaxe + new int[] { 5, 12, 0, }, // Excavator + new int[] { 4, 10, 0, }, // Scythe + new int[] { 5, 7, 1, }, // Cleaver + new int[] { 5, 8, 1, }, // Battleaxe + }; + + static int[][] iconCoordsT2 = { + new int[] { 11, 8, 9, 9 }, new int[] { 2, 3, 2, 2 }, // Hammer + new int[] { 6, 8, 9, 9 }, new int[] { 2, 3, 2, 3 }, // Lumberaxe + new int[] { 10, 8, 9, 9 }, new int[] { 2, 3, 2, 3 }, // Excavator + new int[] { 8, 8, 9, 8 }, new int[] { 2, 3, 3, 3 }, // Scythe + new int[] { 6, 8, 9, 8 }, new int[] { 3, 3, 2, 3 }, // Cleaver + new int[] { 6, 8, 6, 9 }, new int[] { 2, 3, 2, 3 }, // Battleaxe + }; void addToolButtons () { - // has to be in here so TinkerTools.tool is already initialized - final String[] toolNames = {StatCollector.translateToLocal("gui.toolforge1"), TinkerTools.pickaxe.getLocalizedToolName(), TinkerTools.shovel.getLocalizedToolName(), TinkerTools.hatchet.getLocalizedToolName(), - // "Lumber Axe", - // "Ice Axe", - TinkerTools.mattock.getLocalizedToolName(), TinkerTools.broadsword.getLocalizedToolName(), TinkerTools.longsword.getLocalizedToolName(), TinkerTools.rapier.getLocalizedToolName(), TinkerTools.dagger.getLocalizedToolName(), TinkerTools.frypan.getLocalizedToolName(), TinkerTools.battlesign.getLocalizedToolName(), TinkerTools.chisel.getLocalizedToolName() }; + final ToolCore[] tier1Tools = {pickaxe, shovel, hatchet, mattock, broadsword, longsword, rapier, dagger, frypan, battlesign, chisel}; + final ToolCore[] tier2Tools = {hammer, lumberaxe, excavator, scythe, cleaver, battleaxe}; - for (int i = 0; i < toolNames.length; i++) + // repair + addToolButton(0, 3, 0, new int[] { 0, 1, 2, 13 }, new int[] { 13, 13, 13, 13 }, "gui.toolforge1", "gui.toolforge2"); + + // tier 1 tools + for (int i = 0; i < tier1Tools.length; i++) { - addToolButton(itemIcons[i][0], itemIcons[i][1], itemIcons[i][2], iconCoords[i * 2], iconCoords[i * 2 + 1], toolNames[i], toolDescriptions[i]); + String locString = String.format("gui.toolstation.%s.desc", tier1Tools[i].getToolName().toLowerCase()); + addToolButton(itemIconsT1[i][0], itemIconsT1[i][1], itemIconsT1[i][2], iconCoordsT1[i * 2], iconCoordsT1[i * 2 + 1], tier1Tools[i].getLocalizedToolName(), locString); } addToolButton(3, 9, 1, new int[] { 0, 10, 0, 13 }, new int[] { 3, 3, 3, 13 }, TinkerTools.shortbow.getLocalizedToolName(), "gui.toolstation.chisel.desc"); addToolButton(7, 10, 1, new int[] { 11, 0, 12, 13 }, new int[] { 3, 3, 3, 13 }, TinkerTools.arrow.getLocalizedToolName(), "gui.toolstation.arrow.desc"); - addTierTwoButton(6, 13, 0, new int[] { 11, 8, 9, 9 }, new int[] { 2, 3, 2, 2 }, TinkerTools.hammer.getLocalizedToolName(), "gui.toolstation.hammer.desc"); - addTierTwoButton(5, 11, 0, new int[] { 6, 8, 9, 9 }, new int[] { 2, 3, 2, 3 }, TinkerTools.lumberaxe.getLocalizedToolName(), "gui.toolstation.lumberaxe.desc"); - addTierTwoButton(5, 12, 0, new int[] { 10, 8, 9, 9 }, new int[] { 2, 3, 2, 3 }, TinkerTools.excavator.getLocalizedToolName(), "gui.toolstation.excavator.desc"); - addTierTwoButton(4, 10, 0, new int[] { 8, 8, 9, 8 }, new int[] { 2, 3, 3, 3 }, TinkerTools.scythe.getLocalizedToolName(), "gui.toolstation.scyte.desc"); - addTierTwoButton(5, 7, 1, new int[] { 6, 8, 9, 8 }, new int[] { 3, 3, 2, 3 }, TinkerTools.cleaver.getLocalizedToolName(), "gui.toolstation.cleaver.desc"); - addTierTwoButton(5, 8, 1, new int[] { 6, 8, 6, 9 }, new int[] { 2, 3, 2, 3 }, TinkerTools.battleaxe.getLocalizedToolName(), "gui.toolstation.battleaxe.desc"); + + // tier 2 tools + for (int i = 0; i < tier2Tools.length; i++) + { + String locString = String.format("gui.toolstation.%s.desc", tier2Tools[i].getToolName().toLowerCase()); + addTierTwoButton(itemIconsT2[i][0], itemIconsT2[i][1], itemIconsT2[i][2], iconCoordsT2[i * 2], iconCoordsT2[i * 2 + 1], tier2Tools[i].getLocalizedToolName(), locString); + } } void addToolButton (int slotType, int xButton, int yButton, int[] xIcons, int[] yIcons, String title, String body)