From 6cd7b497e85eab2095086a137e3bb2760c802cbd Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Wed, 29 Oct 2014 22:33:00 +0100 Subject: [PATCH] Weaponry booooooook --- resources/assets/tinker/lang/en_US.lang | 1 + .../assets/tinker/manuals/en_US/weaponry.xml | 44 ++++++-- .../java/tconstruct/client/TProxyClient.java | 106 +++++++----------- .../tconstruct/tools/ToolProxyClient.java | 4 +- .../java/tconstruct/tools/items/Manual.java | 6 +- .../tconstruct/tools/items/ManualInfo.java | 3 +- .../weaponry/WeaponryClientProxy.java | 15 +++ 7 files changed, 94 insertions(+), 85 deletions(-) diff --git a/resources/assets/tinker/lang/en_US.lang b/resources/assets/tinker/lang/en_US.lang index 81edf5ef672..e781e737072 100644 --- a/resources/assets/tinker/lang/en_US.lang +++ b/resources/assets/tinker/lang/en_US.lang @@ -431,6 +431,7 @@ item.tconstruct.manual.beginner.name=Materials and You: Volume 1 item.tconstruct.manual.toolstation.name=Materials and You: Volume 2 item.tconstruct.manual.smeltery.name=Mighty Smelting item.tconstruct.manual.diary.name=Diary of a Tinker +item.tconstruct.manual.weaponry.name=Tinkers' Weaponry item.tconstruct.bucket.Iron.name=Molten Iron Bucket item.tconstruct.bucket.Gold.name=Molten Gold Bucket diff --git a/resources/assets/tinker/manuals/en_US/weaponry.xml b/resources/assets/tinker/manuals/en_US/weaponry.xml index cabe601c817..e030b51258d 100644 --- a/resources/assets/tinker/manuals/en_US/weaponry.xml +++ b/resources/assets/tinker/manuals/en_US/weaponry.xml @@ -12,23 +12,23 @@ By Sheriff Bownana Table of Contents Introduction - smelterybook + weaponrybook 3 Throwing Weapons - castingtable + throwingknifeIcon 5 Projectile Weapons - smeltery - 5 + shortbowIcon + 7 Projectiles - liquidiron - 9 + arrowIcon + 10 @@ -67,7 +67,11 @@ Throwing knifes stack up to a moderate amount, and deal moderate damage. Shuriken: Small delicate projectiles put together from 4 parts, that are thrown from the wrist. Because of this you don't need to take aim and can throw them directly. -Since they're so small you can carry many of them, however they don't deal much damage. +Since they're so small you can carry many of them, however they don't deal much damage. + + + + Javelin: This is a hybrid between a melee and a ranged weapon, consisting of an arrow head on two tough tool rods. It deals moderate damage as a melee weapon, but to unleash its true potential you have to throw it at your enemy. @@ -80,12 +84,20 @@ The throwing has a small windup. Because of their size you can only carry a few, Shortbow: Put together from two bow limbs and a bowstring, this weapon is a fast and handy bow. Keep in mind that inflexible materials like stone can hardly be drawn back and can't accelerate projectiles well. Organic materials are favoured for quick bows, while metals require lots of strengt to draw back, but provide more power. The bow requires arrows as ammo. -Offensive modifiers on bows do not count for arrows. The only modifiers affecting its ranged performance are Redstone and lapis. +Offensive modifiers on bows do not count for arrows. The only modifiers affecting its ranged performance are Redstone and lapis. + + + + Longbow: The big brother. This bow is much bigger, requiring more time to pull it back, but boy oh boy are those arrows fast. Because of this the longbow performs slightly better against armored targets. Furthermore this makes the longbow less accurate with very light arrows. -The longbow is constructed from two bow limbs, a bowstring and a large plate. +The longbow is constructed from two bow limbs, a bowstring and a large plate. + + + + Crossbow: Those pesky metals are such a pain to pull back. Luckily a tinkerer knows how to help himself! The crossbow allows you to pre-load it with a bolt, and have it ready instantly to fire. Since this allows for much more power, it can shoot heavier projectiles, resulting in more damage and armor penetration. @@ -99,7 +111,11 @@ For these projectiles goes: The heavier the projectile, the more damage carries Arrows: The bread and butter of every ranger. Arrows can be built from many different materials. It needs an arrow head, a shaft and a fletching. The choice of materials allows a balance between damage, arrow-count, accuracy and fragility. The head material is crucial for its weight. -A fragile arrow has a chance to break on impact with terrain. Arrows always break when they hit a target, however the reinforced trait gives a chance for the arrow to survive the impact. +A fragile arrow has a chance to break on impact with terrain. Arrows always break when they hit a target, however the reinforced trait gives a chance for the arrow to survive the impact. + + + + Valid Shaft Materials: * Stick @@ -111,14 +127,18 @@ Valid Fletching Materials: * Leaves * Slimeleaves * Feathers -* Slime +* Slime + + + + Bolts: Crafting bolts is a delicate process. First you need a core in the form of a tool rod. Take this tool rod to a smeltery and put it into a Casting Table. Pour some metal onto it to coat the tip with a more damaging material. After this process, add a fletching and your bolts are ready to be used. -Since the bolts consist of a harder core and tip they carry more weight than regular arrows, making them perfect to fight armored targets. +Since the bolts consist of a harder core and tip they carry more weight than regular arrows, making them perfect to fight armored targets. \ No newline at end of file diff --git a/src/main/java/tconstruct/client/TProxyClient.java b/src/main/java/tconstruct/client/TProxyClient.java index 26499568b10..93f1fc1a03c 100644 --- a/src/main/java/tconstruct/client/TProxyClient.java +++ b/src/main/java/tconstruct/client/TProxyClient.java @@ -3,6 +3,7 @@ import java.io.InputStream; import java.text.DecimalFormat; import javax.xml.parsers.*; + import mantle.client.SmallFontRenderer; import mantle.lib.client.MantleClientRegistry; import net.minecraft.client.Minecraft; @@ -17,8 +18,7 @@ import tconstruct.common.TProxyCommon; import tconstruct.tools.items.ManualInfo; -public class TProxyClient extends TProxyCommon -{ +public class TProxyClient extends TProxyCommon { public static DecimalFormat df = new DecimalFormat("##.#"); /* TODO: Split this class up into its respective parts */ @@ -27,15 +27,13 @@ public class TProxyClient extends TProxyCommon public static Minecraft mc; public static RenderItem itemRenderer = new RenderItem(); - public void initialize () - { + public void initialize() { registerRenderer(); readManuals(); } /* Registers any rendering code. */ - public void registerRenderer () - { + public void registerRenderer() { Minecraft mc = Minecraft.getMinecraft(); smallFontRenderer = new SmallFontRenderer(mc.gameSettings, new ResourceLocation("textures/font/ascii.png"), mc.renderEngine, false); } @@ -44,68 +42,45 @@ public void registerRenderer () public static Document volume1; public static Document volume2; public static Document smelter; + public static Document weaponry; public static ManualInfo manualData; - public void readManuals () - { + public void readManuals() { DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); - String CurrentLanguage = Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode(); - - Document diary_cl = readManual("/assets/tinker/manuals/" + CurrentLanguage + "/diary.xml", dbFactory); - Document volume1_cl = readManual("/assets/tinker/manuals/" + CurrentLanguage + "/firstday.xml", dbFactory); - Document volume2_cl = readManual("/assets/tinker/manuals/" + CurrentLanguage + "/materials.xml", dbFactory); - Document smelter_cl = readManual("/assets/tinker/manuals/" + CurrentLanguage + "/smeltery.xml", dbFactory); - - diary = readManual("/assets/tinker/manuals/en_US/diary.xml", dbFactory); - volume1 = readManual("/assets/tinker/manuals/en_US/firstday.xml", dbFactory); - volume2 = readManual("/assets/tinker/manuals/en_US/materials.xml", dbFactory); - smelter = readManual("/assets/tinker/manuals/en_US/smeltery.xml", dbFactory); - - if(diary_cl != null) - { - diary = diary_cl; - } - - if(volume1_cl != null) - { - volume1 = volume1_cl; - } - - if(volume2_cl != null) - { - volume2 = volume2_cl; - } - - if(smelter_cl != null) - { - smelter = smelter_cl; - } - - initManualIcons(); + String CurrentLanguage = Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode(); + + Document diary_cl = readManual("/assets/tinker/manuals/" + CurrentLanguage + "/diary.xml", dbFactory); + Document volume1_cl = readManual("/assets/tinker/manuals/" + CurrentLanguage + "/firstday.xml", dbFactory); + Document volume2_cl = readManual("/assets/tinker/manuals/" + CurrentLanguage + "/materials.xml", dbFactory); + Document smelter_cl = readManual("/assets/tinker/manuals/" + CurrentLanguage + "/smeltery.xml", dbFactory); + Document weaponry_cl = readManual("/assets/tinker/manuals/" + CurrentLanguage + "/weaponry.xml", dbFactory); + + diary = diary_cl != null ? diary_cl : readManual("/assets/tinker/manuals/en_US/diary.xml", dbFactory); + volume1 = volume1_cl != null ? volume1_cl : readManual("/assets/tinker/manuals/en_US/firstday.xml", dbFactory); + volume2 = volume2_cl != null ? volume2_cl : readManual("/assets/tinker/manuals/en_US/materials.xml", dbFactory); + smelter = smelter_cl != null ? smelter_cl : readManual("/assets/tinker/manuals/en_US/smeltery.xml", dbFactory); + weaponry = weaponry_cl != null ? weaponry_cl : readManual("/assets/tinker/manuals/en_US/weaponry.xml", dbFactory); + + initManualIcons(); initManualRecipes(); initManualPages(); manualData = new ManualInfo(); } - Document readManual (String location, DocumentBuilderFactory dbFactory) - { - try - { + Document readManual(String location, DocumentBuilderFactory dbFactory) { + try { InputStream stream = TConstruct.class.getResourceAsStream(location); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(stream); doc.getDocumentElement().normalize(); return doc; - } - catch (Exception e) - { + } catch (Exception e) { e.printStackTrace(); return null; } } - public void initManualIcons () - { + public void initManualIcons() { MantleClientRegistry.registerManualIcon("torch", new ItemStack(Blocks.torch)); MantleClientRegistry.registerManualIcon("sapling", new ItemStack(Blocks.sapling)); MantleClientRegistry.registerManualIcon("workbench", new ItemStack(Blocks.crafting_table)); @@ -121,34 +96,29 @@ public void initManualIcons () MantleClientRegistry.registerManualIcon("netherrack", new ItemStack(Blocks.netherrack)); } - public void initManualRecipes () - { + public void initManualRecipes() { } - void initManualPages () - { + void initManualPages() { } - public static Document getManualFromStack (ItemStack stack) - { - switch (stack.getItemDamage()) - { - case 0: - return volume1; - case 1: - return volume2; - case 2: - return smelter; - case 3: - return diary; + public static Document getManualFromStack(ItemStack stack) { + switch (stack.getItemDamage()) { + case 0: + return volume1; + case 1: + return volume2; + case 2: + return smelter; + case 3: + return diary; } return null; } - public void recalculateHealth () - { + public void recalculateHealth() { ArmorProxyClient.armorExtended.recalculateHealth(mc.thePlayer, TPlayerStats.get(mc.thePlayer)); } diff --git a/src/main/java/tconstruct/tools/ToolProxyClient.java b/src/main/java/tconstruct/tools/ToolProxyClient.java index 33650f37075..2290044c7e4 100644 --- a/src/main/java/tconstruct/tools/ToolProxyClient.java +++ b/src/main/java/tconstruct/tools/ToolProxyClient.java @@ -101,8 +101,8 @@ public void registerManualIcons () MantleClientRegistry.registerManualIcon("frypanicon", ToolBuilder.instance.buildTool(new ItemStack(TinkerTools.frypanHead, 1, 10), new ItemStack(TinkerTools.toolRod, 1, 11), null, "")); MantleClientRegistry.registerManualIcon("battlesignicon", ToolBuilder.instance.buildTool(new ItemStack(TinkerTools.signHead, 1, 10), new ItemStack(TinkerTools.toolRod, 1, 11), null, "")); MantleClientRegistry.registerManualIcon("chiselicon", ToolBuilder.instance.buildTool(new ItemStack(TinkerTools.chiselHead, 1, 10), new ItemStack(TinkerTools.toolRod, 1, 11), null, "")); - MantleClientRegistry.registerManualIcon("shortbowIcon", ToolBuilder.instance.buildTool(new ItemStack(TinkerTools.toolRod, 1, 10), new ItemStack(TinkerWeaponry.bowstring, 1, 0), new ItemStack(TinkerTools.toolRod, 1, 12), "")); - MantleClientRegistry.registerManualIcon("arrowIcon", ToolBuilder.instance.buildTool(new ItemStack(TinkerWeaponry.arrowhead, 1, 10), new ItemStack(TinkerTools.toolRod, 1, 11), new ItemStack(TinkerWeaponry.fletching, 1, 0), "")); + //MantleClientRegistry.registerManualIcon("shortbowIcon", ToolBuilder.instance.buildTool(new ItemStack(TinkerTools.toolRod, 1, 10), new ItemStack(TinkerWeaponry.bowstring, 1, 0), new ItemStack(TinkerTools.toolRod, 1, 12), "")); + //MantleClientRegistry.registerManualIcon("arrowIcon", ToolBuilder.instance.buildTool(new ItemStack(TinkerWeaponry.arrowhead, 1, 10), new ItemStack(TinkerTools.toolRod, 1, 11), new ItemStack(TinkerWeaponry.fletching, 1, 0), "")); MantleClientRegistry.registerManualIcon("hammericon", ToolBuilder.instance.buildTool(new ItemStack(TinkerTools.hammerHead, 1, 10), new ItemStack(TinkerTools.toughRod, 1, 11), new ItemStack(TinkerTools.largePlate, 1, 12), new ItemStack(TinkerTools.largePlate, 8), "")); MantleClientRegistry.registerManualIcon("lumbericon", ToolBuilder.instance.buildTool(new ItemStack(TinkerTools.broadAxeHead, 1, 10), new ItemStack(TinkerTools.toughRod, 1, 11), new ItemStack(TinkerTools.largePlate, 1, 12), new ItemStack(TinkerTools.toughBinding, 8), "")); diff --git a/src/main/java/tconstruct/tools/items/Manual.java b/src/main/java/tconstruct/tools/items/Manual.java index 1b8edc01596..142cd5f6c9c 100644 --- a/src/main/java/tconstruct/tools/items/Manual.java +++ b/src/main/java/tconstruct/tools/items/Manual.java @@ -18,8 +18,8 @@ public class Manual extends CraftingItem { - static String[] name = new String[] { "beginner", "toolstation", "smeltery", "diary" }; - static String[] textureName = new String[] { "tinkerbook_diary", "tinkerbook_toolstation", "tinkerbook_smeltery", "tinkerbook_blue" }; + static String[] name = new String[] { "beginner", "toolstation", "smeltery", "diary", "weaponry" }; + static String[] textureName = new String[] { "tinkerbook_diary", "tinkerbook_toolstation", "tinkerbook_smeltery", "tinkerbook_blue", "tinkerbook_green" }; public Manual() { @@ -50,6 +50,8 @@ private BookData getData (ItemStack stack) return TProxyClient.manualData.toolStation; case 2: return TProxyClient.manualData.smeltery; + case 4: + return TProxyClient.manualData.weaponry; default: return TProxyClient.manualData.diary; } diff --git a/src/main/java/tconstruct/tools/items/ManualInfo.java b/src/main/java/tconstruct/tools/items/ManualInfo.java index 5c68e0f4f3a..e97f2e2f8d7 100644 --- a/src/main/java/tconstruct/tools/items/ManualInfo.java +++ b/src/main/java/tconstruct/tools/items/ManualInfo.java @@ -16,6 +16,7 @@ public class ManualInfo BookData toolStation = new BookData(); BookData smeltery = new BookData(); BookData diary = new BookData(); + BookData weaponry = new BookData(); /* diary = readManual("/assets/tinker/manuals/diary.xml", dbFactory); volume1 = readManual("/assets/tinker/manuals/firstday.xml", dbFactory); @@ -29,7 +30,7 @@ public ManualInfo() toolStation = initManual(toolStation, "tconstruct.manual.toolstation", "\u00a7o" + StatCollector.translateToLocal("manual2.tooltip"), side == Side.CLIENT ? TProxyClient.volume2 : null, "tinker:tinkerbook_toolstation"); smeltery = initManual(smeltery, "tconstruct.manual.smeltery", "\u00a7o" + StatCollector.translateToLocal("manual3.tooltip"), side == Side.CLIENT ? TProxyClient.smelter : null, "tinker:tinkerbook_smeltery"); diary = initManual(diary, "tconstruct.manual.diary", "\u00a7o" + StatCollector.translateToLocal("manual4.tooltip"), side == Side.CLIENT ? TProxyClient.diary : null, "tinker:tinkerbook_blue"); - + weaponry = initManual(weaponry, "tconstruct.manual.weaponry", "\u00a7o" + StatCollector.translateToLocal("manual5.tooltip"), side == Side.CLIENT ? TProxyClient.weaponry : null, "tinker:tinkerbook_green"); } public BookData initManual (BookData data, String unlocName, String toolTip, Document xmlDoc, String itemImage) diff --git a/src/main/java/tconstruct/weaponry/WeaponryClientProxy.java b/src/main/java/tconstruct/weaponry/WeaponryClientProxy.java index 0710a82a48d..0ea3e427baf 100644 --- a/src/main/java/tconstruct/weaponry/WeaponryClientProxy.java +++ b/src/main/java/tconstruct/weaponry/WeaponryClientProxy.java @@ -1,6 +1,9 @@ package tconstruct.weaponry; +import mantle.lib.client.MantleClientRegistry; +import net.minecraft.init.Items; import tconstruct.client.AmmoItemRenderer; +import tconstruct.library.crafting.ToolBuilder; import tconstruct.library.entity.ProjectileBase; import tconstruct.weaponry.client.AmmoSlotHandler; import tconstruct.weaponry.client.CrosshairHandler; @@ -39,6 +42,7 @@ public void init() { registerMaterialRendering(); buttons(); + registerManualIcons(); } private void registerRenderers() @@ -159,4 +163,15 @@ private void buttons() TConstructClientRegistry.addTierTwoButton(icons[i][0], icons[i][1], icons[i][2], coords[i*2], coords[i*2+1], tools[i].getLocalizedToolName(), locString, Reference.RESOURCE, tex); } } + + + /* Manual Stuff */ + public void registerManualIcons () + { + MantleClientRegistry.registerManualIcon("throwingknifeIcon", ToolBuilder.instance.buildTool(new ItemStack(TinkerTools.knifeBlade, 1, TinkerTools.MaterialID.Iron), new ItemStack(TinkerTools.toolRod, 1, 11), null, "")); + MantleClientRegistry.registerManualIcon("shortbowIcon", ToolBuilder.instance.buildTool(new ItemStack(TinkerWeaponry.partBowLimb, 1, TinkerTools.MaterialID.Wood), new ItemStack(TinkerWeaponry.bowstring, 1, 0), new ItemStack(TinkerWeaponry.partBowLimb, 1, TinkerTools.MaterialID.Wood), "")); + MantleClientRegistry.registerManualIcon("arrowIcon", ToolBuilder.instance.buildTool(new ItemStack(TinkerWeaponry.arrowhead, 1, TinkerTools.MaterialID.Flint), new ItemStack(Items.stick), new ItemStack(TinkerWeaponry.fletching, 1, 0), "")); + + MantleClientRegistry.registerManualIcon("weaponrybook", new ItemStack(TinkerTools.manualBook, 1, 4)); + } }