From ba8feb526da0a1ce15a179e1e5ee44582f769768 Mon Sep 17 00:00:00 2001 From: Lance5057 Date: Fri, 18 Mar 2016 06:14:33 -0500 Subject: Added modifiers, beautified code --- src/main/java/lance5057/tDefense/Reference.java | 10 +- src/main/java/lance5057/tDefense/TD_Config.java | 60 +- .../java/lance5057/tDefense/TinkersDefense.java | 1041 ++++++++------------ .../lance5057/tDefense/addons/TDAddonBotania.java | 58 +- .../java/lance5057/tDefense/armor/ArmorCore.java | 122 +-- .../tDefense/armor/blocks/GlowstoneCrumbs.java | 120 +++ .../tDefense/armor/blocks/UnstableBlock.java | 103 ++ .../tDefense/armor/blocks/UnstableItemBlock.java | 21 + .../tDefense/armor/events/ArmorModEvents.java | 86 +- .../tDefense/armor/events/ArmorRenderEvent.java | 71 +- .../java/lance5057/tDefense/armor/items/Mask.java | 92 +- .../lance5057/tDefense/armor/items/Sheath.java | 96 +- .../tDefense/armor/items/cloth/TinkersHood.java | 113 ++- .../tDefense/armor/items/cloth/TinkersRobe.java | 103 +- .../tDefense/armor/items/cloth/TinkersShawl.java | 113 ++- .../tDefense/armor/items/cloth/TinkersShoes.java | 113 ++- .../armor/items/heavy/TinkersBreastplate.java | 130 +-- .../tDefense/armor/items/heavy/TinkersGrieves.java | 127 +-- .../tDefense/armor/items/heavy/TinkersHelm.java | 119 +-- .../armor/items/heavy/TinkersSabatons.java | 134 +-- .../tDefense/armor/items/light/TinkersBoots.java | 115 ++- .../armor/items/light/TinkersChausses.java | 108 +- .../tDefense/armor/items/light/TinkersCoif.java | 118 +-- .../tDefense/armor/items/light/TinkersHalberd.java | 117 ++- .../tDefense/armor/modifiers/ArmorMods.java | 117 ++- .../armor/modifiers/modifierProtection.java | 182 ++-- .../java/lance5057/tDefense/armor/parts/Cloth.java | 56 +- .../tDefense/armor/parts/ClothMaterial.java | 4 +- .../tDefense/armor/renderers/ArmorRenderer.java | 24 + .../tDefense/armor/renderers/ModelChainArmor.java | 168 ---- .../tDefense/armor/renderers/ModelClothArmor.java | 259 ----- .../tDefense/armor/renderers/ModelMask.java | 117 +-- .../tDefense/armor/renderers/ModelScarf.java | 67 +- .../tDefense/armor/renderers/ModelSheath.java | 180 ++-- .../armor/renderers/cloth/ModelTinkersHood.java | 126 ++- .../armor/renderers/cloth/ModelTinkersRobe.java | 216 ++-- .../armor/renderers/cloth/ModelTinkersShawl.java | 248 +++-- .../renderers/heavy/ModelTinkersBreastplate.java | 249 +++-- .../armor/renderers/heavy/ModelTinkersGrieves.java | 212 ++-- .../armor/renderers/heavy/ModelTinkersHelm.java | 142 ++- .../renderers/heavy/ModelTinkersSabatons.java | 279 +++--- .../armor/renderers/light/ModelTinkersBoots.java | 142 ++- .../renderers/light/ModelTinkersChausses.java | 197 ++-- .../armor/renderers/light/ModelTinkersCoif.java | 113 +-- .../armor/renderers/light/ModelTinkersHalberd.java | 223 ++--- .../lance5057/tDefense/blocks/JewelersBench.java | 40 +- .../java/lance5057/tDefense/core/TD_Patterns.java | 86 +- .../tDefense/core/blocks/AeonSteelBlock.java | 12 +- .../tDefense/core/blocks/DogbeariumBlock.java | 12 +- .../tDefense/core/blocks/GreenMintBlock.java | 12 +- .../tDefense/core/blocks/QueensGoldBlock.java | 12 +- .../tDefense/core/blocks/RedMintBlock.java | 12 +- .../blocks/crestMount/Container_CrestMount.java | 24 +- .../core/blocks/crestMount/CrestMount.java | 246 ++--- .../core/blocks/crestMount/Gui_CrestMount.java | 101 +- .../core/blocks/crestMount/ModelCrestMount.java | 146 +-- .../blocks/crestMount/Renderer_CrestMount.java | 370 +++---- .../blocks/crestMount/TileEntity_CrestMount.java | 159 +-- .../lance5057/tDefense/core/blocks/ore/TD_Ore.java | 42 +- .../tDefense/core/events/TDEventHandler.java | 150 ++- .../tDefense/core/liquids/MoltenFluid.java | 90 +- .../tDefense/core/network/Handler_CrestMount.java | 10 +- .../core/network/Handler_FinishingAnvil.java | 7 +- .../tDefense/core/network/Message_CrestMount.java | 33 +- .../core/network/Message_FinishingAnvil.java | 31 +- .../tDefense/core/network/PacketHandler.java | 11 +- .../core/renderer/BigFlexibleToolRenderer.java | 612 ++++++------ .../tDefense/core/tools/HeaterShield.java | 83 +- .../lance5057/tDefense/core/tools/RoundShield.java | 76 +- .../java/lance5057/tDefense/core/tools/Shears.java | 234 ++--- .../java/lance5057/tDefense/core/tools/Shield.java | 177 ++-- .../tDefense/core/tools/TinkerWrench.java | 86 +- .../tDefense/core/tools/TinkerZweihander.java | 154 +-- .../modifiers/ActiveToolMods/BotaniaToolMods.java | 44 +- .../ActiveToolMods/TDefenseActiveToolMod.java | 65 +- .../modifiers/ActiveToolMods/TdefenseToolMods.java | 46 +- .../tools/modifiers/Botania/modifierCorpseIvy.java | 90 +- .../tDefense/core/tools/modifiers/Modifiers.java | 70 +- .../modifiers/TDefense/modifierSoulBound.java | 29 + .../TDefense/shields/modifierCrestofBlades.java | 90 ++ .../TDefense/shields/modifierCrestofFeathers.java | 129 +++ .../TDefense/shields/modifierCrestofLegends.java | 60 ++ .../TDefense/shields/modifierCrestofMirrors.java | 64 ++ .../modifiers/TDefense/weapons/modifierDaze.java | 97 ++ .../TDefense/weapons/modifierTorchArrow.java | 72 ++ .../modifiers/shields/modifierCrestofBlades.java | 90 -- .../modifiers/shields/modifierCrestofFeathers.java | 119 --- .../modifiers/shields/modifierCrestofLegends.java | 60 -- .../modifiers/shields/modifierCrestofMirrors.java | 64 -- .../core/tools/modifiers/weapons/modifierDaze.java | 97 -- .../modifiers/weapons/modifierTorchArrow.java | 72 -- .../finishingAnvil/Container_FinishingAnvil.java | 20 +- .../blocks/finishingAnvil/FinishingAnvil.java | 246 ++--- .../blocks/finishingAnvil/Gui_FinishingAnvil.java | 258 ++--- .../blocks/finishingAnvil/ModelFinishingAnvil.java | 98 +- .../finishingAnvil/RenderItem_FinishingAnvil.java | 49 +- .../finishingAnvil/Renderer_FinishingAnvil.java | 47 +- .../finishingAnvil/TileEntity_FinishingAnvil.java | 127 ++- .../finishingAnvil/utilities/Injector.java | 127 +-- .../utilities/InjectorLocations.java | 36 +- .../tDefense/models/ModelJewelersBench.java | 176 ++-- .../tDefense/models/Renderer_JewelersBench.java | 45 +- .../java/lance5057/tDefense/proxy/ClientProxy.java | 103 +- .../java/lance5057/tDefense/proxy/CommonProxy.java | 96 +- 104 files changed, 6229 insertions(+), 6196 deletions(-) create mode 100644 src/main/java/lance5057/tDefense/armor/blocks/GlowstoneCrumbs.java create mode 100644 src/main/java/lance5057/tDefense/armor/blocks/UnstableBlock.java create mode 100644 src/main/java/lance5057/tDefense/armor/blocks/UnstableItemBlock.java create mode 100644 src/main/java/lance5057/tDefense/armor/renderers/ArmorRenderer.java delete mode 100644 src/main/java/lance5057/tDefense/armor/renderers/ModelChainArmor.java delete mode 100644 src/main/java/lance5057/tDefense/armor/renderers/ModelClothArmor.java create mode 100644 src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/modifierSoulBound.java create mode 100644 src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/shields/modifierCrestofBlades.java create mode 100644 src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/shields/modifierCrestofFeathers.java create mode 100644 src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/shields/modifierCrestofLegends.java create mode 100644 src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/shields/modifierCrestofMirrors.java create mode 100644 src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/weapons/modifierDaze.java create mode 100644 src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/weapons/modifierTorchArrow.java delete mode 100644 src/main/java/lance5057/tDefense/core/tools/modifiers/shields/modifierCrestofBlades.java delete mode 100644 src/main/java/lance5057/tDefense/core/tools/modifiers/shields/modifierCrestofFeathers.java delete mode 100644 src/main/java/lance5057/tDefense/core/tools/modifiers/shields/modifierCrestofLegends.java delete mode 100644 src/main/java/lance5057/tDefense/core/tools/modifiers/shields/modifierCrestofMirrors.java delete mode 100644 src/main/java/lance5057/tDefense/core/tools/modifiers/weapons/modifierDaze.java delete mode 100644 src/main/java/lance5057/tDefense/core/tools/modifiers/weapons/modifierTorchArrow.java (limited to 'src/main/java') diff --git a/src/main/java/lance5057/tDefense/Reference.java b/src/main/java/lance5057/tDefense/Reference.java index 2c78c27..d0546ca 100644 --- a/src/main/java/lance5057/tDefense/Reference.java +++ b/src/main/java/lance5057/tDefense/Reference.java @@ -2,9 +2,9 @@ package lance5057.tDefense; public class Reference { - - public static final String MOD_ID = "tinkersdefense"; - public static final String VERSION = "1.3a"; - public static final String MOD_NAME = "Tinkers' Defense"; - + + public static final String MOD_ID = "tinkersdefense"; + public static final String VERSION = "1.3a"; + public static final String MOD_NAME = "Tinkers' Defense"; + } diff --git a/src/main/java/lance5057/tDefense/TD_Config.java b/src/main/java/lance5057/tDefense/TD_Config.java index bca70b2..5d212ba 100644 --- a/src/main/java/lance5057/tDefense/TD_Config.java +++ b/src/main/java/lance5057/tDefense/TD_Config.java @@ -8,33 +8,38 @@ import net.minecraftforge.common.config.Property; public class TD_Config { - public int AeonsteelMatID; - public int QueensGoldMatID; - public int DogbeariumMatID; - public int RedMintMatID; - public int GreenMintMatID; - - public int DazeID; - public int CrestFeathersID; - public int CrestMirrorsID; - public int CrestLegendsID; - public int CrestBladesID; - - public int ArmorProtectionID; - - public int MaterialIndex; - - public boolean BotaniaAddon; - public int CorpseIvyModID; - + public int SoulBoundID; + public int AeonsteelMatID; + public int QueensGoldMatID; + public int DogbeariumMatID; + public int RedMintMatID; + public int GreenMintMatID; + + public int DazeID; + public int CrestFeathersID; + public int CrestMirrorsID; + public int CrestLegendsID; + public int CrestBladesID; + + public int ArmorProtectionID; + public int ArmorFireProtectionID; + public int ArmorBlastProtectionID; + public int ArmorProjectileProtectionID; + public int FeatherfallID; + + public int MaterialIndex; + + public boolean BotaniaAddon; + public int CorpseIvyModID; + public TD_Config(FMLPreInitializationEvent e) { Configuration config = new Configuration(e.getSuggestedConfigurationFile()); - + config.load(); - + MaterialIndex = config.get("Material Index", "Highest material ID - TDefense - 206 MFR - 1001 ExtraTIC - 1024", 206).getInt(); - + AeonsteelMatID = config.get("Material Configs", "Aeonsteel Material ID", 201).getInt(); QueensGoldMatID = config.get("Material Configs", "QueensGold Material ID", 202).getInt(); DogbeariumMatID = config.get("Material Configs", "Dogbearium Material ID", 203).getInt(); @@ -46,12 +51,17 @@ public class TD_Config CrestMirrorsID = config.get("Modifier Configs", "Crest of Mirrors ID", 20).getInt(); CrestLegendsID = config.get("Modifier Configs", "Crest of Legends ID", 21).getInt(); CrestLegendsID = config.get("Modifier Configs", "Crest of Legends ID", 22).getInt(); - + SoulBoundID = config.get("Modifier Configs", "Soulbound ID", 23).getInt(); + ArmorProtectionID = config.getInt("Protection ID", "Armor Modifier Configs", 40, 0, Integer.MAX_VALUE, ""); - + ArmorFireProtectionID = config.getInt("Fire Protection ID", "Armor Modifier Configs", 41, 0, Integer.MAX_VALUE, ""); + ArmorBlastProtectionID = config.getInt("Blast Protection ID", "Armor Modifier Configs", 42, 0, Integer.MAX_VALUE, ""); + ArmorProjectileProtectionID = config.getInt("Projectile Protection ID", "Armor Modifier Configs", 43, 0, Integer.MAX_VALUE, ""); + FeatherfallID = config.getInt("Featherfall ID", "Armor Modifier Configs", 44, 0, Integer.MAX_VALUE, ""); + BotaniaAddon = config.getBoolean("Enable Botania Addon", "Botania Addon", true, "Still requires Botania to use"); CorpseIvyModID = config.getInt("Corpse Drinker Ivy Modifier ID", "Botania Addon", 60, 0, Integer.MAX_VALUE, ""); - + config.save(); } } diff --git a/src/main/java/lance5057/tDefense/TinkersDefense.java b/src/main/java/lance5057/tDefense/TinkersDefense.java index 9c66e96..484de86 100644 --- a/src/main/java/lance5057/tDefense/TinkersDefense.java +++ b/src/main/java/lance5057/tDefense/TinkersDefense.java @@ -9,6 +9,9 @@ import java.util.Date; import java.util.List; import lance5057.tDefense.addons.TDAddonBotania; +import lance5057.tDefense.armor.blocks.GlowstoneCrumbs; +import lance5057.tDefense.armor.blocks.UnstableBlock; +import lance5057.tDefense.armor.blocks.UnstableItemBlock; import lance5057.tDefense.armor.events.ArmorModEvents; import lance5057.tDefense.armor.events.ArmorRenderEvent; import lance5057.tDefense.armor.items.cloth.TinkersHood; @@ -43,6 +46,7 @@ import lance5057.tDefense.core.tools.HeaterShield; import lance5057.tDefense.core.tools.RoundShield; import lance5057.tDefense.core.tools.Shears; import lance5057.tDefense.core.tools.TinkerWrench; +import lance5057.tDefense.core.tools.TinkerZweihander; import lance5057.tDefense.core.tools.modifiers.Modifiers; import lance5057.tDefense.finishingAnvil.blocks.finishingAnvil.FinishingAnvil; import lance5057.tDefense.finishingAnvil.blocks.finishingAnvil.TileEntity_FinishingAnvil; @@ -90,430 +94,368 @@ import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = Reference.MOD_ID, version = Reference.VERSION, name = Reference.MOD_NAME) -public class TinkersDefense { +public class TinkersDefense +{ - private static int modGuiIndex = 0; - public static final int GUI_CREST_INV = modGuiIndex++; - public static final int GUI_ANVIL_INV = modGuiIndex++; + private static int modGuiIndex = 0; + public static final int GUI_CREST_INV = modGuiIndex++; + public static final int GUI_ANVIL_INV = modGuiIndex++; @Instance(Reference.MOD_ID) - public static TinkersDefense instance = new TinkersDefense(); + public static TinkersDefense instance = new TinkersDefense(); - public static CreativeTabs tabName = new CreativeTabs("tabName") { + public static CreativeTabs tabName = new CreativeTabs("tabName") + { - public Item getTabIconItem() { - return TinkersDefense.tabIcon; - } + public Item getTabIconItem() + { + return TinkersDefense.tabIcon; + } + + }; + + public static TDEventHandler TDevents; + public static ArmorRenderEvent AREvent; + public static ArmorModEvents AMEvent; + + public static TD_Config config; + + public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MOD_ID); + + static Date date = new Date(); + + public static Item tabIcon; + + public static Modifiers mods; + + public static Item item_AeonSteelIngot; + public static Block block_AeonSteelBlock; + public static Fluid moltenAeonsteel; + public static Block moltenAeonsteelBlock; + + public static Item item_QueensGoldIngot; + public static Block block_QueensGoldBlock; + public static Fluid moltenQueensGold; + public static Block moltenQueensGoldBlock; + + public static Item item_DogbeariumIngot; + public static Block block_DogbeariumBlock; + public static Fluid moltenDogbearium; + public static Block moltenDogbeariumBlock; + + public static Item item_RedMintcane; + public static Item item_GreenMintcane; + + public static Item item_RedMintIngot; + public static Block block_RedMintBlock; + public static Fluid moltenRedMint; + public static Block moltenRedMintBlock; - }; - - public static TDEventHandler TDevents; - public static ArmorRenderEvent AREvent; - public static ArmorModEvents AMEvent; - - public static TD_Config config; - - public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE - .newSimpleChannel(Reference.MOD_ID); - - static Date date = new Date(); - - public static Item tabIcon; - - public static Modifiers mods; - - public static Item item_AeonSteelIngot; - public static Block block_AeonSteelBlock; - public static Fluid moltenAeonsteel; - public static Block moltenAeonsteelBlock; - - public static Item item_QueensGoldIngot; - public static Block block_QueensGoldBlock; - public static Fluid moltenQueensGold; - public static Block moltenQueensGoldBlock; - - public static Item item_DogbeariumIngot; - public static Block block_DogbeariumBlock; - public static Fluid moltenDogbearium; - public static Block moltenDogbeariumBlock; - - public static Item item_RedMintcane; - public static Item item_GreenMintcane; - - public static Item item_RedMintIngot; - public static Block block_RedMintBlock; - public static Fluid moltenRedMint; - public static Block moltenRedMintBlock; - - public static Item item_GreenMintIngot; - public static Block block_GreenMintBlock; - public static Fluid moltenGreenMint; - public static Block moltenGreenMintBlock; - - public static Item item_RawSapphire; - public static Item item_RawRuby; - public static Item item_RawAmethyst; - public static Item item_RawAmber; - - public static Block block_SapphireOre; - public static Block block_RubyOre; - public static Block block_AmethystOre; - public static Block block_AmberOre; - - public static ToolCore tool_roundShield; - public static ToolCore tool_heaterShield; - public static ToolCore tool_wrench; -// public static ToolCore tool_sheath; -// public static ToolCore tool_mask; -// public static ToolCore tool_zweihander; - public static ToolCore tool_shears; - - public static Block block_CrestMount; - public static Block block_ArmorAnvil; - public static Block block_JewelersBench; - - public static ToolCore armor_TinkerHood; - public static ToolCore armor_TinkerShawl; - public static ToolCore armor_TinkerRobe; - public static ToolCore armor_TinkerShoes; - - public static ToolCore armor_TinkerCoif; - public static ToolCore armor_TinkerHalberd; - public static ToolCore armor_TinkerChausses; - public static ToolCore armor_TinkerBoots; - - public static ToolCore armor_TinkerHelm; - public static ToolCore armor_TinkerBreastplate; - public static ToolCore armor_TinkerGrieves; - public static ToolCore armor_TinkerSabatons; - - public static Item item_ChainArmor; - public static Pattern woodPattern; - public static Pattern metalPattern; - - public static Item partRivet; - public static Item partArmorplate; - public static Item partClasp; - public static Item partCloth; - public static Item partChainmaille; - - public static List tcInject; - public static InjectorLocations injectLoc; - - public static TDAddonBotania flowermod; + public static Item item_GreenMintIngot; + public static Block block_GreenMintBlock; + public static Fluid moltenGreenMint; + public static Block moltenGreenMintBlock; + + public static Item item_RawSapphire; + public static Item item_RawRuby; + public static Item item_RawAmethyst; + public static Item item_RawAmber; + + public static Block block_SapphireOre; + public static Block block_RubyOre; + public static Block block_AmethystOre; + public static Block block_AmberOre; + + public static ToolCore tool_roundShield; + public static ToolCore tool_heaterShield; + public static ToolCore tool_wrench; + // public static ToolCore tool_sheath; + // public static ToolCore tool_mask; + public static ToolCore tool_zweihander; + public static ToolCore tool_shears; + + public static Block block_CrestMount; + public static Block block_ArmorAnvil; + public static Block block_JewelersBench; + + public static Block block_Unstable; + public static Block block_GlowCrumbs; + + public static ToolCore armor_TinkerHood; + public static ToolCore armor_TinkerShawl; + public static ToolCore armor_TinkerRobe; + public static ToolCore armor_TinkerShoes; + + public static ToolCore armor_TinkerCoif; + public static ToolCore armor_TinkerHalberd; + public static ToolCore armor_TinkerChausses; + public static ToolCore armor_TinkerBoots; + + public static ToolCore armor_TinkerHelm; + public static ToolCore armor_TinkerBreastplate; + public static ToolCore armor_TinkerGrieves; + public static ToolCore armor_TinkerSabatons; + + public static Item item_ChainArmor; + public static Pattern woodPattern; + public static Pattern metalPattern; + + public static Item partRivet; + public static Item partArmorplate; + public static Item partClasp; + public static Item partCloth; + public static Item partChainmaille; + + public static List tcInject; + public static InjectorLocations injectLoc; + + public static TDAddonBotania flowermod; @SidedProxy(clientSide = "lance5057.tDefense.proxy.ClientProxy", serverSide = "lance5057.tDefense.proxy.CommonProxy") - public static CommonProxy proxy; - public static int month; + public static CommonProxy proxy; + public static int month; @EventHandler - public void preInit(FMLPreInitializationEvent e) { + public void preInit(FMLPreInitializationEvent e) + { month = this.date.getMonth(); - + PacketHandler.init(); + TDevents = new TDEventHandler(); - - AREvent = new ArmorRenderEvent(); AMEvent = new ArmorModEvents(); + AREvent = new ArmorRenderEvent(); + MinecraftForge.EVENT_BUS.register(AREvent); MinecraftForge.EVENT_BUS.register(AMEvent); - + config = new TD_Config(e); - NetworkRegistry.INSTANCE.registerGuiHandler(TinkersDefense.instance, - new CommonProxy()); + NetworkRegistry.INSTANCE.registerGuiHandler(TinkersDefense.instance, new CommonProxy()); MinecraftForge.EVENT_BUS.register(this); - + tabIcon = new Item().setMaxStackSize(1).setCreativeTab(tabName).setUnlocalizedName("tabIcon").setTextureName(Reference.MOD_ID + ":Icon"); GameRegistry.registerItem(tabIcon, "tabIcon"); - + //flowermod = new TDAddonBotania(); mods = new Modifiers(); - + injectLoc = new InjectorLocations(); - -// item_RawSapphire = new RawGem("sapphire"); -// item_RawRuby = new RawGem("ruby"); -// item_RawAmethyst = new RawGem("amethyst"); -// item_RawAmber = new RawGem("amber"); -// -// block_SapphireOre = new TD_Ore(Material.ground, "sapphire", item_RawSapphire); -// block_RubyOre = new TD_Ore(Material.ground, "ruby", item_RawRuby); -// block_AmethystOre = new TD_Ore(Material.ground, "amethyst", item_RawAmethyst); -// block_AmberOre = new TD_Ore(Material.ground, "amber", item_RawAmber); -// -// GameRegistry.registerItem(item_RawSapphire, "rawsapphire"); -// GameRegistry.registerItem(item_RawRuby, "rawruby"); -// GameRegistry.registerItem(item_RawAmethyst, "rawamethyst"); -// GameRegistry.registerItem(item_RawAmber, "rawamber"); -// -// GameRegistry.registerBlock(block_SapphireOre, "sapphireore"); -// GameRegistry.registerBlock(block_RubyOre, "rubyore"); -// GameRegistry.registerBlock(block_AmethystOre, "amethystore"); -// GameRegistry.registerBlock(block_AmberOre, "amber ore"); - - block_CrestMount = new CrestMount().setHardness(4.0F) - .setStepSound(Block.soundTypeStone).setBlockName("CrestMount") - .setCreativeTab(tabName); + + // item_RawSapphire = new RawGem("sapphire"); + // item_RawRuby = new RawGem("ruby"); + // item_RawAmethyst = new RawGem("amethyst"); + // item_RawAmber = new RawGem("amber"); + // + // block_SapphireOre = new TD_Ore(Material.ground, "sapphire", item_RawSapphire); + // block_RubyOre = new TD_Ore(Material.ground, "ruby", item_RawRuby); + // block_AmethystOre = new TD_Ore(Material.ground, "amethyst", item_RawAmethyst); + // block_AmberOre = new TD_Ore(Material.ground, "amber", item_RawAmber); + // + // GameRegistry.registerItem(item_RawSapphire, "rawsapphire"); + // GameRegistry.registerItem(item_RawRuby, "rawruby"); + // GameRegistry.registerItem(item_RawAmethyst, "rawamethyst"); + // GameRegistry.registerItem(item_RawAmber, "rawamber"); + // + // GameRegistry.registerBlock(block_SapphireOre, "sapphireore"); + // GameRegistry.registerBlock(block_RubyOre, "rubyore"); + // GameRegistry.registerBlock(block_AmethystOre, "amethystore"); + // GameRegistry.registerBlock(block_AmberOre, "amber ore"); + + block_Unstable = new UnstableBlock(); + GameRegistry.registerBlock(block_Unstable, UnstableItemBlock.class, "Unstable"); + + block_GlowCrumbs = new GlowstoneCrumbs(); + GameRegistry.registerBlock(block_GlowCrumbs, "Block_GlowCrumbs"); + + block_CrestMount = new CrestMount().setHardness(4.0F).setStepSound(Block.soundTypeStone).setBlockName("CrestMount").setCreativeTab(tabName); GameRegistry.registerBlock(block_CrestMount, "Block_CrestMount"); - GameRegistry.registerTileEntity(TileEntity_CrestMount.class, - "Tile_CrestMount"); - - GameRegistry.addShapedRecipe(new ItemStack(block_CrestMount), - new Object[] { "xxx", "-i-", "---", 'x', - new ItemStack(TinkerTools.toughRod, 1, 1), 'i', - new ItemStack(TinkerTools.toolRod, 1, 1) }); - - block_ArmorAnvil = new FinishingAnvil().setHardness(4.0F) - .setStepSound(Block.soundTypeAnvil).setBlockName("ArmorAnvil") - .setCreativeTab(tabName); + GameRegistry.registerTileEntity(TileEntity_CrestMount.class, "Tile_CrestMount"); + + GameRegistry.addShapedRecipe(new ItemStack(block_CrestMount), new Object[] {"xxx", "-i-", "---", 'x', new ItemStack(TinkerTools.toughRod, 1, 1), 'i', new ItemStack(TinkerTools.toolRod, 1, 1)}); + + block_ArmorAnvil = new FinishingAnvil().setHardness(4.0F).setStepSound(Block.soundTypeAnvil).setBlockName("ArmorAnvil").setCreativeTab(tabName); GameRegistry.registerBlock(block_ArmorAnvil, "Block_ArmorAnvil"); - GameRegistry.registerTileEntity(TileEntity_FinishingAnvil.class, - "Tile_ArmorAnvil"); - - GameRegistry.addShapedRecipe(new ItemStack(block_ArmorAnvil), - new Object[] { "ai-", "lr-", "---", 'r', - new ItemStack(TinkerTools.toughRod, 1, 0), 'a', - Blocks.anvil, 'i', Items.iron_ingot, 'l', Blocks.log }); - - block_JewelersBench = new JewelersBench().setHardness(4.0F) - .setStepSound(Block.soundTypeWood) - .setBlockName("JewelersBench").setCreativeTab(tabName); + GameRegistry.registerTileEntity(TileEntity_FinishingAnvil.class, "Tile_ArmorAnvil"); + + GameRegistry.addShapedRecipe(new ItemStack(block_ArmorAnvil), new Object[] {"ai-", "lr-", "---", 'r', new ItemStack(TinkerTools.toughRod, 1, 0), 'a', Blocks.anvil, 'i', Items.iron_ingot, 'l', Blocks.log}); + + block_JewelersBench = new JewelersBench().setHardness(4.0F).setStepSound(Block.soundTypeWood).setBlockName("JewelersBench").setCreativeTab(tabName); GameRegistry.registerBlock(block_JewelersBench, "Block_JewelersBench"); - GameRegistry.registerTileEntity(TileEntity_JewelersBench.class, - "Tile_JewelersBench"); - - item_AeonSteelIngot = new Item().setCreativeTab(tabName) - .setMaxStackSize(64).setUnlocalizedName("AeonsteelIngot") - .setTextureName(Reference.MOD_ID + ":AeonsteelIngot"); + GameRegistry.registerTileEntity(TileEntity_JewelersBench.class, "Tile_JewelersBench"); + + item_AeonSteelIngot = new Item().setCreativeTab(tabName).setMaxStackSize(64).setUnlocalizedName("AeonsteelIngot").setTextureName(Reference.MOD_ID + ":AeonsteelIngot"); GameRegistry.registerItem(item_AeonSteelIngot, "AeonsteelIngot"); - block_AeonSteelBlock = new AeonSteelBlock(Material.iron) - .setHardness(4.0F).setStepSound(Block.soundTypeMetal) - .setBlockName("AeonsteelBlock").setCreativeTab(tabName) - .setBlockTextureName(Reference.MOD_ID + ":AeonsteelBlock"); + block_AeonSteelBlock = new AeonSteelBlock(Material.iron).setHardness(4.0F).setStepSound(Block.soundTypeMetal).setBlockName("AeonsteelBlock").setCreativeTab(tabName).setBlockTextureName(Reference.MOD_ID + ":AeonsteelBlock"); GameRegistry.registerBlock(block_AeonSteelBlock, "Aeonsteelblock"); - GameRegistry - .addShapedRecipe(new ItemStack(block_AeonSteelBlock), - new Object[] { "xxx", "xxx", "xxx", 'x', - item_AeonSteelIngot }); - GameRegistry.addShapelessRecipe(new ItemStack(item_AeonSteelIngot, 9), - new Object[] { new ItemStack(block_AeonSteelBlock) }); + GameRegistry.addShapedRecipe(new ItemStack(block_AeonSteelBlock), new Object[] {"xxx", "xxx", "xxx", 'x', item_AeonSteelIngot}); + GameRegistry.addShapelessRecipe(new ItemStack(item_AeonSteelIngot, 9), new Object[] {new ItemStack(block_AeonSteelBlock)}); - moltenAeonsteel = new Fluid("moltenAeonsteel").setLuminosity(15) - .setDensity(3000).setViscosity(6000).setTemperature(1300); + moltenAeonsteel = new Fluid("moltenAeonsteel").setLuminosity(15).setDensity(3000).setViscosity(6000).setTemperature(1300); FluidRegistry.registerFluid(moltenAeonsteel); - moltenAeonsteelBlock = new MoltenFluid( - moltenAeonsteel, "Aeonsteel"); + moltenAeonsteelBlock = new MoltenFluid(moltenAeonsteel, "Aeonsteel"); GameRegistry.registerBlock(moltenAeonsteelBlock, "moltenAeonsteel"); - - item_QueensGoldIngot = new Item().setCreativeTab(tabName) - .setMaxStackSize(64).setUnlocalizedName("QueensGoldIngot") - .setTextureName(Reference.MOD_ID + ":QueensGoldIngot"); + + item_QueensGoldIngot = new Item().setCreativeTab(tabName).setMaxStackSize(64).setUnlocalizedName("QueensGoldIngot").setTextureName(Reference.MOD_ID + ":QueensGoldIngot"); GameRegistry.registerItem(item_QueensGoldIngot, "QueensGoldIngot"); - block_QueensGoldBlock = new QueensGoldBlock(Material.iron) - .setHardness(4.0F).setStepSound(Block.soundTypeMetal) - .setBlockName("QueensGoldBlock").setCreativeTab(tabName) - .setBlockTextureName(Reference.MOD_ID + ":QueensGoldBlock"); + block_QueensGoldBlock = new QueensGoldBlock(Material.iron).setHardness(4.0F).setStepSound(Block.soundTypeMetal).setBlockName("QueensGoldBlock").setCreativeTab(tabName).setBlockTextureName(Reference.MOD_ID + ":QueensGoldBlock"); GameRegistry.registerBlock(block_QueensGoldBlock, "QueensGoldblock"); - GameRegistry - .addShapedRecipe(new ItemStack(block_QueensGoldBlock), - new Object[] { "xxx", "xxx", "xxx", 'x', - item_QueensGoldIngot }); - GameRegistry.addShapelessRecipe(new ItemStack(item_QueensGoldIngot, 9), - new Object[] { new ItemStack(block_QueensGoldBlock) }); + GameRegistry.addShapedRecipe(new ItemStack(block_QueensGoldBlock), new Object[] {"xxx", "xxx", "xxx", 'x', item_QueensGoldIngot}); + GameRegistry.addShapelessRecipe(new ItemStack(item_QueensGoldIngot, 9), new Object[] {new ItemStack(block_QueensGoldBlock)}); - moltenQueensGold = new Fluid("moltenQueensGold").setLuminosity(15) - .setDensity(3000).setViscosity(6000).setTemperature(1300); + moltenQueensGold = new Fluid("moltenQueensGold").setLuminosity(15).setDensity(3000).setViscosity(6000).setTemperature(1300); FluidRegistry.registerFluid(moltenQueensGold); - moltenQueensGoldBlock = new MoltenFluid( - moltenQueensGold, "QueensGold"); + moltenQueensGoldBlock = new MoltenFluid(moltenQueensGold, "QueensGold"); GameRegistry.registerBlock(moltenQueensGoldBlock, "moltenQueensGold"); - // Dogbearium - item_DogbeariumIngot = new Item().setCreativeTab(tabName) - .setMaxStackSize(64).setUnlocalizedName("DogbeariumIngot") - .setTextureName(Reference.MOD_ID + ":DogbeariumIngot"); + item_DogbeariumIngot = new Item().setCreativeTab(tabName).setMaxStackSize(64).setUnlocalizedName("DogbeariumIngot").setTextureName(Reference.MOD_ID + ":DogbeariumIngot"); GameRegistry.registerItem(item_DogbeariumIngot, "DogbeariumIngot"); - block_DogbeariumBlock = new DogbeariumBlock(Material.iron) - .setHardness(4.0F).setStepSound(Block.soundTypeMetal) - .setBlockName("DogbeariumBlock").setCreativeTab(tabName) - .setBlockTextureName(Reference.MOD_ID + ":DogbeariumBlock"); + block_DogbeariumBlock = new DogbeariumBlock(Material.iron).setHardness(4.0F).setStepSound(Block.soundTypeMetal).setBlockName("DogbeariumBlock").setCreativeTab(tabName).setBlockTextureName(Reference.MOD_ID + ":DogbeariumBlock"); GameRegistry.registerBlock(block_DogbeariumBlock, "Dogbeariumblock"); - GameRegistry - .addShapedRecipe(new ItemStack(block_DogbeariumBlock), - new Object[] { "xxx", "xxx", "xxx", 'x', - item_DogbeariumIngot }); - GameRegistry.addShapelessRecipe(new ItemStack(item_DogbeariumIngot, 9), - new Object[] { new ItemStack(block_DogbeariumBlock) }); + GameRegistry.addShapedRecipe(new ItemStack(block_DogbeariumBlock), new Object[] {"xxx", "xxx", "xxx", 'x', item_DogbeariumIngot}); + GameRegistry.addShapelessRecipe(new ItemStack(item_DogbeariumIngot, 9), new Object[] {new ItemStack(block_DogbeariumBlock)}); - moltenDogbearium = new Fluid("moltenDogbearium").setLuminosity(15) - .setDensity(3000).setViscosity(6000).setTemperature(1300); + moltenDogbearium = new Fluid("moltenDogbearium").setLuminosity(15).setDensity(3000).setViscosity(6000).setTemperature(1300); FluidRegistry.registerFluid(moltenDogbearium); - moltenDogbeariumBlock = new MoltenFluid( - moltenDogbearium, "dogbearium"); + moltenDogbeariumBlock = new MoltenFluid(moltenDogbearium, "dogbearium"); GameRegistry.registerBlock(moltenDogbeariumBlock, "moltenDogbearium"); - - + //Candy Canes - item_RedMintcane = new Item().setCreativeTab(tabName) - .setMaxStackSize(64).setUnlocalizedName("RedMintcane") - .setTextureName(Reference.MOD_ID + ":redmintcane"); - - item_RedMintIngot = new Item().setCreativeTab(tabName) - .setMaxStackSize(64).setUnlocalizedName("RedMintIngot") - .setTextureName(Reference.MOD_ID + ":redmintingot"); - + item_RedMintcane = new Item().setCreativeTab(tabName).setMaxStackSize(64).setUnlocalizedName("RedMintcane").setTextureName(Reference.MOD_ID + ":redmintcane"); + + item_RedMintIngot = new Item().setCreativeTab(tabName).setMaxStackSize(64).setUnlocalizedName("RedMintIngot").setTextureName(Reference.MOD_ID + ":redmintingot"); + GameRegistry.registerItem(item_RedMintcane, "RedMintCane"); GameRegistry.registerItem(item_RedMintIngot, "RedMintIngot"); - block_RedMintBlock = new RedMintBlock(Material.iron) - .setHardness(4.0F).setStepSound(Block.soundTypeMetal) - .setBlockName("RedMintBlock").setCreativeTab(tabName) - .setBlockTextureName(Reference.MOD_ID + ":redmintblock"); + block_RedMintBlock = new RedMintBlock(Material.iron).setHardness(4.0F).setStepSound(Block.soundTypeMetal).setBlockName("RedMintBlock").setCreativeTab(tabName).setBlockTextureName(Reference.MOD_ID + ":redmintblock"); GameRegistry.registerBlock(block_RedMintBlock, "redmintblock"); - GameRegistry - .addShapedRecipe(new ItemStack(block_RedMintBlock), - new Object[] { "xxx", "xxx", "xxx", 'x', - new ItemStack(item_RedMintcane,1,2) }); - GameRegistry.addShapelessRecipe(new ItemStack(item_RedMintcane, 9,2), - new Object[] { new ItemStack(block_RedMintBlock) }); + GameRegistry.addShapedRecipe(new ItemStack(block_RedMintBlock), new Object[] {"xxx", "xxx", "xxx", 'x', new ItemStack(item_RedMintcane, 1, 2)}); + GameRegistry.addShapelessRecipe(new ItemStack(item_RedMintcane, 9, 2), new Object[] {new ItemStack(block_RedMintBlock)}); - moltenRedMint = new Fluid("moltenRedMint").setLuminosity(15) - .setDensity(3000).setViscosity(6000).setTemperature(1300); + moltenRedMint = new Fluid("moltenRedMint").setLuminosity(15).setDensity(3000).setViscosity(6000).setTemperature(1300); FluidRegistry.registerFluid(moltenRedMint); - moltenRedMintBlock = new MoltenFluid( - moltenRedMint, "RedMint"); + moltenRedMintBlock = new MoltenFluid(moltenRedMint, "RedMint"); GameRegistry.registerBlock(moltenRedMintBlock, "moltenRedMint"); - - item_GreenMintcane = new Item().setCreativeTab(tabName) - .setMaxStackSize(64).setUnlocalizedName("GreenMintcane") - .setTextureName(Reference.MOD_ID + ":greenmintcane"); - - item_GreenMintIngot = new Item().setCreativeTab(tabName) - .setMaxStackSize(64).setUnlocalizedName("GreenMintIngot") - .setTextureName(Reference.MOD_ID + ":greenmintingot"); - + + item_GreenMintcane = new Item().setCreativeTab(tabName).setMaxStackSize(64).setUnlocalizedName("GreenMintcane").setTextureName(Reference.MOD_ID + ":greenmintcane"); + + item_GreenMintIngot = new Item().setCreativeTab(tabName).setMaxStackSize(64).setUnlocalizedName("GreenMintIngot").setTextureName(Reference.MOD_ID + ":greenmintingot"); + GameRegistry.registerItem(item_GreenMintcane, "GreenMintCane"); GameRegistry.registerItem(item_GreenMintIngot, "GreenMintIngot"); - block_GreenMintBlock = new GreenMintBlock(Material.iron) - .setHardness(4.0F).setStepSound(Block.soundTypeMetal) - .setBlockName("GreenMintBlock").setCreativeTab(tabName) - .setBlockTextureName(Reference.MOD_ID + ":greenmintblock"); + block_GreenMintBlock = new GreenMintBlock(Material.iron).setHardness(4.0F).setStepSound(Block.soundTypeMetal).setBlockName("GreenMintBlock").setCreativeTab(tabName).setBlockTextureName(Reference.MOD_ID + ":greenmintblock"); GameRegistry.registerBlock(block_GreenMintBlock, "GreenMintblock"); - GameRegistry - .addShapedRecipe(new ItemStack(block_GreenMintBlock), new Object[] { "xxx", "xxx", "xxx", 'x', new ItemStack(item_GreenMintcane,1,3)}); - GameRegistry.addShapelessRecipe(new ItemStack(item_GreenMintcane, 9, 3), - new Object[] { new ItemStack(block_GreenMintBlock) }); + GameRegistry.addShapedRecipe(new ItemStack(block_GreenMintBlock), new Object[] {"xxx", "xxx", "xxx", 'x', new ItemStack(item_GreenMintcane, 1, 3)}); + GameRegistry.addShapelessRecipe(new ItemStack(item_GreenMintcane, 9, 3), new Object[] {new ItemStack(block_GreenMintBlock)}); - moltenGreenMint = new Fluid("moltenGreenMint").setLuminosity(15) - .setDensity(3000).setViscosity(6000).setTemperature(1300); + moltenGreenMint = new Fluid("moltenGreenMint").setLuminosity(15).setDensity(3000).setViscosity(6000).setTemperature(1300); FluidRegistry.registerFluid(moltenGreenMint); - moltenGreenMintBlock = new MoltenFluid( - moltenGreenMint, "GreenMint"); + moltenGreenMintBlock = new MoltenFluid(moltenGreenMint, "GreenMint"); GameRegistry.registerBlock(moltenGreenMintBlock, "moltenGreenMint"); - + tool_roundShield = new RoundShield(); tool_heaterShield = new HeaterShield(); tool_shears = new Shears(); tool_wrench = new TinkerWrench(); -// tool_sheath = new Sheath(); -// tool_mask = new Mask(); - -// tool_zweihander = new TinkerZweihander(0); - + // tool_sheath = new Sheath(); + // tool_mask = new Mask(); + + tool_zweihander = new TinkerZweihander(0); + armor_TinkerHelm = new TinkersHelm(); armor_TinkerBreastplate = new TinkersBreastplate(); armor_TinkerGrieves = new TinkersGrieves(); armor_TinkerSabatons = new TinkersSabatons(); - + armor_TinkerRobe = new TinkersRobe(); armor_TinkerShawl = new TinkersShawl(); armor_TinkerHood = new TinkersHood(); armor_TinkerShoes = new TinkersShoes(); - + armor_TinkerCoif = new TinkersCoif(); armor_TinkerHalberd = new TinkersHalberd(); armor_TinkerChausses = new TinkersChausses(); armor_TinkerBoots = new TinkersBoots(); - + //Register Tools - + GameRegistry.registerItem(tool_roundShield, "Round Shield"); GameRegistry.registerItem(tool_heaterShield, "Heater Shield"); - + GameRegistry.registerItem(tool_shears, "Tinker Shears"); GameRegistry.registerItem(tool_wrench, "Tinker Wrench"); -// GameRegistry.registerItem(tool_sheath, "Sheath"); -// GameRegistry.registerItem(tool_mask, "Mask"); -// GameRegistry.registerItem(tool_zweihander, "Zweihander"); - - GameRegistry.registerItem(armor_TinkerHelm,"tinkerhelm"); - GameRegistry.registerItem(armor_TinkerBreastplate,"tinkerbreastplate"); - GameRegistry.registerItem(armor_TinkerGrieves,"tinkergrieves"); - GameRegistry.registerItem(armor_TinkerSabatons,"tinkersabatons"); - - GameRegistry.registerItem(armor_TinkerCoif,"tinkercoif"); - GameRegistry.registerItem(armor_TinkerHalberd,"tinkerhalberd"); - GameRegistry.registerItem(armor_TinkerChausses,"tinkerchausses"); - GameRegistry.registerItem(armor_TinkerBoots,"tinkerboots"); - + // GameRegistry.registerItem(tool_sheath, "Sheath"); + // GameRegistry.registerItem(tool_mask, "Mask"); + GameRegistry.registerItem(tool_zweihander, "Zweihander"); + + GameRegistry.registerItem(armor_TinkerHelm, "tinkerhelm"); + GameRegistry.registerItem(armor_TinkerBreastplate, "tinkerbreastplate"); + GameRegistry.registerItem(armor_TinkerGrieves, "tinkergrieves"); + GameRegistry.registerItem(armor_TinkerSabatons, "tinkersabatons"); + + GameRegistry.registerItem(armor_TinkerCoif, "tinkercoif"); + GameRegistry.registerItem(armor_TinkerHalberd, "tinkerhalberd"); + GameRegistry.registerItem(armor_TinkerChausses, "tinkerchausses"); + GameRegistry.registerItem(armor_TinkerBoots, "tinkerboots"); + GameRegistry.registerItem(armor_TinkerRobe, "tinkerrobe"); GameRegistry.registerItem(armor_TinkerShawl, "tinkershawl"); GameRegistry.registerItem(armor_TinkerHood, "tinkerhood"); GameRegistry.registerItem(armor_TinkerShoes, "tinkershoes"); - + //Add Tools to TiCo directory TConstructRegistry.addItemToDirectory("Round Shield", tool_roundShield); TConstructRegistry.addItemToDirectory("Heater Shield", tool_heaterShield); TConstructRegistry.addItemToDirectory("Tinker Shears", tool_shears); TConstructRegistry.addItemToDirectory("Tinker Wrench", tool_wrench); -// TConstructRegistry.addItemToDirectory("Sheath", tool_sheath); -// TConstructRegistry.addItemToDirectory("Mask", tool_mask); -// TConstructRegistry.addItemToDirectory("Zweihander", tool_zweihander); - + // TConstructRegistry.addItemToDirectory("Sheath", tool_sheath); + // TConstructRegistry.addItemToDirectory("Mask", tool_mask); + TConstructRegistry.addItemToDirectory("Zweihander", tool_zweihander); + TConstructRegistry.addItemToDirectory("tinkerhelm", armor_TinkerHelm); TConstructRegistry.addItemToDirectory("tinkerbreastplate", armor_TinkerBreastplate); TConstructRegistry.addItemToDirectory("tinkergrieves", armor_TinkerGrieves); TConstructRegistry.addItemToDirectory("tinkersabatons", armor_TinkerSabatons); - + TConstructRegistry.addItemToDirectory("tinkercoif", armor_TinkerCoif); TConstructRegistry.addItemToDirectory("tinkerhalberd", armor_TinkerHalberd); TConstructRegistry.addItemToDirectory("tinkerchausses", armor_TinkerChausses); TConstructRegistry.addItemToDirectory("tinkerboots", armor_TinkerBoots); - + TConstructRegistry.addItemToDirectory("tinkerrobe", armor_TinkerRobe); TConstructRegistry.addItemToDirectory("tinkershawl", armor_TinkerShawl); TConstructRegistry.addItemToDirectory("tinkerhood", armor_TinkerHood); @@ -527,228 +469,147 @@ public class TinkersDefense { GameRegistry.registerItem(metalPattern, "Cast"); - TConstructRegistry.addItemStackToDirectory("rivets Pattern", - new ItemStack(woodPattern, 1, 0)); - TConstructRegistry.addItemStackToDirectory("clasp Pattern", - new ItemStack(woodPattern, 1, 1)); - TConstructRegistry.addItemStackToDirectory("armorplate Pattern", - new ItemStack(woodPattern, 1, 2)); + TConstructRegistry.addItemStackToDirectory("rivets Pattern", new ItemStack(woodPattern, 1, 0)); + TConstructRegistry.addItemStackToDirectory("clasp Pattern", new ItemStack(woodPattern, 1, 1)); + TConstructRegistry.addItemStackToDirectory("armorplate Pattern", new ItemStack(woodPattern, 1, 2)); // Renderers proxy.registerRenderers(); - -// item_ChainArmor = new ChainArmor(ArmorMaterial.IRON, 4, 1).setUnlocalizedName("Chain_Armor"); -// GameRegistry.registerItem(item_ChainArmor,"Chain Armor"); - + + // item_ChainArmor = new ChainArmor(ArmorMaterial.IRON, 4, 1).setUnlocalizedName("Chain_Armor"); + // GameRegistry.registerItem(item_ChainArmor,"Chain Armor"); + //tool_Sheath = new Sheath().setUnlocalizedName("Sheath"); - // network.registerMessage(messageHandler, requestMessageType, // discriminator, side); - } @EventHandler - public void init(FMLInitializationEvent e) { + public void init(FMLInitializationEvent e) + { //System.out.print(Reference.MOD_ID); - + //flowermod.RegisterRecipes(); //flowermod.RegisterModifiers(); - + StencilBuilder.registerStencil(50, woodPattern, 0); // rivets StencilBuilder.registerStencil(51, woodPattern, 1); // clasp StencilBuilder.registerStencil(52, woodPattern, 2); // armorplate StencilBuilder.registerStencil(53, woodPattern, 3); // cloth - StencilBuilder.registerStencil(54, woodPattern, 4); // chainmaille + StencilBuilder.registerStencil(54, woodPattern, 4); // chainmaille PatternBuilder.instance.addToolPattern(woodPattern); partRivet = new DynamicToolPart("_rivets", "Rivets"); GameRegistry.registerItem(partRivet, "RivetPart"); - + partClasp = new DynamicToolPart("_clasp", "Clasp"); GameRegistry.registerItem(partClasp, "ClaspPart"); partArmorplate = new DynamicToolPart("_armorplate", "Armor Plate"); GameRegistry.registerItem(partArmorplate, "ArmorPlatePart"); - + partCloth = new Cloth().setUnlocalizedName("TD.Cloth"); GameRegistry.registerItem(partCloth, "clothPart"); partChainmaille = new DynamicToolPart("_chainmaille", "Chainmaille"); GameRegistry.registerItem(partChainmaille, "chainmaillePart"); - + buildParts(partRivet, 0); buildParts(partClasp, 1); buildParts(partArmorplate, 2); //buildParts(partCloth, 3); buildParts(partChainmaille, 4); - + mods.init(); - + PatternBuilder pb = PatternBuilder.instance; - - TConstructClientRegistry.toolButtons - .add( - new ToolGuiElement( - 1, - 0, - 0, - new int[] { 9, 0, 4, 0 }, - new int[] { 2, 3, 2, 0 }, - StatCollector - .translateToLocal("gui.toolstation.roundshield.name"), - StatCollector - .translateToLocal("gui.toolstation.roundshield.desc"), - "tinkersdefense", "textures/gui/icons.png")); - - ToolGuiElement button2 = new ToolGuiElement(5,0,0,new int[] { 9, 8, 9, 9 },new int[] { 2, 3, 2, 3 },StatCollector.translateToLocal("gui.toolstation.heatershield.name"),StatCollector.translateToLocal("gui.toolstation.heatershield.desc"),"tinkersdefense:", "textures/gui/icons.png"); + + TConstructClientRegistry.toolButtons.add(new ToolGuiElement(1, 0, 0, new int[] {9, 0, 4, 0}, new int[] {2, 3, 2, 0}, StatCollector.translateToLocal("gui.toolstation.roundshield.name"), StatCollector.translateToLocal("gui.toolstation.roundshield.desc"), "tinkersdefense", "textures/gui/icons.png")); + + ToolGuiElement button2 = new ToolGuiElement(5, 0, 0, new int[] {9, 8, 9, 9}, new int[] {2, 3, 2, 3}, StatCollector.translateToLocal("gui.toolstation.heatershield.name"), StatCollector.translateToLocal("gui.toolstation.heatershield.desc"), "tinkersdefense:", "textures/gui/icons.png"); TConstructClientRegistry.tierTwoButtons.add(button2); - + TConstructClientRegistry.stencilButtons2.add(new StencilGuiElement(0, 0, 50, "tinkersdefense", "textures/gui/icons.png")); TConstructClientRegistry.stencilButtons2.add(new StencilGuiElement(0, 0, 51, "tinkersdefense", "textures/gui/icons.png")); TConstructClientRegistry.stencilButtons2.add(new StencilGuiElement(0, 0, 52, "tinkersdefense", "textures/gui/icons.png")); TConstructClientRegistry.stencilButtons2.add(new StencilGuiElement(0, 0, 53, "tinkersdefense", "textures/gui/icons.png")); TConstructClientRegistry.stencilButtons2.add(new StencilGuiElement(0, 0, 54, "tinkersdefense", "textures/gui/icons.png")); - + // Aeonsteel - pb.registerMaterialSet("aeonsteel", new ItemStack( - TinkerTools.toolShard, 1, 10), new ItemStack( - TinkerTools.toolRod, 1, 10), config.AeonsteelMatID); + pb.registerMaterialSet("aeonsteel", new ItemStack(TinkerTools.toolShard, 1, 10), new ItemStack(TinkerTools.toolRod, 1, 10), config.AeonsteelMatID); - TConstructClientRegistry.addMaterialRenderMapping(config.AeonsteelMatID, "tinker", - "aeonsteel", true); + TConstructClientRegistry.addMaterialRenderMapping(config.AeonsteelMatID, "tinker", "aeonsteel", true); // Tool Materials: id, name, harvestlevel, durability, speed, damage, // handlemodifier, reinforced, shoddy, style color, primary color for // block use - TConstructRegistry.addToolMaterial(config.AeonsteelMatID, "AeonSteel", 4, 822, 1100, 3, - 1.6F, 2, 0f, LIGHT_PURPLE.toString(), 0xb565e6); + TConstructRegistry.addToolMaterial(config.AeonsteelMatID, "AeonSteel", 4, 822, 1100, 3, 1.6F, 2, 0f, LIGHT_PURPLE.toString(), 0xb565e6); TinkerTools.registerPatternMaterial("AeonSteelIngot", 2, "AeonSteel"); TConstructRegistry.addDefaultToolPartMaterial(config.AeonsteelMatID); - Smeltery.addMelting(new ItemStack(item_AeonSteelIngot, 1, 0), - block_AeonSteelBlock, 0, 500, new FluidStack(moltenAeonsteel, - TConstruct.ingotLiquidValue)); - Smeltery.addMelting(block_AeonSteelBlock, 0, 500, new FluidStack( - moltenAeonsteel, TConstruct.ingotLiquidValue * 9)); + Smeltery.addMelting(new ItemStack(item_AeonSteelIngot, 1, 0), block_AeonSteelBlock, 0, 500, new FluidStack(moltenAeonsteel, TConstruct.ingotLiquidValue)); + Smeltery.addMelting(block_AeonSteelBlock, 0, 500, new FluidStack(moltenAeonsteel, TConstruct.ingotLiquidValue * 9)); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(item_AeonSteelIngot, 1, 0), - new FluidStack(moltenAeonsteel, TConstruct.ingotLiquidValue), - TConstructRegistry.getItemStack("ingotCast"), false, 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(item_AeonSteelIngot, 1, 0), new FluidStack(moltenAeonsteel, TConstruct.ingotLiquidValue), TConstructRegistry.getItemStack("ingotCast"), false, 50); - TConstructRegistry.instance.getBasinCasting() - .addCastingRecipe( - new ItemStack(block_AeonSteelBlock, 1, 0), - new FluidStack(moltenAeonsteel, - TConstruct.ingotLiquidValue * 9), 100); + TConstructRegistry.instance.getBasinCasting().addCastingRecipe(new ItemStack(block_AeonSteelBlock, 1, 0), new FluidStack(moltenAeonsteel, TConstruct.ingotLiquidValue * 9), 100); castMolten(moltenAeonsteel, config.AeonsteelMatID); - PatternBuilder.instance.registerFullMaterial(new ItemStack( - item_AeonSteelIngot, 1, 0), 2, "Aeonsteel", new ItemStack( - TinkerTools.toolShard, 1, config.AeonsteelMatID), new ItemStack( - TinkerTools.toolRod, 1, config.AeonsteelMatID), config.AeonsteelMatID); - - Smeltery.addAlloyMixing(new FluidStack(moltenAeonsteel, 144), - new FluidStack[] { - new FluidStack(TinkerSmeltery.moltenAlumiteFluid, 144), - new FluidStack(TinkerSmeltery.moltenCobaltFluid, 144) }); - - + PatternBuilder.instance.registerFullMaterial(new ItemStack(item_AeonSteelIngot, 1, 0), 2, "Aeonsteel", new ItemStack(TinkerTools.toolShard, 1, config.AeonsteelMatID), new ItemStack(TinkerTools.toolRod, 1, config.AeonsteelMatID), config.AeonsteelMatID); + + Smeltery.addAlloyMixing(new FluidStack(moltenAeonsteel, 144), new FluidStack[] {new FluidStack(TinkerSmeltery.moltenAlumiteFluid, 144), new FluidStack(TinkerSmeltery.moltenCobaltFluid, 144)}); + // Queen's Gold - pb.registerMaterialSet("queensgold", new ItemStack( - TinkerTools.toolShard, 1, 10), new ItemStack( - TinkerTools.toolRod, 1, 10), config.QueensGoldMatID); - - TConstructClientRegistry.addMaterialRenderMapping(config.QueensGoldMatID, "tinker", - "queensgold", true); - TConstructRegistry.addToolMaterial(config.QueensGoldMatID, "QueensGold", 3, 100, 500, 2, - 1.0F, 0, 0f, GOLD.toString(), 0xeaee57); + pb.registerMaterialSet("queensgold", new ItemStack(TinkerTools.toolShard, 1, 10), new ItemStack(TinkerTools.toolRod, 1, 10), config.QueensGoldMatID); + + TConstructClientRegistry.addMaterialRenderMapping(config.QueensGoldMatID, "tinker", "queensgold", true); + TConstructRegistry.addToolMaterial(config.QueensGoldMatID, "QueensGold", 3, 100, 500, 2, 1.0F, 0, 0f, GOLD.toString(), 0xeaee57); TinkerTools.registerPatternMaterial("QueensGoldIngot", 2, "QueensGold"); TConstructRegistry.addDefaultToolPartMaterial(config.QueensGoldMatID); - Smeltery.addMelting(new ItemStack(item_QueensGoldIngot, 1, 0), - block_QueensGoldBlock, 0, 500, new FluidStack(moltenQueensGold, - TConstruct.ingotLiquidValue)); - Smeltery.addMelting(block_QueensGoldBlock, 0, 500, new FluidStack( - moltenQueensGold, TConstruct.ingotLiquidValue * 9)); + Smeltery.addMelting(new ItemStack(item_QueensGoldIngot, 1, 0), block_QueensGoldBlock, 0, 500, new FluidStack(moltenQueensGold, TConstruct.ingotLiquidValue)); + Smeltery.addMelting(block_QueensGoldBlock, 0, 500, new FluidStack(moltenQueensGold, TConstruct.ingotLiquidValue * 9)); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(item_QueensGoldIngot, 1, 0), - new FluidStack(moltenQueensGold, TConstruct.ingotLiquidValue), - TConstructRegistry.getItemStack("ingotCast"), false, 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(item_QueensGoldIngot, 1, 0), new FluidStack(moltenQueensGold, TConstruct.ingotLiquidValue), TConstructRegistry.getItemStack("ingotCast"), false, 50); - TConstructRegistry.instance.getBasinCasting().addCastingRecipe( - new ItemStack(block_QueensGoldBlock, 1, 0), - new FluidStack(moltenQueensGold, - TConstruct.ingotLiquidValue * 9), 100); + TConstructRegistry.instance.getBasinCasting().addCastingRecipe(new ItemStack(block_QueensGoldBlock, 1, 0), new FluidStack(moltenQueensGold, TConstruct.ingotLiquidValue * 9), 100); castMolten(moltenQueensGold, config.QueensGoldMatID); - PatternBuilder.instance.registerFullMaterial(new ItemStack( - item_QueensGoldIngot, 1, 0), 2, "QueensGold", new ItemStack( - TinkerTools.toolShard, 1, config.QueensGoldMatID), new ItemStack( - TinkerTools.toolRod, 1, config.QueensGoldMatID), config.QueensGoldMatID); + PatternBuilder.instance.registerFullMaterial(new ItemStack(item_QueensGoldIngot, 1, 0), 2, "QueensGold", new ItemStack(TinkerTools.toolShard, 1, config.QueensGoldMatID), new ItemStack(TinkerTools.toolRod, 1, config.QueensGoldMatID), config.QueensGoldMatID); - Smeltery.addAlloyMixing( - new FluidStack(moltenQueensGold, 144 * 8), - new FluidStack[] { - new FluidStack(TinkerSmeltery.moltenGoldFluid, 144 * 8), - new FluidStack(TinkerSmeltery.moltenEmeraldFluid, 80) }); + Smeltery.addAlloyMixing(new FluidStack(moltenQueensGold, 144 * 8), new FluidStack[] {new FluidStack(TinkerSmeltery.moltenGoldFluid, 144 * 8), new FluidStack(TinkerSmeltery.moltenEmeraldFluid, 80)}); // Dogbearium - pb.registerMaterialSet("dogbearium", new ItemStack( - TinkerTools.toolShard, 1, 10), new ItemStack( - TinkerTools.toolRod, 1, 10), config.DogbeariumMatID); - - TConstructClientRegistry.addMaterialRenderMapping(config.DogbeariumMatID, "tinker", - "dogbearium", true); - TConstructRegistry.addToolMaterial(config.DogbeariumMatID, "Dogbearium", 4, 600, 800, 2, - 1.6F, 0, -2f, DARK_RED.toString(), 0x754200); + pb.registerMaterialSet("dogbearium", new ItemStack(TinkerTools.toolShard, 1, 10), new ItemStack(TinkerTools.toolRod, 1, 10), config.DogbeariumMatID); + + TConstructClientRegistry.addMaterialRenderMapping(config.DogbeariumMatID, "tinker", "dogbearium", true); + TConstructRegistry.addToolMaterial(config.DogbeariumMatID, "Dogbearium", 4, 600, 800, 2, 1.6F, 0, -2f, DARK_RED.toString(), 0x754200); TinkerTools.registerPatternMaterial("DogbeariumIngot", 2, "Dogbearium"); TConstructRegistry.addDefaultToolPartMaterial(config.DogbeariumMatID); - Smeltery.addMelting(new ItemStack(item_DogbeariumIngot, 1, 0), - block_DogbeariumBlock, 0, 500, new FluidStack(moltenDogbearium, - TConstruct.ingotLiquidValue)); - Smeltery.addMelting(block_DogbeariumBlock, 0, 500, new FluidStack( - moltenDogbearium, TConstruct.ingotLiquidValue * 9)); + Smeltery.addMelting(new ItemStack(item_DogbeariumIngot, 1, 0), block_DogbeariumBlock, 0, 500, new FluidStack(moltenDogbearium, TConstruct.ingotLiquidValue)); + Smeltery.addMelting(block_DogbeariumBlock, 0, 500, new FluidStack(moltenDogbearium, TConstruct.ingotLiquidValue * 9)); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(item_DogbeariumIngot, 1, 0), - new FluidStack(moltenDogbearium, TConstruct.ingotLiquidValue), - TConstructRegistry.getItemStack("ingotCast"), false, 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(item_DogbeariumIngot, 1, 0), new FluidStack(moltenDogbearium, TConstruct.ingotLiquidValue), TConstructRegistry.getItemStack("ingotCast"), false, 50); - TConstructRegistry.instance.getBasinCasting().addCastingRecipe( - new ItemStack(block_DogbeariumBlock, 1, 0), - new FluidStack(moltenDogbearium, - TConstruct.ingotLiquidValue * 9), 100); + TConstructRegistry.instance.getBasinCasting().addCastingRecipe(new ItemStack(block_DogbeariumBlock, 1, 0), new FluidStack(moltenDogbearium, TConstruct.ingotLiquidValue * 9), 100); castMolten(moltenDogbearium, config.DogbeariumMatID); - PatternBuilder.instance.registerFullMaterial(new ItemStack( - item_DogbeariumIngot, 1, 0), 2, "Dogbearium", new ItemStack( - TinkerTools.toolShard, 1, config.DogbeariumMatID), new ItemStack( - TinkerTools.toolRod, 1, config.DogbeariumMatID), config.DogbeariumMatID); - - Smeltery.addAlloyMixing(new FluidStack(moltenDogbearium, 144 * 2), - new FluidStack[] { - new FluidStack(TinkerSmeltery.moltenArditeFluid, 144), - new FluidStack(TinkerSmeltery.bloodFluid, 160), - new FluidStack(TinkerSmeltery.moltenEnderFluid, 250) }); - + PatternBuilder.instance.registerFullMaterial(new ItemStack(item_DogbeariumIngot, 1, 0), 2, "Dogbearium", new ItemStack(TinkerTools.toolShard, 1, config.DogbeariumMatID), new ItemStack(TinkerTools.toolRod, 1, config.DogbeariumMatID), config.DogbeariumMatID); + + Smeltery.addAlloyMixing(new FluidStack(moltenDogbearium, 144 * 2), new FluidStack[] {new FluidStack(TinkerSmeltery.moltenArditeFluid, 144), new FluidStack(TinkerSmeltery.bloodFluid, 160), new FluidStack(TinkerSmeltery.moltenEnderFluid, 250)}); + //Red Mint - pb.registerMaterialSet("RedMint", new ItemStack( - TinkerTools.toolShard, 1, 10), new ItemStack( - TinkerTools.toolRod, 1, 10), config.RedMintMatID); - - TConstructClientRegistry.addMaterialRenderMapping(config.RedMintMatID, "tinker", - "RedMint", true); - TConstructRegistry.addToolMaterial(config.RedMintMatID, "RedMint", 1, 50, 10, 0, - 0F, 0, 0f, DARK_RED.toString(), 0xFF0000); + pb.registerMaterialSet("RedMint", new ItemStack(TinkerTools.toolShard, 1, 10), new ItemStack(TinkerTools.toolRod, 1, 10), config.RedMintMatID); + + TConstructClientRegistry.addMaterialRenderMapping(config.RedMintMatID, "tinker", "RedMint", true); + TConstructRegistry.addToolMaterial(config.RedMintMatID, "RedMint", 1, 50, 10, 0, 0F, 0, 0f, DARK_RED.toString(), 0xFF0000); TinkerTools.registerPatternMaterial("RedMintIngot", 2, "RedMint"); TConstructRegistry.addDefaultToolPartMaterial(config.RedMintMatID); @@ -756,32 +617,19 @@ public class TinkersDefense { Smeltery.addMelting(new ItemStack(item_RedMintIngot, 1, 0), block_RedMintBlock, 0, 500, new FluidStack(moltenRedMint, TConstruct.ingotLiquidValue)); Smeltery.addMelting(block_RedMintBlock, 0, 500, new FluidStack(moltenRedMint, TConstruct.ingotLiquidValue * 9)); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(item_RedMintIngot, 1, 0), - new FluidStack(moltenRedMint, TConstruct.ingotLiquidValue), - TConstructRegistry.getItemStack("ingotCast"), false, 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(item_RedMintIngot, 1, 0), new FluidStack(moltenRedMint, TConstruct.ingotLiquidValue), TConstructRegistry.getItemStack("ingotCast"), false, 50); - TConstructRegistry.instance.getBasinCasting().addCastingRecipe( - new ItemStack(block_RedMintBlock, 1, 0), - new FluidStack(moltenRedMint, - TConstruct.ingotLiquidValue * 9), 100); + TConstructRegistry.instance.getBasinCasting().addCastingRecipe(new ItemStack(block_RedMintBlock, 1, 0), new FluidStack(moltenRedMint, TConstruct.ingotLiquidValue * 9), 100); castMolten(moltenRedMint, config.RedMintMatID); - PatternBuilder.instance.registerFullMaterial(new ItemStack( - item_RedMintcane, 1, 0), 2, "RedMint", new ItemStack( - TinkerTools.toolShard, 1, config.RedMintMatID), new ItemStack( - TinkerTools.toolRod, 1, config.RedMintMatID), config.RedMintMatID); + PatternBuilder.instance.registerFullMaterial(new ItemStack(item_RedMintcane, 1, 0), 2, "RedMint", new ItemStack(TinkerTools.toolShard, 1, config.RedMintMatID), new ItemStack(TinkerTools.toolRod, 1, config.RedMintMatID), config.RedMintMatID); //Green Mint - pb.registerMaterialSet("GreenMint", new ItemStack( - TinkerTools.toolShard, 1, 10), new ItemStack( - TinkerTools.toolRod, 1, 10), config.GreenMintMatID); - - TConstructClientRegistry.addMaterialRenderMapping(config.GreenMintMatID, "tinker", - "GreenMint", true); - TConstructRegistry.addToolMaterial(config.GreenMintMatID, "GreenMint", 1, 50, 10, 0, - 0F, 0, 0f, DARK_RED.toString(), 0x5bde4b); + pb.registerMaterialSet("GreenMint", new ItemStack(TinkerTools.toolShard, 1, 10), new ItemStack(TinkerTools.toolRod, 1, 10), config.GreenMintMatID); + + TConstructClientRegistry.addMaterialRenderMapping(config.GreenMintMatID, "tinker", "GreenMint", true); + TConstructRegistry.addToolMaterial(config.GreenMintMatID, "GreenMint", 1, 50, 10, 0, 0F, 0, 0f, DARK_RED.toString(), 0x5bde4b); TinkerTools.registerPatternMaterial("GreenMintIngot", 2, "GreenMint"); TConstructRegistry.addDefaultToolPartMaterial(config.GreenMintMatID); @@ -789,66 +637,48 @@ public class TinkersDefense { Smeltery.addMelting(new ItemStack(item_GreenMintIngot, 1, 0), block_GreenMintBlock, 0, 500, new FluidStack(moltenGreenMint, TConstruct.ingotLiquidValue)); Smeltery.addMelting(block_GreenMintBlock, 0, 500, new FluidStack(moltenGreenMint, TConstruct.ingotLiquidValue * 9)); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(item_GreenMintIngot, 1, 0), - new FluidStack(moltenGreenMint, TConstruct.ingotLiquidValue), - TConstructRegistry.getItemStack("ingotCast"), false, 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(item_GreenMintIngot, 1, 0), new FluidStack(moltenGreenMint, TConstruct.ingotLiquidValue), TConstructRegistry.getItemStack("ingotCast"), false, 50); - TConstructRegistry.instance.getBasinCasting().addCastingRecipe( - new ItemStack(block_GreenMintBlock, 1, 0), - new FluidStack(moltenGreenMint, - TConstruct.ingotLiquidValue * 9), 100); + TConstructRegistry.instance.getBasinCasting().addCastingRecipe(new ItemStack(block_GreenMintBlock, 1, 0), new FluidStack(moltenGreenMint, TConstruct.ingotLiquidValue * 9), 100); castMolten(moltenGreenMint, config.GreenMintMatID); - PatternBuilder.instance.registerFullMaterial(new ItemStack( - item_GreenMintcane, 1, 0), 2, "GreenMint", new ItemStack( - TinkerTools.toolShard, 1, config.GreenMintMatID), new ItemStack( - TinkerTools.toolRod, 1, config.GreenMintMatID), config.GreenMintMatID); + PatternBuilder.instance.registerFullMaterial(new ItemStack(item_GreenMintcane, 1, 0), 2, "GreenMint", new ItemStack(TinkerTools.toolShard, 1, config.GreenMintMatID), new ItemStack(TinkerTools.toolRod, 1, config.GreenMintMatID), config.GreenMintMatID); - //Cloth - TConstructRegistry.addCustomMaterial(new ClothMaterial(0, 2, new ItemStack(Blocks.wool,1,0), new ItemStack(TinkersDefense.partCloth,1,0), 0xffffff)); - TConstructRegistry.addCustomMaterial(new ClothMaterial(1, 2, new ItemStack(Blocks.wool,1,1), new ItemStack(TinkersDefense.partCloth,1,1), 0xe08c54)); - TConstructRegistry.addCustomMaterial(new ClothMaterial(2, 2, new ItemStack(Blocks.wool,1,2), new ItemStack(TinkersDefense.partCloth,1,2), 0xc16bc9)); - TConstructRegistry.addCustomMaterial(new ClothMaterial(3, 2, new ItemStack(Blocks.wool,1,3), new ItemStack(TinkersDefense.partCloth,1,3), 0x8ba4d6)); - TConstructRegistry.addCustomMaterial(new ClothMaterial(4, 2, new ItemStack(Blocks.wool,1,4), new ItemStack(TinkersDefense.partCloth,1,4), 0xcfc231)); - TConstructRegistry.addCustomMaterial(new ClothMaterial(5, 2, new ItemStack(Blocks.wool,1,5), new ItemStack(TinkersDefense.partCloth,1,5), 0x50c447)); - TConstructRegistry.addCustomMaterial(new ClothMaterial(6, 2, new ItemStack(Blocks.wool,1,6), new ItemStack(TinkersDefense.partCloth,1,6), 0xdea5b3)); - TConstructRegistry.addCustomMaterial(new ClothMaterial(7, 2, new ItemStack(Blocks.wool,1,7), new ItemStack(TinkersDefense.partCloth,1,7), 0x494949)); - TConstructRegistry.addCustomMaterial(new ClothMaterial(8, 2, new ItemStack(Blocks.wool,1,8), new ItemStack(TinkersDefense.partCloth,1,8), 0xb6baba)); - TConstructRegistry.addCustomMaterial(new ClothMaterial(9, 2, new ItemStack(Blocks.wool,1,9), new ItemStack(TinkersDefense.partCloth,1,9), 0x3782a1)); - TConstructRegistry.addCustomMaterial(new ClothMaterial(10, 2, new ItemStack(Blocks.wool,1,10), new ItemStack(TinkersDefense.partCloth,1,10), 0x9453c9)); - TConstructRegistry.addCustomMaterial(new ClothMaterial(11, 2, new ItemStack(Blocks.wool,1,11), new ItemStack(TinkersDefense.partCloth,1,11), 0x3543a6)); - TConstructRegistry.addCustomMaterial(new ClothMaterial(12, 2, new ItemStack(Blocks.wool,1,12), new ItemStack(TinkersDefense.partCloth,1,12), 0x5c3a24)); - TConstructRegistry.addCustomMaterial(new ClothMaterial(13, 2, new ItemStack(Blocks.wool,1,13), new ItemStack(TinkersDefense.partCloth,1,13), 0x3e5420)); - TConstructRegistry.addCustomMaterial(new ClothMaterial(14, 2, new ItemStack(Blocks.wool,1,14), new ItemStack(TinkersDefense.partCloth,1,14), 0xb03e38)); - TConstructRegistry.addCustomMaterial(new ClothMaterial(15, 2, new ItemStack(Blocks.wool,1,15), new ItemStack(TinkersDefense.partCloth,1,15), 0x242222)); - - + TConstructRegistry.addCustomMaterial(new ClothMaterial(0, 2, new ItemStack(Blocks.wool, 1, 0), new ItemStack(TinkersDefense.partCloth, 1, 0), 0xffffff)); + TConstructRegistry.addCustomMaterial(new ClothMaterial(1, 2, new ItemStack(Blocks.wool, 1, 1), new ItemStack(TinkersDefense.partCloth, 1, 1), 0xe08c54)); + TConstructRegistry.addCustomMaterial(new ClothMaterial(2, 2, new ItemStack(Blocks.wool, 1, 2), new ItemStack(TinkersDefense.partCloth, 1, 2), 0xc16bc9)); + TConstructRegistry.addCustomMaterial(new ClothMaterial(3, 2, new ItemStack(Blocks.wool, 1, 3), new ItemStack(TinkersDefense.partCloth, 1, 3), 0x8ba4d6)); + TConstructRegistry.addCustomMaterial(new ClothMaterial(4, 2, new ItemStack(Blocks.wool, 1, 4), new ItemStack(TinkersDefense.partCloth, 1, 4), 0xcfc231)); + TConstructRegistry.addCustomMaterial(new ClothMaterial(5, 2, new ItemStack(Blocks.wool, 1, 5), new ItemStack(TinkersDefense.partCloth, 1, 5), 0x50c447)); + TConstructRegistry.addCustomMaterial(new ClothMaterial(6, 2, new ItemStack(Blocks.wool, 1, 6), new ItemStack(TinkersDefense.partCloth, 1, 6), 0xdea5b3)); + TConstructRegistry.addCustomMaterial(new ClothMaterial(7, 2, new ItemStack(Blocks.wool, 1, 7), new ItemStack(TinkersDefense.partCloth, 1, 7), 0x494949)); + TConstructRegistry.addCustomMaterial(new ClothMaterial(8, 2, new ItemStack(Blocks.wool, 1, 8), new ItemStack(TinkersDefense.partCloth, 1, 8), 0xb6baba)); + TConstructRegistry.addCustomMaterial(new ClothMaterial(9, 2, new ItemStack(Blocks.wool, 1, 9), new ItemStack(TinkersDefense.partCloth, 1, 9), 0x3782a1)); + TConstructRegistry.addCustomMaterial(new ClothMaterial(10, 2, new ItemStack(Blocks.wool, 1, 10), new ItemStack(TinkersDefense.partCloth, 1, 10), 0x9453c9)); + TConstructRegistry.addCustomMaterial(new ClothMaterial(11, 2, new ItemStack(Blocks.wool, 1, 11), new ItemStack(TinkersDefense.partCloth, 1, 11), 0x3543a6)); + TConstructRegistry.addCustomMaterial(new ClothMaterial(12, 2, new ItemStack(Blocks.wool, 1, 12), new ItemStack(TinkersDefense.partCloth, 1, 12), 0x5c3a24)); + TConstructRegistry.addCustomMaterial(new ClothMaterial(13, 2, new ItemStack(Blocks.wool, 1, 13), new ItemStack(TinkersDefense.partCloth, 1, 13), 0x3e5420)); + TConstructRegistry.addCustomMaterial(new ClothMaterial(14, 2, new ItemStack(Blocks.wool, 1, 14), new ItemStack(TinkersDefense.partCloth, 1, 14), 0xb03e38)); + TConstructRegistry.addCustomMaterial(new ClothMaterial(15, 2, new ItemStack(Blocks.wool, 1, 15), new ItemStack(TinkersDefense.partCloth, 1, 15), 0x242222)); + // Shields - TConstructRegistry.addToolRecipe(tool_roundShield, - partArmorplate, TinkerTools.toolRod, - TinkerTools.frypanHead); + TConstructRegistry.addToolRecipe(tool_roundShield, partArmorplate, TinkerTools.toolRod, TinkerTools.frypanHead); - TConstructRegistry.addToolRecipe(tool_heaterShield, - partArmorplate, TinkerTools.toughRod, - partArmorplate, partRivet); + TConstructRegistry.addToolRecipe(tool_heaterShield, partArmorplate, TinkerTools.toughRod, partArmorplate, partRivet); // Wrench - TConstructRegistry.addToolRecipe(tool_wrench, TinkerTools.handGuard, - TinkerTools.toolRod, TinkerTools.binding); - - TConstructRegistry.addToolRecipe(tool_shears, TinkerTools.knifeBlade, - TinkerTools.binding, TinkerTools.knifeBlade); - + TConstructRegistry.addToolRecipe(tool_wrench, TinkerTools.handGuard, TinkerTools.toolRod, TinkerTools.binding); + + TConstructRegistry.addToolRecipe(tool_shears, TinkerTools.knifeBlade, TinkerTools.binding, TinkerTools.knifeBlade); + //Zweihander -// TConstructRegistry.addToolRecipe(tool_zweihander, TinkerTools.largeSwordBlade, -// TinkerTools.toughRod, TinkerTools.wideGuard, TinkerTools.swordBlade); - + TConstructRegistry.addToolRecipe(tool_zweihander, TinkerTools.largeSwordBlade, TinkerTools.toughRod, TinkerTools.wideGuard, TinkerTools.swordBlade); + //Armor -// TConstructRegistry.addToolRecipe(tool_sheath, partArmorplate,TinkerTools.toolRod, partCloth, partClasp); -// TConstructRegistry.addToolRecipe(tool_mask, partArmorplate, partCloth, partClasp); + // TConstructRegistry.addToolRecipe(tool_sheath, partArmorplate,TinkerTools.toolRod, partCloth, partClasp); + // TConstructRegistry.addToolRecipe(tool_mask, partArmorplate, partCloth, partClasp); TConstructRegistry.addToolRecipe(armor_TinkerHelm, TinkerTools.frypanHead, TinkerTools.toughRod, partArmorplate); TConstructRegistry.addToolRecipe(armor_TinkerBreastplate, TinkerTools.largePlate, TinkerTools.toughRod, partArmorplate, partChainmaille); @@ -859,149 +689,73 @@ public class TinkersDefense { TConstructRegistry.addToolRecipe(armor_TinkerShawl, partCloth, partCloth, partClasp); TConstructRegistry.addToolRecipe(armor_TinkerHood, partCloth, partCloth, partRivet); TConstructRegistry.addToolRecipe(armor_TinkerShoes, partCloth, partClasp, partRivet); - + TConstructRegistry.addToolRecipe(armor_TinkerCoif, partChainmaille, partCloth, TinkerTools.toughRod); TConstructRegistry.addToolRecipe(armor_TinkerHalberd, partChainmaille, partArmorplate, partRivet); TConstructRegistry.addToolRecipe(armor_TinkerChausses, partChainmaille, partArmorplate); TConstructRegistry.addToolRecipe(armor_TinkerBoots, partChainmaille, partCloth, partRivet); - - tcInject = new ArrayList(); - + + tcInject = new ArrayList(); + for(int i = 0; i < TConstructRegistry.tools.size(); i++) { if(!(TConstructRegistry.tools.get(i) instanceof Injector)) { - tcInject.add(new Injector(i,TConstructRegistry.tools.get(i), injectLoc)); - GameRegistry.registerItem(tcInject.get(i), "debugger_"+TConstructRegistry.tools.get(i).getLocalizedToolName()); + tcInject.add(new Injector(i, TConstructRegistry.tools.get(i), injectLoc)); + GameRegistry.registerItem(tcInject.get(i), "debugger_" + TConstructRegistry.tools.get(i).getLocalizedToolName()); } } + + //AMEvent.init(); } @EventHandler - public void postInit(FMLPostInitializationEvent e) { - List list = ModifyBuilder.instance.itemModifiers; - list = ModifyBuilder.instance.itemModifiers; + public void postInit(FMLPostInitializationEvent e) + { + // List list = ModifyBuilder.instance.itemModifiers; + // list = ModifyBuilder.instance.itemModifiers; } - public void castMolten(Fluid fluid, int ID) { + public void castMolten(Fluid fluid, int ID) + { // .addCastingRecipe(output, fluid, cast, hardeningDelay) - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(TinkerTools.toolRod, 1, ID), - new FluidStack(fluid, (int) (144 * 0.5D)), - TConstructRegistry.getItemStack("toolRodCast"), 50); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(TinkerTools.pickaxeHead, 1, ID), - new FluidStack(fluid, (int) (144 * 1.0D)), - TConstructRegistry.getItemStack("pickaxeHeadCast"), 50); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(TinkerTools.shovelHead, 1, ID), - new FluidStack(fluid, (int) (144 * 1.0D)), - TConstructRegistry.getItemStack("shovelHeadCast"), 50); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(TinkerTools.hatchetHead, 1, ID), - new FluidStack(fluid, (int) (144 * 1.0D)), - TConstructRegistry.getItemStack("hatchetHeadCast"), 50); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(TinkerTools.swordBlade, 1, ID), - new FluidStack(fluid, (int) (144 * 1.0D)), - TConstructRegistry.getItemStack("swordBladeCast"), 50); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(TinkerTools.fullGuard, 1, ID), - new FluidStack(fluid, (int) (144 * 3.0D)), - TConstructRegistry.getItemStack("fullGuardCast"), 50); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(TinkerTools.wideGuard, 1, ID), - new FluidStack(fluid, (int) (144 * 0.5D)), - TConstructRegistry.getItemStack("wideGuardCast"), 50); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(TinkerTools.crossbar, 1, ID), - new FluidStack(fluid, (int) (144 * 0.5D)), - TConstructRegistry.getItemStack("crossbarCast"), 50); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(TinkerTools.binding, 1, ID), - new FluidStack(fluid, (int) (144 * 0.5D)), - TConstructRegistry.getItemStack("bindingCast"), 50); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(TinkerTools.handGuard, 1, ID), - new FluidStack(fluid, (int) (144 * 0.5D)), - TConstructRegistry.getItemStack("handGuardCast"), 50); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(TinkerTools.frypanHead, 1, ID), - new FluidStack(fluid, (int) (144 * 1.0D)), - TConstructRegistry.getItemStack("frypanHeadCast"), 50); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(TinkerTools.signHead, 1, ID), - new FluidStack(fluid, (int) (144 * 1.0D)), - TConstructRegistry.getItemStack("signHeadCast"), 50); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(TinkerTools.knifeBlade, 1, ID), - new FluidStack(fluid, (int) (144 * 0.5D)), - TConstructRegistry.getItemStack("knifeBladeCast"), 50); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(TinkerTools.chiselHead, 1, ID), - new FluidStack(fluid, (int) (144 * 0.5D)), - TConstructRegistry.getItemStack("chiselHeadCast"), 50); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(TinkerTools.toughRod, 1, ID), - new FluidStack(fluid, (int) (144 * 3.0D)), - TConstructRegistry.getItemStack("toughRodCast"), 50); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(TinkerTools.toughBinding, 1, ID), - new FluidStack(fluid, (int) (144 * 3.0D)), - TConstructRegistry.getItemStack("toughBindingCast"), 50); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(TinkerTools.largePlate, 1, ID), - new FluidStack(fluid, (int) (144 * 8.0D)), - TConstructRegistry.getItemStack("largePlateCast"), 50); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(TinkerTools.broadAxeHead, 1, ID), - new FluidStack(fluid, (int) (144 * 8.0D)), - TConstructRegistry.getItemStack("broadAxeHeadCast"), 50); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(TinkerTools.scytheBlade, 1, ID), - new FluidStack(fluid, (int) (144 * 8.0D)), - TConstructRegistry.getItemStack("scytheHeadCast"), 50); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(TinkerTools.excavatorHead, 1, ID), - new FluidStack(fluid, (int) (144 * 8.0D)), - TConstructRegistry.getItemStack("excavatorHeadCast"), 50); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(TinkerTools.largeSwordBlade, 1, ID), - new FluidStack(fluid, (int) (144 * 8.0D)), - TConstructRegistry.getItemStack("largeBladeCast"), 50); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(TinkerTools.hammerHead, 1, ID), - new FluidStack(fluid, (int) (144 * 8.0D)), - TConstructRegistry.getItemStack("hammerHeadCast"), 50); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(TinkerTools.arrowhead, 1, ID), - new FluidStack(fluid, (int) (144 * 1.0D)), - TConstructRegistry.getItemStack("arrowheadCast"), 50); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(partArmorplate, 1, ID), - new FluidStack(fluid, (int) (144 * 4.0D)), - new ItemStack(metalPattern, 1, 2), 50); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(partRivet, 1, ID), - new FluidStack(fluid, (int) (144 * 0.5D)), - new ItemStack(metalPattern, 1, 0), 50); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(partClasp, 1, ID), - new FluidStack(fluid, (int) (144 * 1.0D)), - new ItemStack(metalPattern, 1, 1), 50); - TConstructRegistry.instance.getTableCasting().addCastingRecipe( - new ItemStack(partChainmaille, 1, ID), - new FluidStack(fluid, (int) (144 * 4.0D)), - new ItemStack(metalPattern, 1, 3), 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(TinkerTools.toolRod, 1, ID), new FluidStack(fluid, (int) (144 * 0.5D)), TConstructRegistry.getItemStack("toolRodCast"), 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(TinkerTools.pickaxeHead, 1, ID), new FluidStack(fluid, (int) (144 * 1.0D)), TConstructRegistry.getItemStack("pickaxeHeadCast"), 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(TinkerTools.shovelHead, 1, ID), new FluidStack(fluid, (int) (144 * 1.0D)), TConstructRegistry.getItemStack("shovelHeadCast"), 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(TinkerTools.hatchetHead, 1, ID), new FluidStack(fluid, (int) (144 * 1.0D)), TConstructRegistry.getItemStack("hatchetHeadCast"), 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(TinkerTools.swordBlade, 1, ID), new FluidStack(fluid, (int) (144 * 1.0D)), TConstructRegistry.getItemStack("swordBladeCast"), 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(TinkerTools.fullGuard, 1, ID), new FluidStack(fluid, (int) (144 * 3.0D)), TConstructRegistry.getItemStack("fullGuardCast"), 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(TinkerTools.wideGuard, 1, ID), new FluidStack(fluid, (int) (144 * 0.5D)), TConstructRegistry.getItemStack("wideGuardCast"), 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(TinkerTools.crossbar, 1, ID), new FluidStack(fluid, (int) (144 * 0.5D)), TConstructRegistry.getItemStack("crossbarCast"), 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(TinkerTools.binding, 1, ID), new FluidStack(fluid, (int) (144 * 0.5D)), TConstructRegistry.getItemStack("bindingCast"), 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(TinkerTools.handGuard, 1, ID), new FluidStack(fluid, (int) (144 * 0.5D)), TConstructRegistry.getItemStack("handGuardCast"), 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(TinkerTools.frypanHead, 1, ID), new FluidStack(fluid, (int) (144 * 1.0D)), TConstructRegistry.getItemStack("frypanHeadCast"), 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(TinkerTools.signHead, 1, ID), new FluidStack(fluid, (int) (144 * 1.0D)), TConstructRegistry.getItemStack("signHeadCast"), 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(TinkerTools.knifeBlade, 1, ID), new FluidStack(fluid, (int) (144 * 0.5D)), TConstructRegistry.getItemStack("knifeBladeCast"), 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(TinkerTools.chiselHead, 1, ID), new FluidStack(fluid, (int) (144 * 0.5D)), TConstructRegistry.getItemStack("chiselHeadCast"), 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(TinkerTools.toughRod, 1, ID), new FluidStack(fluid, (int) (144 * 3.0D)), TConstructRegistry.getItemStack("toughRodCast"), 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(TinkerTools.toughBinding, 1, ID), new FluidStack(fluid, (int) (144 * 3.0D)), TConstructRegistry.getItemStack("toughBindingCast"), 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(TinkerTools.largePlate, 1, ID), new FluidStack(fluid, (int) (144 * 8.0D)), TConstructRegistry.getItemStack("largePlateCast"), 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(TinkerTools.broadAxeHead, 1, ID), new FluidStack(fluid, (int) (144 * 8.0D)), TConstructRegistry.getItemStack("broadAxeHeadCast"), 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(TinkerTools.scytheBlade, 1, ID), new FluidStack(fluid, (int) (144 * 8.0D)), TConstructRegistry.getItemStack("scytheHeadCast"), 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(TinkerTools.excavatorHead, 1, ID), new FluidStack(fluid, (int) (144 * 8.0D)), TConstructRegistry.getItemStack("excavatorHeadCast"), 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(TinkerTools.largeSwordBlade, 1, ID), new FluidStack(fluid, (int) (144 * 8.0D)), TConstructRegistry.getItemStack("largeBladeCast"), 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(TinkerTools.hammerHead, 1, ID), new FluidStack(fluid, (int) (144 * 8.0D)), TConstructRegistry.getItemStack("hammerHeadCast"), 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(TinkerTools.arrowhead, 1, ID), new FluidStack(fluid, (int) (144 * 1.0D)), TConstructRegistry.getItemStack("arrowheadCast"), 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(partArmorplate, 1, ID), new FluidStack(fluid, (int) (144 * 4.0D)), new ItemStack(metalPattern, 1, 2), 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(partRivet, 1, ID), new FluidStack(fluid, (int) (144 * 0.5D)), new ItemStack(metalPattern, 1, 0), 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(partClasp, 1, ID), new FluidStack(fluid, (int) (144 * 1.0D)), new ItemStack(metalPattern, 1, 1), 50); + TConstructRegistry.instance.getTableCasting().addCastingRecipe(new ItemStack(partChainmaille, 1, ID), new FluidStack(fluid, (int) (144 * 4.0D)), new ItemStack(metalPattern, 1, 3), 50); } - public void buildParts(Item item, int meta) { - int[] nonMetals = { 0, 1, 3, 4, 5, 6, 7, 8, 9, 17 }; - int[] liquidDamage = new int[] { 2, 13, 10, 11, 12, 14, 15, 6, 16, 18 }; + public void buildParts(Item item, int meta) + { + int[] nonMetals = {0, 1, 3, 4, 5, 6, 7, 8, 9, 17}; + int[] liquidDamage = new int[] {2, 13, 10, 11, 12, 14, 15, 6, 16, 18}; - for (int mat = 0; mat < nonMetals.length; mat++) { - TConstructRegistry.addPartMapping(woodPattern, meta, mat, - new ItemStack(item, 1, mat)); + for(int mat = 0; mat < nonMetals.length; mat++) + { + TConstructRegistry.addPartMapping(woodPattern, meta, mat, new ItemStack(item, 1, mat)); } LiquidCasting tableCasting = TConstructRegistry.getTableCasting(); @@ -1010,37 +764,28 @@ public class TinkersDefense { ItemStack cast = new ItemStack(metalPattern, 1, meta); - tableCasting.addCastingRecipe(cast, - new FluidStack(TinkerSmeltery.moltenAlubrassFluid, - TConstruct.ingotLiquidValue), new ItemStack(item, 1, - Short.MAX_VALUE), false, 50); - tableCasting.addCastingRecipe(cast, - new FluidStack(TinkerSmeltery.moltenGoldFluid, - TConstruct.ingotLiquidValue * 2), new ItemStack(item, - 1, Short.MAX_VALUE), false, 50); + tableCasting.addCastingRecipe(cast, new FluidStack(TinkerSmeltery.moltenAlubrassFluid, TConstruct.ingotLiquidValue), new ItemStack(item, 1, Short.MAX_VALUE), false, 50); + tableCasting.addCastingRecipe(cast, new FluidStack(TinkerSmeltery.moltenGoldFluid, TConstruct.ingotLiquidValue * 2), new ItemStack(item, 1, Short.MAX_VALUE), false, 50); - for (int iterTwo = 0; iterTwo < TinkerSmeltery.liquids.length; iterTwo++) { + for(int iterTwo = 0; iterTwo < TinkerSmeltery.liquids.length; iterTwo++) + { Fluid fs = TinkerSmeltery.liquids[iterTwo].getFluid(); - int fluidAmount = metalPattern.getPatternCost(cast) - * TConstruct.ingotLiquidValue / 2; + int fluidAmount = metalPattern.getPatternCost(cast) * TConstruct.ingotLiquidValue / 2; ItemStack metalCast = new ItemStack(item, 1, liquidDamage[iterTwo]); - tableCasting.addCastingRecipe(metalCast, new FluidStack(fs, - fluidAmount), cast, 50); - Smeltery.addMelting(FluidType.getFluidType(fs), metalCast, 0, - fluidAmount); + tableCasting.addCastingRecipe(metalCast, new FluidStack(fs, fluidAmount), cast, 50); + Smeltery.addMelting(FluidType.getFluidType(fs), metalCast, 0, fluidAmount); } } - + public static int[] hexToRGB(String hex) { int color[] = new int[3]; - + color[0] = Integer.parseInt(hex.substring(0, 2), 16); color[1] = Integer.parseInt(hex.substring(2, 4), 16); color[2] = Integer.parseInt(hex.substring(4, 6), 16); - + return color; } } - diff --git a/src/main/java/lance5057/tDefense/addons/TDAddonBotania.java b/src/main/java/lance5057/tDefense/addons/TDAddonBotania.java index fc28e7e..3911fe9 100644 --- a/src/main/java/lance5057/tDefense/addons/TDAddonBotania.java +++ b/src/main/java/lance5057/tDefense/addons/TDAddonBotania.java @@ -2,9 +2,6 @@ package lance5057.tDefense.addons; import lance5057.tDefense.TinkersDefense; import lance5057.tDefense.core.tools.modifiers.Botania.modifierCorpseIvy; -import lance5057.tDefense.core.tools.modifiers.weapons.modifierDaze; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; @@ -15,63 +12,48 @@ import vazkii.botania.api.BotaniaAPI; import vazkii.botania.common.item.ModItems; import vazkii.botania.common.item.block.ItemBlockSpecialFlower; import vazkii.botania.common.lib.LibBlockNames; -import vazkii.botania.common.lib.LibItemNames; import vazkii.botania.common.lib.LibOreDict; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.GameRegistry; -public class TDAddonBotania { - boolean active; - - Item corpseIvyGraft; - Item corpseIvy; - +public class TDAddonBotania +{ + boolean active; + + Item corpseIvyGraft; + Item corpseIvy; + public TDAddonBotania() { active = false; - + if(Loader.isModLoaded("Botania")) { active = true; - + LoadItems(); } } - + public void LoadItems() { - corpseIvyGraft = new Item() - .setUnlocalizedName("corpseivygraft") - .setCreativeTab(TinkersDefense.tabName) - .setTextureName("tinkersdefense:corpseIvyGraft"); - - corpseIvy = new Item() - .setUnlocalizedName("corpseivy") - .setCreativeTab(TinkersDefense.tabName) - .setTextureName("tinkersdefense:corpseIvy"); - + corpseIvyGraft = new Item().setUnlocalizedName("corpseivygraft").setCreativeTab(TinkersDefense.tabName).setTextureName("tinkersdefense:corpseIvyGraft"); + + corpseIvy = new Item().setUnlocalizedName("corpseivy").setCreativeTab(TinkersDefense.tabName).setTextureName("tinkersdefense:corpseIvy"); + GameRegistry.registerItem(corpseIvyGraft, "corpseivygraft"); GameRegistry.registerItem(corpseIvy, "corpseivy"); } - + public void RegisterRecipes() { - CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(corpseIvyGraft), - new Object[] { - "fsf", - "oio", - "fgf", - 'f', ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_BELLETHORN), - 'i', new ItemStack(ModItems.keepIvy, 1, 0), - 's', LibOreDict.MANA_STRING, - 'g', new ItemStack(TinkerTools.craftedSoil,1,3), - 'o', new ItemStack(ModItems.fertilizer,1,1)})); - - BotaniaAPI.registerManaAlchemyRecipe(new ItemStack(corpseIvy,1,0), new ItemStack(corpseIvyGraft,1,0), 100000); + CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(corpseIvyGraft), new Object[] {"fsf", "oio", "fgf", 'f', ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_BELLETHORN), 'i', new ItemStack(ModItems.keepIvy, 1, 0), 's', LibOreDict.MANA_STRING, 'g', new ItemStack(TinkerTools.craftedSoil, 1, 3), 'o', new ItemStack(ModItems.fertilizer, 1, 1)})); + + BotaniaAPI.registerManaAlchemyRecipe(new ItemStack(corpseIvy, 1, 0), new ItemStack(corpseIvyGraft, 1, 0), 100000); } - + public void RegisterModifiers() { - ModifyBuilder.registerModifier(new modifierCorpseIvy("Corpse Ivy", TinkersDefense.config.CorpseIvyModID, new ItemStack[] { new ItemStack(corpseIvy)}, new int[] {1})); + ModifyBuilder.registerModifier(new modifierCorpseIvy("Corpse Ivy", TinkersDefense.config.CorpseIvyModID, new ItemStack[] {new ItemStack(corpseIvy)}, new int[] {1})); } } diff --git a/src/main/java/lance5057/tDefense/armor/ArmorCore.java b/src/main/java/lance5057/tDefense/armor/ArmorCore.java index 63abd7f..f43cc46 100644 --- a/src/main/java/lance5057/tDefense/armor/ArmorCore.java +++ b/src/main/java/lance5057/tDefense/armor/ArmorCore.java @@ -1,7 +1,6 @@ package lance5057.tDefense.armor; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import lance5057.tDefense.armor.modifiers.ArmorMods; import net.minecraft.client.model.ModelBiped; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -9,95 +8,84 @@ 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.ChatComponentText; import net.minecraft.util.DamageSource; -import net.minecraft.util.IChatComponent; -import net.minecraft.util.MathHelper; -import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.common.ISpecialArmor; -import scala.Int; -import tconstruct.library.accessory.IAccessoryModel; import tconstruct.library.tools.AbilityHelper; import tconstruct.library.tools.ToolCore; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class ArmorCore extends ToolCore implements ISpecialArmor +{ + int slot; + public float reductionPercent = 0f; + protected int maxReduction = 100; + ArmorMods amod; -public class ArmorCore extends ToolCore implements ISpecialArmor//, IAccessoryModel -{ - int slot; - protected Double reductionPercent = 0.0; - protected int maxReduction = 0; - - public ArmorCore(int baseProtection, int slot) { + public ArmorCore(int baseProtection, int slot) + { super(baseProtection); - + this.slot = slot; + amod = new ArmorMods(); } - -// @Override -// public void onUpdate(ItemStack stack, World world, Entity entity, int par4, -// boolean par5) { -// super.onUpdate(stack, world, entity, par4, par5); -// -// } @Override - public ArmorProperties getProperties(EntityLivingBase player, - ItemStack armor, DamageSource source, double damage, int slot) + public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { - NBTTagCompound tags = armor.getTagCompound().getCompoundTag("InfiTool"); - - Double enhancedPercent = reductionPercent; - - if(tags.hasKey("Protection")) - enhancedPercent += (calcModifierDamage(tags.getInteger("Protection"), 0.75f, source) * 0.04); - - ArmorProperties armorp = new ArmorProperties(0, enhancedPercent, maxReduction); //0.04 per half shirt - ((EntityPlayer)player).addChatComponentMessage(new ChatComponentText(source.getDamageType() + - " - Max: " + Double.toString(damage) + - " - ReductPerc: " + Double.toString(reductionPercent) + - " - EnhancedPerc: " + Double.toString(enhancedPercent))); + ArmorProperties armorp; + if(!source.isUnblockable()) + { + armorp = new ArmorProperties(0, reductionPercent, maxReduction); // 0.04 + // per + // half + // shirt + } + else + armorp = new ArmorProperties(0, 0, 0); + return armorp; } - + @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { - return 0; + return (int) ((int) reductionPercent / 0.04); } - + public int getSlot() { return slot; } - + @SideOnly(Side.CLIENT) public ModelBiped getModel(String[] color, NBTTagCompound tags) { return null; } - + @Override - public boolean isValidArmor(ItemStack stack, int armorType, Entity entity) + public boolean isValidArmor(ItemStack stack, int armorType, Entity entity) { return armorType == slot; } @Override - public void damageArmor(EntityLivingBase entity, ItemStack stack, - DamageSource source, int damage, int slot) { + public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) + { AbilityHelper.damageTool(stack, damage, entity, false); } - + @Override @SideOnly(Side.CLIENT) - public ModelBiped getArmorModel(EntityLivingBase entityLiving, - ItemStack itemStack, int armorSlot) + public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) { return null; } @Override - public Item getAccessoryItem() + public Item getAccessoryItem() { return null; } @@ -109,46 +97,34 @@ public class ArmorCore extends ToolCore implements ISpecialArmor//, IAccessoryMo } @Override - public String getEffectSuffix() + public String getEffectSuffix() { return null; } @Override - public Item getHeadItem() + public Item getHeadItem() { return null; } @Override - public String getIconSuffix(int arg0) + public String getIconSuffix(int arg0) { return null; } @Override - public String[] getTraits() { + public String[] getTraits() + { return new String[] {"armor"}; } -// @Override -// public ResourceLocation getWearbleTexture(Entity arg0, ItemStack arg1, -// int arg2) { -// // TODO Auto-generated method stub -// return null; -// } - - public int calcModifierDamage(int level, float typeMod, DamageSource source) - { - if (source.canHarmInCreative()) - { - return 0; - } - else - { - float f = (float)(6 + level * level) / 3.0F; - return MathHelper.floor_float(f * typeMod); - } - } + @Override + public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) + { + + amod.UpdateAll((ToolCore) itemStack.getItem(), itemStack, world, player, itemStack.getTagCompound().getCompoundTag("InfiTool")); + } } diff --git a/src/main/java/lance5057/tDefense/armor/blocks/GlowstoneCrumbs.java b/src/main/java/lance5057/tDefense/armor/blocks/GlowstoneCrumbs.java new file mode 100644 index 0000000..3bbe32e --- /dev/null +++ b/src/main/java/lance5057/tDefense/armor/blocks/GlowstoneCrumbs.java @@ -0,0 +1,120 @@ +package lance5057.tDefense.armor.blocks; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Random; +import java.util.Set; + +import lance5057.tDefense.Reference; +import lance5057.tDefense.TinkersDefense; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.Direction; +import net.minecraft.util.IIcon; +import net.minecraft.world.ChunkPosition; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +public class GlowstoneCrumbs extends Block +{ + public GlowstoneCrumbs() + { + super(Material.ground); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F); + this.setBlockName("glowstonecrumbs"); + this.setBlockTextureName(Reference.MOD_ID + ":glowstonecrumbs"); + this.setLightLevel(1f); + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) + { + return null; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 23; + } + + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) + { + return null; + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) + { + return super.canPlaceBlockAt(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && this.canBlockStay(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_); + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor Block + */ + public void onNeighborBlockChange(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_) + { + super.onNeighborBlockChange(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, p_149695_5_); + this.checkAndDropBlock(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_); + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) + { + this.checkAndDropBlock(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_); + } + + /** + * checks if the block can stay, if not drop as item + */ + protected void checkAndDropBlock(World p_149855_1_, int p_149855_2_, int p_149855_3_, int p_149855_4_) + { + if(!this.canBlockStay(p_149855_1_, p_149855_2_, p_149855_3_, p_149855_4_)) + { + p_149855_1_.setBlock(p_149855_2_, p_149855_3_, p_149855_4_, getBlockById(0), 0, 2); + } + } + + /** + * Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants. + */ + public boolean canBlockStay(World p_149718_1_, int p_149718_2_, int p_149718_3_, int p_149718_4_) + { + return p_149718_1_.getBlock(p_149718_2_, p_149718_3_ - 1, p_149718_4_).isNormalCube(p_149718_1_, p_149718_2_, p_149718_3_ - 1, p_149718_4_) && !p_149718_1_.getBlock(p_149718_2_, p_149718_3_ - 1, p_149718_4_).isAir(p_149718_1_, p_149718_2_, p_149718_3_ - 1, p_149718_4_); + } +} diff --git a/src/main/java/lance5057/tDefense/armor/blocks/UnstableBlock.java b/src/main/java/lance5057/tDefense/armor/blocks/UnstableBlock.java new file mode 100644 index 0000000..f98206e --- /dev/null +++ b/src/main/java/lance5057/tDefense/armor/blocks/UnstableBlock.java @@ -0,0 +1,103 @@ +package lance5057.tDefense.armor.blocks; + +import java.util.List; +import java.util.Random; + +import lance5057.tDefense.Reference; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class UnstableBlock extends Block +{ + public static final String[] types = {"ice", "obsidian"}; + public int timer; + + public static final String[] field_150096_a = new String[] {"ice", "obsidian"}; + @SideOnly(Side.CLIENT) + private IIcon[] field_150095_b; + + public UnstableBlock() + { + super(Material.rock); + this.setBlockName("unstable"); + this.setBlockTextureName("unstable"); + this.setTickRandomly(true); + } + + /** + * Gets the block's texture. Args: side, meta + */ + @SideOnly(Side.CLIENT) + public IIcon getIcon(int p_149691_1_, int p_149691_2_) + { + if(p_149691_2_ < 0 || p_149691_2_ >= this.field_150095_b.length) + { + p_149691_2_ = 0; + } + + return this.field_150095_b[p_149691_2_]; + } + + /** + * Determines the damage on the item the block drops. Used in cloth and + * wood. + */ + public int damageDropped(int p_149692_1_) + { + return p_149692_1_; + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood + * returns 4 blocks) + */ + @SideOnly(Side.CLIENT) + public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_) + { + p_149666_3_.add(new ItemStack(p_149666_1_, 1, 0)); + p_149666_3_.add(new ItemStack(p_149666_1_, 1, 1)); + } + + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister p_149651_1_) + { + this.field_150095_b = new IIcon[field_150096_a.length]; + + for(int i = 0; i < this.field_150095_b.length; ++i) + { + this.field_150095_b[i] = p_149651_1_.registerIcon(Reference.MOD_ID + ":" + this.getTextureName() + field_150096_a[i]); + } + } + + @SideOnly(Side.CLIENT) + public int getRenderBlockPass() + { + return 1; + } + + @Override + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + int meta = par1World.getBlockMetadata(par2, par3, par4); + + if(meta == 0) + { + par1World.setBlock(par2, par3, par4, Blocks.water, 0, 3); + } + if(meta == 1) + { + par1World.setBlock(par2, par3, par4, Blocks.lava, 0, 3); + } + par1World.notifyBlockOfNeighborChange(par2, par3, par4, par1World.getBlock(par2, par3, par4)); + } +} diff --git a/src/main/java/lance5057/tDefense/armor/blocks/UnstableItemBlock.java b/src/main/java/lance5057/tDefense/armor/blocks/UnstableItemBlock.java new file mode 100644 index 0000000..0b1c18d --- /dev/null +++ b/src/main/java/lance5057/tDefense/armor/blocks/UnstableItemBlock.java @@ -0,0 +1,21 @@ +package lance5057.tDefense.armor.blocks; + +import lance5057.tDefense.TinkersDefense; +import net.minecraft.block.Block; +import net.minecraft.item.ItemBlockWithMetadata; +import net.minecraft.item.ItemStack; + +public class UnstableItemBlock extends ItemBlockWithMetadata +{ + + public UnstableItemBlock(Block block) + { + super(block, block); + } + + @Override + public String getUnlocalizedName(ItemStack stack) + { + return this.getUnlocalizedName() + "_" + ((UnstableBlock) TinkersDefense.block_Unstable).types[stack.getItemDamage()]; + } +} diff --git a/src/main/java/lance5057/tDefense/armor/events/ArmorModEvents.java b/src/main/java/lance5057/tDefense/armor/events/ArmorModEvents.java index d077565..2db5a65 100644 --- a/src/main/java/lance5057/tDefense/armor/events/ArmorModEvents.java +++ b/src/main/java/lance5057/tDefense/armor/events/ArmorModEvents.java @@ -1,17 +1,93 @@ package lance5057.tDefense.armor.events; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import lance5057.tDefense.armor.ArmorCore; +import lance5057.tDefense.armor.modifiers.ArmorMods; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ChatComponentText; -import net.minecraftforge.client.event.RenderPlayerEvent; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; import net.minecraftforge.event.entity.living.LivingHurtEvent; +import tconstruct.library.tools.ToolCore; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.TickEvent; -public class ArmorModEvents +public class ArmorModEvents { @SubscribeEvent public void AddProtections(LivingHurtEvent event) { -// if(event.entityLiving instanceof EntityPlayer) -// ((EntityPlayer)event.entity).addChatComponentMessage(new ChatComponentText("Damage Recieved:" + Double.toString(event.ammount))); + int epf = 0; + + if(event.entityLiving instanceof EntityPlayer) + { + ((EntityPlayer) event.entityLiving).addChatComponentMessage(new ChatComponentText(event.source.getDamageType() + " - Max: " + Double.toString(event.ammount))); + } + + for(int i = 0; i < 4; i++) + { + ItemStack armor = event.entityLiving.getEquipmentInSlot(i + 1); + if(armor != null && armor.getItem() instanceof ArmorCore) + { + NBTTagCompound tags = armor.getTagCompound().getCompoundTag("InfiTool"); + + if(!event.source.isUnblockable()) + { + if(tags.hasKey("Protection")) + epf += (calcModifierDamage(tags.getInteger("Protection"), 1f, event.source)); + else if(tags.hasKey("Fire Protection") && event.source.isFireDamage()) + epf += (calcModifierDamage(tags.getInteger("Fire Protection"), 2f, event.source)); + else if(tags.hasKey("Blast Protection") && event.source.isExplosion()) + epf += (calcModifierDamage(tags.getInteger("Blast Protection"), 2f, event.source)); + else if(tags.hasKey("Projectile Protection") && event.source.isProjectile()) + epf += (calcModifierDamage(tags.getInteger("Projectile Protection"), 2f, event.source)); + } + else if(tags.hasKey("Featherfall") && event.source.getDamageType() == event.source.fall.getDamageType()) + epf += (calcModifierDamage(tags.getInteger("Featherfall"), 3f, event.source)); + } + } + + if(epf > 20) + epf = 20; + + float adjustedPerc = (float) (1f - (epf * 0.04)); + event.ammount = adjustedPerc * event.ammount; + + if(event.entityLiving instanceof EntityPlayer) + { + ((EntityPlayer) event.entityLiving).addChatComponentMessage(new ChatComponentText(event.source.getDamageType() + " - Adjusted: " + Double.toString(event.ammount))); + } + } + + // @SubscribeEvent + // public void playerTick(TickEvent.PlayerTickEvent event) + // { + // for(int i = 0; i < 4; i++) + // { + // EntityPlayer entity = event.player; + // World world = entity.worldObj; + // ItemStack stack = entity.getCurrentArmor(i); + // + // if(stack.getItem() instanceof ToolCore) + // { + // ToolCore tool = (ToolCore) stack.getItem(); + // NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool"); + // } + // } + // } + + public int calcModifierDamage(int level, float typeMod, DamageSource source) + { + if(source.canHarmInCreative()) + { + return 0; + } + else + { + float f = (float) (6 + level * level) / 3.0F; + return MathHelper.floor_float(f * typeMod); + } } } diff --git a/src/main/java/lance5057/tDefense/armor/events/ArmorRenderEvent.java b/src/main/java/lance5057/tDefense/armor/events/ArmorRenderEvent.java index 42810b1..9accd4f 100644 --- a/src/main/java/lance5057/tDefense/armor/events/ArmorRenderEvent.java +++ b/src/main/java/lance5057/tDefense/armor/events/ArmorRenderEvent.java @@ -3,6 +3,7 @@ package lance5057.tDefense.armor.events; import lance5057.tDefense.armor.ArmorCore; import net.minecraft.client.model.ModelBiped; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumAction; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.client.event.RenderPlayerEvent; @@ -15,51 +16,69 @@ public class ArmorRenderEvent @SideOnly(Side.CLIENT) @SubscribeEvent - public void renderArmorEvent(RenderPlayerEvent.SetArmorModel event) { - if (event.entityPlayer != null) + public void renderArmorEvent(RenderPlayerEvent.SetArmorModel event) + { + if(event.entityPlayer != null) { - for(int i = 0; i < 4 ; i++) + for(int i = 0; i < 4; i++) { if(event.entityPlayer.inventory.armorItemInSlot(i) != null) { ItemStack Armor = event.entityPlayer.inventory.armorItemInSlot(i); NBTTagCompound tags = Armor.getTagCompound(); - + if(Armor.getItem() instanceof ArmorCore) { - ArmorCore AArmor = (ArmorCore)Armor.getItem(); - String color[] = new String[10]; - - for(int j = 0; j<10; j++) - color[j] = Integer.toHexString(AArmor.getColorFromItemStack(Armor, j)); - - ModelBiped armorModel = AArmor.getModel(color, tags); - - if (armorModel != null) { + ArmorCore AArmor = (ArmorCore) Armor.getItem(); + ModelBiped armorModel = AArmor.getArmorModel(event.entityLiving, Armor, AArmor.getSlot()); + + if(armorModel != null) + { armorModel.isSneak = event.entityPlayer.isSneaking(); armorModel.isRiding = event.entityPlayer.isRiding(); armorModel.isChild = event.entityPlayer.isChild(); - armorModel.heldItemRight = event.entityPlayer.getHeldItem() != null ? 1 - : 0; - if (event.entityPlayer instanceof EntityPlayer) { - armorModel.aimedBow = ((EntityPlayer) event.entityPlayer) - .getItemInUseDuration() > 2; + armorModel.onGround = event.entityPlayer.getSwingProgress(event.partialRenderTick); + + if(event.entityPlayer instanceof EntityPlayer) + { + ItemStack itemstack = event.entityPlayer.inventory.getCurrentItem(); + armorModel.heldItemRight = 0; + armorModel.aimedBow = false; + if(itemstack != null) + { + if(event.entityPlayer.getItemInUseCount() > 0) + { + EnumAction enumaction = itemstack.getItemUseAction(); + + if(enumaction == EnumAction.block) + { + armorModel.heldItemRight = 3; + } + else if(enumaction == EnumAction.bow) + { + armorModel.aimedBow = true; + } + } + else + { + armorModel.heldItemRight = event.entityPlayer.getHeldItem() != null ? 1 : 0; + } + } } } - + float yaw = event.entityPlayer.prevRotationYawHead + (event.entityPlayer.rotationYawHead - event.entityPlayer.prevRotationYawHead) * event.partialRenderTick; float yawOffset = event.entityPlayer.prevRenderYawOffset + (event.entityPlayer.renderYawOffset - event.entityPlayer.prevRenderYawOffset) * event.partialRenderTick; - float limbs = event.entityPlayer.prevLimbSwingAmount + (event.entityPlayer.limbSwingAmount - event.entityPlayer.prevLimbSwingAmount) * event.partialRenderTick; - float limbSwing = event.entityPlayer.limbSwing - event.entityPlayer.limbSwingAmount * (1.0F - event.partialRenderTick); - - armorModel.render(event.entityPlayer, limbSwing, limbs,event.entityPlayer.ticksExisted , - yaw - yawOffset - , event.entityPlayer.rotationPitch, 0.1f); + float limbs = event.entityPlayer.prevLimbSwingAmount + (event.entityPlayer.limbSwingAmount - event.entityPlayer.prevLimbSwingAmount) * event.partialRenderTick; + float limbSwing = event.entityPlayer.limbSwing - event.entityPlayer.limbSwingAmount * (1.0F - event.partialRenderTick); + + armorModel.setRotationAngles(limbSwing, limbs, event.entityPlayer.ticksExisted, yaw - yawOffset, event.entityPlayer.rotationPitch, 0.1f, event.entityPlayer); + armorModel.render(event.entityPlayer, limbSwing, limbs, event.entityPlayer.ticksExisted, yaw - yawOffset, event.entityPlayer.rotationPitch, 0.1f); } } } } } - + } diff --git a/src/main/java/lance5057/tDefense/armor/items/Mask.java b/src/main/java/lance5057/tDefense/armor/items/Mask.java index da6ca4c..c9557a0 100644 --- a/src/main/java/lance5057/tDefense/armor/items/Mask.java +++ b/src/main/java/lance5057/tDefense/armor/items/Mask.java @@ -14,7 +14,7 @@ import tconstruct.library.tools.ToolCore; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class Mask extends ToolCore implements IAccessoryModel,IAccessory +public class Mask extends ToolCore implements IAccessoryModel, IAccessory { public Mask() @@ -23,86 +23,94 @@ public class Mask extends ToolCore implements IAccessoryModel,IAccessory } @Override - public boolean canEquipAccessory(ItemStack item, int slot) + public boolean canEquipAccessory(ItemStack item, int slot) { return slot == 0; } - + @Override - @SideOnly(Side.CLIENT) - public ModelBiped getArmorModel (EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) - { + @SideOnly(Side.CLIENT) + public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) + { String color[] = new String[10]; - - for(int i = 0; i<10; i++) + + for(int i = 0; i < 10; i++) color[i] = Integer.toHexString(this.getColorFromItemStack(itemStack, i)); - - return new ModelMask(color); - } - + + return new ModelMask(color); + } + @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, - String type) { + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) + { return "tinkersdefense:textures/armor/Mask/_mask_face.png"; } - - ResourceLocation texture = new ResourceLocation("tinkersdefense", "textures/armor/Mask/_mask_face.png"); - + + ResourceLocation texture = new ResourceLocation("tinkersdefense", "textures/armor/Mask/_mask_face.png"); + @Override - @SideOnly(Side.CLIENT) - public ResourceLocation getWearbleTexture (Entity entity, ItemStack stack, int slot) - { - return texture; - } + @SideOnly(Side.CLIENT) + public ResourceLocation getWearbleTexture(Entity entity, ItemStack stack, int slot) + { + return texture; + } @Override - public Item getAccessoryItem() { + public Item getAccessoryItem() + { // TODO Auto-generated method stub return null; } @Override - public String getDefaultFolder() { + public String getDefaultFolder() + { // TODO Auto-generated method stub return "Armor/Mask"; } @Override - public String getEffectSuffix() { + public String getEffectSuffix() + { return "_mask_effect"; } @Override - public Item getHeadItem() { + public Item getHeadItem() + { // TODO Auto-generated method stub return null; } - + @SideOnly(Side.CLIENT) @Override - public int getPartAmount() { + public int getPartAmount() + { return 3; } @Override - public String getIconSuffix(int partType) { - switch (partType) { - case 0: - return "_mask_face"; - case 1: - return "hurdur"; //useless - case 2: - return "_mask_clasp"; - case 3: - return "_mask_strap"; - default: - return ""; + public String getIconSuffix(int partType) + { + switch(partType) + { + case 0: + return "_mask_face"; + case 1: + return "hurdur"; //useless + case 2: + return "_mask_clasp"; + case 3: + return "_mask_strap"; + default: + return ""; } } @Override - public String[] getTraits() { - return new String[] { "mask", "cosmetic" }; + public String[] getTraits() + { + return new String[] {"mask", "cosmetic"}; } } diff --git a/src/main/java/lance5057/tDefense/armor/items/Sheath.java b/src/main/java/lance5057/tDefense/armor/items/Sheath.java index f96d90a..b631d1b 100644 --- a/src/main/java/lance5057/tDefense/armor/items/Sheath.java +++ b/src/main/java/lance5057/tDefense/armor/items/Sheath.java @@ -13,7 +13,7 @@ import tconstruct.library.tools.ToolCore; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class Sheath extends ToolCore implements IAccessoryModel,IAccessory +public class Sheath extends ToolCore implements IAccessoryModel, IAccessory { public Sheath() @@ -22,88 +22,96 @@ public class Sheath extends ToolCore implements IAccessoryModel,IAccessory } @Override - public boolean canEquipAccessory(ItemStack item, int slot) + public boolean canEquipAccessory(ItemStack item, int slot) { return slot == 3; } - + @Override - @SideOnly(Side.CLIENT) - public ModelBiped getArmorModel (EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) - { + @SideOnly(Side.CLIENT) + public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) + { String color[] = new String[10]; - - for(int i = 0; i<10; i++) + + for(int i = 0; i < 10; i++) color[i] = Integer.toHexString(this.getColorFromItemStack(itemStack, i)); - - return new ModelSheath(color); - } - + + return new ModelSheath(color); + } + @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, - String type) { + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) + { return "tinkersdefense:textures/armor/Sheath/_sheath_base.png"; } - - ResourceLocation texture = new ResourceLocation("tinkersdefense", "textures/armor/Sheath/_sheath_base.png"); - + + ResourceLocation texture = new ResourceLocation("tinkersdefense", "textures/armor/Sheath/_sheath_base.png"); + @Override - @SideOnly(Side.CLIENT) - public ResourceLocation getWearbleTexture (Entity entity, ItemStack stack, int slot) - { - return texture; - } + @SideOnly(Side.CLIENT) + public ResourceLocation getWearbleTexture(Entity entity, ItemStack stack, int slot) + { + return texture; + } @Override - public Item getAccessoryItem() { + public Item getAccessoryItem() + { // TODO Auto-generated method stub return null; } @Override - public String getDefaultFolder() { + public String getDefaultFolder() + { // TODO Auto-generated method stub return "Armor/Sheath"; } @Override - public String getEffectSuffix() { + public String getEffectSuffix() + { return "_sheath_effect"; } @Override - public Item getHeadItem() { + public Item getHeadItem() + { // TODO Auto-generated method stub return null; } - + @SideOnly(Side.CLIENT) @Override - public int getPartAmount() { + public int getPartAmount() + { return 4; } @Override - public String getIconSuffix(int partType) { - switch (partType) { - case 0: - return "_sheath_base"; - case 1: - return "_shield_base_broken"; //useless - case 2: - return "_sheath_filigree"; - case 3: - return "_sheath_belt"; - case 4: - return "_sheath_clasp"; - default: - return ""; + public String getIconSuffix(int partType) + { + switch(partType) + { + case 0: + return "_sheath_base"; + case 1: + return "_shield_base_broken"; //useless + case 2: + return "_sheath_filigree"; + case 3: + return "_sheath_belt"; + case 4: + return "_sheath_clasp"; + default: + return ""; } } @Override - public String[] getTraits() { - return new String[] { "sheath", "cosmetic" }; + public String[] getTraits() + { + return new String[] {"sheath", "cosmetic"}; } } diff --git a/src/main/java/lance5057/tDefense/armor/items/cloth/TinkersHood.java b/src/main/java/lance5057/tDefense/armor/items/cloth/TinkersHood.java index daa71f6..98a17bb 100644 --- a/src/main/java/lance5057/tDefense/armor/items/cloth/TinkersHood.java +++ b/src/main/java/lance5057/tDefense/armor/items/cloth/TinkersHood.java @@ -18,122 +18,131 @@ import net.minecraftforge.common.ISpecialArmor.ArmorProperties; import tconstruct.library.TConstructRegistry; import tconstruct.library.tools.CustomMaterial; -public class TinkersHood extends ArmorCore +public class TinkersHood extends ArmorCore { - public TinkersHood() { - super(0,0); + public TinkersHood() + { + super(0, 0); this.setUnlocalizedName("tinkershood"); } - + @Override - public Item getHeadItem() + public Item getHeadItem() { return TinkersDefense.partCloth; } - + @Override - public Item getHandleItem() { + public Item getHandleItem() + { return TinkersDefense.partCloth; } - + @Override - public Item getAccessoryItem() + public Item getAccessoryItem() { return TinkersDefense.partRivet; } - + @Override - public int durabilityTypeAccessory() { + public int durabilityTypeAccessory() + { return 1; } @Override - public float getRepairCost() { + public float getRepairCost() + { return 1.0f; } @Override - public float getDurabilityModifier() { + public float getDurabilityModifier() + { return 1f; } - + @Override - public float getDamageModifier() { + public float getDamageModifier() + { return 1f; } @Override - public int getPartAmount() { + public int getPartAmount() + { return 3; } - + @Override - public String getIconSuffix(int partType) - { - switch (partType) { - case 0: - return "_hood_cloth"; - case 1: - return "_hood_cloth_broken"; - case 2: - return "_hood_trim"; - case 3: - return "_hood_rivet"; - default: - return ""; + public String getIconSuffix(int partType) + { + switch(partType) + { + case 0: + return "_hood_cloth"; + case 1: + return "_hood_cloth_broken"; + case 2: + return "_hood_trim"; + case 3: + return "_hood_rivet"; + default: + return ""; } } - + @Override - public String getEffectSuffix() + public String getEffectSuffix() { return "_hood_effect"; } - + @Override public String getDefaultFolder() { return "armor/hood"; } - -// @Override -// public void onUpdate(ItemStack stack, World world, Entity entity, int par4, -// boolean par5) { -// super.onUpdate(stack, world, entity, par4, par5); -// -// } + + // @Override + // public void onUpdate(ItemStack stack, World world, Entity entity, int par4, + // boolean par5) { + // super.onUpdate(stack, world, entity, par4, par5); + // + // } @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, - String type) { + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) + { return "tinkersdefense:textures/armor/TinkersHood.png"; } - + @Override - public String[] getTraits() { - return new String[] {"armor","helmet","hood","cloth"}; + public String[] getTraits() + { + return new String[] {"armor", "helmet", "hood", "cloth"}; } @Override @SideOnly(Side.CLIENT) - public ModelBiped getModel(String[] color,NBTTagCompound tags) + public ModelBiped getModel(String[] color, NBTTagCompound tags) { - String[] textures = {this.getIconSuffix(2),this.getIconSuffix(0),this.getIconSuffix(3)}; - + String[] textures = {this.getIconSuffix(2), this.getIconSuffix(0), this.getIconSuffix(3)}; + int HeadID = tags.getCompoundTag("InfiTool").getInteger("RenderHead"); int HandleID = tags.getCompoundTag("InfiTool").getInteger("RenderHandle"); - + CustomMaterial newColor = TConstructRegistry.getCustomMaterial(HeadID, ClothMaterial.class); color[1] = Integer.toHexString(newColor.color); - + newColor = TConstructRegistry.getCustomMaterial(HandleID, ClothMaterial.class); color[0] = Integer.toHexString(newColor.color); return new ModelTinkersHood(color, this.getDefaultFolder(), textures); } - + @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { return 0; } diff --git a/src/main/java/lance5057/tDefense/armor/items/cloth/TinkersRobe.java b/src/main/java/lance5057/tDefense/armor/items/cloth/TinkersRobe.java index 0961b57..d963c1d 100644 --- a/src/main/java/lance5057/tDefense/armor/items/cloth/TinkersRobe.java +++ b/src/main/java/lance5057/tDefense/armor/items/cloth/TinkersRobe.java @@ -15,114 +15,123 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -public class TinkersRobe extends ArmorCore +public class TinkersRobe extends ArmorCore { - public TinkersRobe() { - super(0,2); + public TinkersRobe() + { + super(0, 2); this.setUnlocalizedName("tinkerrobe"); } - + @Override - public Item getHeadItem() + public Item getHeadItem() { return TinkersDefense.partCloth; } - + @Override - public Item getHandleItem() { + public Item getHandleItem() + { return TinkersDefense.partCloth; } - + @Override - public int durabilityTypeAccessory() { + public int durabilityTypeAccessory() + { return 1; } @Override - public float getRepairCost() { + public float getRepairCost() + { return 1.0f; } @Override - public float getDurabilityModifier() { + public float getDurabilityModifier() + { return 1f; } - + @Override - public float getDamageModifier() { + public float getDamageModifier() + { return 1f; } @Override - public int getPartAmount() { + public int getPartAmount() + { return 2; } - + @Override - public String getIconSuffix(int partType) + public String getIconSuffix(int partType) { - switch (partType) { - case 0: - return "_robe_cloth"; - case 1: - return "_robe_cloth_broken"; - case 2: - return "_robe_trim"; - default: - return ""; + switch(partType) + { + case 0: + return "_robe_cloth"; + case 1: + return "_robe_cloth_broken"; + case 2: + return "_robe_trim"; + default: + return ""; } } - + @Override - public String getEffectSuffix() + public String getEffectSuffix() { return "_robe_effect"; } - + @Override public String getDefaultFolder() { return "armor/robe"; } - -// @Override -// public void onUpdate(ItemStack stack, World world, Entity entity, int par4, -// boolean par5) { -// super.onUpdate(stack, world, entity, par4, par5); -// -// } + + // @Override + // public void onUpdate(ItemStack stack, World world, Entity entity, int par4, + // boolean par5) { + // super.onUpdate(stack, world, entity, par4, par5); + // + // } @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, - String type) { + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) + { return "tinkersdefense:textures/armor/TinkersRobe.png"; } - + @Override - public String[] getTraits() { - return new String[] {"armor","pants","robe","cloth"}; + public String[] getTraits() + { + return new String[] {"armor", "pants", "robe", "cloth"}; } @Override @SideOnly(Side.CLIENT) - public ModelBiped getModel(String[] color,NBTTagCompound tags) + public ModelBiped getModel(String[] color, NBTTagCompound tags) { - String[] textures = {this.getIconSuffix(2),this.getIconSuffix(0)}; - + String[] textures = {this.getIconSuffix(2), this.getIconSuffix(0)}; + int HeadID = tags.getCompoundTag("InfiTool").getInteger("RenderHead"); int HandleID = tags.getCompoundTag("InfiTool").getInteger("RenderHandle"); CustomMaterial newColor = TConstructRegistry.getCustomMaterial(HeadID, ClothMaterial.class); color[1] = Integer.toHexString(newColor.color); - + newColor = TConstructRegistry.getCustomMaterial(HandleID, ClothMaterial.class); color[0] = Integer.toHexString(newColor.color); - + return new ModelTinkersRobe(color, this.getDefaultFolder(), textures); } - + @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { return 0; } diff --git a/src/main/java/lance5057/tDefense/armor/items/cloth/TinkersShawl.java b/src/main/java/lance5057/tDefense/armor/items/cloth/TinkersShawl.java index 97341a1..76b5ae9 100644 --- a/src/main/java/lance5057/tDefense/armor/items/cloth/TinkersShawl.java +++ b/src/main/java/lance5057/tDefense/armor/items/cloth/TinkersShawl.java @@ -17,122 +17,131 @@ import tconstruct.library.TConstructRegistry; import tconstruct.library.tools.CustomMaterial; import tconstruct.tools.TinkerTools; -public class TinkersShawl extends ArmorCore +public class TinkersShawl extends ArmorCore { - public TinkersShawl() { - super(0,1); + public TinkersShawl() + { + super(0, 1); this.setUnlocalizedName("tinkersshawl"); } - + @Override - public Item getHeadItem() + public Item getHeadItem() { return TinkersDefense.partCloth; } - + @Override - public Item getHandleItem() { + public Item getHandleItem() + { return TinkersDefense.partCloth; } - + @Override - public Item getAccessoryItem() + public Item getAccessoryItem() { return TinkersDefense.partClasp; } - + @Override - public int durabilityTypeAccessory() { + public int durabilityTypeAccessory() + { return 1; } @Override - public float getRepairCost() { + public float getRepairCost() + { return 1f; } @Override - public float getDurabilityModifier() { + public float getDurabilityModifier() + { return 1f; } - + @Override - public float getDamageModifier() { + public float getDamageModifier() + { return 1f; } @Override - public int getPartAmount() { + public int getPartAmount() + { return 3; } - + @Override - public String getIconSuffix(int partType) - { - switch (partType) { - case 0: - return "_shawl_cloth"; - case 1: - return "_shawl_cloth_broken"; - case 2: - return "_shawl_trim"; - case 3: - return "_shawl_clasp"; - default: - return ""; + public String getIconSuffix(int partType) + { + switch(partType) + { + case 0: + return "_shawl_cloth"; + case 1: + return "_shawl_cloth_broken"; + case 2: + return "_shawl_trim"; + case 3: + return "_shawl_clasp"; + default: + return ""; } } - + @Override - public String getEffectSuffix() + public String getEffectSuffix() { return "_shawl_effect"; } - + @Override public String getDefaultFolder() { return "armor/shawl"; } - -// @Override -// public void onUpdate(ItemStack stack, World world, Entity entity, int par4, -// boolean par5) { -// super.onUpdate(stack, world, entity, par4, par5); -// -// } + + // @Override + // public void onUpdate(ItemStack stack, World world, Entity entity, int par4, + // boolean par5) { + // super.onUpdate(stack, world, entity, par4, par5); + // + // } @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, - String type) { + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) + { return "tinkersdefense:textures/armor/TinkersShawl.png"; } - + @Override - public String[] getTraits() { - return new String[] {"armor","chest","shawl","cloth"}; + public String[] getTraits() + { + return new String[] {"armor", "chest", "shawl", "cloth"}; } @Override @SideOnly(Side.CLIENT) - public ModelBiped getModel(String[] color,NBTTagCompound tags) + public ModelBiped getModel(String[] color, NBTTagCompound tags) { - String[] textures = {this.getIconSuffix(2),this.getIconSuffix(0),this.getIconSuffix(3)}; - + String[] textures = {this.getIconSuffix(2), this.getIconSuffix(0), this.getIconSuffix(3)}; + int HeadID = tags.getCompoundTag("InfiTool").getInteger("RenderHead"); int HandleID = tags.getCompoundTag("InfiTool").getInteger("RenderHandle"); CustomMaterial newColor = TConstructRegistry.getCustomMaterial(HeadID, ClothMaterial.class); color[1] = Integer.toHexString(newColor.color); - + newColor = TConstructRegistry.getCustomMaterial(HandleID, ClothMaterial.class); color[0] = Integer.toHexString(newColor.color); - + return new ModelTinkersShawl(color, this.getDefaultFolder(), textures); } - + @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { return 0; } diff --git a/src/main/java/lance5057/tDefense/armor/items/cloth/TinkersShoes.java b/src/main/java/lance5057/tDefense/armor/items/cloth/TinkersShoes.java index d842647..0ab18d1 100644 --- a/src/main/java/lance5057/tDefense/armor/items/cloth/TinkersShoes.java +++ b/src/main/java/lance5057/tDefense/armor/items/cloth/TinkersShoes.java @@ -15,118 +15,127 @@ import net.minecraft.nbt.NBTTagCompound; import tconstruct.library.TConstructRegistry; import tconstruct.library.tools.CustomMaterial; -public class TinkersShoes extends ArmorCore +public class TinkersShoes extends ArmorCore { - public TinkersShoes() { - super(0,3); + public TinkersShoes() + { + super(0, 3); this.setUnlocalizedName("tinkersshoes"); } - + @Override - public Item getHeadItem() + public Item getHeadItem() { return TinkersDefense.partCloth; } - + @Override - public Item getHandleItem() { + public Item getHandleItem() + { return TinkersDefense.partClasp; } - + @Override - public Item getAccessoryItem() + public Item getAccessoryItem() { return TinkersDefense.partRivet; } - + @Override - public int durabilityTypeAccessory() { + public int durabilityTypeAccessory() + { return 1; } @Override - public float getRepairCost() { + public float getRepairCost() + { return 1.0f; } @Override - public float getDurabilityModifier() { + public float getDurabilityModifier() + { return 1f; } - + @Override - public float getDamageModifier() { + public float getDamageModifier() + { return 1f; } @Override - public int getPartAmount() { + public int getPartAmount() + { return 3; } - + @Override - public String getIconSuffix(int partType) - { - switch (partType) { - case 0: - return "_shoes_cloth"; - case 1: - return "_shoes_cloth_broken"; - case 2: - return "_shoes_clasp"; - case 3: - return "_shoes_rivet"; - default: - return ""; + public String getIconSuffix(int partType) + { + switch(partType) + { + case 0: + return "_shoes_cloth"; + case 1: + return "_shoes_cloth_broken"; + case 2: + return "_shoes_clasp"; + case 3: + return "_shoes_rivet"; + default: + return ""; } } - + @Override - public String getEffectSuffix() + public String getEffectSuffix() { return "_shoes_effect"; } - + @Override public String getDefaultFolder() { return "armor/shoes"; } - -// @Override -// public void onUpdate(ItemStack stack, World world, Entity entity, int par4, -// boolean par5) { -// super.onUpdate(stack, world, entity, par4, par5); -// -// } + + // @Override + // public void onUpdate(ItemStack stack, World world, Entity entity, int par4, + // boolean par5) { + // super.onUpdate(stack, world, entity, par4, par5); + // + // } @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, - String type) { + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) + { return "tinkersdefense:textures/armor/TinkersShoes.png"; } - + @Override - public String[] getTraits() { - return new String[] {"armor","helmet","shoes","cloth"}; + public String[] getTraits() + { + return new String[] {"armor", "feet", "shoes", "cloth"}; } @Override @SideOnly(Side.CLIENT) - public ModelBiped getModel(String[] color,NBTTagCompound tags) + public ModelBiped getModel(String[] color, NBTTagCompound tags) { - String[] textures = {this.getIconSuffix(2),this.getIconSuffix(0),this.getIconSuffix(3)}; - + String[] textures = {this.getIconSuffix(2), this.getIconSuffix(0), this.getIconSuffix(3)}; + int HeadID = tags.getCompoundTag("InfiTool").getInteger("RenderHead"); - + CustomMaterial newColor = TConstructRegistry.getCustomMaterial(HeadID, ClothMaterial.class); color[1] = Integer.toHexString(newColor.color); - + return (ModelBiped) new ModelTinkersBoots(color, this.getDefaultFolder(), textures); } - + @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { return 0; } diff --git a/src/main/java/lance5057/tDefense/armor/items/heavy/TinkersBreastplate.java b/src/main/java/lance5057/tDefense/armor/items/heavy/TinkersBreastplate.java index d3fce5d..2195951 100644 --- a/src/main/java/lance5057/tDefense/armor/items/heavy/TinkersBreastplate.java +++ b/src/main/java/lance5057/tDefense/armor/items/heavy/TinkersBreastplate.java @@ -6,6 +6,7 @@ import lance5057.tDefense.TinkersDefense; import lance5057.tDefense.armor.ArmorCore; import lance5057.tDefense.armor.renderers.heavy.ModelTinkersBreastplate; import lance5057.tDefense.armor.renderers.heavy.ModelTinkersHelm; +import lance5057.tDefense.proxy.ClientProxy; import net.minecraft.client.model.ModelBiped; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -18,124 +19,133 @@ import net.minecraft.world.World; import net.minecraftforge.common.ISpecialArmor.ArmorProperties; import tconstruct.tools.TinkerTools; -public class TinkersBreastplate extends ArmorCore +public class TinkersBreastplate extends ArmorCore { - public TinkersBreastplate() { - super(2,1); - this.setUnlocalizedName("tinkershelm"); + public TinkersBreastplate() + { + super(2, 1); + this.setUnlocalizedName("tinkersbreastplate"); this.maxReduction = 100; - this.reductionPercent = 0.32; + reductionPercent = 8 * 0.04f; } - + @Override - public Item getHeadItem() + public Item getHeadItem() { return TinkerTools.largePlate; } - + @Override - public Item getHandleItem() { + public Item getHandleItem() + { return TinkerTools.toughRod; } - + @Override - public Item getAccessoryItem() + public Item getAccessoryItem() { return TinkersDefense.partArmorplate; } - + @Override public Item getExtraItem() { return TinkersDefense.partChainmaille; } - + @Override - public int durabilityTypeAccessory() { + public int durabilityTypeAccessory() + { return 2; } @Override - public float getRepairCost() { + public float getRepairCost() + { return 4.0f; } @Override - public float getDurabilityModifier() { + public float getDurabilityModifier() + { return 2.5f; } - + @Override - public float getDamageModifier() { + public float getDamageModifier() + { return 1.4f; } @Override - public int getPartAmount() { + public int getPartAmount() + { return 4; } - + @Override - public String getIconSuffix(int partType) - { - switch (partType) { - case 0: - return "_breastplate_plate"; - case 1: - return "_breastplate_plate_broken"; - case 2: - return "_breastplate_trim"; - case 3: - return "_breastplate_smallplate"; - case 4: - return "_breastplate_chain"; - default: - return ""; + public String getIconSuffix(int partType) + { + switch(partType) + { + case 0: + return "_breastplate_plate"; + case 1: + return "_breastplate_plate_broken"; + case 2: + return "_breastplate_trim"; + case 3: + return "_breastplate_smallplate"; + case 4: + return "_breastplate_chain"; + default: + return ""; } } - + @Override - public String getEffectSuffix() + public String getEffectSuffix() { return "_breastplate_effect"; } - + @Override public String getDefaultFolder() { return "armor/breastplate"; } - -// @Override -// public void onUpdate(ItemStack stack, World world, Entity entity, int par4, -// boolean par5) { -// super.onUpdate(stack, world, entity, par4, par5); -// -// } + + // @Override + // public void onUpdate(ItemStack stack, World world, Entity entity, int + // par4, + // boolean par5) { + // super.onUpdate(stack, world, entity, par4, par5); + // + // } @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, - String type) { + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) + { return "tinkersdefense:textures/armor/Tinkersbreastplate.png"; } - - @Override - public String[] getTraits() { - return new String[] {"armor","chest","breastplate","heavyarmor"}; - } @Override - @SideOnly(Side.CLIENT) - public ModelBiped getModel(String[] color,NBTTagCompound tags) + public String[] getTraits() { - String[] textures = {this.getIconSuffix(2),this.getIconSuffix(0),this.getIconSuffix(3), this.getIconSuffix(4)}; - - return new ModelTinkersBreastplate(color, this.getDefaultFolder(), textures); + return new String[] {"armor", "chest", "breastplate", "heavyarmor"}; } - + @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) + @SideOnly(Side.CLIENT) + public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) { - return 8; + String[] color = new String[10]; + + for(int j = 0; j < 10; j++) + color[j] = Integer.toHexString(itemStack.getItem().getColorFromItemStack(itemStack, j)); + + String[] textures = {this.getIconSuffix(2), this.getIconSuffix(0), this.getIconSuffix(3), this.getIconSuffix(4)}; + ClientProxy.breastplate.SetColors(color, this.getDefaultFolder(), textures); + return ClientProxy.breastplate; } } diff --git a/src/main/java/lance5057/tDefense/armor/items/heavy/TinkersGrieves.java b/src/main/java/lance5057/tDefense/armor/items/heavy/TinkersGrieves.java index 747b0e7..b0913a1 100644 --- a/src/main/java/lance5057/tDefense/armor/items/heavy/TinkersGrieves.java +++ b/src/main/java/lance5057/tDefense/armor/items/heavy/TinkersGrieves.java @@ -5,6 +5,7 @@ import cpw.mods.fml.relauncher.SideOnly; import lance5057.tDefense.TinkersDefense; import lance5057.tDefense.armor.ArmorCore; import lance5057.tDefense.armor.renderers.heavy.ModelTinkersGrieves; +import lance5057.tDefense.proxy.ClientProxy; import net.minecraft.client.model.ModelBiped; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -17,124 +18,132 @@ import net.minecraft.world.World; import net.minecraftforge.common.ISpecialArmor.ArmorProperties; import tconstruct.tools.TinkerTools; -public class TinkersGrieves extends ArmorCore +public class TinkersGrieves extends ArmorCore { - public TinkersGrieves() { - super(2,2); + public TinkersGrieves() + { + super(2, 2); this.setUnlocalizedName("tinkergrieves"); this.maxReduction = 100; - this.reductionPercent = 0.24; + reductionPercent = 6 * 0.04f; } - + @Override - public Item getHeadItem() + public Item getHeadItem() { return TinkersDefense.partArmorplate; } - + @Override - public Item getHandleItem() { + public Item getHandleItem() + { return TinkerTools.toughRod; } - + @Override - public Item getAccessoryItem() + public Item getAccessoryItem() { return TinkersDefense.partChainmaille; } - + @Override public Item getExtraItem() { return TinkersDefense.partArmorplate; } - + @Override - public int durabilityTypeAccessory() { + public int durabilityTypeAccessory() + { return 2; } @Override - public float getRepairCost() { + public float getRepairCost() + { return 4.0f; } @Override - public float getDurabilityModifier() { + public float getDurabilityModifier() + { return 2.5f; } - + @Override - public float getDamageModifier() { + public float getDamageModifier() + { return 1.4f; } @Override - public int getPartAmount() { + public int getPartAmount() + { return 4; } - + @Override - public String getIconSuffix(int partType) - { - switch (partType) { - case 0: - return "_grieves_plate"; - case 1: - return "_grieves_plate_broken"; - case 2: - return "_grieves_trim"; - case 3: - return "_grieves_chain"; - case 4: - return "_grieves_cod"; - default: - return ""; + public String getIconSuffix(int partType) + { + switch(partType) + { + case 0: + return "_grieves_plate"; + case 1: + return "_grieves_plate_broken"; + case 2: + return "_grieves_trim"; + case 3: + return "_grieves_chain"; + case 4: + return "_grieves_cod"; + default: + return ""; } } - + @Override - public String getEffectSuffix() + public String getEffectSuffix() { return "_grieves_effect"; } - + @Override public String getDefaultFolder() { return "armor/grieves"; } - -// @Override -// public void onUpdate(ItemStack stack, World world, Entity entity, int par4, -// boolean par5) { -// super.onUpdate(stack, world, entity, par4, par5); -// -// } + + // @Override + // public void onUpdate(ItemStack stack, World world, Entity entity, int par4, + // boolean par5) { + // super.onUpdate(stack, world, entity, par4, par5); + // + // } @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, - String type) { + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) + { return "tinkersdefense:textures/armor/TinkersGrieves.png"; } - - @Override - public String[] getTraits() { - return new String[] {"armor","pants","grieves","heavyarmor"}; - } @Override - @SideOnly(Side.CLIENT) - public ModelBiped getModel(String[] color,NBTTagCompound tags) + public String[] getTraits() { - String[] textures = {this.getIconSuffix(2),this.getIconSuffix(0),this.getIconSuffix(3), this.getIconSuffix(4)}; - - return new ModelTinkersGrieves(color, this.getDefaultFolder(), textures); + return new String[] {"armor", "pants", "grieves", "heavyarmor"}; } - + @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) + @SideOnly(Side.CLIENT) + public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) { - return 6; + String[] color = new String[10]; + + for(int j = 0; j < 10; j++) + color[j] = Integer.toHexString(itemStack.getItem().getColorFromItemStack(itemStack, j)); + + String[] textures = {this.getIconSuffix(2), this.getIconSuffix(0), this.getIconSuffix(3), this.getIconSuffix(4)}; + ClientProxy.grieves.SetColors(color, this.getDefaultFolder(), textures); + return ClientProxy.grieves; } } diff --git a/src/main/java/lance5057/tDefense/armor/items/heavy/TinkersHelm.java b/src/main/java/lance5057/tDefense/armor/items/heavy/TinkersHelm.java index a2ad9eb..5bd30f2 100644 --- a/src/main/java/lance5057/tDefense/armor/items/heavy/TinkersHelm.java +++ b/src/main/java/lance5057/tDefense/armor/items/heavy/TinkersHelm.java @@ -3,6 +3,7 @@ package lance5057.tDefense.armor.items.heavy; import lance5057.tDefense.TinkersDefense; import lance5057.tDefense.armor.ArmorCore; import lance5057.tDefense.armor.renderers.heavy.ModelTinkersHelm; +import lance5057.tDefense.proxy.ClientProxy; import net.minecraft.client.model.ModelBiped; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -16,116 +17,124 @@ import tconstruct.tools.TinkerTools; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class TinkersHelm extends ArmorCore +public class TinkersHelm extends ArmorCore { - public TinkersHelm() { - super(2,0); + public TinkersHelm() + { + super(2, 0); this.setUnlocalizedName("tinkershelm"); this.maxReduction = 100; - this.reductionPercent = 0.12; + reductionPercent = 3 * 0.04f; } - + @Override - public Item getHeadItem() + public Item getHeadItem() { return TinkerTools.frypanHead; } - + @Override - public Item getHandleItem() { + public Item getHandleItem() + { return TinkerTools.toughRod; } - + @Override - public Item getAccessoryItem() + public Item getAccessoryItem() { return TinkersDefense.partArmorplate; } - + @Override - public int durabilityTypeAccessory() { + public int durabilityTypeAccessory() + { return 2; } @Override - public float getRepairCost() { + public float getRepairCost() + { return 4.0f; } @Override - public float getDurabilityModifier() { + public float getDurabilityModifier() + { return 2.5f; } - + @Override - public float getDamageModifier() { + public float getDamageModifier() + { return 1.4f; } @Override - public int getPartAmount() { + public int getPartAmount() + { return 3; } - + @Override - public String getIconSuffix(int partType) + public String getIconSuffix(int partType) { - switch (partType) { - case 0: - return "_helm_top"; - case 1: - return "_helm_top_broken"; - case 2: - return "_helm_visor"; - case 3: - return "_helm_chain"; - default: - return ""; + switch(partType) + { + case 0: + return "_helm_top"; + case 1: + return "_helm_top_broken"; + case 2: + return "_helm_visor"; + case 3: + return "_helm_chain"; + default: + return ""; } } - + @Override - public String getEffectSuffix() + public String getEffectSuffix() { return "_helm_effect"; } - + @Override public String getDefaultFolder() { return "armor/helm"; } - -// @Override -// public void onUpdate(ItemStack stack, World world, Entity entity, int par4, -// boolean par5) { -// super.onUpdate(stack, world, entity, par4, par5); -// -// } + + // @Override + // public void onUpdate(ItemStack stack, World world, Entity entity, int par4, + // boolean par5) { + // super.onUpdate(stack, world, entity, par4, par5); + // + // } @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, - String type) { + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) + { return "tinkersdefense:textures/armor/TinkersHelm.png"; } - - @Override - public String[] getTraits() { - return new String[] {"armor","helmet","helm","heavyarmor"}; - } @Override - @SideOnly(Side.CLIENT) - public ModelBiped getModel(String[] color,NBTTagCompound tags) + public String[] getTraits() { - String[] textures = {this.getIconSuffix(2),this.getIconSuffix(0),this.getIconSuffix(3)}; - - return new ModelTinkersHelm(color, this.getDefaultFolder(), textures); + return new String[] {"armor", "helmet", "helm", "heavyarmor"}; } - + @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) + @SideOnly(Side.CLIENT) + public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) { - return 3; + String[] color = new String[10]; + + for(int j = 0; j < 10; j++) + color[j] = Integer.toHexString(itemStack.getItem().getColorFromItemStack(itemStack, j)); + + String[] textures = {this.getIconSuffix(2), this.getIconSuffix(0), this.getIconSuffix(3), this.getIconSuffix(4)}; + ClientProxy.helm.SetColors(color, this.getDefaultFolder(), textures); + return ClientProxy.helm; } } diff --git a/src/main/java/lance5057/tDefense/armor/items/heavy/TinkersSabatons.java b/src/main/java/lance5057/tDefense/armor/items/heavy/TinkersSabatons.java index b3cb58a..48845ce 100644 --- a/src/main/java/lance5057/tDefense/armor/items/heavy/TinkersSabatons.java +++ b/src/main/java/lance5057/tDefense/armor/items/heavy/TinkersSabatons.java @@ -6,6 +6,7 @@ import lance5057.tDefense.TinkersDefense; import lance5057.tDefense.armor.ArmorCore; import lance5057.tDefense.armor.parts.ClothMaterial; import lance5057.tDefense.armor.renderers.heavy.ModelTinkersSabatons; +import lance5057.tDefense.proxy.ClientProxy; import net.minecraft.client.model.ModelBiped; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -20,131 +21,132 @@ import tconstruct.library.TConstructRegistry; import tconstruct.library.tools.CustomMaterial; import tconstruct.tools.TinkerTools; -public class TinkersSabatons extends ArmorCore +public class TinkersSabatons extends ArmorCore { - public TinkersSabatons() { - super(2,3); + public TinkersSabatons() + { + super(2, 3); this.setUnlocalizedName("tinkersabatons"); this.maxReduction = 100; - this.reductionPercent = 0.12; + reductionPercent = 3 * 0.04f; } - + @Override - public Item getHeadItem() + public Item getHeadItem() { return TinkersDefense.partArmorplate; } - + @Override - public Item getHandleItem() { + public Item getHandleItem() + { return TinkerTools.toughRod; } - + @Override - public Item getAccessoryItem() + public Item getAccessoryItem() { return TinkersDefense.partArmorplate; } - + @Override public Item getExtraItem() { return TinkersDefense.partCloth; } - + @Override - public int durabilityTypeAccessory() { + public int durabilityTypeAccessory() + { return 2; } @Override - public float getRepairCost() { + public float getRepairCost() + { return 4.0f; } @Override - public float getDurabilityModifier() { + public float getDurabilityModifier() + { return 2.5f; } - + @Override - public float getDamageModifier() { + public float getDamageModifier() + { return 1.4f; } @Override - public int getPartAmount() { + public int getPartAmount() + { return 4; } - + @Override - public String getIconSuffix(int partType) - { - switch (partType) { - case 0: - return "_sabatons_plates"; - case 1: - return "_sabatons_plate_broken"; - case 2: - return "_sabatons_trim"; - case 3: - return "_sabatons_caps"; - case 4: - return "_sabatons_soles"; - default: - return ""; + public String getIconSuffix(int partType) + { + switch(partType) + { + case 0: + return "_sabatons_plates"; + case 1: + return "_sabatons_plate_broken"; + case 2: + return "_sabatons_trim"; + case 3: + return "_sabatons_caps"; + case 4: + return "_sabatons_soles"; + default: + return ""; } } - + @Override - public String getEffectSuffix() + public String getEffectSuffix() { return "_sabatons_effect"; } - + @Override public String getDefaultFolder() { return "armor/sabatons"; } - -// @Override -// public void onUpdate(ItemStack stack, World world, Entity entity, int par4, -// boolean par5) { -// super.onUpdate(stack, world, entity, par4, par5); -// -// } + + // @Override + // public void onUpdate(ItemStack stack, World world, Entity entity, int par4, + // boolean par5) { + // super.onUpdate(stack, world, entity, par4, par5); + // + // } @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, - String type) { + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) + { return "tinkersdefense:textures/armor/TinkersSabatons.png"; } - + @Override - public String[] getTraits() { - return new String[] {"armor","shoes","sabatons","heavyarmor"}; + public String[] getTraits() + { + return new String[] {"armor", "feet", "sabatons", "heavyarmor"}; } @Override @SideOnly(Side.CLIENT) - public ModelBiped getModel(String[] color, NBTTagCompound tags) - { - String[] textures = {this.getIconSuffix(2),this.getIconSuffix(0),this.getIconSuffix(3), this.getIconSuffix(4)}; - - int matID = tags.getCompoundTag("InfiTool").getInteger("RenderExtra"); - - - CustomMaterial newColor = TConstructRegistry.getCustomMaterial(matID, ClothMaterial.class); - - color[3] = Integer.toHexString(newColor.color); - - return new ModelTinkersSabatons(color, this.getDefaultFolder(), textures); - } - - @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) + public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) { - return 3; + String[] color = new String[10]; + + for(int j = 0; j < 10; j++) + color[j] = Integer.toHexString(itemStack.getItem().getColorFromItemStack(itemStack, j)); + + String[] textures = {this.getIconSuffix(2), this.getIconSuffix(0), this.getIconSuffix(3), this.getIconSuffix(4)}; + ClientProxy.sabatons.SetColors(color, this.getDefaultFolder(), textures); + return ClientProxy.sabatons; } } diff --git a/src/main/java/lance5057/tDefense/armor/items/light/TinkersBoots.java b/src/main/java/lance5057/tDefense/armor/items/light/TinkersBoots.java index afe0368..ce972ea 100644 --- a/src/main/java/lance5057/tDefense/armor/items/light/TinkersBoots.java +++ b/src/main/java/lance5057/tDefense/armor/items/light/TinkersBoots.java @@ -19,120 +19,129 @@ import net.minecraftforge.common.ISpecialArmor.ArmorProperties; import tconstruct.library.TConstructRegistry; import tconstruct.library.tools.CustomMaterial; -public class TinkersBoots extends ArmorCore +public class TinkersBoots extends ArmorCore { - public TinkersBoots() { - super(1,3); + public TinkersBoots() + { + super(1, 3); this.setUnlocalizedName("tinkersboots"); this.maxReduction = 100; - this.reductionPercent = 0.08; + this.reductionPercent = 0.08f; } - + @Override - public Item getHeadItem() + public Item getHeadItem() { return TinkersDefense.partChainmaille; } - + @Override - public Item getHandleItem() { + public Item getHandleItem() + { return TinkersDefense.partCloth; } - + @Override - public Item getAccessoryItem() + public Item getAccessoryItem() { return TinkersDefense.partRivet; } - + @Override - public int durabilityTypeAccessory() { + public int durabilityTypeAccessory() + { return 1; } @Override - public float getRepairCost() { + public float getRepairCost() + { return 1.0f; } @Override - public float getDurabilityModifier() { + public float getDurabilityModifier() + { return 1f; } - + @Override - public float getDamageModifier() { + public float getDamageModifier() + { return 1f; } @Override - public int getPartAmount() { + public int getPartAmount() + { return 3; } - + @Override - public String getIconSuffix(int partType) - { - switch (partType) { - case 0: - return "_boots_chain"; - case 1: - return "_boots_chain_broken"; - case 2: - return "_boots_cloth"; - case 3: - return "_boots_rivet"; - default: - return ""; + public String getIconSuffix(int partType) + { + switch(partType) + { + case 0: + return "_boots_chain"; + case 1: + return "_boots_chain_broken"; + case 2: + return "_boots_cloth"; + case 3: + return "_boots_rivet"; + default: + return ""; } } - + @Override - public String getEffectSuffix() + public String getEffectSuffix() { return "_boots_effect"; } - + @Override public String getDefaultFolder() { return "armor/boots"; } - -// @Override -// public void onUpdate(ItemStack stack, World world, Entity entity, int par4, -// boolean par5) { -// super.onUpdate(stack, world, entity, par4, par5); -// -// } + + // @Override + // public void onUpdate(ItemStack stack, World world, Entity entity, int par4, + // boolean par5) { + // super.onUpdate(stack, world, entity, par4, par5); + // + // } @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, - String type) { + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) + { return "tinkersdefense:textures/armor/TinkersBoots.png"; } - + @Override - public String[] getTraits() { - return new String[] {"armor","feet","boots","lightarmor"}; + public String[] getTraits() + { + return new String[] {"armor", "feet", "boots", "lightarmor"}; } @Override @SideOnly(Side.CLIENT) - public ModelBiped getModel(String[] color,NBTTagCompound tags) + public ModelBiped getModel(String[] color, NBTTagCompound tags) { - String[] textures = {this.getIconSuffix(2),this.getIconSuffix(0),this.getIconSuffix(3)}; - + String[] textures = {this.getIconSuffix(2), this.getIconSuffix(0), this.getIconSuffix(3)}; + int HandleID = tags.getCompoundTag("InfiTool").getInteger("RenderHandle"); - + CustomMaterial newColor = TConstructRegistry.getCustomMaterial(HandleID, ClothMaterial.class); color[0] = Integer.toHexString(newColor.color); - + return new ModelTinkersBoots(color, this.getDefaultFolder(), textures); } - + @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { return 2; } diff --git a/src/main/java/lance5057/tDefense/armor/items/light/TinkersChausses.java b/src/main/java/lance5057/tDefense/armor/items/light/TinkersChausses.java index 203535d..c552584 100644 --- a/src/main/java/lance5057/tDefense/armor/items/light/TinkersChausses.java +++ b/src/main/java/lance5057/tDefense/armor/items/light/TinkersChausses.java @@ -18,114 +18,122 @@ import net.minecraftforge.common.ISpecialArmor.ArmorProperties; import tconstruct.library.TConstructRegistry; import tconstruct.library.tools.CustomMaterial; -public class TinkersChausses extends ArmorCore +public class TinkersChausses extends ArmorCore { - public TinkersChausses() { - super(1,2); + public TinkersChausses() + { + super(1, 2); this.setUnlocalizedName("tinkerschausses"); this.maxReduction = 100; - this.reductionPercent = 0.2; + this.reductionPercent = 0.2f; } - + @Override - public Item getHeadItem() + public Item getHeadItem() { return TinkersDefense.partChainmaille; } - + @Override - public Item getHandleItem() { + public Item getHandleItem() + { return TinkersDefense.partArmorplate; } - + @Override - public int durabilityTypeAccessory() { + public int durabilityTypeAccessory() + { return 1; } @Override - public float getRepairCost() { + public float getRepairCost() + { return 1.0f; } @Override - public float getDurabilityModifier() { + public float getDurabilityModifier() + { return 1f; } - + @Override - public float getDamageModifier() { + public float getDamageModifier() + { return 1f; } @Override - public int getPartAmount() { + public int getPartAmount() + { return 2; } - + @Override - public String getIconSuffix(int partType) - { - switch (partType) { - case 0: - return "_chausses_chain"; - case 1: - return "_chausses_chain_broken"; - case 2: - return "_chausses_plate"; - default: - return ""; + public String getIconSuffix(int partType) + { + switch(partType) + { + case 0: + return "_chausses_chain"; + case 1: + return "_chausses_chain_broken"; + case 2: + return "_chausses_plate"; + default: + return ""; } } - + @Override - public String getEffectSuffix() + public String getEffectSuffix() { return "_chausses_effect"; } - + @Override public String getDefaultFolder() { return "armor/chausses"; } - -// @Override -// public void onUpdate(ItemStack stack, World world, Entity entity, int par4, -// boolean par5) { -// super.onUpdate(stack, world, entity, par4, par5); -// -// } + + // @Override + // public void onUpdate(ItemStack stack, World world, Entity entity, int par4, + // boolean par5) { + // super.onUpdate(stack, world, entity, par4, par5); + // + // } @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, - String type) { + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) + { return "tinkersdefense:textures/armor/TinkersChausses.png"; } - + @Override - public String[] getTraits() { - return new String[] {"armor","feet","chausses","lightarmor"}; + public String[] getTraits() + { + return new String[] {"armor", "feet", "chausses", "lightarmor"}; } @Override @SideOnly(Side.CLIENT) - public ModelBiped getModel(String[] color,NBTTagCompound tags) + public ModelBiped getModel(String[] color, NBTTagCompound tags) { - String[] textures = {this.getIconSuffix(2),this.getIconSuffix(0)}; - + String[] textures = {this.getIconSuffix(2), this.getIconSuffix(0)}; + return new ModelTinkersChausses(color, this.getDefaultFolder(), textures); } - + @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { return 5; } - + @Override - public ArmorProperties getProperties(EntityLivingBase player, - ItemStack armor, DamageSource source, double damage, int slot) + public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { ArmorProperties armorp = new ArmorProperties(0, 0.2, 100); //0.04 per half shirt //((EntityPlayer)player).addChatComponentMessage(new ChatComponentText(Double.toString(damage))); diff --git a/src/main/java/lance5057/tDefense/armor/items/light/TinkersCoif.java b/src/main/java/lance5057/tDefense/armor/items/light/TinkersCoif.java index 47dbf27..98a77c6 100644 --- a/src/main/java/lance5057/tDefense/armor/items/light/TinkersCoif.java +++ b/src/main/java/lance5057/tDefense/armor/items/light/TinkersCoif.java @@ -20,127 +20,135 @@ import tconstruct.library.TConstructRegistry; import tconstruct.library.tools.CustomMaterial; import tconstruct.tools.TinkerTools; -public class TinkersCoif extends ArmorCore +public class TinkersCoif extends ArmorCore { - public TinkersCoif() { - super(1,0); + public TinkersCoif() + { + super(1, 0); this.setUnlocalizedName("tinkerscoif"); this.maxReduction = 100; - this.reductionPercent = 0.08; + this.reductionPercent = 0.08f; } - + @Override - public Item getHeadItem() + public Item getHeadItem() { return TinkersDefense.partChainmaille; } - + @Override - public Item getHandleItem() { + public Item getHandleItem() + { return TinkersDefense.partCloth; } - + @Override public Item getAccessoryItem() { return TinkerTools.toughRod; } - + @Override - public int durabilityTypeAccessory() { + public int durabilityTypeAccessory() + { return 1; } @Override - public float getRepairCost() { + public float getRepairCost() + { return 1.0f; } @Override - public float getDurabilityModifier() { + public float getDurabilityModifier() + { return 1f; } - + @Override - public float getDamageModifier() { + public float getDamageModifier() + { return 1f; } @Override - public int getPartAmount() { + public int getPartAmount() + { return 3; } - - @Override - public String getIconSuffix(int partType) - { - switch (partType) { - case 0: - return "_coif_chain"; - case 1: - return "_coif_chain_broken"; - case 2: - return "_coif_cloth"; - case 3: - return "_coif_circlet"; - default: - return ""; + + @Override + public String getIconSuffix(int partType) + { + switch(partType) + { + case 0: + return "_coif_chain"; + case 1: + return "_coif_chain_broken"; + case 2: + return "_coif_cloth"; + case 3: + return "_coif_circlet"; + default: + return ""; } } - + @Override - public String getEffectSuffix() + public String getEffectSuffix() { return "_coif_effect"; } - + @Override public String getDefaultFolder() { return "armor/coif"; } - -// @Override -// public void onUpdate(ItemStack stack, World world, Entity entity, int par4, -// boolean par5) { -// super.onUpdate(stack, world, entity, par4, par5); -// -// } + + // @Override + // public void onUpdate(ItemStack stack, World world, Entity entity, int par4, + // boolean par5) { + // super.onUpdate(stack, world, entity, par4, par5); + // + // } @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, - String type) { + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) + { return "tinkersdefense:textures/armor/TinkersCoif.png"; } - + @Override - public String[] getTraits() { - return new String[] {"armor","head","coif","lightarmor"}; + public String[] getTraits() + { + return new String[] {"armor", "head", "coif", "lightarmor"}; } @Override @SideOnly(Side.CLIENT) - public ModelBiped getModel(String[] color,NBTTagCompound tags) + public ModelBiped getModel(String[] color, NBTTagCompound tags) { - String[] textures = {this.getIconSuffix(2),this.getIconSuffix(0),this.getIconSuffix(3)}; - + String[] textures = {this.getIconSuffix(2), this.getIconSuffix(0), this.getIconSuffix(3)}; + int HandleID = tags.getCompoundTag("InfiTool").getInteger("RenderHandle"); - + CustomMaterial newColor = TConstructRegistry.getCustomMaterial(HandleID, ClothMaterial.class); color[0] = Integer.toHexString(newColor.color); return new ModelTinkersCoif(color, this.getDefaultFolder(), textures); } - + @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { return 2; } - + @Override - public ArmorProperties getProperties(EntityLivingBase player, - ItemStack armor, DamageSource source, double damage, int slot) + public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { ArmorProperties armorp = new ArmorProperties(0, 0.08, 100); //0.04 per half shirt //((EntityPlayer)player).addChatComponentMessage(new ChatComponentText(Double.toString(damage))); diff --git a/src/main/java/lance5057/tDefense/armor/items/light/TinkersHalberd.java b/src/main/java/lance5057/tDefense/armor/items/light/TinkersHalberd.java index 739e6e0..b71d719 100644 --- a/src/main/java/lance5057/tDefense/armor/items/light/TinkersHalberd.java +++ b/src/main/java/lance5057/tDefense/armor/items/light/TinkersHalberd.java @@ -7,6 +7,7 @@ import lance5057.tDefense.armor.ArmorCore; import lance5057.tDefense.armor.parts.ClothMaterial; import lance5057.tDefense.armor.renderers.cloth.ModelTinkersHood; import lance5057.tDefense.armor.renderers.light.ModelTinkersHalberd; +import lance5057.tDefense.proxy.ClientProxy; import net.minecraft.client.model.ModelBiped; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -20,115 +21,129 @@ import tconstruct.library.TConstructRegistry; import tconstruct.library.tools.CustomMaterial; import tconstruct.tools.TinkerTools; -public class TinkersHalberd extends ArmorCore +public class TinkersHalberd extends ArmorCore { - public TinkersHalberd() { - super(1,1); + public TinkersHalberd() + { + super(1, 1); this.setUnlocalizedName("tinkershalberd"); this.maxReduction = 100; - this.reductionPercent = 0.24; + this.reductionPercent = 0.24f; } - + @Override - public Item getHeadItem() + public Item getHeadItem() { return TinkersDefense.partChainmaille; } - + @Override - public Item getHandleItem() { + public Item getHandleItem() + { return TinkersDefense.partArmorplate; } - + @Override public Item getAccessoryItem() { return TinkersDefense.partRivet; } - + @Override - public int durabilityTypeAccessory() { + public int durabilityTypeAccessory() + { return 1; } @Override - public float getRepairCost() { + public float getRepairCost() + { return 1.0f; } @Override - public float getDurabilityModifier() { + public float getDurabilityModifier() + { return 1f; } - + @Override - public float getDamageModifier() { + public float getDamageModifier() + { return 1f; } @Override - public int getPartAmount() { + public int getPartAmount() + { return 3; } - + @Override - public String getIconSuffix(int partType) - { - switch (partType) { - case 0: - return "_halberd_chain"; - case 1: - return "_halberd_chain_broken"; - case 2: - return "_halberd_plate"; - case 3: - return "_halberd_rivet"; - default: - return ""; + public String getIconSuffix(int partType) + { + switch(partType) + { + case 0: + return "_halberd_chain"; + case 1: + return "_halberd_chain_broken"; + case 2: + return "_halberd_plate"; + case 3: + return "_halberd_rivet"; + default: + return ""; } } - + @Override - public String getEffectSuffix() + public String getEffectSuffix() { return "_halberd_effect"; } - + @Override public String getDefaultFolder() { return "armor/halberd"; } - -// @Override -// public void onUpdate(ItemStack stack, World world, Entity entity, int par4, -// boolean par5) { -// super.onUpdate(stack, world, entity, par4, par5); -// -// } + + // @Override + // public void onUpdate(ItemStack stack, World world, Entity entity, int par4, + // boolean par5) { + // super.onUpdate(stack, world, entity, par4, par5); + // + // } @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, - String type) { + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) + { return "tinkersdefense:textures/armor/TinkersHalberd.png"; } - + @Override - public String[] getTraits() { - return new String[] {"armor","chest","halberd","lightarmor"}; + public String[] getTraits() + { + return new String[] {"armor", "chest", "halberd", "lightarmor"}; } @Override @SideOnly(Side.CLIENT) - public ModelBiped getModel(String[] color,NBTTagCompound tags) + public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) { - String[] textures = {this.getIconSuffix(2),this.getIconSuffix(0),this.getIconSuffix(3)}; - - return new ModelTinkersHalberd(color, this.getDefaultFolder(), textures); + String[] color = new String[10]; + + for(int j = 0; j < 10; j++) + color[j] = Integer.toHexString(itemStack.getItem().getColorFromItemStack(itemStack, j)); + + String[] textures = {this.getIconSuffix(2), this.getIconSuffix(0), this.getIconSuffix(3), this.getIconSuffix(4)}; + ClientProxy.breastplate.SetColors(color, this.getDefaultFolder(), textures); + return ClientProxy.breastplate; } - + @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { return 6; } diff --git a/src/main/java/lance5057/tDefense/armor/modifiers/ArmorMods.java b/src/main/java/lance5057/tDefense/armor/modifiers/ArmorMods.java index 1ee7b1f..b59f789 100644 --- a/src/main/java/lance5057/tDefense/armor/modifiers/ArmorMods.java +++ b/src/main/java/lance5057/tDefense/armor/modifiers/ArmorMods.java @@ -1,22 +1,22 @@ package lance5057.tDefense.armor.modifiers; -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; import lance5057.tDefense.TinkersDefense; +import net.minecraft.block.Block; +import net.minecraft.block.BlockLiquid; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.init.Items; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import tconstruct.armor.TinkerArmor; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; import tconstruct.library.TConstructRegistry; import tconstruct.library.client.TConstructClientRegistry; import tconstruct.library.crafting.ModifyBuilder; import tconstruct.library.tools.ToolCore; -public class ArmorMods +public class ArmorMods { - Item protKit; public ArmorMods() { @@ -24,29 +24,100 @@ public class ArmorMods RegisterRecipes(); RegisterModifiers(); } - + public void LoadItems() { - protKit = new Item() - .setUnlocalizedName("protectionkit") - .setCreativeTab(TinkersDefense.tabName) - .setTextureName("tinkersdefense:protectionkit"); - - GameRegistry.registerItem(protKit, "protectionkit"); + // protKit = new Item() + // .setUnlocalizedName("protectionkit") + // .setCreativeTab(TinkersDefense.tabName) + // .setTextureName("tinkersdefense:protectionkit"); + // + // GameRegistry.registerItem(protKit, "protectionkit"); } - + public void RegisterRecipes() { - GameRegistry.addShapelessRecipe(new ItemStack(protKit,1), new ItemStack(TinkersDefense.partArmorplate,1,2), TinkerArmor.heartCanister, Items.iron_ingot); + // GameRegistry.addShapelessRecipe(new ItemStack(protKit,1), new + // ItemStack(TinkersDefense.partArmorplate,1,2), + // TinkerArmor.heartCanister, Items.iron_ingot); } - + public void RegisterModifiers() - { - ModifyBuilder.registerModifier(new modifierProtection(new ItemStack[] {new ItemStack(protKit,1)}, TinkersDefense.config.ArmorProtectionID, 1, "\u00A77")); - - for (ToolCore tool : TConstructRegistry.getToolMapping()) - { + { + ModifyBuilder.registerModifier(new modifierProtection(new ItemStack[] {new ItemStack(TinkersDefense.partArmorplate, 1, 2)}, TinkersDefense.config.ArmorProtectionID, 1, "\u00A77", "Protection")); + ModifyBuilder.registerModifier(new modifierProtection(new ItemStack[] {new ItemStack(Items.magma_cream, 1)}, TinkersDefense.config.ArmorFireProtectionID, 1, "\u00A7c", "Fire Protection")); + ModifyBuilder.registerModifier(new modifierProtection(new ItemStack[] {new ItemStack(Blocks.wool, 1)}, TinkersDefense.config.ArmorBlastProtectionID, 1, "\u00A72", "Blast Protection")); + ModifyBuilder.registerModifier(new modifierProtection(new ItemStack[] {new ItemStack(TinkersDefense.partRivet, 1, 2)}, TinkersDefense.config.ArmorProjectileProtectionID, 1, "\u00A7f", "Projectile Protection")); + ModifyBuilder.registerModifier(new modifierProtection(new ItemStack[] {new ItemStack(Blocks.hay_block)}, TinkersDefense.config.FeatherfallID, 1, "\u00A7f", "Featherfall")); + + for(ToolCore tool : TConstructRegistry.getToolMapping()) + { TConstructClientRegistry.addEffectRenderMapping(tool, TinkersDefense.config.ArmorProtectionID, "tinker", "protection", true); - } + TConstructClientRegistry.addEffectRenderMapping(tool, TinkersDefense.config.ArmorFireProtectionID, "tinker", "fireprotection", true); + TConstructClientRegistry.addEffectRenderMapping(tool, TinkersDefense.config.ArmorBlastProtectionID, "tinker", "blastprotection", true); + TConstructClientRegistry.addEffectRenderMapping(tool, TinkersDefense.config.ArmorProjectileProtectionID, "tinker", "projprotection", true); + TConstructClientRegistry.addEffectRenderMapping(tool, TinkersDefense.config.FeatherfallID, "tinker", "featherfall", true); + } + } + + public void UpdateAll(ToolCore tool, ItemStack stack, World world, Entity entity, NBTTagCompound tags) + { + if(!world.isRemote) + { + UpdateWalker(tool, stack, world, entity, Material.water, TinkersDefense.block_Unstable, 0); + UpdateWalker(tool, stack, world, entity, Material.lava, TinkersDefense.block_Unstable, 1); + UpdateGlowstep(tool, stack, world, entity); + } + } + + public void UpdateWalker(ToolCore tool, ItemStack stack, World world, Entity entity, Material mat, Block replacement, int meta) + { + int x = (int) Math.floor(entity.posX); + int y = (int) (entity.posY - entity.getYOffset()); + int z = (int) Math.floor(entity.posZ); + + Block block; + + for(int i = 0; i < 5; i++) + for(int j = 0; j < 5; j++) + { + block = world.getBlock(x + (i - 2), y - 1, z + (j - 2)); + if(block instanceof BlockLiquid) + { + if(((BlockLiquid) block).getMaterial() == mat && world.getBlockMetadata(x + (i - 2), y - 1, z + (j - 2)) == 0) + { + world.setBlock(x + (i - 2), y - 1, z + (j - 2), replacement, meta, 3); + world.notifyBlocksOfNeighborChange(x + (i - 2), y - 1, z + (j - 2), world.getBlock(x + (i - 2), y - 1, z + (j - 2))); + } + } + } + } + + int glowTimer = 8; + int prevX = 0; + int prevZ = 0; + + public void UpdateGlowstep(ToolCore tool, ItemStack stack, World world, Entity entity) + { + int x = (int) Math.floor(entity.posX); + int y = (int) (entity.posY - entity.getYOffset()); + int z = (int) Math.floor(entity.posZ); + + if(glowTimer == 0) + { + if(world.getBlock(x, y, z) == Blocks.air && world.getBlock(x, y - 1, z).isNormalCube()) + { + world.setBlock(x, y, z, TinkersDefense.block_GlowCrumbs, 0, 3); + //world.notifyBlocksOfNeighborChange(x + (i - 2), y - 1, z + (j - 2), world.getBlock(x + (i - 2), y - 1, z + (j - 2))); + } + glowTimer = 8; + } + else if(Math.abs(x - prevX) >= 1 || Math.abs(z - prevZ) >= 1) + { + glowTimer--; + } + + prevX = x; + prevZ = z; } } diff --git a/src/main/java/lance5057/tDefense/armor/modifiers/modifierProtection.java b/src/main/java/lance5057/tDefense/armor/modifiers/modifierProtection.java index bd781cd..f691adf 100644 --- a/src/main/java/lance5057/tDefense/armor/modifiers/modifierProtection.java +++ b/src/main/java/lance5057/tDefense/armor/modifiers/modifierProtection.java @@ -11,88 +11,114 @@ import tconstruct.library.tools.AbilityHelper; import tconstruct.library.tools.ToolCore; import tconstruct.modifiers.tools.ModInteger; - public class modifierProtection extends ModInteger { - String color; - String tooltipName = ""; - int initialIncrease; - int secondaryIncrease; - - public modifierProtection(ItemStack[] items, int effect, int increase, String c) - { - super(items, effect, "Protection", increase, c, "Protection"); - color = c; - } + String color; + String type; + String tooltipName = ""; + int initialIncrease; + int secondaryIncrease; + String[] types = {"Protection", "Fire Protection", "Blast Protection", "Projectile Protection", "Featherfall"}; + + public modifierProtection(ItemStack[] items, int effect, int increase, String c, String t) + { + super(items, effect, t, increase, c, t); + color = c; + type = t; + } + + @Override + protected boolean canModify(ItemStack tool, ItemStack[] input) + { + if(tool.getItem() instanceof ToolCore) + { + List list = Arrays.asList(((ToolCore) tool.getItem()).getTraits()); + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + + if(list.contains("heavyarmor") || list.contains("lightarmor")) + { + if(type != types[4]) + { + for(int i = 0; i < 4; i++) + { + if(tags.hasKey(types[i])) + { + if(types[i] != type) + return false; + if(types[i] == type && tags.getInteger(types[i]) > 5) + return false; + } + } + return true; + } + else if(type == types[4] && tags.getInteger(types[4]) < 5) + { + if(list.contains("feet")) + { + return true; + } + return false; + } + } + + } + return false; + } - @Override - protected boolean canModify (ItemStack tool, ItemStack[] input) - { - if (tool.getItem() instanceof ToolCore) - { - List list = Arrays.asList(((ToolCore)tool.getItem()).getTraits()); - if (list.contains("heavyarmor") || list.contains("lightarmor")) - { - return true; - } - } - return false; - } - - @Override - public void modify (ItemStack[] input, ItemStack tool) - { - NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - if (tags.hasKey(key)) - { - int increase = tags.getInteger(key); - increase += secondaryIncrease; - tags.setInteger(key, increase); - } - else - { - tags.setInteger(key, initialIncrease); - } + @Override + public void modify(ItemStack[] input, ItemStack tool) + { + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + if(tags.hasKey(key)) + { + int increase = tags.getInteger(key); + increase += secondaryIncrease; + tags.setInteger(key, increase); + } + else + { + tags.setInteger(key, initialIncrease); + } - int modifiers = tags.getInteger("Modifiers"); - modifiers -= 1; - tags.setInteger("Modifiers", modifiers); + int modifiers = tags.getInteger("Modifiers"); + modifiers -= 1; + tags.setInteger("Modifiers", modifiers); - int prot = tags.getInteger("Protection"); - prot += 1; - tags.setInteger("Protection", prot); + int prot = tags.getInteger(type); + prot += 1; + tags.setInteger(type, prot); - addToolTip(tool, color + tooltipName, color + key); - } + addToolTip(tool, color + tooltipName, color + key); + } - protected int addToolTip (ItemStack tool, String tooltip, String modifierTip) - { - NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - int tipNum = 0; - while (true) - { - tipNum++; - String tip = "Tooltip" + tipNum; - if (!tags.hasKey(tip)) - { - tags.setString(tip, ""); - String modTip = "ModifierTip" + tipNum; - String tag = tags.getString(modTip); - tags.setString(modTip, getProperName(modifierTip, tag)); - return tipNum; - } - else - { - String modTip = "ModifierTip" + tipNum; - String tag = tags.getString(modTip); - if (tag.contains(modifierTip)) - { - tags.setString(tip, ""); - tag = tags.getString(modTip); - tags.setString(modTip, getProperName(modifierTip, tag)); - return tipNum; - } - } - } - } -} \ No newline at end of file + protected int addToolTip(ItemStack tool, String tooltip, String modifierTip) + { + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + int tipNum = 0; + while(true) + { + tipNum++; + String tip = "Tooltip" + tipNum; + if(!tags.hasKey(tip)) + { + tags.setString(tip, ""); + String modTip = "ModifierTip" + tipNum; + String tag = tags.getString(modTip); + tags.setString(modTip, getProperName(modifierTip, tag)); + return tipNum; + } + else + { + String modTip = "ModifierTip" + tipNum; + String tag = tags.getString(modTip); + if(tag.contains(modifierTip)) + { + tags.setString(tip, ""); + tag = tags.getString(modTip); + tags.setString(modTip, getProperName(modifierTip, tag)); + return tipNum; + } + } + } + } +} diff --git a/src/main/java/lance5057/tDefense/armor/parts/Cloth.java b/src/main/java/lance5057/tDefense/armor/parts/Cloth.java index 5613157..021a607 100644 --- a/src/main/java/lance5057/tDefense/armor/parts/Cloth.java +++ b/src/main/java/lance5057/tDefense/armor/parts/Cloth.java @@ -7,34 +7,34 @@ import tconstruct.library.util.IToolPart; public class Cloth extends CraftingItem implements IToolPart { - public Cloth() - { - super(toolMaterialNames, buildTextureNames("_cloth"), "parts/", "tinker", TConstructRegistry.materialTab); - this.setHasSubtypes(true); - this.setMaxDamage(0); - } + public Cloth() + { + super(toolMaterialNames, buildTextureNames("_cloth"), "parts/", "tinker", TConstructRegistry.materialTab); + this.setHasSubtypes(true); + this.setMaxDamage(0); + } - private static String[] buildTextureNames (String textureType) - { - String[] names = new String[toolMaterialNames.length]; - for (int i = 0; i < toolMaterialNames.length; i++) - { - if (toolTextureNames[i].equals("")) - names[i] = ""; - else - names[i] = toolTextureNames[i] + textureType; - } - return names; - } + private static String[] buildTextureNames(String textureType) + { + String[] names = new String[toolMaterialNames.length]; + for(int i = 0; i < toolMaterialNames.length; i++) + { + if(toolTextureNames[i].equals("")) + names[i] = ""; + else + names[i] = toolTextureNames[i] + textureType; + } + return names; + } - public static final String[] toolMaterialNames = new String[] { "white", "orange", "magenta", "lightblue", "yellow", "lime", "pink", "gray", "lightgray", "cyan", "purple", "blue", "brown", "green", "red", "black" }; - public static final String[] toolTextureNames = new String[] { "white", "orange", "magenta", "lightblue", "yellow", "lime", "pink", "gray", "lightgray", "cyan", "purple", "blue", "brown", "green", "red", "black" }; + public static final String[] toolMaterialNames = new String[] {"white", "orange", "magenta", "lightblue", "yellow", "lime", "pink", "gray", "lightgray", "cyan", "purple", "blue", "brown", "green", "red", "black"}; + public static final String[] toolTextureNames = new String[] {"white", "orange", "magenta", "lightblue", "yellow", "lime", "pink", "gray", "lightgray", "cyan", "purple", "blue", "brown", "green", "red", "black"}; - @Override - public int getMaterialID (ItemStack stack) - { - if (stack.getItemDamage() >= toolMaterialNames.length) - return -1; - return stack.getItemDamage(); - } -} \ No newline at end of file + @Override + public int getMaterialID(ItemStack stack) + { + if(stack.getItemDamage() >= toolMaterialNames.length) + return -1; + return stack.getItemDamage(); + } +} diff --git a/src/main/java/lance5057/tDefense/armor/parts/ClothMaterial.java b/src/main/java/lance5057/tDefense/armor/parts/ClothMaterial.java index 40bf260..4b1733d 100644 --- a/src/main/java/lance5057/tDefense/armor/parts/ClothMaterial.java +++ b/src/main/java/lance5057/tDefense/armor/parts/ClothMaterial.java @@ -6,8 +6,8 @@ import tconstruct.library.tools.CustomMaterial; public class ClothMaterial extends CustomMaterial { - public ClothMaterial(int materialID, int value, ItemStack input, - ItemStack craftingItem, int color) { + public ClothMaterial(int materialID, int value, ItemStack input, ItemStack craftingItem, int color) + { super(materialID, value, input, craftingItem, color); } diff --git a/src/main/java/lance5057/tDefense/armor/renderers/ArmorRenderer.java b/src/main/java/lance5057/tDefense/armor/renderers/ArmorRenderer.java new file mode 100644 index 0000000..01a5983 --- /dev/null +++ b/src/main/java/lance5057/tDefense/armor/renderers/ArmorRenderer.java @@ -0,0 +1,24 @@ +package lance5057.tDefense.armor.renderers; + +import net.minecraft.client.model.ModelBiped; +import net.minecraft.entity.Entity; + +public class ArmorRenderer extends ModelBiped +{ + public String[] colors; + + public String[] textures; + public String defaultFolder; + + public ArmorRenderer(float a, float b, int c, int d) + { + super(a, b, c, d); + } + + public void SetColors(String[] colors, String defaultFolder, String[] textures) + { + this.colors = colors; + this.textures = textures; + this.defaultFolder = defaultFolder; + } +} diff --git a/src/main/java/lance5057/tDefense/armor/renderers/ModelChainArmor.java b/src/main/java/lance5057/tDefense/armor/renderers/ModelChainArmor.java deleted file mode 100644 index baca0f1..0000000 --- a/src/main/java/lance5057/tDefense/armor/renderers/ModelChainArmor.java +++ /dev/null @@ -1,168 +0,0 @@ -package lance5057.tDefense.armor.renderers; - -import net.minecraft.client.model.ModelBiped; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.entity.Entity; - -public class ModelChainArmor extends ModelBiped -{ - public ModelRenderer Pauldron1R; - public ModelRenderer Pauldron2R; - public ModelRenderer Pauldron3R; - public ModelRenderer ArmR; - public ModelRenderer Belt; - public ModelRenderer BeltBuckle; - public ModelRenderer Body; - public ModelRenderer Coif; - public ModelRenderer Head; - public ModelRenderer LegR; - public ModelRenderer FootR; - public ModelRenderer HipGuardR; - public ModelRenderer HipGuardBR; - public ModelRenderer Pauldron1L; - public ModelRenderer Pauldron2L; - public ModelRenderer Pauldron3L; - public ModelRenderer ArmL; - public ModelRenderer LegL; - public ModelRenderer FootL; - public ModelRenderer HipGuardL; - public ModelRenderer HipGuardBL; - - public ModelChainArmor(float f) { - super(f, 0, 64,96); - - this.textureWidth = 64; - this.textureHeight = 96; - - this.BeltBuckle = new ModelRenderer(this, 0, 32); - this.BeltBuckle.setRotationPoint(0.0F, 0.0F, 0.0F); - this.BeltBuckle.addBox(-1.0F, 10.0F, -2.4F, 2, 2, 1, 0.2F); - this.bipedBody.addChild(BeltBuckle); - - this.Pauldron3L = new ModelRenderer(this, 16, 64); - this.Pauldron3L.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Pauldron3L.addBox(-1.3F, -1.3F, -2.5F, 2, 2, 5, 0.1F); - this.setRotateAngle(Pauldron3L, 0.0F, 3.141592653589793F, 0.2617993877991494F); - this.bipedLeftArm.addChild(Pauldron3L); - - this.LegL = new ModelRenderer(this, 0, 48); - this.LegL.setRotationPoint(0.0F, 0.0F, 0.0F); - this.LegL.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.1F); - this.bipedLeftLeg.addChild(LegL); - - this.LegR = new ModelRenderer(this, 0, 48); - this.LegR.setRotationPoint(0.0F, 0.0F, 0.0F); - this.LegR.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.1F); - this.bipedRightLeg.addChild(LegR); - - this.FootR = new ModelRenderer(this, 0, 75); - this.FootR.setRotationPoint(0.0F, 0.0F, 0.0F); - this.FootR.addBox(-2.0F, 10.0F, -3.0F, 4, 2, 1, 0.0F); - this.bipedRightLeg.addChild(FootR); - - this.Pauldron1R = new ModelRenderer(this, 30, 64); - this.Pauldron1R.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Pauldron1R.addBox(-3.5F, -1.6F, -2.5F, 3, 4, 5, 0.0F); - this.setRotateAngle(Pauldron1R, 0.0F, 0.0F, 0.2617993877991494F); - this.bipedRightArm.addChild(Pauldron1R); - - this.ArmR = new ModelRenderer(this, 40, 48); - this.ArmR.setRotationPoint(0.0F, 0.0F, 0.0F); - this.ArmR.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, 0.1F); - this.bipedRightArm.addChild(ArmR); - - this.ArmL = new ModelRenderer(this, 40, 48); - this.ArmL.setRotationPoint(0.0F, 0.0F, 0.0F); - this.ArmL.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, 0.1F); - this.setRotateAngle(ArmL, 0.0F, 3.141592653589793F, 0.0F); - this.bipedLeftArm.addChild(ArmL); - - this.HipGuardL = new ModelRenderer(this, 24, 32); - this.HipGuardL.setRotationPoint(0.0F, 0.0F, 0.0F); - this.HipGuardL.addBox(-2.1F, 0.0F, 1.5F, 4, 6, 1, -0.1F); - this.setRotateAngle(HipGuardL, 0.17453292519943295F, 1.5707963267948966F, 0.0F); - this.bipedLeftLeg.addChild(HipGuardL); - - this.Pauldron2R = new ModelRenderer(this, 0, 64); - this.Pauldron2R.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Pauldron2R.addBox(-2.4F, -2.7F, -2.5F, 3, 3, 5, -0.1F); - this.setRotateAngle(Pauldron2R, 0.0F, 0.0F, -0.2617993877991494F); - this.bipedRightArm.addChild(Pauldron2R); - - this.Body = new ModelRenderer(this, 16, 48); - this.Body.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Body.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, 0.1F); - this.bipedBody.addChild(Body); - - this.Pauldron2L = new ModelRenderer(this, 0, 64); - this.Pauldron2L.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Pauldron2L.addBox(-2.4F, -2.7F, -2.5F, 3, 3, 5, -0.1F); - this.setRotateAngle(Pauldron2L, 0.0F, 3.141592653589793F, 0.2617993877991494F); - this.bipedLeftArm.addChild(Pauldron2L); - - this.Coif = new ModelRenderer(this, 0, 78); - this.Coif.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Coif.addBox(-4.0F, -8.0F, -4.0F, 8, 10, 8, 0.5F); - this.bipedHead.addChild(Coif); - - this.HipGuardBR = new ModelRenderer(this, 24, 32); - this.HipGuardBR.setRotationPoint(0.0F, 0.0F, 0.0F); - this.HipGuardBR.addBox(-2.0F, 0.0F, 1.0F, 4, 6, 1, 0.0F); - this.setRotateAngle(HipGuardBR, 0.17453292519943295F, 0.0F, 0.0F); - this.bipedRightLeg.addChild(HipGuardBR); - - this.Pauldron3R = new ModelRenderer(this, 16, 64); - this.Pauldron3R.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Pauldron3R.addBox(-1.3F, -1.3F, -2.5F, 2, 2, 5, 0.1F); - this.setRotateAngle(Pauldron3R, 0.0F, 0.0F, -0.2617993877991494F); - this.bipedRightArm.addChild(Pauldron3R); - - this.Head = new ModelRenderer(this, 0, 32); - this.Head.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Head.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0.1F); - this.bipedHead.addChild(Head); - - this.FootL = new ModelRenderer(this, 0, 75); - this.FootL.setRotationPoint(0.0F, 0.0F, 0.0F); - this.FootL.addBox(-2.0F, 10.0F, -3.0F, 4, 2, 1, 0.0F); - this.bipedLeftLeg.addChild(FootL); - - this.Belt = new ModelRenderer(this, 32, 90); - this.Belt.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Belt.addBox(-4.0F, 10.0F, -2.0F, 8, 2, 4, 0.2F); - this.bipedBody.addChild(Belt); - - this.HipGuardBL = new ModelRenderer(this, 24, 32); - this.HipGuardBL.setRotationPoint(0.0F, 0.0F, 0.0F); - this.HipGuardBL.addBox(-2.0F, 0.0F, 1.0F, 4, 6, 1, 0.0F); - this.setRotateAngle(HipGuardBL, 0.17453292519943295F, 0.0F, 0.0F); - this.bipedLeftLeg.addChild(HipGuardBL); - - this.Pauldron1L = new ModelRenderer(this, 30, 64); - this.Pauldron1L.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Pauldron1L.addBox(-3.5F, -1.6F, -2.5F, 3, 4, 5, 0.0F); - this.setRotateAngle(Pauldron1L, 0.0F, 3.141592653589793F, -0.2617993877991494F); - this.bipedLeftArm.addChild(Pauldron1L); - - this.HipGuardR = new ModelRenderer(this, 24, 32); - this.HipGuardR.setRotationPoint(0.0F, 0.0F, 0.0F); - this.HipGuardR.addBox(-2.1F, 0.0F, -2.5F, 4, 6, 1, -0.1F); - this.setRotateAngle(HipGuardR, -0.17453292519943295F, 1.5707963267948966F, 0.0F); - this.bipedRightLeg.addChild(HipGuardR); - } - - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - } - - /** - * This is a helper function from Tabula to set the rotation of model parts - */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } -} diff --git a/src/main/java/lance5057/tDefense/armor/renderers/ModelClothArmor.java b/src/main/java/lance5057/tDefense/armor/renderers/ModelClothArmor.java deleted file mode 100644 index bf58d45..0000000 --- a/src/main/java/lance5057/tDefense/armor/renderers/ModelClothArmor.java +++ /dev/null @@ -1,259 +0,0 @@ -package lance5057.tDefense.armor.renderers; - -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelBiped; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.entity.Entity; - -/** - * ModelBiped - Either Mojang or a mod author - * Created using Tabula 4.1.1 - */ -public class ModelClothArmor extends ModelBiped { - public ModelRenderer Collar; - public ModelRenderer Top; - public ModelRenderer Left; - public ModelRenderer Right; - public ModelRenderer TrimLeft2; - public ModelRenderer TrimLeft3; - public ModelRenderer TrimLeft4; - public ModelRenderer TrimRight3; - public ModelRenderer TrimRight2; - public ModelRenderer TrimRight4; - public ModelRenderer Flop; - public ModelRenderer ArmLeft; - public ModelRenderer ArmRight; - public ModelRenderer Chest; - public ModelRenderer ShawlLeft1; - public ModelRenderer ShawlLeft2; - public ModelRenderer ShawlRight1; - public ModelRenderer ShawlRight2; - public ModelRenderer Belt; - public ModelRenderer Button; - public ModelRenderer TopLeft; - public ModelRenderer Back; - public ModelRenderer TopRight; - public ModelRenderer LeftFront; - public ModelRenderer RightFront; - public ModelRenderer LeftFS; - public ModelRenderer LeftF; - public ModelRenderer LeftBS; - public ModelRenderer LeftB; - public ModelRenderer LeftB2; - public ModelRenderer LeftBA; - public ModelRenderer RightFS; - public ModelRenderer RightF; - public ModelRenderer RightBS; - public ModelRenderer RightB; - public ModelRenderer RightB2; - public ModelRenderer RightBA; - - public ModelClothArmor() { - super(1f, 0, 64,96); - - this.textureWidth = 64; - this.textureHeight = 96; - - this.TrimLeft2 = new ModelRenderer(this, 0, 65); - this.TrimLeft2.setRotationPoint(0.0F, 0.0F, 0.0F); - this.TrimLeft2.addBox(-3.1F, 1.1F, -6.0F, 2, 2, 1, 0.0F); - this.setRotateAngle(TrimLeft2, 0.0F, 0.0F, 0.7853981633974483F); - this.ShawlLeft2 = new ModelRenderer(this, 42, 43); - this.ShawlLeft2.mirror = true; - this.ShawlLeft2.setRotationPoint(-2.5F, -1.8F, 0.1F); - this.ShawlLeft2.addBox(-1.5F, -1.6F, -3.0F, 6, 3, 5, 0.0F); - this.setRotateAngle(ShawlLeft2, 0.0F, 0.0F, 0.9424777960769379F); - this.Back = new ModelRenderer(this, 46, 72); - this.Back.setRotationPoint(0.0F, 1.2F, 2.02F); - this.Back.addBox(-4.0F, 0.0F, 0.0F, 8, 5, 1, 0.0F); - this.Collar = new ModelRenderer(this, 0, 65); - this.Collar.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Collar.addBox(-5.5F, -1.0F, -5.5F, 11, 2, 11, 0.0F); - this.LeftFS = new ModelRenderer(this, 36, 83); - this.LeftFS.setRotationPoint(0.0F, 0.0F, 0.0F); - this.LeftFS.addBox(1.75F, 0.0F, -1.35F, 1, 11, 2, 0.0F); - this.setRotateAngle(LeftFS, 0.0F, 0.7853981633974483F, 0.0F); - this.TopLeft = new ModelRenderer(this, 0, 49); - this.TopLeft.setRotationPoint(0.0F, 0.0F, 0.0F); - this.TopLeft.addBox(-8.5F, -0.3F, -3.0F, 9, 2, 6, 0.0F); - this.setRotateAngle(TopLeft, 0.0F, 3.141592653589793F, 0.0F); - this.LeftB = new ModelRenderer(this, 34, 82); - this.LeftB.setRotationPoint(0.0F, 0.0F, 0.0F); - this.LeftB.addBox(1.9F, 0.0F, -1.0F, 1, 11, 3, 0.0F); - this.setRotateAngle(LeftB, 0.0F, 4.71238898038469F, 0.0F); - this.RightFS = new ModelRenderer(this, 35, 83); - this.RightFS.setRotationPoint(0.0F, 0.0F, 0.0F); - this.RightFS.addBox(1.75F, 0.0F, -0.65F, 1, 11, 2, 0.0F); - this.setRotateAngle(RightFS, 0.0F, -0.7853981633974483F, 0.0F); - this.RightBS = new ModelRenderer(this, 34, 83); - this.RightBS.setRotationPoint(0.0F, 0.0F, 0.0F); - this.RightBS.addBox(1.75F, 0.0F, -1.35F, 1, 11, 2, 0.0F); - this.setRotateAngle(RightBS, 0.0F, 0.7853981633974483F, 0.0F); - this.RightFront = new ModelRenderer(this, 31, 82); - this.RightFront.setRotationPoint(0.0F, 0.0F, 0.0F); - this.RightFront.addBox(1.4F, 0.0F, -1.5F, 1, 11, 3, 0.0F); - this.setRotateAngle(RightFront, 0.0F, 3.141592653589793F, 0.08726646259971647F); - this.TrimLeft3 = new ModelRenderer(this, 0, 32); - this.TrimLeft3.setRotationPoint(-2.3F, 0.0F, -5.5F); - this.TrimLeft3.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F); - this.setRotateAngle(TrimLeft3, 0.009773843811168246F, 3.141592653589793F, 0.7853981633974483F); - this.TrimRight4 = new ModelRenderer(this, 0, 78); - this.TrimRight4.mirror = true; - this.TrimRight4.setRotationPoint(0.0F, 0.0F, 0.0F); - this.TrimRight4.addBox(2.6F, -4.5F, -5.0F, 1, 3, 11, 0.0F); - this.setRotateAngle(TrimRight4, 0.0F, 3.141592653589793F, -0.5235987755982988F); - this.RightBA = new ModelRenderer(this, 33, 80); - this.RightBA.setRotationPoint(0.0F, 0.0F, 0.0F); - this.RightBA.addBox(2.9F, 0.1F, -3.9F, 1, 11, 5, 0.0F); - this.setRotateAngle(RightBA, 0.0F, 2.6179938779914944F, 0.08726646259971647F); - this.ArmLeft = new ModelRenderer(this, 44, 62); - this.ArmLeft.setRotationPoint(0.0F, 0.0F, 0.0F); - this.ArmLeft.addBox(-1.5F, -2.0F, -2.5F, 5, 11, 5, 0.0F); - this.RightB2 = new ModelRenderer(this, 33, 83); - this.RightB2.setRotationPoint(0.0F, 0.0F, 0.0F); - this.RightB2.addBox(1.91F, 0.1F, -2.8F, 1, 11, 2, 0.0F); - this.setRotateAngle(RightB2, 0.0F, 1.5707963267948966F, 0.08726646259971647F); - this.LeftB2 = new ModelRenderer(this, 34, 83); - this.LeftB2.setRotationPoint(0.0F, 0.0F, 0.0F); - this.LeftB2.addBox(1.91F, 0.1F, 1.0F, 1, 11, 2, 0.0F); - this.setRotateAngle(LeftB2, 0.0F, 4.71238898038469F, 0.08726646259971647F); - this.LeftFront = new ModelRenderer(this, 33, 82); - this.LeftFront.setRotationPoint(0.0F, 0.0F, 0.0F); - this.LeftFront.addBox(1.4F, 0.0F, -1.5F, 1, 11, 3, 0.0F); - this.setRotateAngle(LeftFront, 0.0F, 0.0F, -0.08726646259971647F); - this.TopRight = new ModelRenderer(this, 0, 49); - this.TopRight.setRotationPoint(0.0F, 0.0F, 0.0F); - this.TopRight.addBox(-8.5F, -0.3F, -3.0F, 9, 2, 6, 0.0F); - this.LeftBA = new ModelRenderer(this, 35, 80); - this.LeftBA.setRotationPoint(0.0F, 0.0F, 0.0F); - this.LeftBA.addBox(3.1F, 0.1F, -1.0F, 1, 11, 5, 0.0F); - this.setRotateAngle(LeftBA, 0.0F, 3.6651914291880923F, 0.08726646259971647F); - this.Left = new ModelRenderer(this, 0, 78); - this.Left.mirror = true; - this.Left.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Left.addBox(4.5F, -8.6F, -5.0F, 1, 7, 11, 0.0F); - this.setRotateAngle(Left, 0.0F, 3.141592653589793F, 0.08726646259971647F); - this.Flop = new ModelRenderer(this, 2, 32); - this.Flop.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Flop.addBox(-4.5F, -10.0F, -4.0F, 9, 7, 4, 0.0F); - this.setRotateAngle(Flop, 0.5235987755982988F, 3.141592653589793F, 0.0F); - this.Top = new ModelRenderer(this, 24, 84); - this.Top.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Top.addBox(-4.5F, -9.0F, -6.0F, 9, 1, 11, 0.0F); - this.Button = new ModelRenderer(this, 0, 32); - this.Button.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Button.addBox(0.0F, 0.0F, -3.5F, 2, 2, 1, 0.0F); - this.setRotateAngle(Button, 0.0F, 0.0F, 0.7853981633974483F); - this.Right = new ModelRenderer(this, 0, 78); - this.Right.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Right.addBox(-5.5F, -8.6F, -5.0F, 1, 7, 11, 0.0F); - this.setRotateAngle(Right, 0.0F, 3.141592653589793F, -0.08726646259971647F); - this.RightB = new ModelRenderer(this, 34, 82); - this.RightB.setRotationPoint(0.0F, 0.0F, 0.0F); - this.RightB.addBox(1.9F, 0.0F, -2.0F, 1, 11, 3, 0.0F); - this.setRotateAngle(RightB, 0.0F, 1.5707963267948966F, 0.0F); - this.ShawlLeft1 = new ModelRenderer(this, 40, 32); - this.ShawlLeft1.setRotationPoint(-0.6F, 1.4F, 0.0F); - this.ShawlLeft1.addBox(-0.9F, -2.3F, -3.0F, 6, 5, 6, 0.0F); - this.setRotateAngle(ShawlLeft1, 0.0F, 0.0F, -0.2792526803190927F); - this.TrimRight3 = new ModelRenderer(this, 0, 32); - this.TrimRight3.setRotationPoint(3.7F, 0.0F, -5.5F); - this.TrimRight3.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F); - this.setRotateAngle(TrimRight3, 0.0F, 3.141592653589793F, 0.7853981633974483F); - this.ShawlRight1 = new ModelRenderer(this, 40, 32); - this.ShawlRight1.mirror = true; - this.ShawlRight1.setRotationPoint(-0.6F, 1.4F, 0.0F); - this.ShawlRight1.addBox(-0.9F, -2.3F, -3.0F, 6, 5, 6, 0.0F); - this.setRotateAngle(ShawlRight1, 0.0F, 0.0F, -0.2792526803190927F); - this.ArmRight = new ModelRenderer(this, 44, 62); - this.ArmRight.setRotationPoint(0.0F, 0.0F, 0.0F); - this.ArmRight.addBox(-1.5F, -2.0F, -2.5F, 5, 11, 5, 0.0F); - this.setRotateAngle(ArmRight, 0.0F, 3.141592653589793F, 0.0F); - this.LeftF = new ModelRenderer(this, 32, 82); - this.LeftF.setRotationPoint(0.0F, 0.0F, 0.0F); - this.LeftF.addBox(1.9F, 0.0F, -2.0F, 1, 11, 3, 0.0F); - this.setRotateAngle(LeftF, 0.0F, 1.5707963267948966F, 0.0F); - this.TrimRight2 = new ModelRenderer(this, 0, 65); - this.TrimRight2.setRotationPoint(3.0F, -1.5F, -6.0F); - this.TrimRight2.addBox(0.0F, 0.0F, 0.0F, 2, 2, 1, 0.0F); - this.setRotateAngle(TrimRight2, 0.0F, 0.0F, 0.7853981633974483F); - this.Belt = new ModelRenderer(this, 0, 69); - this.Belt.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Belt.addBox(-6.8F, 10.0F, -3.0F, 10, 3, 6, 0.0F); - this.setRotateAngle(Belt, 0.0F, 0.0F, -0.13962634015954636F); - this.ShawlRight2 = new ModelRenderer(this, 42, 43); - this.ShawlRight2.mirror = true; - this.ShawlRight2.setRotationPoint(-2.5F, -1.8F, -0.1F); - this.ShawlRight2.addBox(-1.5F, -1.6F, -2.0F, 6, 3, 5, 0.0F); - this.setRotateAngle(ShawlRight2, 0.0F, 0.0F, 0.9424777960769379F); - this.LeftBS = new ModelRenderer(this, 33, 83); - this.LeftBS.setRotationPoint(0.0F, 0.0F, 0.0F); - this.LeftBS.addBox(1.75F, 0.0F, -0.65F, 1, 11, 2, 0.0F); - this.setRotateAngle(LeftBS, 0.0F, -0.7853981633974483F, 0.0F); - this.TrimLeft4 = new ModelRenderer(this, 0, 78); - this.TrimLeft4.setRotationPoint(0.0F, 0.0F, 0.0F); - this.TrimLeft4.addBox(-3.6F, -4.5F, -5.0F, 1, 3, 11, 0.0F); - this.setRotateAngle(TrimLeft4, 0.0F, 3.141592653589793F, 0.5235987755982988F); - this.Chest = new ModelRenderer(this, 0, 32); - this.Chest.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Chest.addBox(-4.5F, 0.0F, -2.5F, 9, 12, 5, 0.0F); - this.RightF = new ModelRenderer(this, 32, 82); - this.RightF.setRotationPoint(0.0F, 0.0F, 0.0F); - this.RightF.addBox(1.9F, 0.0F, -1.0F, 1, 11, 3, 0.0F); - this.setRotateAngle(RightF, 0.0F, -1.5707963267948966F, 0.0F); - this.Collar.addChild(this.TrimLeft2); - this.ShawlLeft1.addChild(this.ShawlLeft2); - this.Chest.addChild(this.Back); - this.LeftFront.addChild(this.LeftFS); - this.Chest.addChild(this.TopLeft); - this.LeftFront.addChild(this.LeftB); - this.RightFront.addChild(this.RightFS); - this.RightFront.addChild(this.RightBS); - this.Collar.addChild(this.TrimLeft3); - this.Collar.addChild(this.TrimRight4); - this.RightFront.addChild(this.RightBA); - this.RightFront.addChild(this.RightB2); - this.LeftFront.addChild(this.LeftB2); - this.Chest.addChild(this.TopRight); - this.LeftFront.addChild(this.LeftBA); - this.Collar.addChild(this.Left); - this.Collar.addChild(this.Flop); - this.Collar.addChild(this.Top); - this.Chest.addChild(this.Button); - this.Collar.addChild(this.Right); - this.RightFront.addChild(this.RightB); - this.ArmLeft.addChild(this.ShawlLeft1); - this.Collar.addChild(this.TrimRight3); - this.ArmRight.addChild(this.ShawlRight1); - this.LeftFront.addChild(this.LeftF); - this.Collar.addChild(this.TrimRight2); - this.Chest.addChild(this.Belt); - this.ShawlRight1.addChild(this.ShawlRight2); - this.LeftFront.addChild(this.LeftBS); - this.Collar.addChild(this.TrimLeft4); - this.RightFront.addChild(this.RightF); - - this.bipedHead.addChild(Collar); - this.bipedLeftArm.addChild(ArmLeft); - this.bipedRightArm.addChild(ArmRight); - this.bipedLeftLeg.addChild(LeftFront); - this.bipedRightLeg.addChild(RightFront); - this.bipedBody.addChild(Chest); - this.bipedBody.addChild(Belt); - } - - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - } - - /** - * This is a helper function from Tabula to set the rotation of model parts - */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } -} diff --git a/src/main/java/lance5057/tDefense/armor/renderers/ModelMask.java b/src/main/java/lance5057/tDefense/armor/renderers/ModelMask.java index 055e0c6..aee3b9e 100644 --- a/src/main/java/lance5057/tDefense/armor/renderers/ModelMask.java +++ b/src/main/java/lance5057/tDefense/armor/renderers/ModelMask.java @@ -11,64 +11,67 @@ import net.minecraft.entity.Entity; */ public class ModelMask extends ModelBiped { - public ModelRenderer Plate; - public ModelRenderer Band; - public ModelRenderer HornTipR; - public ModelRenderer HornTipL; - public ModelRenderer HornBaseR; - public ModelRenderer HornBaseL; + public ModelRenderer Plate; + public ModelRenderer Band; + public ModelRenderer HornTipR; + public ModelRenderer HornTipL; + public ModelRenderer HornBaseR; + public ModelRenderer HornBaseL; - String Color[]; - int rgbColors[]; - - public ModelMask(String color[] /*3*/) { - this.textureWidth = 64; - this.textureHeight = 64; - this.HornBaseR = new ModelRenderer(this, 0, 35); - this.HornBaseR.setRotationPoint(0.0F, 0.0F, 0.0F); - this.HornBaseR.addBox(-3.5F, -6.1F, -7.5F, 2, 2, 2, 0.0F); - this.setRotateAngle(HornBaseR, -0.17453292519943295F, 0.0F, 0.0F); - this.HornTipL = new ModelRenderer(this, 0, 39); - this.HornTipL.setRotationPoint(0.0F, 0.0F, 0.0F); - this.HornTipL.addBox(2.0F, -0.5F, -10.8F, 1, 1, 2, 0.1F); - this.setRotateAngle(HornTipL, -0.7853981633974483F, 0.0F, 0.0F); - this.HornTipR = new ModelRenderer(this, 0, 39); - this.HornTipR.setRotationPoint(0.0F, 0.0F, 0.0F); - this.HornTipR.addBox(-3.0F, -0.5F, -10.8F, 1, 1, 2, 0.1F); - this.setRotateAngle(HornTipR, -0.7853981633974483F, 0.0F, 0.0F); - this.Plate = new ModelRenderer(this, 0, 32); - this.Plate.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Plate.addBox(-4.0F, -7.0F, -5.0F, 8, 2, 1, 0.0F); - this.Band = new ModelRenderer(this, 0, 39); - this.Band.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Band.addBox(-4.0F, -6.5F, -4.0F, 8, 1, 8, 0.1F); - this.HornBaseL = new ModelRenderer(this, 0, 35); - this.HornBaseL.setRotationPoint(0.0F, 0.0F, 0.0F); - this.HornBaseL.addBox(1.5F, -6.1F, -7.5F, 2, 2, 2, 0.0F); - this.setRotateAngle(HornBaseL, -0.17453292519943295F, 0.0F, 0.0F); - this.Plate.addChild(this.HornBaseR); - this.Plate.addChild(this.HornBaseL); - - this.bipedHead.addChild(this.Plate); - this.bipedHead.addChild(this.HornTipL); - this.bipedHead.addChild(this.HornTipR); - this.bipedHead.addChild(this.Band); - - Color = color; - } + String Color[]; + int rgbColors[]; - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - } + public ModelMask(String color[] /*3*/) + { + this.textureWidth = 64; + this.textureHeight = 64; + this.HornBaseR = new ModelRenderer(this, 0, 35); + this.HornBaseR.setRotationPoint(0.0F, 0.0F, 0.0F); + this.HornBaseR.addBox(-3.5F, -6.1F, -7.5F, 2, 2, 2, 0.0F); + this.setRotateAngle(HornBaseR, -0.17453292519943295F, 0.0F, 0.0F); + this.HornTipL = new ModelRenderer(this, 0, 39); + this.HornTipL.setRotationPoint(0.0F, 0.0F, 0.0F); + this.HornTipL.addBox(2.0F, -0.5F, -10.8F, 1, 1, 2, 0.1F); + this.setRotateAngle(HornTipL, -0.7853981633974483F, 0.0F, 0.0F); + this.HornTipR = new ModelRenderer(this, 0, 39); + this.HornTipR.setRotationPoint(0.0F, 0.0F, 0.0F); + this.HornTipR.addBox(-3.0F, -0.5F, -10.8F, 1, 1, 2, 0.1F); + this.setRotateAngle(HornTipR, -0.7853981633974483F, 0.0F, 0.0F); + this.Plate = new ModelRenderer(this, 0, 32); + this.Plate.setRotationPoint(0.0F, 0.0F, 0.0F); + this.Plate.addBox(-4.0F, -7.0F, -5.0F, 8, 2, 1, 0.0F); + this.Band = new ModelRenderer(this, 0, 39); + this.Band.setRotationPoint(0.0F, 0.0F, 0.0F); + this.Band.addBox(-4.0F, -6.5F, -4.0F, 8, 1, 8, 0.1F); + this.HornBaseL = new ModelRenderer(this, 0, 35); + this.HornBaseL.setRotationPoint(0.0F, 0.0F, 0.0F); + this.HornBaseL.addBox(1.5F, -6.1F, -7.5F, 2, 2, 2, 0.0F); + this.setRotateAngle(HornBaseL, -0.17453292519943295F, 0.0F, 0.0F); + this.Plate.addChild(this.HornBaseR); + this.Plate.addChild(this.HornBaseL); - /** - * This is a helper function from Tabula to set the rotation of model parts - */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } + this.bipedHead.addChild(this.Plate); + this.bipedHead.addChild(this.HornTipL); + this.bipedHead.addChild(this.HornTipR); + this.bipedHead.addChild(this.Band); + + Color = color; + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + } + + /** + * This is a helper function from Tabula to set the rotation of model parts + */ + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) + { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } } diff --git a/src/main/java/lance5057/tDefense/armor/renderers/ModelScarf.java b/src/main/java/lance5057/tDefense/armor/renderers/ModelScarf.java index 56d085e..1158394 100644 --- a/src/main/java/lance5057/tDefense/armor/renderers/ModelScarf.java +++ b/src/main/java/lance5057/tDefense/armor/renderers/ModelScarf.java @@ -11,39 +11,42 @@ import net.minecraft.entity.Entity; */ public class ModelScarf extends ModelBiped { - public ModelRenderer ScarfNeck; - public ModelRenderer ScarfExtra1; - public ModelRenderer ScarfExtra1_1; + public ModelRenderer ScarfNeck; + public ModelRenderer ScarfExtra1; + public ModelRenderer ScarfExtra1_1; - public ModelScarf() { - this.textureWidth = 64; - this.textureHeight = 64; - this.ScarfExtra1_1 = new ModelRenderer(this, 0, 32); - this.ScarfExtra1_1.setRotationPoint(0.0F, 1.0F, 3.5F); - this.ScarfExtra1_1.addBox(-3.0F, 0.0F, 0.0F, 3, 11, 1, 0.0F); - this.setRotateAngle(ScarfExtra1_1, 0.0F, 0.0F, 0.17453292519943295F); - this.ScarfNeck = new ModelRenderer(this, 8, 32); - this.ScarfNeck.setRotationPoint(0.0F, 0.0F, 0.0F); - this.ScarfNeck.addBox(-4.0F, -2.0F, -4.0F, 8, 3, 8, 0.6F); - this.ScarfExtra1 = new ModelRenderer(this, 8, 32); - this.ScarfExtra1.setRotationPoint(0.0F, 1.0F, 3.5F); - this.ScarfExtra1.addBox(-0.5F, 0.0F, 0.0F, 3, 7, 1, 0.0F); - this.setRotateAngle(ScarfExtra1, 0.0F, 0.0F, -0.17453292519943295F); - this.ScarfNeck.addChild(this.ScarfExtra1_1); - this.ScarfNeck.addChild(this.ScarfExtra1); - } + public ModelScarf() + { + this.textureWidth = 64; + this.textureHeight = 64; + this.ScarfExtra1_1 = new ModelRenderer(this, 0, 32); + this.ScarfExtra1_1.setRotationPoint(0.0F, 1.0F, 3.5F); + this.ScarfExtra1_1.addBox(-3.0F, 0.0F, 0.0F, 3, 11, 1, 0.0F); + this.setRotateAngle(ScarfExtra1_1, 0.0F, 0.0F, 0.17453292519943295F); + this.ScarfNeck = new ModelRenderer(this, 8, 32); + this.ScarfNeck.setRotationPoint(0.0F, 0.0F, 0.0F); + this.ScarfNeck.addBox(-4.0F, -2.0F, -4.0F, 8, 3, 8, 0.6F); + this.ScarfExtra1 = new ModelRenderer(this, 8, 32); + this.ScarfExtra1.setRotationPoint(0.0F, 1.0F, 3.5F); + this.ScarfExtra1.addBox(-0.5F, 0.0F, 0.0F, 3, 7, 1, 0.0F); + this.setRotateAngle(ScarfExtra1, 0.0F, 0.0F, -0.17453292519943295F); + this.ScarfNeck.addChild(this.ScarfExtra1_1); + this.ScarfNeck.addChild(this.ScarfExtra1); + } - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { - this.ScarfNeck.render(f5); - } + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + this.ScarfNeck.render(f5); + } - /** - * This is a helper function from Tabula to set the rotation of model parts - */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } + /** + * This is a helper function from Tabula to set the rotation of model parts + */ + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) + { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } } diff --git a/src/main/java/lance5057/tDefense/armor/renderers/ModelSheath.java b/src/main/java/lance5057/tDefense/armor/renderers/ModelSheath.java index ba2b101..609908d 100644 --- a/src/main/java/lance5057/tDefense/armor/renderers/ModelSheath.java +++ b/src/main/java/lance5057/tDefense/armor/renderers/ModelSheath.java @@ -14,92 +14,96 @@ import cpw.mods.fml.client.FMLClientHandler; * ModelBiped - Either Mojang or a mod author * Created using Tabula 4.1.1 */ -public class ModelSheath extends ModelBiped { - public ModelRenderer sheath; - public ModelRenderer belt; - - String Color[]; - int rgbColors[]; - - public ModelSheath(String color[] /*4*/) { - this.textureWidth = 32; - this.textureHeight = 32; - this.belt = new ModelRenderer(this, 16, 0); - this.belt.setRotationPoint(-4.5F, 0.0F, 0.5F); - this.belt.addBox(0.0F, 0.0F, -3.0F, 1, 12, 5, 0.0F); - this.setRotateAngle(belt, 0.0F, 0.0F, -0.7853981633974483F); - this.sheath = new ModelRenderer(this, 0, 0); - this.sheath.setRotationPoint(-0.3F, 3.5F, 2.0F); - this.sheath.addBox(-3.0F, 0.0F, 0.0F, 6, 24, 2, 0.0F); - this.setRotateAngle(sheath, 0.0F, 0.0F, -0.45F); - - Color = color; - } - - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { - - GL11.glPushMatrix(); - - //Sheath Base - GL11.glPushMatrix(); - rgbColors = TinkersDefense.hexToRGB(Color[1]); - GL11.glColor3d((float)rgbColors[0]/255, (float)rgbColors[1]/255, (float)rgbColors[2]/255); - - GL11.glTranslatef(this.sheath.offsetX, this.sheath.offsetY, this.sheath.offsetZ); - GL11.glTranslatef(this.sheath.rotationPointX * f5, this.sheath.rotationPointY * f5, this.sheath.rotationPointZ * f5); - GL11.glScaled(0.65D, 0.65D, 0.5D); - GL11.glTranslatef(-this.sheath.offsetX, -this.sheath.offsetY, -this.sheath.offsetZ); - GL11.glTranslatef(-this.sheath.rotationPointX * f5, -this.sheath.rotationPointY * f5, -this.sheath.rotationPointZ * f5); - - this.sheath.render(f5); - GL11.glPopMatrix(); - - //Belt - GL11.glPushMatrix(); - FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/armor/Sheath/_sheath_belt.png")); - - rgbColors = TinkersDefense.hexToRGB(Color[2]); - GL11.glColor3d((float)rgbColors[0]/255, (float)rgbColors[1]/255, (float)rgbColors[2]/255); - - this.belt.render(f5); - GL11.glPopMatrix(); - - //Buckle - GL11.glPushMatrix(); - FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/armor/Sheath/_sheath_clasp.png")); - - rgbColors = TinkersDefense.hexToRGB(Color[3]); - GL11.glColor3d((float)rgbColors[0]/255, (float)rgbColors[1]/255, (float)rgbColors[2]/255); - - this.belt.render(f5); - GL11.glPopMatrix(); - - //Filigree - GL11.glPushMatrix(); - FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/armor/Sheath/_sheath_filigree.png")); - - rgbColors = TinkersDefense.hexToRGB(Color[0]); - GL11.glColor3d((float)rgbColors[0]/255, (float)rgbColors[1]/255, (float)rgbColors[2]/255); - - GL11.glTranslatef(this.sheath.offsetX, this.sheath.offsetY, this.sheath.offsetZ); - GL11.glTranslatef(this.sheath.rotationPointX * f5, this.sheath.rotationPointY * f5, this.sheath.rotationPointZ * f5); - GL11.glScaled(0.65D, 0.65D, 0.5D); - GL11.glTranslatef(-this.sheath.offsetX, -this.sheath.offsetY, -this.sheath.offsetZ); - GL11.glTranslatef(-this.sheath.rotationPointX * f5, -this.sheath.rotationPointY * f5, -this.sheath.rotationPointZ * f5); - - this.sheath.render(f5); - GL11.glPopMatrix(); - - GL11.glPopMatrix(); - } - - /** - * This is a helper function from Tabula to set the rotation of model parts - */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } +public class ModelSheath extends ModelBiped +{ + public ModelRenderer sheath; + public ModelRenderer belt; + + String Color[]; + int rgbColors[]; + + public ModelSheath(String color[] /*4*/) + { + this.textureWidth = 32; + this.textureHeight = 32; + this.belt = new ModelRenderer(this, 16, 0); + this.belt.setRotationPoint(-4.5F, 0.0F, 0.5F); + this.belt.addBox(0.0F, 0.0F, -3.0F, 1, 12, 5, 0.0F); + this.setRotateAngle(belt, 0.0F, 0.0F, -0.7853981633974483F); + this.sheath = new ModelRenderer(this, 0, 0); + this.sheath.setRotationPoint(-0.3F, 3.5F, 2.0F); + this.sheath.addBox(-3.0F, 0.0F, 0.0F, 6, 24, 2, 0.0F); + this.setRotateAngle(sheath, 0.0F, 0.0F, -0.45F); + + Color = color; + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + + GL11.glPushMatrix(); + + //Sheath Base + GL11.glPushMatrix(); + rgbColors = TinkersDefense.hexToRGB(Color[1]); + GL11.glColor3d((float) rgbColors[0] / 255, (float) rgbColors[1] / 255, (float) rgbColors[2] / 255); + + GL11.glTranslatef(this.sheath.offsetX, this.sheath.offsetY, this.sheath.offsetZ); + GL11.glTranslatef(this.sheath.rotationPointX * f5, this.sheath.rotationPointY * f5, this.sheath.rotationPointZ * f5); + GL11.glScaled(0.65D, 0.65D, 0.5D); + GL11.glTranslatef(-this.sheath.offsetX, -this.sheath.offsetY, -this.sheath.offsetZ); + GL11.glTranslatef(-this.sheath.rotationPointX * f5, -this.sheath.rotationPointY * f5, -this.sheath.rotationPointZ * f5); + + this.sheath.render(f5); + GL11.glPopMatrix(); + + //Belt + GL11.glPushMatrix(); + FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/armor/Sheath/_sheath_belt.png")); + + rgbColors = TinkersDefense.hexToRGB(Color[2]); + GL11.glColor3d((float) rgbColors[0] / 255, (float) rgbColors[1] / 255, (float) rgbColors[2] / 255); + + this.belt.render(f5); + GL11.glPopMatrix(); + + //Buckle + GL11.glPushMatrix(); + FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/armor/Sheath/_sheath_clasp.png")); + + rgbColors = TinkersDefense.hexToRGB(Color[3]); + GL11.glColor3d((float) rgbColors[0] / 255, (float) rgbColors[1] / 255, (float) rgbColors[2] / 255); + + this.belt.render(f5); + GL11.glPopMatrix(); + + //Filigree + GL11.glPushMatrix(); + FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/armor/Sheath/_sheath_filigree.png")); + + rgbColors = TinkersDefense.hexToRGB(Color[0]); + GL11.glColor3d((float) rgbColors[0] / 255, (float) rgbColors[1] / 255, (float) rgbColors[2] / 255); + + GL11.glTranslatef(this.sheath.offsetX, this.sheath.offsetY, this.sheath.offsetZ); + GL11.glTranslatef(this.sheath.rotationPointX * f5, this.sheath.rotationPointY * f5, this.sheath.rotationPointZ * f5); + GL11.glScaled(0.65D, 0.65D, 0.5D); + GL11.glTranslatef(-this.sheath.offsetX, -this.sheath.offsetY, -this.sheath.offsetZ); + GL11.glTranslatef(-this.sheath.rotationPointX * f5, -this.sheath.rotationPointY * f5, -this.sheath.rotationPointZ * f5); + + this.sheath.render(f5); + GL11.glPopMatrix(); + + GL11.glPopMatrix(); + } + + /** + * This is a helper function from Tabula to set the rotation of model parts + */ + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) + { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } } diff --git a/src/main/java/lance5057/tDefense/armor/renderers/cloth/ModelTinkersHood.java b/src/main/java/lance5057/tDefense/armor/renderers/cloth/ModelTinkersHood.java index 0ae93c0..077b6ca 100644 --- a/src/main/java/lance5057/tDefense/armor/renderers/cloth/ModelTinkersHood.java +++ b/src/main/java/lance5057/tDefense/armor/renderers/cloth/ModelTinkersHood.java @@ -1,82 +1,76 @@ package lance5057.tDefense.armor.renderers.cloth; import lance5057.tDefense.TinkersDefense; +import lance5057.tDefense.armor.renderers.ArmorRenderer; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import cpw.mods.fml.client.FMLClientHandler; -import net.minecraft.client.model.ModelBiped; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.util.ResourceLocation; /** * ModelBiped - Either Mojang or a mod author * Created using Tabula 4.1.1 */ -public class ModelTinkersHood extends ModelBiped { - public ModelRenderer Hood; - public ModelRenderer Flop; +public class ModelTinkersHood extends ArmorRenderer +{ + public ModelRenderer Hood; + public ModelRenderer Flop; + + public ModelTinkersHood(String[] colors, String defaultFolder, String[] textures) + { + super(1.1f, 0, 64, 64); + + this.textureWidth = 64; + this.textureHeight = 64; + + this.Hood = new ModelRenderer(this, 0, 44); + this.Hood.setRotationPoint(0.0F, 0.0F, 0.0F); + this.Hood.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0.5F); + this.bipedHead.addChild(this.Hood); + + this.Flop = new ModelRenderer(this, 0, 32); + this.Flop.setRotationPoint(0.0F, 0.0F, 0.0F); + this.Flop.addBox(-4.0F, -9.6F, 0.3F, 8, 8, 4, 0.0F); + this.setRotateAngle(Flop, -0.4553564018453205F, 0.0F, 0.0F); + this.bipedHead.addChild(this.Flop); + + this.bipedHeadwear.isHidden = true; + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + GL11.glPushMatrix(); + for(int i = 0; i < 3; i++) + { + GL11.glPushMatrix(); + + FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/" + defaultFolder + "/" + textures[i] + ".png")); + + float size = 2.25f; + GL11.glScalef(1.5F / size, 1.5F / size, 1.5F / size); + GL11.glTranslatef(0.0F, 0F * f5, 0.0F); - public String[] colors; - - public String[] textures; - public String defaultFolder; - - public ModelTinkersHood(String[] colors, String defaultFolder, String[] textures) - { - super(1.1f, 0, 64,64); - - this.textureWidth = 64; - this.textureHeight = 64; - - this.colors = colors; - this.textures = textures; - this.defaultFolder = defaultFolder; - - this.Hood = new ModelRenderer(this, 0, 44); - this.Hood.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Hood.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0.5F); - this.bipedHead.addChild(this.Hood); - - this.Flop = new ModelRenderer(this, 0, 32); - this.Flop.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Flop.addBox(-4.0F, -9.6F, 0.3F, 8, 8, 4, 0.0F); - this.setRotateAngle(Flop, -0.4553564018453205F, 0.0F, 0.0F); - this.bipedHead.addChild(this.Flop); - - this.bipedHeadwear.isHidden = true; - } + int[] intColors = TinkersDefense.hexToRGB(colors[i]); + GL11.glColor3d((float) intColors[0] / 255, (float) intColors[1] / 255, (float) intColors[2] / 255); - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { - GL11.glPushMatrix(); - for(int i = 0; i<3; i++) - { - GL11.glPushMatrix(); - - FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/" + defaultFolder + "/" + textures[i] + ".png")); - - float size = 2.25f; - GL11.glScalef(1.5F / size, 1.5F / size, 1.5F / size); - GL11.glTranslatef(0.0F, 0F*f5, 0.0F); - - int[] intColors = TinkersDefense.hexToRGB(colors[i]); - GL11.glColor3d((float)intColors[0]/255, (float)intColors[1]/255, (float)intColors[2]/255); - - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - GL11.glPopMatrix(); - } - GL11.glPopMatrix(); - } + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } - /** - * This is a helper function from Tabula to set the rotation of model parts - */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } + /** + * This is a helper function from Tabula to set the rotation of model parts + */ + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) + { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } } diff --git a/src/main/java/lance5057/tDefense/armor/renderers/cloth/ModelTinkersRobe.java b/src/main/java/lance5057/tDefense/armor/renderers/cloth/ModelTinkersRobe.java index 63634c8..024738d 100644 --- a/src/main/java/lance5057/tDefense/armor/renderers/cloth/ModelTinkersRobe.java +++ b/src/main/java/lance5057/tDefense/armor/renderers/cloth/ModelTinkersRobe.java @@ -1,7 +1,7 @@ package lance5057.tDefense.armor.renderers.cloth; import lance5057.tDefense.TinkersDefense; -import net.minecraft.client.model.ModelBiped; +import lance5057.tDefense.armor.renderers.ArmorRenderer; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; @@ -14,114 +14,108 @@ import cpw.mods.fml.client.FMLClientHandler; * ClothRobes - Undefined * Created using Tabula 4.1.1 */ -public class ModelTinkersRobe extends ModelBiped { - public ModelRenderer Left; - public ModelRenderer Right; - public ModelRenderer RightBack; - public ModelRenderer LeftFront; - public ModelRenderer RightFront; - public ModelRenderer Belt; - public ModelRenderer LeftBack; - - public String[] colors; - - public String[] textures; - public String defaultFolder; - - public ModelTinkersRobe(String[] colors, String defaultFolder, String[] textures) - { - super(1f, 0, 64,64); - - this.colors = colors; - this.textures = textures; - this.defaultFolder = defaultFolder; - - this.textureWidth = 64; - this.textureHeight = 64; - - this.Right = new ModelRenderer(this, 18, 41); - this.Right.mirror = true; - this.Right.setRotationPoint(0F, 0F, 0F); - this.Right.addBox(-2.5F, 0.0F, -2.5F, 6, 11, 5, 0.01F); - this.setRotateAngle(Right, 0.0F, 0.0F, 0.08726646259971647F); - this.bipedRightLeg.addChild(this.Right); - - this.RightBack = new ModelRenderer(this, 40, 43); - this.RightBack.mirror = true; - this.RightBack.setRotationPoint(0F, 0F, 0F); - this.RightBack.addBox(-2.5F, 0.27F, -0.6F, 6, 11, 3, 0.0F); - this.setRotateAngle(RightBack, 0.2617993877991494F, 0.0F, 0.08726646259971647F); - this.bipedRightLeg.addChild(this.RightBack); - - this.LeftBack = new ModelRenderer(this, 40, 43); - this.LeftBack.setRotationPoint(0F, 0F, 0F); - this.LeftBack.addBox(-3.5F, 0.27F, -0.6F, 6, 11, 3, 0.0F); - this.setRotateAngle(LeftBack, 0.2617993877991494F, 0.0F, -0.08726646259971647F); - this.bipedLeftLeg.addChild(this.LeftBack); - - this.Belt = new ModelRenderer(this, 0, 32); - this.Belt.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Belt.addBox(-6.8F, 10.0F, -3.0F, 10, 3, 6, 0.0F); - this.setRotateAngle(Belt, 0.0F, 0.0F, -0.13962634015954636F); - this.bipedBody.addChild(this.Belt); - - this.Left = new ModelRenderer(this, 18, 41); - this.Left.setRotationPoint(0F, 0F, 0F); - this.Left.addBox(-3.5F, 0.0F, -2.5F, 6, 11, 5, 0.01F); - this.setRotateAngle(Left, 0.0F, 0.0F, -0.08726646259971647F); - this.bipedLeftLeg.addChild(this.Left); - - this.LeftFront = new ModelRenderer(this, 0, 43); - this.LeftFront.setRotationPoint(0F, 0F, 0F); - this.LeftFront.addBox(-3.5F, 0.27F, -2.4F, 6, 11, 3, 0.0F); - this.setRotateAngle(LeftFront, -0.2617993877991494F, 0.0F, -0.08726646259971647F); - this.bipedLeftLeg.addChild(this.LeftFront); - - this.RightFront = new ModelRenderer(this, 0, 43); - this.RightFront.mirror = true; - this.RightFront.setRotationPoint(0F, 0F, 0F); - this.RightFront.addBox(-2.5F, 0.27F, -2.4F, 6, 11, 3, 0.0F); - this.setRotateAngle(RightFront, -0.2617993877991494F, 0.0F, 0.08726646259971647F); - this.bipedRightLeg.addChild(this.RightFront); - - //this.bipedBody.isHidden = true; - this.bipedHead.isHidden = true; - this.bipedHeadwear.isHidden = true; - //this.bipedRightLeg.isHidden = true; - //this.bipedLeftLeg.isHidden = true; - this.bipedRightArm.isHidden = true; - this.bipedLeftArm.isHidden = true; - } - - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { - GL11.glPushMatrix(); - for(int i = 0; i<2; i++) - { - GL11.glPushMatrix(); - - FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/" + defaultFolder + "/" + textures[i] + ".png")); - - float size = 1.45f; - GL11.glScalef(1.0F / size, 1.0F / size, 1.0F / size); - GL11.glTranslatef(0F, -1.5F*f5, -0F); - - int[] intColors = TinkersDefense.hexToRGB(colors[i]); - GL11.glColor3d((float)intColors[0]/255, (float)intColors[1]/255, (float)intColors[2]/255); - - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - GL11.glPopMatrix(); - } - GL11.glPopMatrix(); - } - - /** - * This is a helper function from Tabula to set the rotation of model parts - */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } +public class ModelTinkersRobe extends ArmorRenderer +{ + public ModelRenderer Left; + public ModelRenderer Right; + public ModelRenderer RightBack; + public ModelRenderer LeftFront; + public ModelRenderer RightFront; + public ModelRenderer Belt; + public ModelRenderer LeftBack; + + public ModelTinkersRobe(String[] colors, String defaultFolder, String[] textures) + { + super(1f, 0, 64, 64); + + this.textureWidth = 64; + this.textureHeight = 64; + + this.Right = new ModelRenderer(this, 18, 41); + this.Right.mirror = true; + this.Right.setRotationPoint(0F, 0F, 0F); + this.Right.addBox(-2.5F, 0.0F, -2.5F, 6, 11, 5, 0.01F); + this.setRotateAngle(Right, 0.0F, 0.0F, 0.08726646259971647F); + this.bipedRightLeg.addChild(this.Right); + + this.RightBack = new ModelRenderer(this, 40, 43); + this.RightBack.mirror = true; + this.RightBack.setRotationPoint(0F, 0F, 0F); + this.RightBack.addBox(-2.5F, 0.27F, -0.6F, 6, 11, 3, 0.0F); + this.setRotateAngle(RightBack, 0.2617993877991494F, 0.0F, 0.08726646259971647F); + this.bipedRightLeg.addChild(this.RightBack); + + this.LeftBack = new ModelRenderer(this, 40, 43); + this.LeftBack.setRotationPoint(0F, 0F, 0F); + this.LeftBack.addBox(-3.5F, 0.27F, -0.6F, 6, 11, 3, 0.0F); + this.setRotateAngle(LeftBack, 0.2617993877991494F, 0.0F, -0.08726646259971647F); + this.bipedLeftLeg.addChild(this.LeftBack); + + this.Belt = new ModelRenderer(this, 0, 32); + this.Belt.setRotationPoint(0.0F, 0.0F, 0.0F); + this.Belt.addBox(-6.8F, 10.0F, -3.0F, 10, 3, 6, 0.0F); + this.setRotateAngle(Belt, 0.0F, 0.0F, -0.13962634015954636F); + this.bipedBody.addChild(this.Belt); + + this.Left = new ModelRenderer(this, 18, 41); + this.Left.setRotationPoint(0F, 0F, 0F); + this.Left.addBox(-3.5F, 0.0F, -2.5F, 6, 11, 5, 0.01F); + this.setRotateAngle(Left, 0.0F, 0.0F, -0.08726646259971647F); + this.bipedLeftLeg.addChild(this.Left); + + this.LeftFront = new ModelRenderer(this, 0, 43); + this.LeftFront.setRotationPoint(0F, 0F, 0F); + this.LeftFront.addBox(-3.5F, 0.27F, -2.4F, 6, 11, 3, 0.0F); + this.setRotateAngle(LeftFront, -0.2617993877991494F, 0.0F, -0.08726646259971647F); + this.bipedLeftLeg.addChild(this.LeftFront); + + this.RightFront = new ModelRenderer(this, 0, 43); + this.RightFront.mirror = true; + this.RightFront.setRotationPoint(0F, 0F, 0F); + this.RightFront.addBox(-2.5F, 0.27F, -2.4F, 6, 11, 3, 0.0F); + this.setRotateAngle(RightFront, -0.2617993877991494F, 0.0F, 0.08726646259971647F); + this.bipedRightLeg.addChild(this.RightFront); + + //this.bipedBody.isHidden = true; + this.bipedHead.isHidden = true; + this.bipedHeadwear.isHidden = true; + //this.bipedRightLeg.isHidden = true; + //this.bipedLeftLeg.isHidden = true; + this.bipedRightArm.isHidden = true; + this.bipedLeftArm.isHidden = true; + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + GL11.glPushMatrix(); + for(int i = 0; i < 2; i++) + { + GL11.glPushMatrix(); + + FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/" + defaultFolder + "/" + textures[i] + ".png")); + + float size = 1.45f; + GL11.glScalef(1.0F / size, 1.0F / size, 1.0F / size); + GL11.glTranslatef(0F, -1.5F * f5, -0F); + + int[] intColors = TinkersDefense.hexToRGB(colors[i]); + GL11.glColor3d((float) intColors[0] / 255, (float) intColors[1] / 255, (float) intColors[2] / 255); + + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + + /** + * This is a helper function from Tabula to set the rotation of model parts + */ + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) + { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } } diff --git a/src/main/java/lance5057/tDefense/armor/renderers/cloth/ModelTinkersShawl.java b/src/main/java/lance5057/tDefense/armor/renderers/cloth/ModelTinkersShawl.java index 8ddb70b..37519b2 100644 --- a/src/main/java/lance5057/tDefense/armor/renderers/cloth/ModelTinkersShawl.java +++ b/src/main/java/lance5057/tDefense/armor/renderers/cloth/ModelTinkersShawl.java @@ -1,140 +1,134 @@ package lance5057.tDefense.armor.renderers.cloth; import lance5057.tDefense.TinkersDefense; +import lance5057.tDefense.armor.renderers.ArmorRenderer; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import cpw.mods.fml.client.FMLClientHandler; -import net.minecraft.client.model.ModelBiped; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.util.ResourceLocation; /** * ModelBiped - Either Mojang or a mod author * Created using Tabula 4.1.1 */ -public class ModelTinkersShawl extends ModelBiped { - public ModelRenderer ShawlLeft1; - public ModelRenderer ShawlLeft2; - public ModelRenderer ShawlRight1; - public ModelRenderer ShawlRight2; - public ModelRenderer Button; - public ModelRenderer TopLeft; - public ModelRenderer TopRight; - public ModelRenderer ArmLeft; - public ModelRenderer ArmRight; - public ModelRenderer Chest; - - public String[] colors; - - public String[] textures; - public String defaultFolder; - - public ModelTinkersShawl(String[] colors, String defaultFolder, String[] textures) - { - super(1f, 0, 64,64); - - this.colors = colors; - this.textures = textures; - this.defaultFolder = defaultFolder; - - this.textureWidth = 64; - this.textureHeight = 64; - - this.ArmLeft = new ModelRenderer(this, 48, 48); - this.ArmLeft.mirror = true; - this.ArmLeft.setRotationPoint(0.0F, 0.0F, 0.0F); - this.ArmLeft.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F); - this.bipedLeftArm.addChild(this.ArmLeft); - - this.ArmRight = new ModelRenderer(this, 48, 48); - this.ArmRight.setRotationPoint(0.0F, 0.0F, 0.0F); - this.ArmRight.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F); - this.bipedRightArm.addChild(this.ArmRight); - - this.Chest = new ModelRenderer(this, 40, 32); - this.Chest.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Chest.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, 0.0F); - this.bipedBody.addChild(this.Chest); - - this.TopRight = new ModelRenderer(this, 0, 52); - this.TopRight.mirror = true; - this.TopRight.setRotationPoint(0.0F, 0.0F, 0.0F); - this.TopRight.addBox(-3.5F, -2.3F, -3.0F, 9, 3, 6, -0.01F); - this.bipedRightArm.addChild(this.TopRight); - - this.Button = new ModelRenderer(this, 0, 61); - this.Button.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Button.addBox(0.0F, 0.0F, -3.5F, 2, 2, 1, 0.0F); - this.setRotateAngle(Button, 0.0F, 0.0F, 0.7853981633974483F); - this.bipedBody.addChild(this.Button); - - this.TopLeft = new ModelRenderer(this, 0, 52); - this.TopLeft.setRotationPoint(0.0F, 0.0F, 0.0F); - this.TopLeft.addBox(-5.5F, -2.3F, -3.0F, 9, 3, 6, -0.01F); - this.bipedLeftArm.addChild(this.TopLeft); - - this.ShawlRight1 = new ModelRenderer(this, 0, 32); - this.ShawlRight1.mirror = true; - this.ShawlRight1.setRotationPoint(0.0F, 0.0F, 0.0F); - this.ShawlRight1.addBox(-4.0F, -1.3F, -3.0F, 6, 5, 6, 0.0F); - this.setRotateAngle(ShawlRight1, 0.0F, 0.0F, 0.2617993877991494F); - this.bipedRightArm.addChild(this.ShawlRight1); - - this.ShawlRight2 = new ModelRenderer(this, 0, 43); - this.ShawlRight2.mirror = true; - this.ShawlRight2.setRotationPoint(0.0F, 0.0F, 0.0F); - this.ShawlRight2.addBox(-1.9F, 0.8F, -3.0F, 6, 3, 6, 0.01F); - this.setRotateAngle(ShawlRight2, 0.0F, 0.0F, -0.6981317007977318F); - this.bipedRightArm.addChild(this.ShawlRight2); - - this.ShawlLeft1 = new ModelRenderer(this, 0, 32); - this.ShawlLeft1.setRotationPoint(0.0F, 0.0F, 0.0F); - this.ShawlLeft1.addBox(-2.0F, -1.3F, -3.0F, 6, 5, 6, 0.0F); - this.setRotateAngle(ShawlLeft1, 0.0F, 0.0F, -0.2617993877991494F); - this.bipedLeftArm.addChild(this.ShawlLeft1); - - this.ShawlLeft2 = new ModelRenderer(this, 0, 43); - this.ShawlLeft2.setRotationPoint(0.0F, 0.0F, 0.0F); - this.ShawlLeft2.addBox(-4.1F, 0.8F, -3.0F, 6, 3, 6, 0.1F); - this.setRotateAngle(ShawlLeft2, 0.0F, 0.0F, 0.6981317007977318F); - this.bipedLeftArm.addChild(this.ShawlLeft2); - - this.bipedHead.isHidden = true; - this.bipedHeadwear.isHidden = true; - this.bipedCloak.isHidden = true; - } - - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { - GL11.glPushMatrix(); - for(int i = 0; i<3; i++) - { - GL11.glPushMatrix(); - - FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/" + defaultFolder + "/" + textures[i] + ".png")); - - float size = 1.5f; - GL11.glScalef(1.0F / size, 1.0F / size, 1.0F / size); - GL11.glTranslatef(0F, -0F*f5, -0F); - - int[] intColors = TinkersDefense.hexToRGB(colors[i]); - GL11.glColor3d((float)intColors[0]/255, (float)intColors[1]/255, (float)intColors[2]/255); - - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - GL11.glPopMatrix(); - } - GL11.glPopMatrix(); - } - - /** - * This is a helper function from Tabula to set the rotation of model parts - */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } +public class ModelTinkersShawl extends ArmorRenderer +{ + public ModelRenderer ShawlLeft1; + public ModelRenderer ShawlLeft2; + public ModelRenderer ShawlRight1; + public ModelRenderer ShawlRight2; + public ModelRenderer Button; + public ModelRenderer TopLeft; + public ModelRenderer TopRight; + public ModelRenderer ArmLeft; + public ModelRenderer ArmRight; + public ModelRenderer Chest; + + public ModelTinkersShawl(String[] colors, String defaultFolder, String[] textures) + { + super(1f, 0, 64, 64); + + this.textureWidth = 64; + this.textureHeight = 64; + + this.ArmLeft = new ModelRenderer(this, 48, 48); + this.ArmLeft.mirror = true; + this.ArmLeft.setRotationPoint(0.0F, 0.0F, 0.0F); + this.ArmLeft.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F); + this.bipedLeftArm.addChild(this.ArmLeft); + + this.ArmRight = new ModelRenderer(this, 48, 48); + this.ArmRight.setRotationPoint(0.0F, 0.0F, 0.0F); + this.ArmRight.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F); + this.bipedRightArm.addChild(this.ArmRight); + + this.Chest = new ModelRenderer(this, 40, 32); + this.Chest.setRotationPoint(0.0F, 0.0F, 0.0F); + this.Chest.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, 0.0F); + this.bipedBody.addChild(this.Chest); + + this.TopRight = new ModelRenderer(this, 0, 52); + this.TopRight.mirror = true; + this.TopRight.setRotationPoint(0.0F, 0.0F, 0.0F); + this.TopRight.addBox(-3.5F, -2.3F, -3.0F, 9, 3, 6, -0.01F); + this.bipedRightArm.addChild(this.TopRight); + + this.Button = new ModelRenderer(this, 0, 61); + this.Button.setRotationPoint(0.0F, 0.0F, 0.0F); + this.Button.addBox(0.0F, 0.0F, -3.5F, 2, 2, 1, 0.0F); + this.setRotateAngle(Button, 0.0F, 0.0F, 0.7853981633974483F); + this.bipedBody.addChild(this.Button); + + this.TopLeft = new ModelRenderer(this, 0, 52); + this.TopLeft.setRotationPoint(0.0F, 0.0F, 0.0F); + this.TopLeft.addBox(-5.5F, -2.3F, -3.0F, 9, 3, 6, -0.01F); + this.bipedLeftArm.addChild(this.TopLeft); + + this.ShawlRight1 = new ModelRenderer(this, 0, 32); + this.ShawlRight1.mirror = true; + this.ShawlRight1.setRotationPoint(0.0F, 0.0F, 0.0F); + this.ShawlRight1.addBox(-4.0F, -1.3F, -3.0F, 6, 5, 6, 0.0F); + this.setRotateAngle(ShawlRight1, 0.0F, 0.0F, 0.2617993877991494F); + this.bipedRightArm.addChild(this.ShawlRight1); + + this.ShawlRight2 = new ModelRenderer(this, 0, 43); + this.ShawlRight2.mirror = true; + this.ShawlRight2.setRotationPoint(0.0F, 0.0F, 0.0F); + this.ShawlRight2.addBox(-1.9F, 0.8F, -3.0F, 6, 3, 6, 0.01F); + this.setRotateAngle(ShawlRight2, 0.0F, 0.0F, -0.6981317007977318F); + this.bipedRightArm.addChild(this.ShawlRight2); + + this.ShawlLeft1 = new ModelRenderer(this, 0, 32); + this.ShawlLeft1.setRotationPoint(0.0F, 0.0F, 0.0F); + this.ShawlLeft1.addBox(-2.0F, -1.3F, -3.0F, 6, 5, 6, 0.0F); + this.setRotateAngle(ShawlLeft1, 0.0F, 0.0F, -0.2617993877991494F); + this.bipedLeftArm.addChild(this.ShawlLeft1); + + this.ShawlLeft2 = new ModelRenderer(this, 0, 43); + this.ShawlLeft2.setRotationPoint(0.0F, 0.0F, 0.0F); + this.ShawlLeft2.addBox(-4.1F, 0.8F, -3.0F, 6, 3, 6, 0.1F); + this.setRotateAngle(ShawlLeft2, 0.0F, 0.0F, 0.6981317007977318F); + this.bipedLeftArm.addChild(this.ShawlLeft2); + + this.bipedHead.isHidden = true; + this.bipedHeadwear.isHidden = true; + this.bipedCloak.isHidden = true; + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + GL11.glPushMatrix(); + for(int i = 0; i < 3; i++) + { + GL11.glPushMatrix(); + + FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/" + defaultFolder + "/" + textures[i] + ".png")); + + float size = 1.5f; + GL11.glScalef(1.0F / size, 1.0F / size, 1.0F / size); + GL11.glTranslatef(0F, -0F * f5, -0F); + + int[] intColors = TinkersDefense.hexToRGB(colors[i]); + GL11.glColor3d((float) intColors[0] / 255, (float) intColors[1] / 255, (float) intColors[2] / 255); + + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + + /** + * This is a helper function from Tabula to set the rotation of model parts + */ + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) + { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } } diff --git a/src/main/java/lance5057/tDefense/armor/renderers/heavy/ModelTinkersBreastplate.java b/src/main/java/lance5057/tDefense/armor/renderers/heavy/ModelTinkersBreastplate.java index d1c3fd5..fa4ee35 100644 --- a/src/main/java/lance5057/tDefense/armor/renderers/heavy/ModelTinkersBreastplate.java +++ b/src/main/java/lance5057/tDefense/armor/renderers/heavy/ModelTinkersBreastplate.java @@ -1,141 +1,136 @@ package lance5057.tDefense.armor.renderers.heavy; import lance5057.tDefense.TinkersDefense; +import lance5057.tDefense.armor.renderers.ArmorRenderer; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import cpw.mods.fml.client.FMLClientHandler; -import net.minecraft.client.model.ModelBiped; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.util.ResourceLocation; /** * ModelBiped - Either Mojang or a mod author * Created using Tabula 4.1.1 */ -public class ModelTinkersBreastplate extends ModelBiped +public class ModelTinkersBreastplate extends ArmorRenderer { - public ModelRenderer BackPlate; - public ModelRenderer BreastPlate; - public ModelRenderer Plackart; - public ModelRenderer PauldronR; - public ModelRenderer ArmGuardR; - public ModelRenderer PauldronL; - public ModelRenderer ArmGuardL; - public ModelRenderer ArmL; - public ModelRenderer ArmR; - public ModelRenderer BreastPlateFront; - - public String[] colors; - - public String[] textures; - public String defaultFolder; - - public ModelTinkersBreastplate(String[] colors, String defaultFolder, String[] textures) - { - super(1.1f, 0, 64,64); - - this.colors = colors; - this.textures = textures; - this.defaultFolder = defaultFolder; - - this.textureWidth = 64; - this.textureHeight = 64; - - this.BreastPlate = new ModelRenderer(this, 0, 32); - this.BreastPlate.setRotationPoint(0.0F, 0.0F, 0.0F); - this.BreastPlate.addBox(-4.0F, 0.1F, -3.6F, 8, 6, 4, 0.1F); - this.bipedBody.addChild(this.BreastPlate); - - this.BreastPlateFront = new ModelRenderer(this, 22, 56); - this.BreastPlateFront.setRotationPoint(0.0F, 0.0F, 0.0F); - this.BreastPlateFront.addBox(-3.0F, 0.5F, -4.2F, 6, 4, 4, 0.1F); - this.bipedBody.addChild(this.BreastPlateFront); - - this.Plackart = new ModelRenderer(this, 0, 42); - this.Plackart.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Plackart.addBox(-4.0F, 5.0F, -3.0F, 8, 7, 6, 0.0F); - this.bipedBody.addChild(this.Plackart); - - this.ArmGuardR = new ModelRenderer(this, 28, 44); - this.ArmGuardR.mirror = true; - this.ArmGuardR.setRotationPoint(0.0F, 0.0F, 0.0F); - this.ArmGuardR.addBox(-4.0F, -2.1F, -3.0F, 5, 6, 6, 0.0F); - this.bipedRightArm.addChild(this.ArmGuardR); - - this.ArmGuardL = new ModelRenderer(this, 28, 44); - this.ArmGuardL.setRotationPoint(0.0F, 0.0F, 0.0F); - this.ArmGuardL.addBox(-1.0F, -2.1F, -3.0F, 5, 6, 6, 0.0F); - this.bipedLeftArm.addChild(this.ArmGuardL); - - this.PauldronR = new ModelRenderer(this, 24, 32); - this.PauldronR.mirror = true; - this.PauldronR.setRotationPoint(0.0F, 0.0F, 0.0F); - this.PauldronR.addBox(-4.6F, -2.0F, -3.5F, 4, 5, 7, 0.0F); - this.setRotateAngle(PauldronR, 0.0F, -0.0F, 0.4363323129985824F); - this.bipedRightArm.addChild(this.PauldronR); - - this.ArmL = new ModelRenderer(this, 48, 34); - this.ArmL.mirror = true; - this.ArmL.setRotationPoint(0.0F, 0.0F, 0.0F); - this.ArmL.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F); - this.setRotateAngle(ArmL, 0.0F, 0.0F, 0.0017453292519943296F); - this.bipedLeftArm.addChild(this.ArmL); - - this.ArmR = new ModelRenderer(this, 48, 34); - this.ArmR.setRotationPoint(0.0F, 0.0F, 0.0F); - this.ArmR.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F); - this.bipedRightArm.addChild(this.ArmR); - - this.BackPlate = new ModelRenderer(this, 0, 56); - this.BackPlate.setRotationPoint(0.0F, 0.0F, 0.0F); - this.BackPlate.addBox(-4.0F, 0.0F, 1.0F, 8, 5, 3, 0.0F); - this.setRotateAngle(BackPlate, -0.08726646006107329F, -0.0F, 0.0F); - this.bipedBody.addChild(this.BackPlate); - - this.PauldronL = new ModelRenderer(this, 24, 32); - this.PauldronL.setRotationPoint(0.0F, 0.0F, 0.0F); - this.PauldronL.addBox(0.5F, -2.0F, -3.5F, 4, 5, 7, 0.0F); - this.setRotateAngle(PauldronL, 0.0F, -0.0F, -0.4363323129985824F); - this.bipedLeftArm.addChild(this.PauldronL); - - // this.ArmR.offsetX = this.ArmR.offsetX + 0.04f; - - this.bipedHead.isHidden = true; - this.bipedHeadwear.isHidden = true; - this.bipedCloak.isHidden = true; - } - - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { - GL11.glPushMatrix(); - for(int i = 0; i<4; i++) - { - GL11.glPushMatrix(); - - FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/" + defaultFolder + "/" + textures[i] + ".png")); - - float size =1.5f; - GL11.glScalef(1.0F / size, 1.0F / size, 1.0F / size); - GL11.glTranslatef(0.0F, -0F*f5, 0.0F); - - int[] intColors = TinkersDefense.hexToRGB(colors[i]); - GL11.glColor3d((float)intColors[0]/255, (float)intColors[1]/255, (float)intColors[2]/255); - - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - GL11.glPopMatrix(); - } - GL11.glPopMatrix(); - } - - /** - * This is a helper function from Tabula to set the rotation of model parts - */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } + public ModelRenderer BackPlate; + public ModelRenderer BreastPlate; + public ModelRenderer Plackart; + public ModelRenderer PauldronR; + public ModelRenderer ArmGuardR; + public ModelRenderer PauldronL; + public ModelRenderer ArmGuardL; + public ModelRenderer ArmL; + public ModelRenderer ArmR; + public ModelRenderer BreastPlateFront; + + public ModelTinkersBreastplate() + { + super(1f, 0, 64, 64); + + this.textureWidth = 64; + this.textureHeight = 64; + + this.BreastPlate = new ModelRenderer(this, 0, 32); + this.BreastPlate.setRotationPoint(0.0F, 0.0F, 0.0F); + this.BreastPlate.addBox(-4.0F, 0.1F, -3.6F, 8, 6, 4, 0.1F); + this.bipedBody.addChild(this.BreastPlate); + + this.BreastPlateFront = new ModelRenderer(this, 22, 56); + this.BreastPlateFront.setRotationPoint(0.0F, 0.0F, 0.0F); + this.BreastPlateFront.addBox(-3.0F, 0.5F, -4.2F, 6, 4, 4, 0.1F); + this.bipedBody.addChild(this.BreastPlateFront); + + this.Plackart = new ModelRenderer(this, 0, 42); + this.Plackart.setRotationPoint(0.0F, 0.0F, 0.0F); + this.Plackart.addBox(-4.0F, 5.0F, -3.0F, 8, 7, 6, 0.0F); + this.bipedBody.addChild(this.Plackart); + + this.ArmGuardR = new ModelRenderer(this, 28, 44); + this.ArmGuardR.mirror = true; + this.ArmGuardR.setRotationPoint(0.0F, 0.0F, 0.0F); + this.ArmGuardR.addBox(-4.0F, -2.0F, -3.0F, 5, 6, 6, 0.0F); + this.bipedRightArm.addChild(this.ArmGuardR); + + this.ArmGuardL = new ModelRenderer(this, 28, 44); + this.ArmGuardL.setRotationPoint(0.0F, 0.0F, 0.0F); + this.ArmGuardL.addBox(-1.0F, -2.0F, -3.0F, 5, 6, 6, 0.0F); + this.bipedLeftArm.addChild(this.ArmGuardL); + + this.PauldronR = new ModelRenderer(this, 24, 32); + this.PauldronR.mirror = true; + this.PauldronR.setRotationPoint(0.0F, 0.0F, 0.0F); + this.PauldronR.addBox(-4.6F, -2.0F, -3.5F, 4, 5, 7, 0.0F); + this.setRotateAngle(PauldronR, 0.0F, -0.0F, 0.4363323129985824F); + this.bipedRightArm.addChild(this.PauldronR); + + this.ArmL = new ModelRenderer(this, 48, 34); + this.ArmL.mirror = true; + this.ArmL.setRotationPoint(0.0F, 0.0F, 0.0F); + this.ArmL.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, 0.1F); + this.setRotateAngle(ArmL, 0.0F, 0.0F, 0.0017453292519943296F); + this.bipedLeftArm.addChild(this.ArmL); + + this.ArmR = new ModelRenderer(this, 48, 34); + this.ArmR.setRotationPoint(0.0F, 0.0F, 0.0F); + this.ArmR.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, 0.1F); + this.bipedRightArm.addChild(this.ArmR); + + this.BackPlate = new ModelRenderer(this, 0, 56); + this.BackPlate.setRotationPoint(0.0F, 0.0F, 0.0F); + this.BackPlate.addBox(-4.0F, 0.0F, 1.0F, 8, 5, 3, 0.0F); + this.setRotateAngle(BackPlate, -0.08726646006107329F, -0.0F, 0.0F); + this.bipedBody.addChild(this.BackPlate); + + this.PauldronL = new ModelRenderer(this, 24, 32); + this.PauldronL.setRotationPoint(0.0F, 0.0F, 0.0F); + this.PauldronL.addBox(0.5F, -2.0F, -3.5F, 4, 5, 7, 0.0F); + this.setRotateAngle(PauldronL, 0.0F, -0.0F, -0.4363323129985824F); + this.bipedLeftArm.addChild(this.PauldronL); + + // this.ArmR.offsetX = this.ArmR.offsetX + 0.04f; + + this.bipedHead.isHidden = true; + this.bipedHeadwear.isHidden = true; + this.bipedCloak.isHidden = true; + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + GL11.glPushMatrix(); + for(int i = 0; i < 4; i++) + { + GL11.glPushMatrix(); + + FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/" + defaultFolder + "/" + textures[i] + ".png")); + + float size = 1.6f; + GL11.glScalef(1.0F / size, 1.0F / size, 1.0F / size); + GL11.glTranslatef(0.0F, -0.01F, 0.0F); + + int[] intColors = TinkersDefense.hexToRGB(colors[i]); + GL11.glColor3d((float) intColors[0] / 255, (float) intColors[1] / 255, (float) intColors[2] / 255); + + //setLivingAnimations((EntityLivingBase) entity, f,f1, f5); + super.render(entity, f, f1, f2, f3, f4, f5); + + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + + /** + * This is a helper function from Tabula to set the rotation of model parts + */ + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) + { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } } diff --git a/src/main/java/lance5057/tDefense/armor/renderers/heavy/ModelTinkersGrieves.java b/src/main/java/lance5057/tDefense/armor/renderers/heavy/ModelTinkersGrieves.java index ecc00da..c5f59ff 100644 --- a/src/main/java/lance5057/tDefense/armor/renderers/heavy/ModelTinkersGrieves.java +++ b/src/main/java/lance5057/tDefense/armor/renderers/heavy/ModelTinkersGrieves.java @@ -1,122 +1,116 @@ package lance5057.tDefense.armor.renderers.heavy; import lance5057.tDefense.TinkersDefense; +import lance5057.tDefense.armor.renderers.ArmorRenderer; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import cpw.mods.fml.client.FMLClientHandler; -import net.minecraft.client.model.ModelBiped; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.util.ResourceLocation; /** * TinkersGrieves - Either Mojang or a mod author * Created using Tabula 4.1.1 */ -public class ModelTinkersGrieves extends ModelBiped { - public ModelRenderer LegPlateL; - public ModelRenderer CodPiece; - public ModelRenderer LegPlateBackL; - public ModelRenderer LegPlateBackR; - public ModelRenderer LegPlateR; - public ModelRenderer Belt; - public ModelRenderer LeftLeg; - public ModelRenderer RightLeg; - - public String[] colors; - - public String[] textures; - public String defaultFolder; - - public ModelTinkersGrieves(String[] colors, String defaultFolder, String[] textures) - { - super(1f, 0, 64,64); - - this.colors = colors; - this.textures = textures; - this.defaultFolder = defaultFolder; - - this.textureWidth = 64; - this.textureHeight = 64; - - this.LegPlateBackL = new ModelRenderer(this, 0, 43); - this.LegPlateBackL.mirror = true; - this.LegPlateBackL.setRotationPoint(0.0F, 0.0F, 0.0F); - this.LegPlateBackL.addBox(-2.0F, 0.0F, 1.2F, 4, 5, 1, 0.1F); - this.setRotateAngle(LegPlateBackL, 0.2617993877991494F, 0.0F, 0.0F); - this.bipedLeftLeg.addChild(this.LegPlateBackL); - - this.LegPlateR = new ModelRenderer(this, 0, 32); - this.LegPlateR.setRotationPoint(0.0F, 0.0F, 0.0F); - this.LegPlateR.addBox(1.1F, 0.0F, -1.9F, 1, 5, 4, 0.1F); - this.setRotateAngle(LegPlateR, 0.0F, 3.141592653589793F, 0.2617993877991494F); - this.bipedRightLeg.addChild(this.LegPlateR); - - this.LeftLeg = new ModelRenderer(this, 32, 32); - this.LeftLeg.mirror = true; - this.LeftLeg.setRotationPoint(0.0F, 0.0F, 0.0F); - this.LeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F); - this.bipedLeftLeg.addChild(this.LeftLeg); - - this.LegPlateL = new ModelRenderer(this, 0, 32); - this.LegPlateL.mirror = true; - this.LegPlateL.setRotationPoint(0.0F, 0.0F, 0.0F); - this.LegPlateL.addBox(1.1F, 0.0F, -2.1F, 1, 5, 4, 0.1F); - this.setRotateAngle(LegPlateL, 0.0F, 0.0F, -0.2617993877991494F); - this.bipedLeftLeg.addChild(this.LegPlateL); - - this.CodPiece = new ModelRenderer(this, 0, 50); - this.CodPiece.setRotationPoint(0.0F, 0.0F, 0.0F); - this.CodPiece.addBox(-2.0F, 10.0F, -2.8F, 4, 4, 3, -0.4F); - this.bipedBody.addChild(this.CodPiece); - - this.LegPlateBackR = new ModelRenderer(this, 0, 43); - this.LegPlateBackR.setRotationPoint(0.0F, 0.0F, 0.0F); - this.LegPlateBackR.addBox(-2.0F, 0.0F, 1.2F, 4, 5, 1, 0.1F); - this.setRotateAngle(LegPlateBackR, 0.2617993877991494F, 0.0F, 0.0F); - this.bipedRightLeg.addChild(this.LegPlateBackR); - - this.RightLeg = new ModelRenderer(this, 32, 32); - this.RightLeg.setRotationPoint(0.0F, 0.0F, 0.0F); - this.RightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F); - this.bipedRightLeg.addChild(this.RightLeg); - - this.Belt = new ModelRenderer(this, 0, 57); - this.Belt.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Belt.addBox(-4.5F, 10.0F, -2.5F, 9, 2, 5, -0.25F); - this.bipedBody.addChild(this.Belt); - } - - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { - GL11.glPushMatrix(); - for(int i = 0; i<4; i++) - { - GL11.glPushMatrix(); - - FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/" + defaultFolder + "/" + textures[i] + ".png")); - - float size =1.45f; - GL11.glScalef(1.0F / size, 1.0F / size, 1.0F / size); - GL11.glTranslatef(0F, -1F*f5, -0F); - - int[] intColors = TinkersDefense.hexToRGB(colors[i]); - GL11.glColor3d((float)intColors[0]/255, (float)intColors[1]/255, (float)intColors[2]/255); - - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - GL11.glPopMatrix(); - } - GL11.glPopMatrix(); - } - - /** - * This is a helper function from Tabula to set the rotation of model parts - */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } +public class ModelTinkersGrieves extends ArmorRenderer +{ + public ModelRenderer LegPlateL; + public ModelRenderer CodPiece; + public ModelRenderer LegPlateBackL; + public ModelRenderer LegPlateBackR; + public ModelRenderer LegPlateR; + public ModelRenderer Belt; + public ModelRenderer LeftLeg; + public ModelRenderer RightLeg; + + public ModelTinkersGrieves() + { + super(1f, 0, 64, 64); + + this.textureWidth = 64; + this.textureHeight = 64; + + this.LegPlateBackL = new ModelRenderer(this, 0, 43); + this.LegPlateBackL.mirror = true; + this.LegPlateBackL.setRotationPoint(0.0F, 0.0F, 0.0F); + this.LegPlateBackL.addBox(-2.0F, 0.0F, 1.2F, 4, 5, 1, 0.1F); + this.setRotateAngle(LegPlateBackL, 0.2617993877991494F, 0.0F, 0.0F); + this.bipedLeftLeg.addChild(this.LegPlateBackL); + + this.LegPlateR = new ModelRenderer(this, 0, 32); + this.LegPlateR.setRotationPoint(0.0F, 0.0F, 0.0F); + this.LegPlateR.addBox(1.1F, 0.0F, -1.9F, 1, 5, 4, 0.1F); + this.setRotateAngle(LegPlateR, 0.0F, 3.141592653589793F, 0.2617993877991494F); + this.bipedRightLeg.addChild(this.LegPlateR); + + this.LeftLeg = new ModelRenderer(this, 32, 32); + this.LeftLeg.mirror = true; + this.LeftLeg.setRotationPoint(0.0F, 0.0F, 0.0F); + this.LeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.05F); + this.bipedLeftLeg.addChild(this.LeftLeg); + + this.LegPlateL = new ModelRenderer(this, 0, 32); + this.LegPlateL.mirror = true; + this.LegPlateL.setRotationPoint(0.0F, 0.0F, 0.0F); + this.LegPlateL.addBox(1.1F, 0.0F, -2.1F, 1, 5, 4, 0.1F); + this.setRotateAngle(LegPlateL, 0.0F, 0.0F, -0.2617993877991494F); + this.bipedLeftLeg.addChild(this.LegPlateL); + + this.CodPiece = new ModelRenderer(this, 0, 50); + this.CodPiece.setRotationPoint(0.0F, 0.0F, 0.0F); + this.CodPiece.addBox(-2.0F, 10.0F, -2.8F, 4, 4, 3, 0.2F); + this.bipedBody.addChild(this.CodPiece); + + this.LegPlateBackR = new ModelRenderer(this, 0, 43); + this.LegPlateBackR.setRotationPoint(0.0F, 0.0F, 0.0F); + this.LegPlateBackR.addBox(-2.0F, 0.0F, 1.2F, 4, 5, 1, 0.1F); + this.setRotateAngle(LegPlateBackR, 0.2617993877991494F, 0.0F, 0.0F); + this.bipedRightLeg.addChild(this.LegPlateBackR); + + this.RightLeg = new ModelRenderer(this, 32, 32); + this.RightLeg.setRotationPoint(0.0F, 0.0F, 0.0F); + this.RightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.05F); + this.bipedRightLeg.addChild(this.RightLeg); + + this.Belt = new ModelRenderer(this, 8, 56); + this.Belt.setRotationPoint(0.0F, 0.0F, 0.0F); + this.Belt.addBox(-4F, 10.0F, -3F, 8, 2, 6, 0.25F); + this.bipedBody.addChild(this.Belt); + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + GL11.glPushMatrix(); + for(int i = 0; i < 4; i++) + { + GL11.glPushMatrix(); + + FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/" + defaultFolder + "/" + textures[i] + ".png")); + + float size = 1.6f; + GL11.glScalef(1.0F / size, 1.0F / size, 1.0F / size); + GL11.glTranslatef(0F, -0F * f5, -0F); + + int[] intColors = TinkersDefense.hexToRGB(colors[i]); + GL11.glColor3d((float) intColors[0] / 255, (float) intColors[1] / 255, (float) intColors[2] / 255); + + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + + /** + * This is a helper function from Tabula to set the rotation of model parts + */ + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) + { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } } diff --git a/src/main/java/lance5057/tDefense/armor/renderers/heavy/ModelTinkersHelm.java b/src/main/java/lance5057/tDefense/armor/renderers/heavy/ModelTinkersHelm.java index 5c87cdb..78a0c83 100644 --- a/src/main/java/lance5057/tDefense/armor/renderers/heavy/ModelTinkersHelm.java +++ b/src/main/java/lance5057/tDefense/armor/renderers/heavy/ModelTinkersHelm.java @@ -1,92 +1,84 @@ package lance5057.tDefense.armor.renderers.heavy; import lance5057.tDefense.TinkersDefense; +import lance5057.tDefense.armor.renderers.ArmorRenderer; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import cpw.mods.fml.client.FMLClientHandler; -import net.minecraft.client.model.ModelBiped; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.util.ResourceLocation; /** * TinkerHelm - Either Mojang or a mod author * Created using Tabula 4.1.1 */ -public class ModelTinkersHelm extends ModelBiped +public class ModelTinkersHelm extends ArmorRenderer { - public ModelRenderer Visor; - public ModelRenderer Helm; - public ModelRenderer Trim; - - public String[] colors; - - public String[] textures; - public String defaultFolder; + public ModelRenderer Visor; + public ModelRenderer Helm; + public ModelRenderer Trim; + + public ModelTinkersHelm() + { + super(1.5f, 0, 64, 64); + + this.textureWidth = 64; + this.textureHeight = 64; + this.Helm = new ModelRenderer(this, 0, 47); + this.Helm.setRotationPoint(0.0F, 0.0F, 0.0F); + this.Helm.addBox(-4.0F, -8.0F, -4.0F, 8, 9, 8, 0.5F); + this.bipedHead.addChild(this.Helm); + + this.Visor = new ModelRenderer(this, 0, 32); + this.Visor.setRotationPoint(0.0F, 0.0F, 0.0F); + this.Visor.addBox(-4.5F, -6.5F, -4.7F, 9, 5, 8, 0.1F); + this.bipedHead.addChild(this.Visor); + + this.Trim = new ModelRenderer(this, 44, 47); + this.Trim.setRotationPoint(0.0F, 0.0F, 0.0F); + this.Trim.addBox(-1.0F, -8.3F, -4.0F, 2, 9, 8, 0.7F); + this.bipedHead.addChild(this.Trim); + + this.bipedBody.isHidden = true; + this.bipedCloak.isHidden = true; + this.bipedLeftArm.isHidden = true; + this.bipedLeftLeg.isHidden = true; + this.bipedRightArm.isHidden = true; + this.bipedRightLeg.isHidden = true; + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + GL11.glPushMatrix(); + for(int i = 0; i < 3; i++) + { + GL11.glPushMatrix(); + + FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/" + defaultFolder + "/" + textures[i] + ".png")); - public ModelTinkersHelm(String[] colors, String defaultFolder, String[] textures) - { - super(1.5f, 0, 64,64); - - this.colors = colors; - this.textures = textures; - this.defaultFolder = defaultFolder; - - this.textureWidth = 64; - this.textureHeight = 64; - this.Helm = new ModelRenderer(this, 0, 47); - this.Helm.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Helm.addBox(-4.0F, -8.0F, -4.0F, 8, 9, 8, 0.5F); - this.bipedHead.addChild(this.Helm); - - this.Visor = new ModelRenderer(this, 0, 32); - this.Visor.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Visor.addBox(-4.5F, -6.5F, -4.7F, 9, 5, 8, 0.1F); - this.bipedHead.addChild(this.Visor); - - this.Trim = new ModelRenderer(this, 44, 47); - this.Trim.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Trim.addBox(-1.0F, -8.3F, -4.0F, 2, 9, 8, 0.7F); - this.bipedHead.addChild(this.Trim); - - this.bipedBody.isHidden = true; - this.bipedCloak.isHidden = true; - this.bipedLeftArm.isHidden = true; - this.bipedLeftLeg.isHidden = true; - this.bipedRightArm.isHidden = true; - this.bipedRightLeg.isHidden = true; - } + float size = 2.5f; + GL11.glScalef(1.5F / size, 1.5F / size, 1.5F / size); + GL11.glTranslatef(0.0F, -0F * f5, 0.0F); + int[] intColors = TinkersDefense.hexToRGB(colors[i]); + GL11.glColor3d((float) intColors[0] / 255, (float) intColors[1] / 255, (float) intColors[2] / 255); - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - GL11.glPushMatrix(); - for(int i = 0; i<3; i++) - { - GL11.glPushMatrix(); - - FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/" + defaultFolder + "/" + textures[i] + ".png")); - - float size = 2.5f; - GL11.glScalef(1.5F / size, 1.5F / size, 1.5F / size); - GL11.glTranslatef(0.0F, -0F * f5, 0.0F); - int[] intColors = TinkersDefense.hexToRGB(colors[i]); - GL11.glColor3d((float)intColors[0]/255, (float)intColors[1]/255, (float)intColors[2]/255); - - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - GL11.glPopMatrix(); - } - GL11.glPopMatrix(); - } + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } - /** - * This is a helper function from Tabula to set the rotation of model parts - */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } + /** + * This is a helper function from Tabula to set the rotation of model parts + */ + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) + { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } } diff --git a/src/main/java/lance5057/tDefense/armor/renderers/heavy/ModelTinkersSabatons.java b/src/main/java/lance5057/tDefense/armor/renderers/heavy/ModelTinkersSabatons.java index e8f8963..1a948aa 100644 --- a/src/main/java/lance5057/tDefense/armor/renderers/heavy/ModelTinkersSabatons.java +++ b/src/main/java/lance5057/tDefense/armor/renderers/heavy/ModelTinkersSabatons.java @@ -1,159 +1,148 @@ package lance5057.tDefense.armor.renderers.heavy; -import java.io.File; - import lance5057.tDefense.TinkersDefense; +import lance5057.tDefense.armor.renderers.ArmorRenderer; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; -import tconstruct.library.TConstructRegistry; import cpw.mods.fml.client.FMLClientHandler; -import net.minecraft.client.model.ModelBiped; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.util.ResourceLocation; /** * ModelBiped - Either Mojang or a mod author * Created using Tabula 4.1.1 */ -public class ModelTinkersSabatons extends ModelBiped +public class ModelTinkersSabatons extends ArmorRenderer { - public ModelRenderer BootL; - public ModelRenderer KneeGuardR; - public ModelRenderer ShinGuardL; - public ModelRenderer KneeGuardCapL; - public ModelRenderer LegBackL; - public ModelRenderer BootR; - public ModelRenderer ShinGuardR; - public ModelRenderer BootCapR; - public ModelRenderer BootCapL; - public ModelRenderer LegBackR; - public ModelRenderer KneeGuardL; - public ModelRenderer KneeGuardCapR; - - public String[] colors; - - public String[] textures; - public String defaultFolder; - - public ModelTinkersSabatons(String[] colors, String defaultFolder, String[] textures) - { - super(1f, 0, 64,64); - - this.colors = colors; - this.textures = textures; - this.defaultFolder = defaultFolder; - - this.textureWidth = 64; - this.textureHeight = 64; - - this.ShinGuardL = new ModelRenderer(this, 0, 48); - this.ShinGuardL.mirror = true; - this.ShinGuardL.setRotationPoint(0.0F, 0.0F, 0.0F); - this.ShinGuardL.addBox(-2.0F, 4.0F, -2.6F, 4, 5, 3, 0.11F); - this.setRotateAngle(ShinGuardL, 0.05759586531581287F, 0.0F, 0.0F); - this.bipedLeftLeg.addChild(this.ShinGuardL); - - this.KneeGuardL = new ModelRenderer(this, 6, 32); - this.KneeGuardL.mirror = true; - this.KneeGuardL.setRotationPoint(0.0F, 0.0F, 0.0F); - this.KneeGuardL.addBox(-2.0F, 3.0F, -2.5F, 4, 3, 4, 0.2F); - this.bipedLeftLeg.addChild(this.KneeGuardL); - - this.BootL = new ModelRenderer(this, 0, 56); - this.BootL.mirror = true; - this.BootL.setRotationPoint(0.0F, 0.0F, 0.0F); - this.BootL.addBox(-2.0F, 9.0F, -3.0F, 4, 3, 5, 0.2F); - this.bipedLeftLeg.addChild(this.BootL); - - this.KneeGuardCapL = new ModelRenderer(this, 0, 37); - this.KneeGuardCapL.mirror = true; - this.KneeGuardCapL.setRotationPoint(0.0F, 0.0F, 0.0F); - this.KneeGuardCapL.addBox(-1.0F, 2.4F, -3.0F, 2, 2, 1, 0.2F); - this.bipedLeftLeg.addChild(this.KneeGuardCapL); - - this.KneeGuardR = new ModelRenderer(this, 6, 32); - this.KneeGuardR.setRotationPoint(0.0F, 0.0F, 0.0F); - this.KneeGuardR.addBox(-2.0F, 3.0F, -2.5F, 4, 3, 4, 0.2F); - this.bipedRightLeg.addChild(this.KneeGuardR); - - this.LegBackL = new ModelRenderer(this, 0, 40); - this.LegBackL.mirror = true; - this.LegBackL.setRotationPoint(0.0F, 0.0F, 0.0F); - this.LegBackL.addBox(-2.0F, 3.0F, -2.6F, 4, 6, 2, 0.1F); - this.setRotateAngle(LegBackL, 0.05759586531581287F, 3.141592653589793F, 0.0F); - this.bipedLeftLeg.addChild(this.LegBackL); - - this.BootCapL = new ModelRenderer(this, 0, 33); - this.BootCapL.mirror = true; - this.BootCapL.setRotationPoint(0.0F, 0.0F, 0.0F); - this.BootCapL.addBox(-1.0F, 9.1F, -5.2F, 2, 2, 1, 0.2F); - this.setRotateAngle(BootCapL, 0.17453292519943295F, 0.0F, 0.0F); - this.bipedLeftLeg.addChild(this.BootCapL); - - this.KneeGuardCapR = new ModelRenderer(this, 0, 37); - this.KneeGuardCapR.setRotationPoint(0.0F, 0.0F, 0.0F); - this.KneeGuardCapR.addBox(-1.0F, 2.4F, -3.0F, 2, 2, 1, 0.2F); - this.bipedRightLeg.addChild(this.KneeGuardCapR); - - this.BootR = new ModelRenderer(this, 0, 56); - this.BootR.setRotationPoint(0.0F, 0.0F, 0.0F); - this.BootR.addBox(-2.0F, 9.0F, -3.0F, 4, 3, 5, 0.2F); - this.bipedRightLeg.addChild(this.BootR); - - this.ShinGuardR = new ModelRenderer(this, 0, 48); - this.ShinGuardR.setRotationPoint(0.0F, 0.0F, 0.0F); - this.ShinGuardR.addBox(-2.0F, 4.0F, -2.6F, 4, 5, 3, 0.11F); - this.setRotateAngle(ShinGuardR, 0.05759586531581287F, 0.0F, 0.0F); - this.bipedRightLeg.addChild(this.ShinGuardR); - - this.LegBackR = new ModelRenderer(this, 0, 40); - this.LegBackR.setRotationPoint(0.0F, 0.0F, 0.0F); - this.LegBackR.addBox(-2.0F, 3.0F, -2.6F, 4, 6, 2, 0.1F); - this.setRotateAngle(LegBackR, 0.05759586531581287F, 3.141592653589793F, 0.0F); - this.bipedRightLeg.addChild(this.LegBackR); - - this.BootCapR = new ModelRenderer(this, 0, 33); - this.BootCapR.setRotationPoint(0.0F, 0.0F, 0.0F); - this.BootCapR.addBox(-1.0F, 9.1F, -5.2F, 2, 2, 1, 0.2F); - this.setRotateAngle(BootCapR, 0.17453292519943295F, 0.0F, 0.0F); - this.bipedRightLeg.addChild(this.BootCapR); - } - - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { - GL11.glPushMatrix(); - - for(int i = 0; i<4; i++) - { - //TConstructRegistry.getCustomMaterial(arg0, arg1) - GL11.glPushMatrix(); - ResourceLocation texture = new ResourceLocation("tinkersdefense:textures/" + defaultFolder + "/" + textures[i] + ".png"); - //Boolean exists = new File(texture.getResourceDomain() + ":" + texture.getResourcePath()).exists(); - FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture); - - - float size =1.5f; - GL11.glScalef(1.0F / size, 1.0F / size, 1.0F / size); - GL11.glTranslatef(0.0F, -1F*f5, 0.0F); - - int[] intColors = TinkersDefense.hexToRGB(colors[i]); - GL11.glColor3d((float)intColors[0]/255, (float)intColors[1]/255, (float)intColors[2]/255); - - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - GL11.glPopMatrix(); - } - GL11.glPopMatrix(); - } - - /** - * This is a helper function from Tabula to set the rotation of model parts - */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } + public ModelRenderer BootL; + public ModelRenderer KneeGuardR; + public ModelRenderer ShinGuardL; + public ModelRenderer KneeGuardCapL; + public ModelRenderer LegBackL; + public ModelRenderer BootR; + public ModelRenderer ShinGuardR; + public ModelRenderer BootCapR; + public ModelRenderer BootCapL; + public ModelRenderer LegBackR; + public ModelRenderer KneeGuardL; + public ModelRenderer KneeGuardCapR; + + public ModelTinkersSabatons() + { + super(1f, 0, 64, 64); + + this.textureWidth = 64; + this.textureHeight = 64; + + this.ShinGuardL = new ModelRenderer(this, 0, 48); + this.ShinGuardL.mirror = true; + this.ShinGuardL.setRotationPoint(0.0F, 0.0F, 0.0F); + this.ShinGuardL.addBox(-2.0F, 4.0F, -2.6F, 4, 5, 3, 0.11F); + this.setRotateAngle(ShinGuardL, 0.05759586531581287F, 0.0F, 0.0F); + this.bipedLeftLeg.addChild(this.ShinGuardL); + + this.KneeGuardL = new ModelRenderer(this, 6, 32); + this.KneeGuardL.mirror = true; + this.KneeGuardL.setRotationPoint(0.0F, 0.0F, 0.0F); + this.KneeGuardL.addBox(-2.0F, 3.0F, -2.5F, 4, 3, 4, 0.2F); + this.bipedLeftLeg.addChild(this.KneeGuardL); + + this.BootL = new ModelRenderer(this, 0, 56); + this.BootL.mirror = true; + this.BootL.setRotationPoint(0.0F, 0.0F, 0.0F); + this.BootL.addBox(-2.0F, 9.0F, -3.0F, 4, 3, 5, 0.2F); + this.bipedLeftLeg.addChild(this.BootL); + + this.KneeGuardCapL = new ModelRenderer(this, 0, 37); + this.KneeGuardCapL.mirror = true; + this.KneeGuardCapL.setRotationPoint(0.0F, 0.0F, 0.0F); + this.KneeGuardCapL.addBox(-1.0F, 2.4F, -3.0F, 2, 2, 1, 0.2F); + this.bipedLeftLeg.addChild(this.KneeGuardCapL); + + this.KneeGuardR = new ModelRenderer(this, 6, 32); + this.KneeGuardR.setRotationPoint(0.0F, 0.0F, 0.0F); + this.KneeGuardR.addBox(-2.0F, 3.0F, -2.5F, 4, 3, 4, 0.2F); + this.bipedRightLeg.addChild(this.KneeGuardR); + + this.LegBackL = new ModelRenderer(this, 0, 40); + this.LegBackL.mirror = true; + this.LegBackL.setRotationPoint(0.0F, 0.0F, 0.0F); + this.LegBackL.addBox(-2.0F, 3.0F, -2.6F, 4, 6, 2, 0.1F); + this.setRotateAngle(LegBackL, 0.05759586531581287F, 3.141592653589793F, 0.0F); + this.bipedLeftLeg.addChild(this.LegBackL); + + this.BootCapL = new ModelRenderer(this, 0, 33); + this.BootCapL.mirror = true; + this.BootCapL.setRotationPoint(0.0F, 0.0F, 0.0F); + this.BootCapL.addBox(-1.0F, 9.1F, -5.2F, 2, 2, 1, 0.2F); + this.setRotateAngle(BootCapL, 0.17453292519943295F, 0.0F, 0.0F); + this.bipedLeftLeg.addChild(this.BootCapL); + + this.KneeGuardCapR = new ModelRenderer(this, 0, 37); + this.KneeGuardCapR.setRotationPoint(0.0F, 0.0F, 0.0F); + this.KneeGuardCapR.addBox(-1.0F, 2.4F, -3.0F, 2, 2, 1, 0.2F); + this.bipedRightLeg.addChild(this.KneeGuardCapR); + + this.BootR = new ModelRenderer(this, 0, 56); + this.BootR.setRotationPoint(0.0F, 0.0F, 0.0F); + this.BootR.addBox(-2.0F, 9.0F, -3.0F, 4, 3, 5, 0.2F); + this.bipedRightLeg.addChild(this.BootR); + + this.ShinGuardR = new ModelRenderer(this, 0, 48); + this.ShinGuardR.setRotationPoint(0.0F, 0.0F, 0.0F); + this.ShinGuardR.addBox(-2.0F, 4.0F, -2.6F, 4, 5, 3, 0.11F); + this.setRotateAngle(ShinGuardR, 0.05759586531581287F, 0.0F, 0.0F); + this.bipedRightLeg.addChild(this.ShinGuardR); + + this.LegBackR = new ModelRenderer(this, 0, 40); + this.LegBackR.setRotationPoint(0.0F, 0.0F, 0.0F); + this.LegBackR.addBox(-2.0F, 3.0F, -2.6F, 4, 6, 2, 0.1F); + this.setRotateAngle(LegBackR, 0.05759586531581287F, 3.141592653589793F, 0.0F); + this.bipedRightLeg.addChild(this.LegBackR); + + this.BootCapR = new ModelRenderer(this, 0, 33); + this.BootCapR.setRotationPoint(0.0F, 0.0F, 0.0F); + this.BootCapR.addBox(-1.0F, 9.1F, -5.2F, 2, 2, 1, 0.2F); + this.setRotateAngle(BootCapR, 0.17453292519943295F, 0.0F, 0.0F); + this.bipedRightLeg.addChild(this.BootCapR); + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + GL11.glPushMatrix(); + + for(int i = 0; i < 4; i++) + { + //TConstructRegistry.getCustomMaterial(arg0, arg1) + GL11.glPushMatrix(); + ResourceLocation texture = new ResourceLocation("tinkersdefense:textures/" + defaultFolder + "/" + textures[i] + ".png"); + //Boolean exists = new File(texture.getResourceDomain() + ":" + texture.getResourcePath()).exists(); + FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture); + + float size = 1.6f; + GL11.glScalef(1.0F / size, 1.0F / size, 1.0F / size); + GL11.glTranslatef(0.0F, -0F * f5, 0.0F); + + int[] intColors = TinkersDefense.hexToRGB(colors[i]); + GL11.glColor3d((float) intColors[0] / 255, (float) intColors[1] / 255, (float) intColors[2] / 255); + + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + + /** + * This is a helper function from Tabula to set the rotation of model parts + */ + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) + { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } } diff --git a/src/main/java/lance5057/tDefense/armor/renderers/light/ModelTinkersBoots.java b/src/main/java/lance5057/tDefense/armor/renderers/light/ModelTinkersBoots.java index 9144d38..d10ea48 100644 --- a/src/main/java/lance5057/tDefense/armor/renderers/light/ModelTinkersBoots.java +++ b/src/main/java/lance5057/tDefense/armor/renderers/light/ModelTinkersBoots.java @@ -1,7 +1,7 @@ package lance5057.tDefense.armor.renderers.light; import lance5057.tDefense.TinkersDefense; -import net.minecraft.client.model.ModelBiped; +import lance5057.tDefense.armor.renderers.ArmorRenderer; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; @@ -14,78 +14,72 @@ import cpw.mods.fml.client.FMLClientHandler; * ModelBiped - Either Mojang or a mod author * Created using Tabula 4.1.1 */ -public class ModelTinkersBoots extends ModelBiped +public class ModelTinkersBoots extends ArmorRenderer { - public ModelRenderer LegR; - public ModelRenderer LegL; - public ModelRenderer FootL; - public ModelRenderer FootR; - - public String[] colors; - - public String[] textures; - public String defaultFolder; - - public ModelTinkersBoots(String[] colors, String defaultFolder, String[] textures) { - super(1.1f, 0, 64,64); - - this.textureWidth = 64; - this.textureHeight = 64; - - this.colors = colors; - this.textures = textures; - this.defaultFolder = defaultFolder; - - this.FootL = new ModelRenderer(this, 0, 43); - this.FootL.setRotationPoint(0.0F, 0.0F, 0.0F); - this.FootL.addBox(-2.0F, 10.0F, -3.0F, 4, 2, 1, 0.0F); - this.bipedLeftLeg.addChild(this.FootL); - - this.LegL = new ModelRenderer(this, 0, 48); - this.LegL.setRotationPoint(0.0F, 0.0F, 0.0F); - this.LegL.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F); - this.bipedLeftLeg.addChild(this.LegL); - - this.FootR = new ModelRenderer(this, 0, 43); - this.FootR.setRotationPoint(0.0F, 0.0F, 0.0F); - this.FootR.addBox(-2.0F, 10.0F, -3.0F, 4, 2, 1, 0.0F); - this.bipedRightLeg.addChild(this.FootR); - - this.LegR = new ModelRenderer(this, 0, 48); - this.LegR.setRotationPoint(0.0F, 0.0F, 0.0F); - this.LegR.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F); - this.bipedRightLeg.addChild(this.LegR); - } - - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { - GL11.glPushMatrix(); - for(int i = 0; i<3; i++) - { - GL11.glPushMatrix(); - - FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/" + defaultFolder + "/" + textures[i] + ".png")); - - float size =1.45f; - GL11.glScalef(1.0F / size, 1.0F / size, 1.0F / size); - GL11.glTranslatef(0.0F, -1F*f5, 0.0F); - - int[] intColors = TinkersDefense.hexToRGB(colors[i]); - GL11.glColor3d((float)intColors[0]/255, (float)intColors[1]/255, (float)intColors[2]/255); - - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - GL11.glPopMatrix(); - } - GL11.glPopMatrix(); - } - - /** - * This is a helper function from Tabula to set the rotation of model parts - */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } + public ModelRenderer LegR; + public ModelRenderer LegL; + public ModelRenderer FootL; + public ModelRenderer FootR; + + public ModelTinkersBoots(String[] colors, String defaultFolder, String[] textures) + { + super(1.1f, 0, 64, 64); + + this.textureWidth = 64; + this.textureHeight = 64; + + this.FootL = new ModelRenderer(this, 0, 43); + this.FootL.setRotationPoint(0.0F, 0.0F, 0.0F); + this.FootL.addBox(-2.0F, 10.0F, -3.0F, 4, 2, 1, 0.0F); + this.bipedLeftLeg.addChild(this.FootL); + + this.LegL = new ModelRenderer(this, 0, 48); + this.LegL.setRotationPoint(0.0F, 0.0F, 0.0F); + this.LegL.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F); + this.bipedLeftLeg.addChild(this.LegL); + + this.FootR = new ModelRenderer(this, 0, 43); + this.FootR.setRotationPoint(0.0F, 0.0F, 0.0F); + this.FootR.addBox(-2.0F, 10.0F, -3.0F, 4, 2, 1, 0.0F); + this.bipedRightLeg.addChild(this.FootR); + + this.LegR = new ModelRenderer(this, 0, 48); + this.LegR.setRotationPoint(0.0F, 0.0F, 0.0F); + this.LegR.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F); + this.bipedRightLeg.addChild(this.LegR); + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + GL11.glPushMatrix(); + for(int i = 0; i < 3; i++) + { + GL11.glPushMatrix(); + + FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/" + defaultFolder + "/" + textures[i] + ".png")); + + float size = 1.45f; + GL11.glScalef(1.0F / size, 1.0F / size, 1.0F / size); + GL11.glTranslatef(0.0F, -1F * f5, 0.0F); + + int[] intColors = TinkersDefense.hexToRGB(colors[i]); + GL11.glColor3d((float) intColors[0] / 255, (float) intColors[1] / 255, (float) intColors[2] / 255); + + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + + /** + * This is a helper function from Tabula to set the rotation of model parts + */ + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) + { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } } diff --git a/src/main/java/lance5057/tDefense/armor/renderers/light/ModelTinkersChausses.java b/src/main/java/lance5057/tDefense/armor/renderers/light/ModelTinkersChausses.java index c9326e7..6936d01 100644 --- a/src/main/java/lance5057/tDefense/armor/renderers/light/ModelTinkersChausses.java +++ b/src/main/java/lance5057/tDefense/armor/renderers/light/ModelTinkersChausses.java @@ -1,7 +1,7 @@ package lance5057.tDefense.armor.renderers.light; import lance5057.tDefense.TinkersDefense; -import net.minecraft.client.model.ModelBiped; +import lance5057.tDefense.armor.renderers.ArmorRenderer; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; @@ -14,104 +14,99 @@ import cpw.mods.fml.client.FMLClientHandler; * ModelBiped - Either Mojang or a mod author * Created using Tabula 4.1.1 */ -public class ModelTinkersChausses extends ModelBiped { - public ModelRenderer LegL; - public ModelRenderer FrontL; - public ModelRenderer HipGuardL; - public ModelRenderer HipGuardR; - public ModelRenderer LegR; - public ModelRenderer BackL; - public ModelRenderer FrontR; - public ModelRenderer BackR; - - public String[] colors; - - public String[] textures; - public String defaultFolder; - - public ModelTinkersChausses(String[] colors, String defaultFolder, String[] textures) { - super(1.1f, 0, 64,64); - - this.textureWidth = 64; - this.textureHeight = 64; - - this.colors = colors; - this.textures = textures; - this.defaultFolder = defaultFolder; - - this.HipGuardR = new ModelRenderer(this, 10, 37); - this.HipGuardR.setRotationPoint(0F, 0F, 0F); - this.HipGuardR.addBox(-2.5F, 0.0F, -2.5F, 4, 6, 5, 0.0F); - this.setRotateAngle(HipGuardR, 0.0F, 0.0F, 0.17453292519943295F); - this.bipedRightLeg.addChild(this.HipGuardR); - - this.LegL = new ModelRenderer(this, 0, 48); - this.LegL.setRotationPoint(0F, 0F, 0F); - this.LegL.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F); - this.bipedLeftLeg.addChild(this.LegL); - - this.BackR = new ModelRenderer(this, 0, 40); - this.BackR.setRotationPoint(0F, 0F, 0F); - this.BackR.addBox(-0.1F, 0.0F, 1.7F, 4, 7, 1, 0.01F); - this.bipedRightLeg.addChild(this.BackR); - - this.FrontL = new ModelRenderer(this, 0, 40); - this.FrontL.setRotationPoint(0F, 0F, 0F); - this.FrontL.addBox(-4.0F, 0.0F, -2.7F, 4, 7, 1, 0.0F); - this.bipedLeftLeg.addChild(this.FrontL); - - this.LegR = new ModelRenderer(this, 0, 48); - this.LegR.setRotationPoint(0F, 0F, 0F); - this.LegR.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F); - this.bipedRightLeg.addChild(this.LegR); - - this.BackL = new ModelRenderer(this, 0, 40); - this.BackL.setRotationPoint(0F, 0F, 0F); - this.BackL.addBox(-4.0F, 0.0F, 1.7F, 4, 7, 1, 0.0F); - this.bipedLeftLeg.addChild(this.BackL); - - this.FrontR = new ModelRenderer(this, 0, 40); - this.FrontR.setRotationPoint(0F, 0F, 0F); - this.FrontR.addBox(-0.1F, 0.0F, -2.7F, 4, 7, 1, 0.01F); - this.bipedRightLeg.addChild(this.FrontR); - - this.HipGuardL = new ModelRenderer(this, 10, 37); - this.HipGuardL.mirror = true; - this.HipGuardL.setRotationPoint(0F, 0F, 0F); - this.HipGuardL.addBox(-1.5F, 0.0F, -2.5F, 4, 6, 5, 0.0F); - this.setRotateAngle(HipGuardL, 0.0F, 0.0F, -0.17453292519943295F); - this.bipedLeftLeg.addChild(this.HipGuardL); - } - - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { - GL11.glPushMatrix(); - for(int i = 0; i<2; i++) - { - GL11.glPushMatrix(); - - FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/" + defaultFolder + "/" + textures[i] + ".png")); - - float size =1.5f; - GL11.glScalef(1.0F / size, 1.0F / size, 1.0F / size); - GL11.glTranslatef(0F, -1F*f5, -0F); - - int[] intColors = TinkersDefense.hexToRGB(colors[i]); - GL11.glColor3d((float)intColors[0]/255, (float)intColors[1]/255, (float)intColors[2]/255); - - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - GL11.glPopMatrix(); - } - GL11.glPopMatrix(); - } - - /** - * This is a helper function from Tabula to set the rotation of model parts - */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } +public class ModelTinkersChausses extends ArmorRenderer +{ + public ModelRenderer LegL; + public ModelRenderer FrontL; + public ModelRenderer HipGuardL; + public ModelRenderer HipGuardR; + public ModelRenderer LegR; + public ModelRenderer BackL; + public ModelRenderer FrontR; + public ModelRenderer BackR; + + public ModelTinkersChausses(String[] colors, String defaultFolder, String[] textures) + { + super(1.1f, 0, 64, 64); + + this.textureWidth = 64; + this.textureHeight = 64; + + this.HipGuardR = new ModelRenderer(this, 10, 37); + this.HipGuardR.setRotationPoint(0F, 0F, 0F); + this.HipGuardR.addBox(-2.5F, 0.0F, -2.5F, 4, 6, 5, 0.0F); + this.setRotateAngle(HipGuardR, 0.0F, 0.0F, 0.17453292519943295F); + this.bipedRightLeg.addChild(this.HipGuardR); + + this.LegL = new ModelRenderer(this, 0, 48); + this.LegL.setRotationPoint(0F, 0F, 0F); + this.LegL.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F); + this.bipedLeftLeg.addChild(this.LegL); + + this.BackR = new ModelRenderer(this, 0, 40); + this.BackR.setRotationPoint(0F, 0F, 0F); + this.BackR.addBox(-0.1F, 0.0F, 1.7F, 4, 7, 1, 0.01F); + this.bipedRightLeg.addChild(this.BackR); + + this.FrontL = new ModelRenderer(this, 0, 40); + this.FrontL.setRotationPoint(0F, 0F, 0F); + this.FrontL.addBox(-4.0F, 0.0F, -2.7F, 4, 7, 1, 0.0F); + this.bipedLeftLeg.addChild(this.FrontL); + + this.LegR = new ModelRenderer(this, 0, 48); + this.LegR.setRotationPoint(0F, 0F, 0F); + this.LegR.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F); + this.bipedRightLeg.addChild(this.LegR); + + this.BackL = new ModelRenderer(this, 0, 40); + this.BackL.setRotationPoint(0F, 0F, 0F); + this.BackL.addBox(-4.0F, 0.0F, 1.7F, 4, 7, 1, 0.0F); + this.bipedLeftLeg.addChild(this.BackL); + + this.FrontR = new ModelRenderer(this, 0, 40); + this.FrontR.setRotationPoint(0F, 0F, 0F); + this.FrontR.addBox(-0.1F, 0.0F, -2.7F, 4, 7, 1, 0.01F); + this.bipedRightLeg.addChild(this.FrontR); + + this.HipGuardL = new ModelRenderer(this, 10, 37); + this.HipGuardL.mirror = true; + this.HipGuardL.setRotationPoint(0F, 0F, 0F); + this.HipGuardL.addBox(-1.5F, 0.0F, -2.5F, 4, 6, 5, 0.0F); + this.setRotateAngle(HipGuardL, 0.0F, 0.0F, -0.17453292519943295F); + this.bipedLeftLeg.addChild(this.HipGuardL); + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + GL11.glPushMatrix(); + for(int i = 0; i < 2; i++) + { + GL11.glPushMatrix(); + + FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/" + defaultFolder + "/" + textures[i] + ".png")); + + float size = 1.5f; + GL11.glScalef(1.0F / size, 1.0F / size, 1.0F / size); + GL11.glTranslatef(0F, -1F * f5, -0F); + + int[] intColors = TinkersDefense.hexToRGB(colors[i]); + GL11.glColor3d((float) intColors[0] / 255, (float) intColors[1] / 255, (float) intColors[2] / 255); + + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + + /** + * This is a helper function from Tabula to set the rotation of model parts + */ + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) + { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } } diff --git a/src/main/java/lance5057/tDefense/armor/renderers/light/ModelTinkersCoif.java b/src/main/java/lance5057/tDefense/armor/renderers/light/ModelTinkersCoif.java index 0589ccc..d631c08 100644 --- a/src/main/java/lance5057/tDefense/armor/renderers/light/ModelTinkersCoif.java +++ b/src/main/java/lance5057/tDefense/armor/renderers/light/ModelTinkersCoif.java @@ -1,7 +1,7 @@ package lance5057.tDefense.armor.renderers.light; import lance5057.tDefense.TinkersDefense; -import net.minecraft.client.model.ModelBiped; +import lance5057.tDefense.armor.renderers.ArmorRenderer; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; @@ -14,65 +14,60 @@ import cpw.mods.fml.client.FMLClientHandler; * ModelBiped - Either Mojang or a mod author * Created using Tabula 4.1.1 */ -public class ModelTinkersCoif extends ModelBiped { - public ModelRenderer Coif; - public ModelRenderer Head; - - public String[] colors; - - public String[] textures; - public String defaultFolder; +public class ModelTinkersCoif extends ArmorRenderer +{ + public ModelRenderer Coif; + public ModelRenderer Head; - public ModelTinkersCoif(String[] colors, String defaultFolder, String[] textures) { - super(1.1f, 0, 64,64); - - this.textureWidth = 64; - this.textureHeight = 64; - - this.colors = colors; - this.textures = textures; - this.defaultFolder = defaultFolder; - - this.Head = new ModelRenderer(this, 32, 48); - this.Head.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Head.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0.0F); - this.bipedHead.addChild(this.Head); - - this.Coif = new ModelRenderer(this, 0, 46); - this.Coif.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Coif.addBox(-4.0F, -8.0F, -4.0F, 8, 10, 8, 0.5F); - this.bipedHead.addChild(this.Coif); - } + public ModelTinkersCoif(String[] colors, String defaultFolder, String[] textures) + { + super(1.1f, 0, 64, 64); - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { - GL11.glPushMatrix(); - for(int i = 0; i<3; i++) - { - GL11.glPushMatrix(); - - FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/" + defaultFolder + "/" + textures[i] + ".png")); - - float size = 2.25f; - GL11.glScalef(1.5F / size, 1.5F / size, 1.5F / size); - GL11.glTranslatef(0.0F, 0F*f5, 0.0F); - - int[] intColors = TinkersDefense.hexToRGB(colors[i]); - GL11.glColor3d((float)intColors[0]/255, (float)intColors[1]/255, (float)intColors[2]/255); - - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - GL11.glPopMatrix(); - } - GL11.glPopMatrix(); - } + this.textureWidth = 64; + this.textureHeight = 64; - /** - * This is a helper function from Tabula to set the rotation of model parts - */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } + this.Head = new ModelRenderer(this, 32, 48); + this.Head.setRotationPoint(0.0F, 0.0F, 0.0F); + this.Head.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0.0F); + this.bipedHead.addChild(this.Head); + + this.Coif = new ModelRenderer(this, 0, 46); + this.Coif.setRotationPoint(0.0F, 0.0F, 0.0F); + this.Coif.addBox(-4.0F, -8.0F, -4.0F, 8, 10, 8, 0.5F); + this.bipedHead.addChild(this.Coif); + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + GL11.glPushMatrix(); + for(int i = 0; i < 3; i++) + { + GL11.glPushMatrix(); + + FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/" + defaultFolder + "/" + textures[i] + ".png")); + + float size = 2.25f; + GL11.glScalef(1.5F / size, 1.5F / size, 1.5F / size); + GL11.glTranslatef(0.0F, 0F * f5, 0.0F); + + int[] intColors = TinkersDefense.hexToRGB(colors[i]); + GL11.glColor3d((float) intColors[0] / 255, (float) intColors[1] / 255, (float) intColors[2] / 255); + + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + + /** + * This is a helper function from Tabula to set the rotation of model parts + */ + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) + { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } } diff --git a/src/main/java/lance5057/tDefense/armor/renderers/light/ModelTinkersHalberd.java b/src/main/java/lance5057/tDefense/armor/renderers/light/ModelTinkersHalberd.java index 4d4b46b..7de3ccd 100644 --- a/src/main/java/lance5057/tDefense/armor/renderers/light/ModelTinkersHalberd.java +++ b/src/main/java/lance5057/tDefense/armor/renderers/light/ModelTinkersHalberd.java @@ -1,7 +1,7 @@ package lance5057.tDefense.armor.renderers.light; import lance5057.tDefense.TinkersDefense; -import net.minecraft.client.model.ModelBiped; +import lance5057.tDefense.armor.renderers.ArmorRenderer; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; @@ -14,117 +14,112 @@ import cpw.mods.fml.client.FMLClientHandler; * ModelBiped - Either Mojang or a mod author * Created using Tabula 4.1.1 */ -public class ModelTinkersHalberd extends ModelBiped { - public ModelRenderer Pauldron1; - public ModelRenderer Pauldron2; - public ModelRenderer Pauldron3; - public ModelRenderer ArmR; - public ModelRenderer Body; - public ModelRenderer Pauldron1_1; - public ModelRenderer Pauldron2_1; - public ModelRenderer Pauldron3_1; - public ModelRenderer ArmL; - - public String[] colors; - - public String[] textures; - public String defaultFolder; - - public ModelTinkersHalberd(String[] colors, String defaultFolder, String[] textures) { - super(1.1f, 0, 64,64); - - this.textureWidth = 64; - this.textureHeight = 64; - - this.colors = colors; - this.textures = textures; - this.defaultFolder = defaultFolder; - - this.Pauldron2_1 = new ModelRenderer(this, 0, 32); - this.Pauldron2_1.mirror = true; - this.Pauldron2_1.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Pauldron2_1.addBox(-0.7F, -2.7F, -2.0F, 3, 3, 4, 0.1F); - this.setRotateAngle(Pauldron2_1, 0.0F, 0.0F, 0.2617993877991494F); - this.bipedLeftArm.addChild(this.Pauldron2_1); - - this.Body = new ModelRenderer(this, 16, 48); - this.Body.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Body.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, 0.0F); - this.bipedBody.addChild(this.Body); - - this.Pauldron1_1 = new ModelRenderer(this, 30, 32); - this.Pauldron1_1.mirror = true; - this.Pauldron1_1.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Pauldron1_1.addBox(0.5F, -1.9F, -2.5F, 3, 4, 5, 0.0F); - this.setRotateAngle(Pauldron1_1, 0.0F, 0.0F, -0.2617993877991494F); - this.bipedLeftArm.addChild(this.Pauldron1_1); - - this.Pauldron3 = new ModelRenderer(this, 16, 32); - this.Pauldron3.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Pauldron3.addBox(-1.2F, -1.5F, -2.5F, 2, 2, 5, 0.1F); - this.setRotateAngle(Pauldron3, 0.0F, 0.0F, -0.2617993877991494F); - this.bipedRightArm.addChild(this.Pauldron3); - - this.ArmL = new ModelRenderer(this, 0, 48); - this.ArmL.mirror = true; - this.ArmL.setRotationPoint(0.0F, 0.0F, 0.0F); - this.ArmL.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F); - this.bipedLeftArm.addChild(this.ArmL); - - this.Pauldron1 = new ModelRenderer(this, 30, 32); - this.Pauldron1.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Pauldron1.addBox(-3.5F, -1.9F, -2.5F, 3, 4, 5, 0.0F); - this.setRotateAngle(Pauldron1, 0.0F, 0.0F, 0.2617993877991494F); - this.bipedRightArm.addChild(this.Pauldron1); - - this.Pauldron3_1 = new ModelRenderer(this, 16, 32); - this.Pauldron3_1.mirror = true; - this.Pauldron3_1.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Pauldron3_1.addBox(-0.8F, -1.5F, -2.5F, 2, 2, 5, 0.1F); - this.setRotateAngle(Pauldron3_1, 0.0F, 0.0F, 0.2617993877991494F); - this.bipedLeftArm.addChild(this.Pauldron3_1); - - this.Pauldron2 = new ModelRenderer(this, 0, 32); - this.Pauldron2.setRotationPoint(0.0F, 0.0F, 0.0F); - this.Pauldron2.addBox(-2.3F, -2.7F, -2.0F, 3, 3, 4, 0.1F); - this.setRotateAngle(Pauldron2, 0.0F, 0.0F, -0.2617993877991494F); - this.bipedRightArm.addChild(this.Pauldron2); - - this.ArmR = new ModelRenderer(this, 0, 48); - this.ArmR.setRotationPoint(0.0F, 0.0F, 0.0F); - this.ArmR.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F); - this.bipedRightArm.addChild(this.ArmR); - } - - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { - GL11.glPushMatrix(); - for(int i = 0; i<3; i++) - { - GL11.glPushMatrix(); - - FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/" + defaultFolder + "/" + textures[i] + ".png")); - - float size = 2.25f; - GL11.glScalef(1.5F / size, 1.5F / size, 1.5F / size); - GL11.glTranslatef(0.0F, 0F*f5, 0.0F); - - int[] intColors = TinkersDefense.hexToRGB(colors[i]); - GL11.glColor3d((float)intColors[0]/255, (float)intColors[1]/255, (float)intColors[2]/255); - - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - GL11.glPopMatrix(); - } - GL11.glPopMatrix(); - } - - /** - * This is a helper function from Tabula to set the rotation of model parts - */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } +public class ModelTinkersHalberd extends ArmorRenderer +{ + public ModelRenderer Pauldron1; + public ModelRenderer Pauldron2; + public ModelRenderer Pauldron3; + public ModelRenderer ArmR; + public ModelRenderer Body; + public ModelRenderer Pauldron1_1; + public ModelRenderer Pauldron2_1; + public ModelRenderer Pauldron3_1; + public ModelRenderer ArmL; + + public ModelTinkersHalberd() + { + super(1.1f, 0, 64, 64); + + this.textureWidth = 64; + this.textureHeight = 64; + + this.Pauldron2_1 = new ModelRenderer(this, 0, 32); + this.Pauldron2_1.mirror = true; + this.Pauldron2_1.setRotationPoint(0.0F, 0.0F, 0.0F); + this.Pauldron2_1.addBox(-0.7F, -2.7F, -2.0F, 3, 3, 4, 0.1F); + this.setRotateAngle(Pauldron2_1, 0.0F, 0.0F, 0.2617993877991494F); + this.bipedLeftArm.addChild(this.Pauldron2_1); + + this.Body = new ModelRenderer(this, 16, 48); + this.Body.setRotationPoint(0.0F, 0.0F, 0.0F); + this.Body.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, 0.0F); + this.bipedBody.addChild(this.Body); + + this.Pauldron1_1 = new ModelRenderer(this, 30, 32); + this.Pauldron1_1.mirror = true; + this.Pauldron1_1.setRotationPoint(0.0F, 0.0F, 0.0F); + this.Pauldron1_1.addBox(0.5F, -1.9F, -2.5F, 3, 4, 5, 0.0F); + this.setRotateAngle(Pauldron1_1, 0.0F, 0.0F, -0.2617993877991494F); + this.bipedLeftArm.addChild(this.Pauldron1_1); + + this.Pauldron3 = new ModelRenderer(this, 16, 32); + this.Pauldron3.setRotationPoint(0.0F, 0.0F, 0.0F); + this.Pauldron3.addBox(-1.2F, -1.5F, -2.5F, 2, 2, 5, 0.1F); + this.setRotateAngle(Pauldron3, 0.0F, 0.0F, -0.2617993877991494F); + this.bipedRightArm.addChild(this.Pauldron3); + + this.ArmL = new ModelRenderer(this, 0, 48); + this.ArmL.mirror = true; + this.ArmL.setRotationPoint(0.0F, 0.0F, 0.0F); + this.ArmL.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F); + this.bipedLeftArm.addChild(this.ArmL); + + this.Pauldron1 = new ModelRenderer(this, 30, 32); + this.Pauldron1.setRotationPoint(0.0F, 0.0F, 0.0F); + this.Pauldron1.addBox(-3.5F, -1.9F, -2.5F, 3, 4, 5, 0.0F); + this.setRotateAngle(Pauldron1, 0.0F, 0.0F, 0.2617993877991494F); + this.bipedRightArm.addChild(this.Pauldron1); + + this.Pauldron3_1 = new ModelRenderer(this, 16, 32); + this.Pauldron3_1.mirror = true; + this.Pauldron3_1.setRotationPoint(0.0F, 0.0F, 0.0F); + this.Pauldron3_1.addBox(-0.8F, -1.5F, -2.5F, 2, 2, 5, 0.1F); + this.setRotateAngle(Pauldron3_1, 0.0F, 0.0F, 0.2617993877991494F); + this.bipedLeftArm.addChild(this.Pauldron3_1); + + this.Pauldron2 = new ModelRenderer(this, 0, 32); + this.Pauldron2.setRotationPoint(0.0F, 0.0F, 0.0F); + this.Pauldron2.addBox(-2.3F, -2.7F, -2.0F, 3, 3, 4, 0.1F); + this.setRotateAngle(Pauldron2, 0.0F, 0.0F, -0.2617993877991494F); + this.bipedRightArm.addChild(this.Pauldron2); + + this.ArmR = new ModelRenderer(this, 0, 48); + this.ArmR.setRotationPoint(0.0F, 0.0F, 0.0F); + this.ArmR.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F); + this.bipedRightArm.addChild(this.ArmR); + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + GL11.glPushMatrix(); + for(int i = 0; i < 3; i++) + { + GL11.glPushMatrix(); + + FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation("tinkersdefense:textures/" + defaultFolder + "/" + textures[i] + ".png")); + + float size = 2.25f; + GL11.glScalef(1.5F / size, 1.5F / size, 1.5F / size); + GL11.glTranslatef(0.0F, 0F * f5, 0.0F); + + int[] intColors = TinkersDefense.hexToRGB(colors[i]); + GL11.glColor3d((float) intColors[0] / 255, (float) intColors[1] / 255, (float) intColors[2] / 255); + + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + GL11.glPopMatrix(); + } + GL11.glPopMatrix(); + } + + /** + * This is a helper function from Tabula to set the rotation of model parts + */ + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) + { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } } diff --git a/src/main/java/lance5057/tDefense/blocks/JewelersBench.java b/src/main/java/lance5057/tDefense/blocks/JewelersBench.java index e224675..06d6f11 100644 --- a/src/main/java/lance5057/tDefense/blocks/JewelersBench.java +++ b/src/main/java/lance5057/tDefense/blocks/JewelersBench.java @@ -13,38 +13,44 @@ import cpw.mods.fml.relauncher.SideOnly; public class JewelersBench extends Block implements ITileEntityProvider { - public JewelersBench() { + public JewelersBench() + { super(Material.iron); } //You don't want the normal render type, or it wont render properly. @Override - public int getRenderType() { - return -1; + public int getRenderType() + { + return -1; } - + //It's not an opaque cube, so you need this. @Override - public boolean isOpaqueCube() { - return false; + public boolean isOpaqueCube() + { + return false; } - + //It's not a normal block, so you need this too. - public boolean renderAsNormalBlock() { - return false; + public boolean renderAsNormalBlock() + { + return false; } - + //This is the icon to use for showing the block in your hand. - @SideOnly(Side.CLIENT) - @Override - public void registerBlockIcons(IIconRegister icon) { - this.blockIcon = icon.registerIcon("tinkersdefense:WIP"); + @SideOnly(Side.CLIENT) + @Override + public void registerBlockIcons(IIconRegister icon) + { + this.blockIcon = icon.registerIcon("tinkersdefense:WIP"); } - + @Override - public TileEntity createNewTileEntity(World w, int md) { + public TileEntity createNewTileEntity(World w, int md) + { TileEntity_JewelersBench te = new TileEntity_JewelersBench(); - return te; + return te; } } diff --git a/src/main/java/lance5057/tDefense/core/TD_Patterns.java b/src/main/java/lance5057/tDefense/core/TD_Patterns.java index 7b33e18..af9d735 100644 --- a/src/main/java/lance5057/tDefense/core/TD_Patterns.java +++ b/src/main/java/lance5057/tDefense/core/TD_Patterns.java @@ -8,43 +8,51 @@ import net.minecraft.item.ItemStack; import tconstruct.tools.items.Pattern; import tconstruct.util.Reference; -public class TD_Patterns extends Pattern { - private static final String[] patternName = new String[] {"rivets","clasp","armorplate","cloth","chainmaille"}; - - public TD_Patterns(String patternType, String name) { - super(patternName, getPatternNames(patternName, patternType), "patterns/"); - - this.setUnlocalizedName(Reference.prefix(name)); - } - - public static String[] getPatternNames (String[] patternName, String partType) - { - String[] names = new String[patternName.length]; - for (int i = 0; i < patternName.length; i++) - names[i] = partType + patternName[i]; - return names; - } - - @Override - public void getSubItems (Item b, CreativeTabs tab, List list) - { - for (int i = 0; i < patternName.length; i++) - { - // if (i != 23) - list.add(new ItemStack(b, 1, i)); - } - } - - @Override - public int getPatternCost(ItemStack pattern) { - switch(pattern.getItemDamage()) - { - case 0: return 1; //rivets - case 1: return 2; //clasp - case 2: return 8; //armorplate - case 3: return 6; //cloth - case 4: return 6; //chainmaille - } - return 0; - } +public class TD_Patterns extends Pattern +{ + private static final String[] patternName = new String[] {"rivets", "clasp", "armorplate", "cloth", "chainmaille"}; + + public TD_Patterns(String patternType, String name) + { + super(patternName, getPatternNames(patternName, patternType), "patterns/"); + + this.setUnlocalizedName(Reference.prefix(name)); + } + + public static String[] getPatternNames(String[] patternName, String partType) + { + String[] names = new String[patternName.length]; + for(int i = 0; i < patternName.length; i++) + names[i] = partType + patternName[i]; + return names; + } + + @Override + public void getSubItems(Item b, CreativeTabs tab, List list) + { + for(int i = 0; i < patternName.length; i++) + { + // if (i != 23) + list.add(new ItemStack(b, 1, i)); + } + } + + @Override + public int getPatternCost(ItemStack pattern) + { + switch(pattern.getItemDamage()) + { + case 0: + return 1; //rivets + case 1: + return 2; //clasp + case 2: + return 8; //armorplate + case 3: + return 6; //cloth + case 4: + return 6; //chainmaille + } + return 0; + } } diff --git a/src/main/java/lance5057/tDefense/core/blocks/AeonSteelBlock.java b/src/main/java/lance5057/tDefense/core/blocks/AeonSteelBlock.java index 7b1349e..d4c59e5 100644 --- a/src/main/java/lance5057/tDefense/core/blocks/AeonSteelBlock.java +++ b/src/main/java/lance5057/tDefense/core/blocks/AeonSteelBlock.java @@ -6,10 +6,10 @@ import net.minecraft.block.material.Material; public class AeonSteelBlock extends Block { - public AeonSteelBlock (Material material) - { - super(material); - setHarvestLevel("pickaxe",2); - } + public AeonSteelBlock(Material material) + { + super(material); + setHarvestLevel("pickaxe", 2); + } -} \ No newline at end of file +} diff --git a/src/main/java/lance5057/tDefense/core/blocks/DogbeariumBlock.java b/src/main/java/lance5057/tDefense/core/blocks/DogbeariumBlock.java index af88f38..2285b72 100644 --- a/src/main/java/lance5057/tDefense/core/blocks/DogbeariumBlock.java +++ b/src/main/java/lance5057/tDefense/core/blocks/DogbeariumBlock.java @@ -6,10 +6,10 @@ import net.minecraft.block.material.Material; public class DogbeariumBlock extends Block { - public DogbeariumBlock (Material material) - { - super(material); - setHarvestLevel("pickaxe",2); - } + public DogbeariumBlock(Material material) + { + super(material); + setHarvestLevel("pickaxe", 2); + } -} \ No newline at end of file +} diff --git a/src/main/java/lance5057/tDefense/core/blocks/GreenMintBlock.java b/src/main/java/lance5057/tDefense/core/blocks/GreenMintBlock.java index b598b02..2e8ff7a 100644 --- a/src/main/java/lance5057/tDefense/core/blocks/GreenMintBlock.java +++ b/src/main/java/lance5057/tDefense/core/blocks/GreenMintBlock.java @@ -6,10 +6,10 @@ import net.minecraft.block.material.Material; public class GreenMintBlock extends Block { - public GreenMintBlock (Material material) - { - super(material); - setHarvestLevel("pickaxe",2); - } + public GreenMintBlock(Material material) + { + super(material); + setHarvestLevel("pickaxe", 2); + } -} \ No newline at end of file +} diff --git a/src/main/java/lance5057/tDefense/core/blocks/QueensGoldBlock.java b/src/main/java/lance5057/tDefense/core/blocks/QueensGoldBlock.java index fea9ed2..0d9e3d0 100644 --- a/src/main/java/lance5057/tDefense/core/blocks/QueensGoldBlock.java +++ b/src/main/java/lance5057/tDefense/core/blocks/QueensGoldBlock.java @@ -6,10 +6,10 @@ import net.minecraft.block.material.Material; public class QueensGoldBlock extends Block { - public QueensGoldBlock (Material material) - { - super(material); - setHarvestLevel("pickaxe",2); - } + public QueensGoldBlock(Material material) + { + super(material); + setHarvestLevel("pickaxe", 2); + } -} \ No newline at end of file +} diff --git a/src/main/java/lance5057/tDefense/core/blocks/RedMintBlock.java b/src/main/java/lance5057/tDefense/core/blocks/RedMintBlock.java index 0b3ca48..ca80865 100644 --- a/src/main/java/lance5057/tDefense/core/blocks/RedMintBlock.java +++ b/src/main/java/lance5057/tDefense/core/blocks/RedMintBlock.java @@ -6,10 +6,10 @@ import net.minecraft.block.material.Material; public class RedMintBlock extends Block { - public RedMintBlock (Material material) - { - super(material); - setHarvestLevel("pickaxe",2); - } + public RedMintBlock(Material material) + { + super(material); + setHarvestLevel("pickaxe", 2); + } -} \ No newline at end of file +} diff --git a/src/main/java/lance5057/tDefense/core/blocks/crestMount/Container_CrestMount.java b/src/main/java/lance5057/tDefense/core/blocks/crestMount/Container_CrestMount.java index d4b55dc..e9e4550 100644 --- a/src/main/java/lance5057/tDefense/core/blocks/crestMount/Container_CrestMount.java +++ b/src/main/java/lance5057/tDefense/core/blocks/crestMount/Container_CrestMount.java @@ -8,30 +8,31 @@ import net.minecraft.item.ItemStack; public class Container_CrestMount extends Container { - + public Container_CrestMount(InventoryPlayer inventoryPlayer, TileEntity_CrestMount te) { addSlotToContainer(new Slot(te, 0, 62, 28)); addSlotToContainer(new Slot(te, 1, 98, 28)); addSlotToContainer(new Slot(te, 2, 80, 28)); addSlotToContainer(new Slot(te, 3, 80, 46)); - - for (int x = 0; x < 9; x++) + + for(int x = 0; x < 9; x++) { addSlotToContainer(new Slot(inventoryPlayer, x, 8 + 18 * x, 142)); } - - for (int y = 0; y < 3; y++) + + for(int y = 0; y < 3; y++) + { + for(int x = 0; x < 9; x++) { - for (int x = 0; x < 9; x++) - { - addSlotToContainer(new Slot(inventoryPlayer, x + y * 9 + 9, 8 + 18 * x, 84 + y * 18)); - } + addSlotToContainer(new Slot(inventoryPlayer, x + y * 9 + 9, 8 + 18 * x, 84 + y * 18)); } + } } - + @Override - public boolean canInteractWith(EntityPlayer player) { + public boolean canInteractWith(EntityPlayer player) + { return true; } @@ -42,4 +43,3 @@ public class Container_CrestMount extends Container return null; } } - diff --git a/src/main/java/lance5057/tDefense/core/blocks/crestMount/CrestMount.java b/src/main/java/lance5057/tDefense/core/blocks/crestMount/CrestMount.java index fa09b53..f366b2d 100644 --- a/src/main/java/lance5057/tDefense/core/blocks/crestMount/CrestMount.java +++ b/src/main/java/lance5057/tDefense/core/blocks/crestMount/CrestMount.java @@ -22,127 +22,139 @@ import net.minecraft.world.World; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class CrestMount extends BlockContainer { - public CrestMount() { - super(Material.iron); - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - } - - @Override - public void onBlockAdded(World world, int i, int j, int k) - { - super.onBlockAdded(world, i, j, k); - world.markBlockForUpdate(i, j, k); - } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, - EntityPlayer player, int metadata, float what, float these, float are) { - TileEntity tileEntity = world.getTileEntity(x, y, z); - if (tileEntity == null || player.isSneaking()) { - return false; - } - //code to open gui explained later - player.openGui(TinkersDefense.instance, TinkersDefense.GUI_CREST_INV, player.worldObj, x, y, z); - return true; - } - - @Override - public void breakBlock(World world, int x, int y, int z, Block par5, int par6) { - dropItems(world, x, y, z); - super.breakBlock(world, x, y, z, par5, par6); - } - - private void dropItems(World world, int x, int y, int z){ - Random rand = new Random(); - - TileEntity tileEntity = world.getTileEntity(x, y, z); - if (!(tileEntity instanceof IInventory)) { - return; - } - IInventory inventory = (IInventory) tileEntity; - - for (int i = 0; i < inventory.getSizeInventory(); i++) { - ItemStack item = inventory.getStackInSlot(i); - - if (item != null && item.stackSize > 0) { - float rx = rand.nextFloat() * 0.8F + 0.1F; - float ry = rand.nextFloat() * 0.8F + 0.1F; - float rz = rand.nextFloat() * 0.8F + 0.1F; - - EntityItem entityItem = new EntityItem(world, - x + rx, y + ry, z + rz, - new ItemStack(item.getItem(), item.stackSize, item.getItemDamage())); - - if (item.hasTagCompound()) { - entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy()); - } - - float factor = 0.05F; - entityItem.motionX = rand.nextGaussian() * factor; - entityItem.motionY = rand.nextGaussian() * factor + 0.2F; - entityItem.motionZ = rand.nextGaussian() * factor; - world.spawnEntityInWorld(entityItem); - item.stackSize = 0; - } - } -} +public class CrestMount extends BlockContainer +{ + public CrestMount() + { + super(Material.iron); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } - //You don't want the normal render type, or it wont render properly. - @Override - public int getRenderType() { - return -1; - } - - //It's not an opaque cube, so you need this. - @Override - public boolean isOpaqueCube() { - return false; - } - - //It's not a normal block, so you need this too. - public boolean renderAsNormalBlock() { - return false; - } - - //This is the icon to use for showing the block in your hand. - @SideOnly(Side.CLIENT) - @Override - public void registerBlockIcons(IIconRegister icon) { - this.blockIcon = icon.registerIcon("tinkersdefense:Item_CrestMount"); - } + @Override + public void onBlockAdded(World world, int i, int j, int k) + { + super.onBlockAdded(world, i, j, k); + world.markBlockForUpdate(i, j, k); + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int metadata, float what, float these, float are) + { + TileEntity tileEntity = world.getTileEntity(x, y, z); + if(tileEntity == null || player.isSneaking()) + { + return false; + } + //code to open gui explained later + player.openGui(TinkersDefense.instance, TinkersDefense.GUI_CREST_INV, player.worldObj, x, y, z); + return true; + } @Override - public TileEntity createNewTileEntity(World w, int md) { + public void breakBlock(World world, int x, int y, int z, Block par5, int par6) + { + dropItems(world, x, y, z); + super.breakBlock(world, x, y, z, par5, par6); + } + + private void dropItems(World world, int x, int y, int z) + { + Random rand = new Random(); + + TileEntity tileEntity = world.getTileEntity(x, y, z); + if(!(tileEntity instanceof IInventory)) + { + return; + } + IInventory inventory = (IInventory) tileEntity; + + for(int i = 0; i < inventory.getSizeInventory(); i++) + { + ItemStack item = inventory.getStackInSlot(i); + + if(item != null && item.stackSize > 0) + { + float rx = rand.nextFloat() * 0.8F + 0.1F; + float ry = rand.nextFloat() * 0.8F + 0.1F; + float rz = rand.nextFloat() * 0.8F + 0.1F; + + EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage())); + + if(item.hasTagCompound()) + { + entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy()); + } + + float factor = 0.05F; + entityItem.motionX = rand.nextGaussian() * factor; + entityItem.motionY = rand.nextGaussian() * factor + 0.2F; + entityItem.motionZ = rand.nextGaussian() * factor; + world.spawnEntityInWorld(entityItem); + item.stackSize = 0; + } + } + } + + //You don't want the normal render type, or it wont render properly. + @Override + public int getRenderType() + { + return -1; + } + + //It's not an opaque cube, so you need this. + @Override + public boolean isOpaqueCube() + { + return false; + } + + //It's not a normal block, so you need this too. + public boolean renderAsNormalBlock() + { + return false; + } + + //This is the icon to use for showing the block in your hand. + @SideOnly(Side.CLIENT) + @Override + public void registerBlockIcons(IIconRegister icon) + { + this.blockIcon = icon.registerIcon("tinkersdefense:Item_CrestMount"); + } + + @Override + public TileEntity createNewTileEntity(World w, int md) + { TileEntity_CrestMount te = new TileEntity_CrestMount(); - return te; + return te; } - + @Override - public int onBlockPlaced(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_) - { - int j1 = p_149660_9_; - - if ((p_149660_9_ == 0 || p_149660_5_ == 2) && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH)) - { - j1 = 1; - } - - if ((j1 == 0 || p_149660_5_ == 3) && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH)) - { - j1 = 2; - } - - if ((j1 == 0 || p_149660_5_ == 4) && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST)) - { - j1 = 3; - } - - if ((j1 == 0 || p_149660_5_ == 5) && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST)) - { - j1 = 4; - } - - return j1; - } + public int onBlockPlaced(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_) + { + int j1 = p_149660_9_; + + if((p_149660_9_ == 0 || p_149660_5_ == 2) && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH)) + { + j1 = 1; + } + + if((j1 == 0 || p_149660_5_ == 3) && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH)) + { + j1 = 2; + } + + if((j1 == 0 || p_149660_5_ == 4) && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST)) + { + j1 = 3; + } + + if((j1 == 0 || p_149660_5_ == 5) && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST)) + { + j1 = 4; + } + + return j1; + } } diff --git a/src/main/java/lance5057/tDefense/core/blocks/crestMount/Gui_CrestMount.java b/src/main/java/lance5057/tDefense/core/blocks/crestMount/Gui_CrestMount.java index efb6f82..ae2aafd 100644 --- a/src/main/java/lance5057/tDefense/core/blocks/crestMount/Gui_CrestMount.java +++ b/src/main/java/lance5057/tDefense/core/blocks/crestMount/Gui_CrestMount.java @@ -11,67 +11,66 @@ import org.lwjgl.opengl.GL11; public class Gui_CrestMount extends GuiContainer { -private float xSize_lo; -private float ySize_lo; + private float xSize_lo; + private float ySize_lo; -private static final ResourceLocation iconLocation = new ResourceLocation("tinkersdefense", "textures/gui/crest_mount.png"); + private static final ResourceLocation iconLocation = new ResourceLocation("tinkersdefense", "textures/gui/crest_mount.png"); -private final TileEntity_CrestMount inventory; + private final TileEntity_CrestMount inventory; -public Gui_CrestMount(InventoryPlayer invPlayer, TileEntity_CrestMount te_crest) -{ -super(new Container_CrestMount(invPlayer, te_crest)); -this.inventory = te_crest; + public Gui_CrestMount(InventoryPlayer invPlayer, TileEntity_CrestMount te_crest) + { + super(new Container_CrestMount(invPlayer, te_crest)); + this.inventory = te_crest; + } -} + @Override + public void initGui() + { + super.initGui(); + this.buttonList.add(new GuiButton(1, this.guiLeft + 61, this.guiTop + 8, 18, 18, "Flip")); + this.buttonList.add(new GuiButton(3, this.guiLeft + 79, this.guiTop + 8, 18, 18, "Flip")); + this.buttonList.add(new GuiButton(2, this.guiLeft + 97, this.guiTop + 8, 18, 18, "Flip")); -@Override -public void initGui() -{ - super.initGui(); - this.buttonList.add(new GuiButton(1,this.guiLeft + 61, this.guiTop + 8, 18, 18,"Flip")); - this.buttonList.add(new GuiButton(3,this.guiLeft + 79, this.guiTop + 8, 18, 18,"Flip")); - this.buttonList.add(new GuiButton(2,this.guiLeft + 97, this.guiTop + 8, 18, 18,"Flip")); - - this.buttonList.add(new GuiButton(4,this.guiLeft + 79, this.guiTop + 63, 18, 18,"Flip")); -} + this.buttonList.add(new GuiButton(4, this.guiLeft + 79, this.guiTop + 63, 18, 18, "Flip")); + } -@Override -protected void actionPerformed(GuiButton button) -{ - for(int i = 1; i<5; i++) + @Override + protected void actionPerformed(GuiButton button) { - if(button.id == i) - { - if(inventory.flip[i-1]==false) - inventory.flip[i-1]=true; - else - inventory.flip[i-1]=false; - - TinkersDefense.INSTANCE.sendToServer(new Message_CrestMount(inventory.xCoord, inventory.yCoord, inventory.zCoord, inventory.flip)); - } + for(int i = 1; i < 5; i++) + { + if(button.id == i) + { + if(inventory.flip[i - 1] == false) + inventory.flip[i - 1] = true; + else + inventory.flip[i - 1] = false; + + TinkersDefense.INSTANCE.sendToServer(new Message_CrestMount(inventory.xCoord, inventory.yCoord, inventory.zCoord, inventory.flip)); + } + } } -} -public void drawScreen(int par1, int par2, float par3) -{ -super.drawScreen(par1, par2, par3); -this.xSize_lo = (float)par1; -this.ySize_lo = (float)par2; -} + public void drawScreen(int par1, int par2, float par3) + { + super.drawScreen(par1, par2, par3); + this.xSize_lo = (float) par1; + this.ySize_lo = (float) par2; + } -protected void drawGuiContainerForegroundLayer(int par1, int par2) -{ - -} + protected void drawGuiContainerForegroundLayer(int par1, int par2) + { -protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) -{ -GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); -this.mc.getTextureManager().bindTexture(iconLocation); -int k = (this.width - this.xSize) / 2; -int l = (this.height - this.ySize) / 2; -this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); + } + + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(iconLocation); + int k = (this.width - this.xSize) / 2; + int l = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); + } } -} \ No newline at end of file diff --git a/src/main/java/lance5057/tDefense/core/blocks/crestMount/ModelCrestMount.java b/src/main/java/lance5057/tDefense/core/blocks/crestMount/ModelCrestMount.java index b077a75..82310dd 100644 --- a/src/main/java/lance5057/tDefense/core/blocks/crestMount/ModelCrestMount.java +++ b/src/main/java/lance5057/tDefense/core/blocks/crestMount/ModelCrestMount.java @@ -12,76 +12,80 @@ import net.minecraft.entity.Entity; public class ModelCrestMount extends ModelBase { - //fields - ModelRenderer ShieldMount; - ModelRenderer Base; - ModelRenderer SwordMount1; - ModelRenderer SwordMount2; - //ModelRenderer SwordMount3; - - public ModelCrestMount() - { - textureWidth = 32; - textureHeight = 32; - - ShieldMount = new ModelRenderer(this, 20, 6); - ShieldMount.addBox(0F, 0F, 0F, 2, 7, 2); - ShieldMount.setRotationPoint(-1F, 17F, -1F); - ShieldMount.setTextureSize(32, 32); - ShieldMount.mirror = true; - setRotation(ShieldMount, 0F, 0F, 0F); - - Base = new ModelRenderer(this, 0, 6); - Base.addBox(0F, 0F, 0F, 4, 4, 4); - Base.setRotationPoint(-2F, 20F, -2F); - Base.setTextureSize(32, 32); - Base.mirror = true; - setRotation(Base, 0F, 0F, 0F); - - SwordMount1 = new ModelRenderer(this, 0, 0); - SwordMount1.addBox(-5F, 0F, -2F, 10, 2, 4); - SwordMount1.setRotationPoint(0F, 22F, 0F); - SwordMount1.setTextureSize(32, 32); - SwordMount1.mirror = true; - setRotation(SwordMount1, 0F, 0.7853982F, 0F); - - SwordMount2 = new ModelRenderer(this, 0, 0); - SwordMount2.addBox(-5F, 0F, -2F, 10, 2, 4); - SwordMount2.setRotationPoint(0F, 22F, 0F); - SwordMount2.setTextureSize(32, 32); - SwordMount2.mirror = true; - setRotation(SwordMount2, 0F, -0.7853982F, 0F); - -// SwordMount3 = new ModelRenderer(this, 0, 0); -// SwordMount3.addBox(-5F, 0F, -2F, 10, 2, 4); -// SwordMount3.setRotationPoint(0F, 21.9F, 0F); -// SwordMount3.setTextureSize(32, 32); -// SwordMount3.mirror = true; -// setRotation(SwordMount3, 0F, 1.570796F, 0F); - } - - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5, boolean left, boolean right, boolean shield) - { - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - if(shield) ShieldMount.render(f5); - if(left) SwordMount1.render(f5); - if(right) SwordMount2.render(f5); - - Base.render(f5); - //SwordMount3.render(f5); - } - - private void setRotation(ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - - public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) - { - super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); - } + //fields + ModelRenderer ShieldMount; + ModelRenderer Base; + ModelRenderer SwordMount1; + ModelRenderer SwordMount2; + + //ModelRenderer SwordMount3; + + public ModelCrestMount() + { + textureWidth = 32; + textureHeight = 32; + + ShieldMount = new ModelRenderer(this, 20, 6); + ShieldMount.addBox(0F, 0F, 0F, 2, 7, 2); + ShieldMount.setRotationPoint(-1F, 17F, -1F); + ShieldMount.setTextureSize(32, 32); + ShieldMount.mirror = true; + setRotation(ShieldMount, 0F, 0F, 0F); + + Base = new ModelRenderer(this, 0, 6); + Base.addBox(0F, 0F, 0F, 4, 4, 4); + Base.setRotationPoint(-2F, 20F, -2F); + Base.setTextureSize(32, 32); + Base.mirror = true; + setRotation(Base, 0F, 0F, 0F); + + SwordMount1 = new ModelRenderer(this, 0, 0); + SwordMount1.addBox(-5F, 0F, -2F, 10, 2, 4); + SwordMount1.setRotationPoint(0F, 22F, 0F); + SwordMount1.setTextureSize(32, 32); + SwordMount1.mirror = true; + setRotation(SwordMount1, 0F, 0.7853982F, 0F); + + SwordMount2 = new ModelRenderer(this, 0, 0); + SwordMount2.addBox(-5F, 0F, -2F, 10, 2, 4); + SwordMount2.setRotationPoint(0F, 22F, 0F); + SwordMount2.setTextureSize(32, 32); + SwordMount2.mirror = true; + setRotation(SwordMount2, 0F, -0.7853982F, 0F); + + // SwordMount3 = new ModelRenderer(this, 0, 0); + // SwordMount3.addBox(-5F, 0F, -2F, 10, 2, 4); + // SwordMount3.setRotationPoint(0F, 21.9F, 0F); + // SwordMount3.setTextureSize(32, 32); + // SwordMount3.mirror = true; + // setRotation(SwordMount3, 0F, 1.570796F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5, boolean left, boolean right, boolean shield) + { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + if(shield) + ShieldMount.render(f5); + if(left) + SwordMount1.render(f5); + if(right) + SwordMount2.render(f5); + + Base.render(f5); + //SwordMount3.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) + { + super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + } } diff --git a/src/main/java/lance5057/tDefense/core/blocks/crestMount/Renderer_CrestMount.java b/src/main/java/lance5057/tDefense/core/blocks/crestMount/Renderer_CrestMount.java index f146c36..33a8f39 100644 --- a/src/main/java/lance5057/tDefense/core/blocks/crestMount/Renderer_CrestMount.java +++ b/src/main/java/lance5057/tDefense/core/blocks/crestMount/Renderer_CrestMount.java @@ -16,188 +16,192 @@ import tconstruct.library.tools.ToolCore; public class Renderer_CrestMount extends TileEntitySpecialRenderer { //private RenderItem itemRenderer; - private final ModelCrestMount model; - EntityItem entItem = null; - EntityItem entItem2 = null; - EntityItem entItem3 = null; - EntityItem entItem4 = null; - - public Renderer_CrestMount() { - this.model = new ModelCrestMount(); - } - - @Override - public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) - { - TileEntity_CrestMount tileEntity = (TileEntity_CrestMount)te; - - boolean left=false, - right=false, - shield=false; - - if(tileEntity.getStackInSlot(0)!=null) - right=true; - if(tileEntity.getStackInSlot(1)!=null) - left=true; - if(tileEntity.getStackInSlot(3)!=null) - shield=true; - - - GL11.glPushMatrix(); - - //Render Crest Mount - GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); - - ResourceLocation textures = (new ResourceLocation("tinkersdefense:textures/blocks/CrestMount.png")); - - Minecraft.getMinecraft().renderEngine.bindTexture(textures); - - GL11.glPushMatrix(); - - int meta = te.getBlockMetadata(); - float rotation = 0; - switch(meta) - { - case 1: rotation = 0; break; - case 2: rotation = 180; break; - case 3: rotation = 90; break; - case 4: rotation = -90; break; - } - GL11.glRotatef(rotation, 0.0F, 1.0F, 0.0F); - - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(90F, 0.5F, 0.0F, 0.0F); - GL11.glTranslatef(0, -1, -1); - - this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F,left,right,shield); - GL11.glPopMatrix(); - - //Render Inventory - - //right slot - int slot = 0; - if(tileEntity.getStackInSlot(slot)!=null) - { - if((entItem == null) || entItem.getEntityItem().getItem() != tileEntity.getStackInSlot(slot).getItem()) - entItem = new EntityItem(tileEntity.getWorldObj(), 0, 0, 0, tileEntity.getStackInSlot(slot)); - GL11.glPushMatrix(); - this.entItem.hoverStart = 0.0F; - RenderItem.renderInFrame = true; - GL11.glScalef(2f,2f,2f); - GL11.glRotatef(90, 0, 0, -1); - GL11.glRotatef(rotation, -1.0F, 0.0F, 0.0F); - //GL11.glTranslatef(0.4f/*up - down*/, -0.3f/*left - right*/, 0.22f); - if(tileEntity.flip[0]==true) - { - GL11.glRotatef(180, 0, 0, 1); - GL11.glTranslatef(-0.8f, 0.2f, 0); - } - - if(tileEntity.getStackInSlot(0).getItem() instanceof ToolCore) - { - GL11.glRotatef(90F, 0.0F, 0.0F, 1.0F); - GL11.glTranslatef(-0.505f, -0.32f, 0); - } - - RenderManager.instance.renderEntityWithPosYaw(entItem, 0.4f/*up - down*/, -0.3f/*left - right*/, 0.23f, 0, 0); - RenderItem.renderInFrame = false; - GL11.glPopMatrix(); - } - - //left slot - slot = 1; - if(tileEntity.getStackInSlot(slot)!=null) - { - if((entItem2 == null) || entItem2.getEntityItem().getItem() != tileEntity.getStackInSlot(slot).getItem()) - entItem2 = new EntityItem(tileEntity.getWorldObj(), x, y, z, tileEntity.getStackInSlot(slot)); - GL11.glPushMatrix(); - this.entItem2.hoverStart = 0.0F; - RenderItem.renderInFrame = true; - //GL11.glTranslatef((float)te.xCoord + 0.5F, (float)te.yCoord + 1.02F, (float)te.zCoord + 0.3F); - GL11.glScalef(2f,2f,2f); - GL11.glRotatef(180, 0, 0, 1); - GL11.glRotatef(rotation, 0.0F, -1.0F, 0.0F); - if(tileEntity.flip[1]==true) - { - GL11.glRotatef(180, 0, 0, 1); - GL11.glTranslatef(0.2f, -0.8f, 0); - } - - if(tileEntity.getStackInSlot(1).getItem() instanceof ToolCore) - { - GL11.glRotatef(90F, 0.0F, 0.0F, 1.0F); - GL11.glTranslatef(0.5f, -0.325f, 0); - } - - RenderManager.instance.renderEntityWithPosYaw(entItem2, -0.1, 0.2, 0.23, 0, 0); - RenderItem.renderInFrame = false; - GL11.glPopMatrix(); - } - - //middle slot - slot = 2; - if(tileEntity.getStackInSlot(slot)!=null) - { - if((entItem3 == null) || entItem3.getEntityItem().getItem() != tileEntity.getStackInSlot(slot).getItem()) - entItem3 = new EntityItem(tileEntity.getWorldObj(), x, y, z, tileEntity.getStackInSlot(slot)); - GL11.glPushMatrix(); - this.entItem3.hoverStart = 0.0F; - RenderItem.renderInFrame = true; - GL11.glScalef(2f,2f,2f); - if(rotation == 90) - GL11.glTranslatef(0.3f, 0, 0.0f); - if(rotation == -90) - GL11.glTranslatef(-0.3f, 0, 0.0f); - GL11.glRotatef(225, 0, 0, 1); - GL11.glRotatef(rotation, 1F, 1F, 0F); - if(tileEntity.flip[2]==true) - { - GL11.glRotatef(180, 0, 0, 1); - GL11.glTranslatef(-0.5f, -0.5f, 0); - } - - if(tileEntity.getStackInSlot(2).getItem() instanceof ToolCore) - { - GL11.glRotatef(90F, 0.0F, 0.0F, 1.0F); - GL11.glTranslatef(-0.1125f, -0.5125f, 0); - } - - RenderManager.instance.renderEntityWithPosYaw(entItem3, 0.3, 0.1, 0.16, 0, 0); - RenderItem.renderInFrame = false; - GL11.glPopMatrix(); - } - - //shield slot - slot = 3; - if(tileEntity.getStackInSlot(slot)!=null) - { - if((entItem4 == null) || entItem4.getEntityItem().getItem() != tileEntity.getStackInSlot(slot).getItem()) - entItem4 = new EntityItem(tileEntity.getWorldObj(), x, y, z, tileEntity.getStackInSlot(slot)); - GL11.glPushMatrix(); - this.entItem4.hoverStart = 0.0F; - RenderItem.renderInFrame = true; - GL11.glScalef(2f,2f,2f); - GL11.glRotatef(180, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(rotation, 0.0F, 1.0F, 0.0F); - if(tileEntity.flip[3]==true) - { - GL11.glRotatef(180, 0, 0, 1); - GL11.glTranslatef(0.0f, 1.0f, 0); - } - - - RenderManager.instance.renderEntityWithPosYaw(entItem4, 0, -0.7, -0.01, 0, 0); - RenderItem.renderInFrame = false; - GL11.glPopMatrix(); - } - - - GL11.glPopMatrix(); - - entItem = null; - entItem2= null; - entItem3= null; - entItem4= null; - } + private final ModelCrestMount model; + EntityItem entItem = null; + EntityItem entItem2 = null; + EntityItem entItem3 = null; + EntityItem entItem4 = null; + + public Renderer_CrestMount() + { + this.model = new ModelCrestMount(); + } + + @Override + public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) + { + TileEntity_CrestMount tileEntity = (TileEntity_CrestMount) te; + + boolean left = false, right = false, shield = false; + + if(tileEntity.getStackInSlot(0) != null) + right = true; + if(tileEntity.getStackInSlot(1) != null) + left = true; + if(tileEntity.getStackInSlot(3) != null) + shield = true; + + GL11.glPushMatrix(); + + //Render Crest Mount + GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); + + ResourceLocation textures = (new ResourceLocation("tinkersdefense:textures/blocks/CrestMount.png")); + + Minecraft.getMinecraft().renderEngine.bindTexture(textures); + + GL11.glPushMatrix(); + + int meta = te.getBlockMetadata(); + float rotation = 0; + switch(meta) + { + case 1: + rotation = 0; + break; + case 2: + rotation = 180; + break; + case 3: + rotation = 90; + break; + case 4: + rotation = -90; + break; + } + GL11.glRotatef(rotation, 0.0F, 1.0F, 0.0F); + + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(90F, 0.5F, 0.0F, 0.0F); + GL11.glTranslatef(0, -1, -1); + + this.model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F, left, right, shield); + GL11.glPopMatrix(); + + //Render Inventory + + //right slot + int slot = 0; + if(tileEntity.getStackInSlot(slot) != null) + { + if((entItem == null) || entItem.getEntityItem().getItem() != tileEntity.getStackInSlot(slot).getItem()) + entItem = new EntityItem(tileEntity.getWorldObj(), 0, 0, 0, tileEntity.getStackInSlot(slot)); + GL11.glPushMatrix(); + this.entItem.hoverStart = 0.0F; + RenderItem.renderInFrame = true; + GL11.glScalef(2f, 2f, 2f); + GL11.glRotatef(90, 0, 0, -1); + GL11.glRotatef(rotation, -1.0F, 0.0F, 0.0F); + //GL11.glTranslatef(0.4f/*up - down*/, -0.3f/*left - right*/, 0.22f); + if(tileEntity.flip[0] == true) + { + GL11.glRotatef(180, 0, 0, 1); + GL11.glTranslatef(-0.8f, 0.2f, 0); + } + + if(tileEntity.getStackInSlot(0).getItem() instanceof ToolCore) + { + GL11.glRotatef(90F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(-0.505f, -0.32f, 0); + } + + RenderManager.instance.renderEntityWithPosYaw(entItem, 0.4f/*up - down*/, -0.3f/*left - right*/, 0.23f, 0, 0); + RenderItem.renderInFrame = false; + GL11.glPopMatrix(); + } + + //left slot + slot = 1; + if(tileEntity.getStackInSlot(slot) != null) + { + if((entItem2 == null) || entItem2.getEntityItem().getItem() != tileEntity.getStackInSlot(slot).getItem()) + entItem2 = new EntityItem(tileEntity.getWorldObj(), x, y, z, tileEntity.getStackInSlot(slot)); + GL11.glPushMatrix(); + this.entItem2.hoverStart = 0.0F; + RenderItem.renderInFrame = true; + //GL11.glTranslatef((float)te.xCoord + 0.5F, (float)te.yCoord + 1.02F, (float)te.zCoord + 0.3F); + GL11.glScalef(2f, 2f, 2f); + GL11.glRotatef(180, 0, 0, 1); + GL11.glRotatef(rotation, 0.0F, -1.0F, 0.0F); + if(tileEntity.flip[1] == true) + { + GL11.glRotatef(180, 0, 0, 1); + GL11.glTranslatef(0.2f, -0.8f, 0); + } + + if(tileEntity.getStackInSlot(1).getItem() instanceof ToolCore) + { + GL11.glRotatef(90F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(0.5f, -0.325f, 0); + } + + RenderManager.instance.renderEntityWithPosYaw(entItem2, -0.1, 0.2, 0.23, 0, 0); + RenderItem.renderInFrame = false; + GL11.glPopMatrix(); + } + + //middle slot + slot = 2; + if(tileEntity.getStackInSlot(slot) != null) + { + if((entItem3 == null) || entItem3.getEntityItem().getItem() != tileEntity.getStackInSlot(slot).getItem()) + entItem3 = new EntityItem(tileEntity.getWorldObj(), x, y, z, tileEntity.getStackInSlot(slot)); + GL11.glPushMatrix(); + this.entItem3.hoverStart = 0.0F; + RenderItem.renderInFrame = true; + GL11.glScalef(2f, 2f, 2f); + if(rotation == 90) + GL11.glTranslatef(0.3f, 0, 0.0f); + if(rotation == -90) + GL11.glTranslatef(-0.3f, 0, 0.0f); + GL11.glRotatef(225, 0, 0, 1); + GL11.glRotatef(rotation, 1F, 1F, 0F); + if(tileEntity.flip[2] == true) + { + GL11.glRotatef(180, 0, 0, 1); + GL11.glTranslatef(-0.5f, -0.5f, 0); + } + + if(tileEntity.getStackInSlot(2).getItem() instanceof ToolCore) + { + GL11.glRotatef(90F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(-0.1125f, -0.5125f, 0); + } + + RenderManager.instance.renderEntityWithPosYaw(entItem3, 0.3, 0.1, 0.16, 0, 0); + RenderItem.renderInFrame = false; + GL11.glPopMatrix(); + } + + //shield slot + slot = 3; + if(tileEntity.getStackInSlot(slot) != null) + { + if((entItem4 == null) || entItem4.getEntityItem().getItem() != tileEntity.getStackInSlot(slot).getItem()) + entItem4 = new EntityItem(tileEntity.getWorldObj(), x, y, z, tileEntity.getStackInSlot(slot)); + GL11.glPushMatrix(); + this.entItem4.hoverStart = 0.0F; + RenderItem.renderInFrame = true; + GL11.glScalef(2f, 2f, 2f); + GL11.glRotatef(180, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(rotation, 0.0F, 1.0F, 0.0F); + if(tileEntity.flip[3] == true) + { + GL11.glRotatef(180, 0, 0, 1); + GL11.glTranslatef(0.0f, 1.0f, 0); + } + + RenderManager.instance.renderEntityWithPosYaw(entItem4, 0, -0.7, -0.01, 0, 0); + RenderItem.renderInFrame = false; + GL11.glPopMatrix(); + } + + GL11.glPopMatrix(); + + entItem = null; + entItem2 = null; + entItem3 = null; + entItem4 = null; + } } diff --git a/src/main/java/lance5057/tDefense/core/blocks/crestMount/TileEntity_CrestMount.java b/src/main/java/lance5057/tDefense/core/blocks/crestMount/TileEntity_CrestMount.java index 1a90b3e..4ed3630 100644 --- a/src/main/java/lance5057/tDefense/core/blocks/crestMount/TileEntity_CrestMount.java +++ b/src/main/java/lance5057/tDefense/core/blocks/crestMount/TileEntity_CrestMount.java @@ -13,64 +13,69 @@ import net.minecraftforge.common.util.Constants; public class TileEntity_CrestMount extends TileEntity implements IInventory { - public static int invSize = 4; - public ItemStack[] inventory; - public boolean[] flip; - - private final String name = "Crest Inventory"; - + public static int invSize = 4; + public ItemStack[] inventory; + public boolean[] flip; + + private final String name = "Crest Inventory"; + public TileEntity_CrestMount() { super(); inventory = new ItemStack[invSize]; flip = new boolean[4]; } - + @Override public void updateEntity() { super.updateEntity(); -// if (!worldObj.isRemote) -// { - -// getWorldObj().markBlockForUpdate(xCoord, yCoord, zCoord); -// markDirty(); -// -// } + // if (!worldObj.isRemote) + // { + + // getWorldObj().markBlockForUpdate(xCoord, yCoord, zCoord); + // markDirty(); + // + // } } - + @Override - public Packet getDescriptionPacket() { - NBTTagCompound tag = new NBTTagCompound(); - writeToNBT(tag); - return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, tag); + public Packet getDescriptionPacket() + { + NBTTagCompound tag = new NBTTagCompound(); + writeToNBT(tag); + return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, tag); } - + @Override - public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { - readFromNBT(pkt.func_148857_g()); + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) + { + readFromNBT(pkt.func_148857_g()); } - + @Override - public int getSizeInventory() { + public int getSizeInventory() + { return invSize; } @Override - public ItemStack getStackInSlot(int slot) { + public ItemStack getStackInSlot(int slot) + { return inventory[slot]; } @Override - public ItemStack decrStackSize(int slot, int amount) { + public ItemStack decrStackSize(int slot, int amount) + { ItemStack stack = getStackInSlot(slot); - if (stack != null) + if(stack != null) { - if (stack.stackSize > amount) + if(stack.stackSize > amount) { stack = stack.splitStack(amount); - - if (stack.stackSize == 0) + + if(stack.stackSize == 0) { setInventorySlotContents(slot, null); } @@ -79,17 +84,18 @@ public class TileEntity_CrestMount extends TileEntity implements IInventory { setInventorySlotContents(slot, null); } - + this.markDirty(); } return stack; } @Override - public ItemStack getStackInSlotOnClosing(int slot) { + public ItemStack getStackInSlotOnClosing(int slot) + { ItemStack stack = getStackInSlot(slot); - - if (stack != null) + + if(stack != null) { setInventorySlotContents(slot, stack); } @@ -97,96 +103,109 @@ public class TileEntity_CrestMount extends TileEntity implements IInventory } @Override - public void setInventorySlotContents(int slot, ItemStack itemstack) { + public void setInventorySlotContents(int slot, ItemStack itemstack) + { this.inventory[slot] = itemstack; - if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) + if(itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) { - itemstack.stackSize = this.getInventoryStackLimit(); + itemstack.stackSize = this.getInventoryStackLimit(); } - this.markDirty(); + this.markDirty(); } @Override - public String getInventoryName() { + public String getInventoryName() + { return name; } @Override - public boolean hasCustomInventoryName() { + public boolean hasCustomInventoryName() + { return name.length() > 0; } @Override - public int getInventoryStackLimit() { + public int getInventoryStackLimit() + { return 1; } @Override - public boolean isUseableByPlayer(EntityPlayer p_70300_1_) { + public boolean isUseableByPlayer(EntityPlayer p_70300_1_) + { return true; } @Override - public void openInventory() { - + public void openInventory() + { + } @Override - public void closeInventory() { - + public void closeInventory() + { + } @Override - public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) { + public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) + { return true; } - + @Override public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); - if(flip!=null) + if(flip != null) { - compound.setBoolean("flip_1", flip[0]); - compound.setBoolean("flip_2", flip[1]); - compound.setBoolean("flip_3", flip[2]); - compound.setBoolean("flip_4", flip[3]); + compound.setBoolean("flip_1", flip[0]); + compound.setBoolean("flip_2", flip[1]); + compound.setBoolean("flip_3", flip[2]); + compound.setBoolean("flip_4", flip[3]); } - - writeInventoryToNBT(compound); + + writeInventoryToNBT(compound); } - + @Override - public void readFromNBT(NBTTagCompound compound) - { + public void readFromNBT(NBTTagCompound compound) + { super.readFromNBT(compound); - + flip[0] = compound.getBoolean("flip_1"); flip[1] = compound.getBoolean("flip_2"); flip[2] = compound.getBoolean("flip_3"); flip[3] = compound.getBoolean("flip_4"); - - readInventoryFromNBT(compound); - } - - public void readInventoryFromNBT(NBTTagCompound tags) { + + readInventoryFromNBT(compound); + } + + public void readInventoryFromNBT(NBTTagCompound tags) + { NBTTagList nbttaglist = tags.getTagList("Items", Constants.NBT.TAG_COMPOUND); - for (int iter = 0; iter < nbttaglist.tagCount(); iter++) { + for(int iter = 0; iter < nbttaglist.tagCount(); iter++) + { NBTTagCompound tagList = (NBTTagCompound) nbttaglist.getCompoundTagAt(iter); byte slotID = tagList.getByte("Slot"); - if (slotID >= 0 && slotID < inventory.length) { + if(slotID >= 0 && slotID < inventory.length) + { inventory[slotID] = ItemStack.loadItemStackFromNBT(tagList); } } } - -public void writeInventoryToNBT(NBTTagCompound tags) { + public void writeInventoryToNBT(NBTTagCompound tags) + { NBTTagList nbttaglist = new NBTTagList(); - for (int iter = 0; iter < inventory.length; iter++) { - if (inventory[iter] != null) { + for(int iter = 0; iter < inventory.length; iter++) + { + if(inventory[iter] != null) + { NBTTagCompound tagList = new NBTTagCompound(); tagList.setByte("Slot", (byte) iter); inventory[iter].writeToNBT(tagList); diff --git a/src/main/java/lance5057/tDefense/core/blocks/ore/TD_Ore.java b/src/main/java/lance5057/tDefense/core/blocks/ore/TD_Ore.java index 708abbe..9219cb6 100644 --- a/src/main/java/lance5057/tDefense/core/blocks/ore/TD_Ore.java +++ b/src/main/java/lance5057/tDefense/core/blocks/ore/TD_Ore.java @@ -10,30 +10,32 @@ import net.minecraft.item.Item; public class TD_Ore extends Block { - Item drops; + Item drops; + public TD_Ore(Material mat, String name, Item drop) { super(mat); this.setBlockName(name + "ore"); - this.setBlockTextureName(Reference.MOD_ID + ":" + name + "ore"); - this.setCreativeTab(TinkersDefense.tabName); - this.setStepSound(soundTypeStone); - this.setHardness(10.0f); - this.setResistance(20.0f); - setHarvestLevel("pickaxe",2); - + this.setBlockTextureName(Reference.MOD_ID + ":" + name + "ore"); + this.setCreativeTab(TinkersDefense.tabName); + this.setStepSound(soundTypeStone); + this.setHardness(10.0f); + this.setResistance(20.0f); + setHarvestLevel("pickaxe", 2); + drops = drop; } - - @Override - public Item getItemDropped(int metadata, Random random, int fortune) { - return drops; - } - - @Override - public int quantityDropped(int meta, int fortune, Random random) - { - int rand = random.nextInt(fortune + 1) + 1; - return rand; - } + + @Override + public Item getItemDropped(int metadata, Random random, int fortune) + { + return drops; + } + + @Override + public int quantityDropped(int meta, int fortune, Random random) + { + int rand = random.nextInt(fortune + 1) + 1; + return rand; + } } diff --git a/src/main/java/lance5057/tDefense/core/events/TDEventHandler.java b/src/main/java/lance5057/tDefense/core/events/TDEventHandler.java index 51612a6..2d653e1 100644 --- a/src/main/java/lance5057/tDefense/core/events/TDEventHandler.java +++ b/src/main/java/lance5057/tDefense/core/events/TDEventHandler.java @@ -24,132 +24,128 @@ import tconstruct.library.tools.BowstringMaterial; import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.eventhandler.SubscribeEvent; -@Optional.InterfaceList({ - @Optional.Interface(modid = "battlegear2", iface = "mods.battlegear2.api.PlayerEventChild.ShieldBlockEvent"), -}) +@Optional.InterfaceList({@Optional.Interface(modid = "battlegear2", iface = "mods.battlegear2.api.PlayerEventChild.ShieldBlockEvent"),}) +public class TDEventHandler +{ -public class TDEventHandler { - - public TDEventHandler() { + public TDEventHandler() + { MinecraftForge.EVENT_BUS.register(this); } - + @SubscribeEvent public void craftTDPart(PartBuilderEvent.NormalPart event) { // Cloth - if (event.pattern.getItem() == TinkersDefense.woodPattern && event.pattern.getItemDamage() == 3) - { - ItemStack result = null; - - ClothMaterial mat = (ClothMaterial) TConstructRegistry.getCustomMaterial(event.material, ClothMaterial.class); - if (mat != null && event.material.stackSize >= 3) - result = mat.craftingItem.copy(); - - if (result != null) - { - event.overrideResult(new ItemStack[] { result, null }); - } - } + if(event.pattern.getItem() == TinkersDefense.woodPattern && event.pattern.getItemDamage() == 3) + { + ItemStack result = null; + + ClothMaterial mat = (ClothMaterial) TConstructRegistry.getCustomMaterial(event.material, ClothMaterial.class); + if(mat != null && event.material.stackSize >= 3) + result = mat.craftingItem.copy(); + + if(result != null) + { + event.overrideResult(new ItemStack[] {result, null}); + } + } } - + @SubscribeEvent @Optional.Method(modid = "battlegear2") public void TD_ShieldBlock(ShieldBlockEvent event) { NBTTagCompound tags = event.shield.getTagCompound().getCompoundTag("InfiTool"); - - if (!tags.getBoolean("Broken")) + + if(!tags.getBoolean("Broken")) { if(tags.hasKey("Crest of Mirrors")) { Entity test = event.source.getSourceOfDamage(); - - - if(event.source.getSourceOfDamage() instanceof EntityLargeFireball || - event.source.getSourceOfDamage() instanceof EntityFireball ) + + if(event.source.getSourceOfDamage() instanceof EntityLargeFireball || event.source.getSourceOfDamage() instanceof EntityFireball) { EntityFireball ent = (EntityFireball) event.source.getSourceOfDamage(); //EntityFireball newEnt = new EntityFireball(); Vec3 playerlook = event.getPlayer().getLookVec(); - + //ent.attackEntityFrom(, 1); - - + //ent.setBeenAttacked(); - + ent.motionX = playerlook.xCoord; ent.motionY = playerlook.yCoord; ent.motionZ = playerlook.zCoord; ent.accelerationX = ent.motionX * 0.1D; ent.accelerationY = ent.motionY * 0.1D; ent.accelerationZ = ent.motionZ * 0.1D; - - ent.shootingEntity = event.getPlayer(); - - ent.motionX += ent.accelerationX*2; - ent.motionY += ent.accelerationY*2; - ent.motionZ += ent.accelerationZ*2; - - //ent. - + + ent.shootingEntity = event.getPlayer(); + + ent.motionX += ent.accelerationX * 2; + ent.motionY += ent.accelerationY * 2; + ent.motionZ += ent.accelerationZ * 2; + + //ent. + ent.setDead(); } } - + if(tags.hasKey("Crest of Legends")) { - event.getPlayer().addPotionEffect(new PotionEffect(Potion.fireResistance.getId(),4,30)); - event.getPlayer().addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(),4,30)); - event.getPlayer().addPotionEffect(new PotionEffect(Potion.resistance.getId(),4,30)); + event.getPlayer().addPotionEffect(new PotionEffect(Potion.fireResistance.getId(), 4, 30)); + event.getPlayer().addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), 4, 30)); + event.getPlayer().addPotionEffect(new PotionEffect(Potion.resistance.getId(), 4, 30)); } - + if(tags.hasKey("Crest of Vampires")) { - event.getPlayer().heal(event.ammount/tags.getInteger("Crest of Vampires")); + event.getPlayer().heal(event.ammount / tags.getInteger("Crest of Vampires")); } } } -// public void TD_LivingHurt(LivingHurtEvent event) -// { -// if(event.entityLiving instanceof EntityPlayer) -// event.entityLiving -// } - -// @SubscribeEvent -// public void dropEasterEggs(LivingDropsEvent event) -// { -// if(!event.entityLiving.worldObj.isRemote) -// { -// if(event.entityLiving.getHeldItem() != null) -// if(event.entityLiving.getHeldItem().getItem() == TinkersDefense.item_RedMintcane) -// event.drops.add(new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, new ItemStack(TinkersDefense.item_RedMintcane,1,0))); -// if(event.entityLiving.getHeldItem().getItem() == TinkersDefense.item_GreenMintcane) -// event.drops.add(new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, new ItemStack(TinkersDefense.item_GreenMintcane,1,0))); -// -// } -// } - + // public void TD_LivingHurt(LivingHurtEvent event) + // { + // if(event.entityLiving instanceof EntityPlayer) + // event.entityLiving + // } + + // @SubscribeEvent + // public void dropEasterEggs(LivingDropsEvent event) + // { + // if(!event.entityLiving.worldObj.isRemote) + // { + // if(event.entityLiving.getHeldItem() != null) + // if(event.entityLiving.getHeldItem().getItem() == TinkersDefense.item_RedMintcane) + // event.drops.add(new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, new ItemStack(TinkersDefense.item_RedMintcane,1,0))); + // if(event.entityLiving.getHeldItem().getItem() == TinkersDefense.item_GreenMintcane) + // event.drops.add(new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, new ItemStack(TinkersDefense.item_GreenMintcane,1,0))); + // + // } + // } + @SubscribeEvent public void giveCandyToUndead(LivingSpawnEvent event) { //if(!Minecraft.getMinecraft().theWorld.isRemote) - if(TinkersDefense.month == 12) + if(TinkersDefense.month == 12) + { + if(event.entityLiving.isEntityUndead()) { - if(event.entityLiving.isEntityUndead()) + Integer chance = Minecraft.getMinecraft().theWorld.rand.nextInt(100); + Boolean candy = Minecraft.getMinecraft().theWorld.rand.nextBoolean(); + if(chance < 25) { - Integer chance = Minecraft.getMinecraft().theWorld.rand.nextInt(100); - Boolean candy = Minecraft.getMinecraft().theWorld.rand.nextBoolean(); - if(chance < 25) - { - if(candy == true) - event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(TinkersDefense.item_RedMintcane,1,0)); - else - event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(TinkersDefense.item_GreenMintcane,1,0)); - } + if(candy == true) + event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(TinkersDefense.item_RedMintcane, 1, 0)); + else + event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(TinkersDefense.item_GreenMintcane, 1, 0)); } } + } } } diff --git a/src/main/java/lance5057/tDefense/core/liquids/MoltenFluid.java b/src/main/java/lance5057/tDefense/core/liquids/MoltenFluid.java index 49e1d15..c3600da 100644 --- a/src/main/java/lance5057/tDefense/core/liquids/MoltenFluid.java +++ b/src/main/java/lance5057/tDefense/core/liquids/MoltenFluid.java @@ -8,50 +8,50 @@ import net.minecraftforge.fluids.Fluid; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class MoltenFluid - extends BlockFluidClassic +public class MoltenFluid extends BlockFluidClassic { - private IIcon stillIcon; - private IIcon flowingIcon; - private String stillIconTexture; - private String flowIconTexture; - - public MoltenFluid(Fluid fluid, String name) - { - super(fluid, Material.lava); - setLightLevel(100.0F); - setHardness(1.0F); - setBlockName("Molten" + name); - - stillIconTexture = "tinkersdefense:molten_" + name; - flowIconTexture = "tinkersdefense:molten_"+name+"_flow"; - } - - @SideOnly(Side.CLIENT) - public void func_149651_a(IIconRegister icon) - { - this.stillIcon = icon.registerIcon(this.stillIconTexture); - this.flowingIcon = icon.registerIcon(this.flowIconTexture); - - getFluid().setIcons(this.stillIcon, this.flowingIcon); - } - - public IIcon getStillIcon() - { - return this.stillIcon; - } - - public IIcon getFlowingIcon() - { - return this.flowingIcon; - } - - @SideOnly(Side.CLIENT) - public IIcon func_149691_a(int side, int meta) - { - if (side <= 1) { - return this.stillIcon; - } - return this.flowingIcon; - } + private IIcon stillIcon; + private IIcon flowingIcon; + private String stillIconTexture; + private String flowIconTexture; + + public MoltenFluid(Fluid fluid, String name) + { + super(fluid, Material.lava); + setLightLevel(100.0F); + setHardness(1.0F); + setBlockName("Molten" + name); + + stillIconTexture = "tinkersdefense:molten_" + name; + flowIconTexture = "tinkersdefense:molten_" + name + "_flow"; + } + + @SideOnly(Side.CLIENT) + public void func_149651_a(IIconRegister icon) + { + this.stillIcon = icon.registerIcon(this.stillIconTexture); + this.flowingIcon = icon.registerIcon(this.flowIconTexture); + + getFluid().setIcons(this.stillIcon, this.flowingIcon); + } + + public IIcon getStillIcon() + { + return this.stillIcon; + } + + public IIcon getFlowingIcon() + { + return this.flowingIcon; + } + + @SideOnly(Side.CLIENT) + public IIcon func_149691_a(int side, int meta) + { + if(side <= 1) + { + return this.stillIcon; + } + return this.flowingIcon; + } } diff --git a/src/main/java/lance5057/tDefense/core/network/Handler_CrestMount.java b/src/main/java/lance5057/tDefense/core/network/Handler_CrestMount.java index 9e4a469..3781788 100644 --- a/src/main/java/lance5057/tDefense/core/network/Handler_CrestMount.java +++ b/src/main/java/lance5057/tDefense/core/network/Handler_CrestMount.java @@ -6,16 +6,16 @@ import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; -public class Handler_CrestMount implements IMessageHandler +public class Handler_CrestMount implements IMessageHandler { @Override - public IMessage onMessage(Message_CrestMount message, MessageContext ctx) + public IMessage onMessage(Message_CrestMount message, MessageContext ctx) { TileEntity te = ctx.getServerHandler().playerEntity.worldObj.getTileEntity(message.x, message.y, message.z); - if (te instanceof TileEntity_CrestMount) { + if(te instanceof TileEntity_CrestMount) + { ((TileEntity_CrestMount) te).flip = message.flip; - } + } return null; } } - diff --git a/src/main/java/lance5057/tDefense/core/network/Handler_FinishingAnvil.java b/src/main/java/lance5057/tDefense/core/network/Handler_FinishingAnvil.java index 4a7d7f1..703f40e 100644 --- a/src/main/java/lance5057/tDefense/core/network/Handler_FinishingAnvil.java +++ b/src/main/java/lance5057/tDefense/core/network/Handler_FinishingAnvil.java @@ -6,13 +6,13 @@ import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; -public class Handler_FinishingAnvil implements IMessageHandler +public class Handler_FinishingAnvil implements IMessageHandler { @Override - public IMessage onMessage(Message_FinishingAnvil message, MessageContext ctx) + public IMessage onMessage(Message_FinishingAnvil message, MessageContext ctx) { TileEntity te = ctx.getServerHandler().playerEntity.worldObj.getTileEntity(message.x, message.y, message.z); - if (te instanceof TileEntity_FinishingAnvil) + if(te instanceof TileEntity_FinishingAnvil) { //((TileEntity_FinishingAnvil) te).flip = message.flip; ((TileEntity_FinishingAnvil) te).inventory[0] = message.item; @@ -20,4 +20,3 @@ public class Handler_FinishingAnvil implements IMessageHandler 1) - ent = (Entity) data[1]; - - IIcon[] parts = new IIcon[toolIcons]; - int iconParts = getIcons(item, type, ent, parts); - - // drawing the inventory is a simple procedure - if (type == ItemRenderType.INVENTORY) { - renderInventory(iconParts, parts, item); - return; - } - - - - Tessellator tess = Tessellator.instance; - float[] xMax = new float[iconParts]; - float[] yMin = new float[iconParts]; - float[] xMin = new float[iconParts]; - float[] yMax = new float[iconParts]; - - float[] width = new float[iconParts]; - float[] height = new float[iconParts]; - float[] xDiff = new float[iconParts]; - float[] yDiff = new float[iconParts]; - float[] xSub = new float[iconParts]; - float[] ySub = new float[iconParts]; - for (int i = 0; i < iconParts; ++i) - { - IIcon icon = parts[i]; - xMin[i] = icon.getMinU(); - xMax[i] = icon.getMaxU(); - yMin[i] = icon.getMinV(); - yMax[i] = icon.getMaxV(); - width[i] = icon.getIconWidth(); - height[i] = icon.getIconHeight(); - xDiff[i] = xMin[i] - xMax[i]; - yDiff[i] = yMin[i] - yMax[i]; - xSub[i] = 0.5f * (xMax[i] - xMin[i]) / width[i]; - ySub[i] = 0.5f * (yMax[i] - yMin[i]) / height[i]; - } - - GL11.glPushMatrix(); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - - GL11.glScalef(1.5f, 1.5f, 1.5f); - GL11.glTranslatef(-0.325f, -0.025f, 0f); - - if(type != ItemRenderType.ENTITY) { - specialAnimation(type, item); - } - else - GL11.glTranslatef(-0.5f, -0.25f, 0); // why? because.. minecraft. - - // prepare colors - int[] color = new int[iconParts]; - for(int i = 0; i < iconParts; i++) - color[i] = item.getItem().getColorFromItemStack(item, i); - - // one side - tess.startDrawingQuads(); - tess.setNormal(0, 0, 1); - for (int i = 0; i < iconParts; ++i) - { - tess.setColorOpaque_I(color[i]); - tess.addVertexWithUV(0, 0, +depth, xMax[i], yMax[i]); - tess.addVertexWithUV(1, 0, +depth, xMin[i], yMax[i]); - tess.addVertexWithUV(1, 1, +depth, xMin[i], yMin[i]); - tess.addVertexWithUV(0, 1, +depth, xMax[i], yMin[i]); - } - tess.draw(); - - // other side - tess.startDrawingQuads(); - tess.setNormal(0, 0, -1); - for (int i = 0; i < iconParts; ++i) - { - tess.setColorOpaque_I(color[i]); - tess.addVertexWithUV(0, 1, -depth, xMax[i], yMin[i]); - tess.addVertexWithUV(1, 1, -depth, xMin[i], yMin[i]); - tess.addVertexWithUV(1, 0, -depth, xMin[i], yMax[i]); - tess.addVertexWithUV(0, 0, -depth, xMax[i], yMax[i]); - } - tess.draw(); - - // make it have "depth" - tess.startDrawingQuads(); - tess.setNormal(-1, 0, 0); - float pos; - float iconPos; - - for (int i = 0; i < iconParts; ++i) - { - tess.setColorOpaque_I(color[i]); - float w = width[i], m = xMax[i], d = xDiff[i], s = xSub[i]; - for (int k = 0, e = (int)w; k < e; ++k) - { - pos = k / w; - iconPos = m + d * pos - s; - tess.addVertexWithUV(pos, 0, -depth, iconPos, yMax[i]); - tess.addVertexWithUV(pos, 0, +depth, iconPos, yMax[i]); - tess.addVertexWithUV(pos, 1, +depth, iconPos, yMin[i]); - tess.addVertexWithUV(pos, 1, -depth, iconPos, yMin[i]); - } - } - - tess.draw(); - tess.startDrawingQuads(); - tess.setNormal(1, 0, 0); - float posEnd; - - for (int i = 0; i < iconParts; ++i) - { - tess.setColorOpaque_I(color[i]); - float w = width[i], m = xMax[i], d = xDiff[i], s = xSub[i]; - float d2 = 1f / w; - for (int k = 0, e = (int)w; k < e; ++k) - { - pos = k / w; - iconPos = m + d * pos - s; - posEnd = pos + d2; - tess.addVertexWithUV(posEnd, 1, -depth, iconPos, yMin[i]); - tess.addVertexWithUV(posEnd, 1, +depth, iconPos, yMin[i]); - tess.addVertexWithUV(posEnd, 0, +depth, iconPos, yMax[i]); - tess.addVertexWithUV(posEnd, 0, -depth, iconPos, yMax[i]); - } - } - - tess.draw(); - tess.startDrawingQuads(); - tess.setNormal(0, 1, 0); - - for (int i = 0; i < iconParts; ++i) - { - tess.setColorOpaque_I(color[i]); - float h = height[i], m = yMax[i], d = yDiff[i], s = ySub[i]; - float d2 = 1f / h; - for (int k = 0, e = (int)h; k < e; ++k) - { - pos = k / h; - iconPos = m + d * pos - s; - posEnd = pos + d2; - tess.addVertexWithUV(0, posEnd, +depth, xMax[i], iconPos); - tess.addVertexWithUV(1, posEnd, +depth, xMin[i], iconPos); - tess.addVertexWithUV(1, posEnd, -depth, xMin[i], iconPos); - tess.addVertexWithUV(0, posEnd, -depth, xMax[i], iconPos); - } - } - - tess.draw(); - tess.startDrawingQuads(); - tess.setNormal(0, -1, 0); - - for (int i = 0; i < iconParts; ++i) - { - tess.setColorOpaque_I(color[i]); - float h = height[i], m = yMax[i], d = yDiff[i], s = ySub[i]; - for (int k = 0, e = (int)h; k < e; ++k) - { - pos = k / h; - iconPos = m + d * pos - s; - tess.addVertexWithUV(1, pos, +depth, xMin[i], iconPos); - tess.addVertexWithUV(0, pos, +depth, xMax[i], iconPos); - tess.addVertexWithUV(0, pos, -depth, xMax[i], iconPos); - tess.addVertexWithUV(1, pos, -depth, xMin[i], iconPos); - } - } - - tess.draw(); - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - - //edit - GL11.glScalef(2f, 2f, 2f); - - GL11.glPopMatrix(); - } - - public void renderInventory(int count, IIcon[] icons, ItemStack item) - { - Tessellator tess = Tessellator.instance; - GL11.glPushMatrix(); - - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glEnable(GL11.GL_ALPHA_TEST); - GL11.glAlphaFunc(GL11.GL_GREATER, 0.5F); - //GL11.glDisable(GL11.GL_BLEND); - - tess.startDrawingQuads(); - - // draw a simple rectangle for the inventory icon - for (int i = 0; i < count; ++i) - { - tess.setColorOpaque_I(item.getItem().getColorFromItemStack(item, i)); - - final IIcon icon = icons[i]; - final float xmin = icon.getMinU(); - final float xmax = icon.getMaxU(); - final float ymin = icon.getMinV(); - final float ymax = icon.getMaxV(); - tess.addVertexWithUV( 0, 16, 0, xmin, ymax); - tess.addVertexWithUV(16, 16, 0, xmax, ymax); - tess.addVertexWithUV(16, 0, 0, xmax, ymin); - tess.addVertexWithUV( 0, 0, 0, xmin, ymin); - } - tess.draw(); - - //GL11.glEnable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glPopMatrix(); - } - - public int getIcons(ItemStack item, ItemRenderType type, Entity ent, IIcon[] parts) - { - int iconParts = toolIcons;//tool.getRenderPasses(item.getItemDamage()); - // TODO: have the tools define how many render passes they have - // (requires more logic rewrite than it sounds like) - - boolean isInventory = type == ItemRenderType.INVENTORY; - ToolCore tool = (ToolCore) item.getItem(); - - IIcon[] tempParts = new IIcon[iconParts]; - label: - { - if (!isInventory && ent instanceof EntityPlayer) - { - EntityPlayer player = (EntityPlayer) ent; - ItemStack itemInUse = player.getItemInUse(); - if (itemInUse != null) - { - int useCount = player.getItemInUseCount(); - for (int i = iconParts; i-- > 0;) - tempParts[i] = tool.getIcon(item, i, player, itemInUse, useCount); - break label; - } - } - for (int i = iconParts; i-- > 0;) - tempParts[i] = tool.getIcon(item, i); - } - - int count = 0; - for (int i = 0; i < iconParts; ++i) - { - IIcon part = tempParts[i]; - if (part == null || part == ToolCore.blankSprite || part == ToolCore.emptyIcon) - ++count; - else - parts[i - count] = part; - } - iconParts -= count; - - if (iconParts <= 0) - { - iconParts = 1; - parts[0] = ToolCore.blankSprite; - } - - return iconParts; - } + public float depth = 1 / 32f; + + public void setDepth(float d) + { + depth = d; + } + + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) + { + if(!item.hasTagCompound()) + return false; + + switch(type) + { + case ENTITY: + //GL11.glTranslatef(-0.0625F, -0.0625F, 0F); + return true; + case EQUIPPED: + //GL11.glTranslatef(0.03f, 0F, -0.09375F); + case EQUIPPED_FIRST_PERSON: + return true; + case INVENTORY: + return true; + default: + TConstruct.logger.warn("[TCon] Unhandled render case!"); + case FIRST_PERSON_MAP: + return false; + } + } + + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) + { + return handleRenderType(item, type) & helper.ordinal() < ItemRendererHelper.EQUIPPED_BLOCK.ordinal(); + } + + private static final int toolIcons = 10; + + protected void specialAnimation(ItemRenderType type, ItemStack item) + { + } + + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) + { + if(item == null || item.getItem() == null || !(item.getItem() instanceof ToolCore)) + return; + + Entity ent = null; + if(data.length > 1) + ent = (Entity) data[1]; + + IIcon[] parts = new IIcon[toolIcons]; + int iconParts = getIcons(item, type, ent, parts); + + // drawing the inventory is a simple procedure + if(type == ItemRenderType.INVENTORY) + { + renderInventory(iconParts, parts, item); + return; + } + + Tessellator tess = Tessellator.instance; + float[] xMax = new float[iconParts]; + float[] yMin = new float[iconParts]; + float[] xMin = new float[iconParts]; + float[] yMax = new float[iconParts]; + + float[] width = new float[iconParts]; + float[] height = new float[iconParts]; + float[] xDiff = new float[iconParts]; + float[] yDiff = new float[iconParts]; + float[] xSub = new float[iconParts]; + float[] ySub = new float[iconParts]; + for(int i = 0; i < iconParts; ++i) + { + IIcon icon = parts[i]; + xMin[i] = icon.getMinU(); + xMax[i] = icon.getMaxU(); + yMin[i] = icon.getMinV(); + yMax[i] = icon.getMaxV(); + width[i] = icon.getIconWidth(); + height[i] = icon.getIconHeight(); + xDiff[i] = xMin[i] - xMax[i]; + yDiff[i] = yMin[i] - yMax[i]; + xSub[i] = 0.5f * (xMax[i] - xMin[i]) / width[i]; + ySub[i] = 0.5f * (yMax[i] - yMin[i]) / height[i]; + } + + GL11.glPushMatrix(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + + GL11.glScalef(1.5f, 1.5f, 1.5f); + GL11.glTranslatef(-0.325f, -0.025f, 0f); + + if(type != ItemRenderType.ENTITY) + { + specialAnimation(type, item); + } + else + GL11.glTranslatef(-0.5f, -0.25f, 0); // why? because.. minecraft. + + // prepare colors + int[] color = new int[iconParts]; + for(int i = 0; i < iconParts; i++) + color[i] = item.getItem().getColorFromItemStack(item, i); + + // one side + tess.startDrawingQuads(); + tess.setNormal(0, 0, 1); + for(int i = 0; i < iconParts; ++i) + { + tess.setColorOpaque_I(color[i]); + tess.addVertexWithUV(0, 0, +depth, xMax[i], yMax[i]); + tess.addVertexWithUV(1, 0, +depth, xMin[i], yMax[i]); + tess.addVertexWithUV(1, 1, +depth, xMin[i], yMin[i]); + tess.addVertexWithUV(0, 1, +depth, xMax[i], yMin[i]); + } + tess.draw(); + + // other side + tess.startDrawingQuads(); + tess.setNormal(0, 0, -1); + for(int i = 0; i < iconParts; ++i) + { + tess.setColorOpaque_I(color[i]); + tess.addVertexWithUV(0, 1, -depth, xMax[i], yMin[i]); + tess.addVertexWithUV(1, 1, -depth, xMin[i], yMin[i]); + tess.addVertexWithUV(1, 0, -depth, xMin[i], yMax[i]); + tess.addVertexWithUV(0, 0, -depth, xMax[i], yMax[i]); + } + tess.draw(); + + // make it have "depth" + tess.startDrawingQuads(); + tess.setNormal(-1, 0, 0); + float pos; + float iconPos; + + for(int i = 0; i < iconParts; ++i) + { + tess.setColorOpaque_I(color[i]); + float w = width[i], m = xMax[i], d = xDiff[i], s = xSub[i]; + for(int k = 0, e = (int) w; k < e; ++k) + { + pos = k / w; + iconPos = m + d * pos - s; + tess.addVertexWithUV(pos, 0, -depth, iconPos, yMax[i]); + tess.addVertexWithUV(pos, 0, +depth, iconPos, yMax[i]); + tess.addVertexWithUV(pos, 1, +depth, iconPos, yMin[i]); + tess.addVertexWithUV(pos, 1, -depth, iconPos, yMin[i]); + } + } + + tess.draw(); + tess.startDrawingQuads(); + tess.setNormal(1, 0, 0); + float posEnd; + + for(int i = 0; i < iconParts; ++i) + { + tess.setColorOpaque_I(color[i]); + float w = width[i], m = xMax[i], d = xDiff[i], s = xSub[i]; + float d2 = 1f / w; + for(int k = 0, e = (int) w; k < e; ++k) + { + pos = k / w; + iconPos = m + d * pos - s; + posEnd = pos + d2; + tess.addVertexWithUV(posEnd, 1, -depth, iconPos, yMin[i]); + tess.addVertexWithUV(posEnd, 1, +depth, iconPos, yMin[i]); + tess.addVertexWithUV(posEnd, 0, +depth, iconPos, yMax[i]); + tess.addVertexWithUV(posEnd, 0, -depth, iconPos, yMax[i]); + } + } + + tess.draw(); + tess.startDrawingQuads(); + tess.setNormal(0, 1, 0); + + for(int i = 0; i < iconParts; ++i) + { + tess.setColorOpaque_I(color[i]); + float h = height[i], m = yMax[i], d = yDiff[i], s = ySub[i]; + float d2 = 1f / h; + for(int k = 0, e = (int) h; k < e; ++k) + { + pos = k / h; + iconPos = m + d * pos - s; + posEnd = pos + d2; + tess.addVertexWithUV(0, posEnd, +depth, xMax[i], iconPos); + tess.addVertexWithUV(1, posEnd, +depth, xMin[i], iconPos); + tess.addVertexWithUV(1, posEnd, -depth, xMin[i], iconPos); + tess.addVertexWithUV(0, posEnd, -depth, xMax[i], iconPos); + } + } + + tess.draw(); + tess.startDrawingQuads(); + tess.setNormal(0, -1, 0); + + for(int i = 0; i < iconParts; ++i) + { + tess.setColorOpaque_I(color[i]); + float h = height[i], m = yMax[i], d = yDiff[i], s = ySub[i]; + for(int k = 0, e = (int) h; k < e; ++k) + { + pos = k / h; + iconPos = m + d * pos - s; + tess.addVertexWithUV(1, pos, +depth, xMin[i], iconPos); + tess.addVertexWithUV(0, pos, +depth, xMax[i], iconPos); + tess.addVertexWithUV(0, pos, -depth, xMax[i], iconPos); + tess.addVertexWithUV(1, pos, -depth, xMin[i], iconPos); + } + } + + tess.draw(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + + //edit + GL11.glScalef(2f, 2f, 2f); + + GL11.glPopMatrix(); + } + + public void renderInventory(int count, IIcon[] icons, ItemStack item) + { + Tessellator tess = Tessellator.instance; + GL11.glPushMatrix(); + + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glAlphaFunc(GL11.GL_GREATER, 0.5F); + //GL11.glDisable(GL11.GL_BLEND); + + tess.startDrawingQuads(); + + // draw a simple rectangle for the inventory icon + for(int i = 0; i < count; ++i) + { + tess.setColorOpaque_I(item.getItem().getColorFromItemStack(item, i)); + + final IIcon icon = icons[i]; + final float xmin = icon.getMinU(); + final float xmax = icon.getMaxU(); + final float ymin = icon.getMinV(); + final float ymax = icon.getMaxV(); + tess.addVertexWithUV(0, 16, 0, xmin, ymax); + tess.addVertexWithUV(16, 16, 0, xmax, ymax); + tess.addVertexWithUV(16, 0, 0, xmax, ymin); + tess.addVertexWithUV(0, 0, 0, xmin, ymin); + } + tess.draw(); + + //GL11.glEnable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glPopMatrix(); + } + + public int getIcons(ItemStack item, ItemRenderType type, Entity ent, IIcon[] parts) + { + int iconParts = toolIcons;//tool.getRenderPasses(item.getItemDamage()); + // TODO: have the tools define how many render passes they have + // (requires more logic rewrite than it sounds like) + + boolean isInventory = type == ItemRenderType.INVENTORY; + ToolCore tool = (ToolCore) item.getItem(); + + IIcon[] tempParts = new IIcon[iconParts]; + label: + { + if(!isInventory && ent instanceof EntityPlayer) + { + EntityPlayer player = (EntityPlayer) ent; + ItemStack itemInUse = player.getItemInUse(); + if(itemInUse != null) + { + int useCount = player.getItemInUseCount(); + for(int i = iconParts; i-- > 0;) + tempParts[i] = tool.getIcon(item, i, player, itemInUse, useCount); + break label; + } + } + for(int i = iconParts; i-- > 0;) + tempParts[i] = tool.getIcon(item, i); + } + + int count = 0; + for(int i = 0; i < iconParts; ++i) + { + IIcon part = tempParts[i]; + if(part == null || part == ToolCore.blankSprite || part == ToolCore.emptyIcon) + ++count; + else + parts[i - count] = part; + } + iconParts -= count; + + if(iconParts <= 0) + { + iconParts = 1; + parts[0] = ToolCore.blankSprite; + } + + return iconParts; + } } diff --git a/src/main/java/lance5057/tDefense/core/tools/HeaterShield.java b/src/main/java/lance5057/tDefense/core/tools/HeaterShield.java index d349b59..00f3707 100644 --- a/src/main/java/lance5057/tDefense/core/tools/HeaterShield.java +++ b/src/main/java/lance5057/tDefense/core/tools/HeaterShield.java @@ -15,89 +15,105 @@ import tconstruct.tools.TinkerTools; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class HeaterShield extends Shield { - int induceDamage = 0; +public class HeaterShield extends Shield +{ + int induceDamage = 0; - public HeaterShield() { + public HeaterShield() + { super(0); this.setUnlocalizedName("heatershield"); } @Override - public Item getHeadItem() { + public Item getHeadItem() + { return TinkersDefense.partArmorplate; } @Override - public Item getHandleItem() { + public Item getHandleItem() + { return TinkerTools.toughRod; } @Override - public Item getAccessoryItem() { + public Item getAccessoryItem() + { return TinkersDefense.partArmorplate; } @Override - public Item getExtraItem() { + public Item getExtraItem() + { return TinkersDefense.partRivet; } @Override - public int durabilityTypeAccessory() { + public int durabilityTypeAccessory() + { return 2; } @Override - public float getRepairCost() { + public float getRepairCost() + { return 4.0f; } @Override - public float getDurabilityModifier() { + public float getDurabilityModifier() + { return 2.5f; } @Override - public float breakSpeedModifier() { + public float breakSpeedModifier() + { return 0.4f; } @Override - public float getDamageModifier() { + public float getDamageModifier() + { return 1.4f; } @Override - public int getPartAmount() { + public int getPartAmount() + { return 4; } @Override - public String getIconSuffix(int partType) { - switch (partType) { - case 0: - return "_shield_face"; - case 1: - return "_shield_face_broken"; - case 2: - return "_shield_edge"; - case 3: - return "_shield_face_other"; - case 4: - return "_shield_binding"; - default: - return ""; + public String getIconSuffix(int partType) + { + switch(partType) + { + case 0: + return "_shield_face"; + case 1: + return "_shield_face_broken"; + case 2: + return "_shield_edge"; + case 3: + return "_shield_face_other"; + case 4: + return "_shield_binding"; + default: + return ""; } } @Override - public String getEffectSuffix() { + public String getEffectSuffix() + { return "_shield_effect"; } @Override - public String getDefaultFolder() { + public String getDefaultFolder() + { return "heatershield"; } @@ -119,14 +135,15 @@ public class HeaterShield extends Shield { // } @Override - public void onUpdate(ItemStack stack, World world, Entity entity, int par4, - boolean par5) { + public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) + { super.onUpdate(stack, world, entity, par4, par5); } @Override - protected String getHarvestType() { + protected String getHarvestType() + { return "shield"; } -} \ No newline at end of file +} diff --git a/src/main/java/lance5057/tDefense/core/tools/RoundShield.java b/src/main/java/lance5057/tDefense/core/tools/RoundShield.java index f6eff84..9a7cd45 100644 --- a/src/main/java/lance5057/tDefense/core/tools/RoundShield.java +++ b/src/main/java/lance5057/tDefense/core/tools/RoundShield.java @@ -15,82 +15,97 @@ import tconstruct.tools.TinkerTools; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class RoundShield extends Shield { - int induceDamage = 0; +public class RoundShield extends Shield +{ + int induceDamage = 0; - public RoundShield() { + public RoundShield() + { super(0); this.setUnlocalizedName("shield"); } @Override - public Item getHeadItem() { + public Item getHeadItem() + { return TinkersDefense.partArmorplate; } @Override - public Item getHandleItem() { + public Item getHandleItem() + { return TinkerTools.toolRod; } @Override - public Item getAccessoryItem() { + public Item getAccessoryItem() + { return TinkerTools.frypanHead; } @Override - public int durabilityTypeAccessory() { + public int durabilityTypeAccessory() + { return 2; } @Override - public float getRepairCost() { + public float getRepairCost() + { return 4.0f; } @Override - public float getDurabilityModifier() { + public float getDurabilityModifier() + { return 1.5f; } @Override - public float breakSpeedModifier() { + public float breakSpeedModifier() + { return 0.4f; } @Override - public float getDamageModifier() { + public float getDamageModifier() + { return 0f; } @Override - public int getPartAmount() { + public int getPartAmount() + { return 3; } @Override - public String getIconSuffix(int partType) { - switch (partType) { - case 0: - return "_shield_face"; - case 1: - return "_shield_face_broken"; - case 2: - return "_shield_edge"; - case 3: - return "_shield_boss"; - default: - return ""; + public String getIconSuffix(int partType) + { + switch(partType) + { + case 0: + return "_shield_face"; + case 1: + return "_shield_face_broken"; + case 2: + return "_shield_edge"; + case 3: + return "_shield_boss"; + default: + return ""; } } @Override - public String getEffectSuffix() { + public String getEffectSuffix() + { return "_shield_effect"; } @Override - public String getDefaultFolder() { + public String getDefaultFolder() + { return "shield"; } @@ -112,14 +127,15 @@ public class RoundShield extends Shield { // } @Override - public void onUpdate(ItemStack stack, World world, Entity entity, int par4, - boolean par5) { + public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) + { super.onUpdate(stack, world, entity, par4, par5); } @Override - protected String getHarvestType() { + protected String getHarvestType() + { return "shield"; } -} \ No newline at end of file +} diff --git a/src/main/java/lance5057/tDefense/core/tools/Shears.java b/src/main/java/lance5057/tDefense/core/tools/Shears.java index bade000..8ba51b7 100644 --- a/src/main/java/lance5057/tDefense/core/tools/Shears.java +++ b/src/main/java/lance5057/tDefense/core/tools/Shears.java @@ -22,148 +22,156 @@ import tconstruct.tools.TinkerTools; public class Shears extends ToolCore { - public Shears() { + public Shears() + { super(0); } @Override - public String getDefaultFolder() { + public String getDefaultFolder() + { return "shears"; } @Override - public String getEffectSuffix() { + public String getEffectSuffix() + { return "_shears_effect"; } - + @Override - public int getPartAmount() { + public int getPartAmount() + { return 3; } @Override - public Item getHeadItem() { + public Item getHeadItem() + { return TinkerTools.knifeBlade; } - + @Override - public Item getAccessoryItem() { + public Item getAccessoryItem() + { return TinkerTools.knifeBlade; } - + @Override - public Item getHandleItem() { + public Item getHandleItem() + { return TinkerTools.binding; } @Override - public String getIconSuffix(int partType) { - switch (partType) { - case 0: - return "_shears_top"; - case 1: - return "_shears_top_broken"; - case 2: - return "_shears_binding"; - case 3: - return "_shears_bottom"; - default: - return ""; + public String getIconSuffix(int partType) + { + switch(partType) + { + case 0: + return "_shears_top"; + case 1: + return "_shears_top_broken"; + case 2: + return "_shears_binding"; + case 3: + return "_shears_bottom"; + default: + return ""; + } + } + + @Override + public String[] getTraits() + { + return new String[] {"shears"}; + } + + public boolean onBlockDestroyed(ItemStack p_150894_1_, World p_150894_2_, Block p_150894_3_, int p_150894_4_, int p_150894_5_, int p_150894_6_, EntityLivingBase p_150894_7_) + { + if(p_150894_3_.getMaterial() != Material.leaves && p_150894_3_ != Blocks.web && p_150894_3_ != Blocks.tallgrass && p_150894_3_ != Blocks.vine && p_150894_3_ != Blocks.tripwire && !(p_150894_3_ instanceof IShearable)) + { + return super.onBlockDestroyed(p_150894_1_, p_150894_2_, p_150894_3_, p_150894_4_, p_150894_5_, p_150894_6_, p_150894_7_); + } + else + { + return true; } } + public boolean func_150897_b(Block p_150897_1_) + { + return p_150897_1_ == Blocks.web || p_150897_1_ == Blocks.redstone_wire || p_150897_1_ == Blocks.tripwire; + } + + public float func_150893_a(ItemStack p_150893_1_, Block p_150893_2_) + { + return p_150893_2_ != Blocks.web && p_150893_2_.getMaterial() != Material.leaves ? (p_150893_2_ == Blocks.wool ? 5.0F : super.func_150893_a(p_150893_1_, p_150893_2_)) : 15.0F; + } + + /** + * Returns true if the item can be used on the given entity, e.g. shears on sheep. + */ @Override - public String[] getTraits() { - return new String[] { "shears"}; + public boolean itemInteractionForEntity(ItemStack itemstack, EntityPlayer player, EntityLivingBase entity) + { + if(entity.worldObj.isRemote) + { + return false; + } + if(entity instanceof IShearable) + { + IShearable target = (IShearable) entity; + if(target.isShearable(itemstack, entity.worldObj, (int) entity.posX, (int) entity.posY, (int) entity.posZ)) + { + ArrayList drops = target.onSheared(itemstack, entity.worldObj, (int) entity.posX, (int) entity.posY, (int) entity.posZ, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, itemstack)); + + Random rand = new Random(); + for(ItemStack stack : drops) + { + EntityItem ent = entity.entityDropItem(stack, 1.0F); + ent.motionY += rand.nextFloat() * 0.05F; + ent.motionX += (rand.nextFloat() - rand.nextFloat()) * 0.1F; + ent.motionZ += (rand.nextFloat() - rand.nextFloat()) * 0.1F; + } + itemstack.damageItem(1, entity); + } + return true; + } + return false; } - public boolean onBlockDestroyed(ItemStack p_150894_1_, World p_150894_2_, Block p_150894_3_, int p_150894_4_, int p_150894_5_, int p_150894_6_, EntityLivingBase p_150894_7_) - { - if (p_150894_3_.getMaterial() != Material.leaves && p_150894_3_ != Blocks.web && p_150894_3_ != Blocks.tallgrass && p_150894_3_ != Blocks.vine && p_150894_3_ != Blocks.tripwire && !(p_150894_3_ instanceof IShearable)) - { - return super.onBlockDestroyed(p_150894_1_, p_150894_2_, p_150894_3_, p_150894_4_, p_150894_5_, p_150894_6_, p_150894_7_); - } - else - { - return true; - } - } - - public boolean func_150897_b(Block p_150897_1_) - { - return p_150897_1_ == Blocks.web || p_150897_1_ == Blocks.redstone_wire || p_150897_1_ == Blocks.tripwire; - } - - public float func_150893_a(ItemStack p_150893_1_, Block p_150893_2_) - { - return p_150893_2_ != Blocks.web && p_150893_2_.getMaterial() != Material.leaves ? (p_150893_2_ == Blocks.wool ? 5.0F : super.func_150893_a(p_150893_1_, p_150893_2_)) : 15.0F; - } - - /** - * Returns true if the item can be used on the given entity, e.g. shears on sheep. - */ - @Override - public boolean itemInteractionForEntity(ItemStack itemstack, EntityPlayer player, EntityLivingBase entity) - { - if (entity.worldObj.isRemote) - { - return false; - } - if (entity instanceof IShearable) - { - IShearable target = (IShearable)entity; - if (target.isShearable(itemstack, entity.worldObj, (int)entity.posX, (int)entity.posY, (int)entity.posZ)) - { - ArrayList drops = target.onSheared(itemstack, entity.worldObj, (int)entity.posX, (int)entity.posY, (int)entity.posZ, - EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, itemstack)); - - Random rand = new Random(); - for(ItemStack stack : drops) - { - EntityItem ent = entity.entityDropItem(stack, 1.0F); - ent.motionY += rand.nextFloat() * 0.05F; - ent.motionX += (rand.nextFloat() - rand.nextFloat()) * 0.1F; - ent.motionZ += (rand.nextFloat() - rand.nextFloat()) * 0.1F; - } - itemstack.damageItem(1, entity); - } - return true; - } - return false; - } - - @Override - public boolean onBlockStartBreak(ItemStack itemstack, int x, int y, int z, EntityPlayer player) - { - if (player.worldObj.isRemote) - { - return false; - } - Block block = player.worldObj.getBlock(x, y, z); - if (block instanceof IShearable) - { - IShearable target = (IShearable)block; - if (target.isShearable(itemstack, player.worldObj, x, y, z)) - { - ArrayList drops = target.onSheared(itemstack, player.worldObj, x, y, z, - EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, itemstack)); - Random rand = new Random(); - - for(ItemStack stack : 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)x + d, (double)y + d1, (double)z + d2, stack); - entityitem.delayBeforeCanPickup = 10; - player.worldObj.spawnEntityInWorld(entityitem); - } - - itemstack.damageItem(1, player); - player.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(block)], 1); - } - } - return false; - } + @Override + public boolean onBlockStartBreak(ItemStack itemstack, int x, int y, int z, EntityPlayer player) + { + if(player.worldObj.isRemote) + { + return false; + } + Block block = player.worldObj.getBlock(x, y, z); + if(block instanceof IShearable) + { + IShearable target = (IShearable) block; + if(target.isShearable(itemstack, player.worldObj, x, y, z)) + { + ArrayList drops = target.onSheared(itemstack, player.worldObj, x, y, z, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, itemstack)); + Random rand = new Random(); + + for(ItemStack stack : 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) x + d, (double) y + d1, (double) z + d2, stack); + entityitem.delayBeforeCanPickup = 10; + player.worldObj.spawnEntityInWorld(entityitem); + } + + itemstack.damageItem(1, player); + player.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(block)], 1); + } + } + return false; + } } diff --git a/src/main/java/lance5057/tDefense/core/tools/Shield.java b/src/main/java/lance5057/tDefense/core/tools/Shield.java index 466ae13..f867dd0 100644 --- a/src/main/java/lance5057/tDefense/core/tools/Shield.java +++ b/src/main/java/lance5057/tDefense/core/tools/Shield.java @@ -26,36 +26,38 @@ import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -@Optional.InterfaceList({ - @Optional.Interface(modid = "battlegear2", iface = "mods.battlegear2.api.ISheathed"), - @Optional.Interface(modid = "battlegear2", iface = "mods.battlegear2.api.shield.IArrowCatcher"), - @Optional.Interface(modid = "battlegear2", iface = "mods.battlegear2.api.shield.IArrowDisplay"), - @Optional.Interface(modid = "battlegear2", iface = "mods.battlegear2.api.shield.IShield") }) -public class Shield extends ToolCore implements IShield, ISheathed, - IArrowCatcher, IArrowDisplay { - public Shield(int baseDamage) { +@Optional.InterfaceList({@Optional.Interface(modid = "battlegear2", iface = "mods.battlegear2.api.ISheathed"), @Optional.Interface(modid = "battlegear2", iface = "mods.battlegear2.api.shield.IArrowCatcher"), @Optional.Interface(modid = "battlegear2", iface = "mods.battlegear2.api.shield.IArrowDisplay"), @Optional.Interface(modid = "battlegear2", iface = "mods.battlegear2.api.shield.IShield")}) +public class Shield extends ToolCore implements IShield, ISheathed, IArrowCatcher, IArrowDisplay +{ + public Shield(int baseDamage) + { super(baseDamage); } - protected float baseSpeed() { + protected float baseSpeed() + { return 1.5f; } - protected float effectiveSpeed() { + protected float effectiveSpeed() + { return 15f; } - public float breakSpeedModifier() { + public float breakSpeedModifier() + { return 1.0f; } @Override - public float getDigSpeed(ItemStack stack, Block block, int meta) { - if (stack.getTagCompound().getCompoundTag("InfiTool") - .getBoolean("Broken")) + public float getDigSpeed(ItemStack stack, Block block, int meta) + { + if(stack.getTagCompound().getCompoundTag("InfiTool").getBoolean("Broken")) return 0.1f; - for (int i = 0; i < web.length; i++) { - if (web[i] == block.getMaterial()) { + for(int i = 0; i < web.length; i++) + { + if(web[i] == block.getMaterial()) + { return effectiveSpeed(); } } @@ -67,7 +69,8 @@ public class Shield extends ToolCore implements IShield, ISheathed, * is being used */ @Override - public EnumAction getItemUseAction(ItemStack par1ItemStack) { + public EnumAction getItemUseAction(ItemStack par1ItemStack) + { return EnumAction.block; } @@ -75,7 +78,8 @@ public class Shield extends ToolCore implements IShield, ISheathed, * How long it takes to use or consume an item */ @Override - public int getMaxItemUseDuration(ItemStack par1ItemStack) { + public int getMaxItemUseDuration(ItemStack par1ItemStack) + { return 72000; } @@ -84,16 +88,15 @@ public class Shield extends ToolCore implements IShield, ISheathed, * pressed. Args: itemStack, world, entityPlayer */ @Override - public ItemStack onItemRightClick(ItemStack stack, World world, - EntityPlayer player) { + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) + { player.setItemInUse(stack, this.getMaxItemUseDuration(stack)); return stack; } @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, - int x, int y, int z, int side, float clickX, float clickY, - float clickZ) { + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float clickX, float clickY, float clickZ) + { return false; } @@ -101,27 +104,32 @@ public class Shield extends ToolCore implements IShield, ISheathed, * Returns if the item (tool) can harvest results from the block type. */ @Override - public boolean canHarvestBlock(Block block, ItemStack is) { - for (int i = 0; i < web.length; i++) { - if (block.getMaterial() == web[i]) + public boolean canHarvestBlock(Block block, ItemStack is) + { + for(int i = 0; i < web.length; i++) + { + if(block.getMaterial() == web[i]) return true; } return super.canHarvestBlock(block, is); } - protected Material[] getEffectiveMaterials() { + protected Material[] getEffectiveMaterials() + { return web; } @Override @SideOnly(Side.CLIENT) - public void onUpdate(ItemStack stack, World world, Entity entity, int par4, - boolean par5) { + public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) + { super.onUpdate(stack, world, entity, par4, par5); - if (entity instanceof EntityPlayerSP) { + if(entity instanceof EntityPlayerSP) + { EntityPlayerSP player = (EntityPlayerSP) entity; ItemStack usingItem = player.getItemInUse(); - if (usingItem != null && usingItem.getItem() == this) { + if(usingItem != null && usingItem.getItem() == this) + { player.movementInput.moveForward *= 2.5F; player.movementInput.moveStrafe *= 2.5F; } @@ -129,36 +137,43 @@ public class Shield extends ToolCore implements IShield, ISheathed, } @Override - public String[] getTraits() { - return new String[] { "shield", "blocking" }; + public String[] getTraits() + { + return new String[] {"shield", "blocking"}; } - public static Material[] web = new Material[] { Material.web, - Material.cloth, Material.coral, Material.cake }; - public static Material[] none = new Material[0]; + public static Material[] web = new Material[] {Material.web, Material.cloth, Material.coral, Material.cake}; + public static Material[] none = new Material[0]; - protected String getHarvestType() { + protected String getHarvestType() + { return null; } @Override @Optional.Method(modid = "battlegear2") - public int getArrowCount(ItemStack stack) { - if (stack.hasTagCompound() && stack.getTagCompound().hasKey("arrows")) { + public int getArrowCount(ItemStack stack) + { + if(stack.hasTagCompound() && stack.getTagCompound().hasKey("arrows")) + { return stack.getTagCompound().getShort("arrows"); - } else + } + else return 0; } @Override @Optional.Method(modid = "battlegear2") - public void setArrowCount(ItemStack stack, int count) { - if (!stack.hasTagCompound()) { + public void setArrowCount(ItemStack stack, int count) + { + if(!stack.hasTagCompound()) + { stack.setTagCompound(new NBTTagCompound()); } // Should never happen, you would need A LOT of arrows for this to // happen - if (count > Short.MAX_VALUE) { + if(count > Short.MAX_VALUE) + { count = Short.MAX_VALUE; } stack.getTagCompound().setShort("arrows", (short) count); @@ -167,9 +182,10 @@ public class Shield extends ToolCore implements IShield, ISheathed, @Override @Optional.Method(modid = "battlegear2") - public boolean catchArrow(ItemStack shield, EntityPlayer player, - IProjectile arrow) { - if (arrow instanceof EntityArrow) { + public boolean catchArrow(ItemStack shield, EntityPlayer player, IProjectile arrow) + { + if(arrow instanceof EntityArrow) + { setArrowCount(shield, getArrowCount(shield) + 1); player.setArrowCountInEntity(player.getArrowCountInEntity() - 1); ((EntityArrow) arrow).setDead(); @@ -180,107 +196,114 @@ public class Shield extends ToolCore implements IShield, ISheathed, @Override @Optional.Method(modid = "battlegear2") - public boolean sheatheOnBack(ItemStack item) { + public boolean sheatheOnBack(ItemStack item) + { return true; } @Override @Optional.Method(modid = "battlegear2") - public void blockAnimation(EntityPlayer player, float dmg) { + public void blockAnimation(EntityPlayer player, float dmg) + { player.worldObj.playSoundAtEntity(player, "battlegear2:shield", 1, 1); } @Override @Optional.Method(modid = "battlegear2") - public boolean canBlock(ItemStack shield, DamageSource source) { + public boolean canBlock(ItemStack shield, DamageSource source) + { return !source.isUnblockable(); } @Override @Optional.Method(modid = "battlegear2") - public int getBashTimer(ItemStack arg0) { + public int getBashTimer(ItemStack arg0) + { return 10; } @Override @Optional.Method(modid = "battlegear2") - public float getBlockAngle(ItemStack arg0) { + public float getBlockAngle(ItemStack arg0) + { return 60; } @Override @Optional.Method(modid = "battlegear2") - public float getDamageDecayRate(ItemStack shield, float amount) { + public float getDamageDecayRate(ItemStack shield, float amount) + { return 0; } @Override @Optional.Method(modid = "battlegear2") - public float getDamageReduction(ItemStack arg0, DamageSource arg1) { + public float getDamageReduction(ItemStack arg0, DamageSource arg1) + { return 1f; } @Override @Optional.Method(modid = "battlegear2") - public float getDecayRate(ItemStack stack) { + public float getDecayRate(ItemStack stack) + { NBTTagCompound tags = stack.getTagCompound(); - float recovery = tags.getCompoundTag("InfiTool").getInteger( - "MiningSpeed") / 1.5f; + float recovery = tags.getCompoundTag("InfiTool").getInteger("MiningSpeed") / 1.5f; return 10f / recovery; } @Override @Optional.Method(modid = "battlegear2") - public float getRecoveryRate(ItemStack stack) { + public float getRecoveryRate(ItemStack stack) + { NBTTagCompound tags = stack.getTagCompound(); - float recovery = tags.getCompoundTag("InfiTool").getInteger( - "MiningSpeed") / 1.5f; + float recovery = tags.getCompoundTag("InfiTool").getInteger("MiningSpeed") / 1.5f; return 10f / recovery; } @Override - public Item getAccessoryItem() { + public Item getAccessoryItem() + { return null; } @Override - public String getDefaultFolder() { + public String getDefaultFolder() + { return null; } @Override - public String getEffectSuffix() { + public String getEffectSuffix() + { return null; } @Override - public Item getHeadItem() { + public Item getHeadItem() + { return null; } @Override - public String getIconSuffix(int arg0) { + public String getIconSuffix(int arg0) + { return null; } - + @Override @Optional.Method(modid = "battlegear2") @SideOnly(Side.CLIENT) - public void addInformation(ItemStack par1ItemStack, - EntityPlayer par2EntityPlayer, List par3List, boolean par4) { + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) + { NBTTagCompound tags = par1ItemStack.getTagCompound(); super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4); par3List.add(""); - par3List.add(EnumChatFormatting.DARK_GREEN - + ItemStack.field_111284_a - .format(1F / (10f / (tags.getCompoundTag("InfiTool") - .getInteger("MiningSpeed") / 1.5f)) / 20F) - + StatCollector.translateToLocal("attribute.shield.block.time")); + par3List.add(EnumChatFormatting.DARK_GREEN + ItemStack.field_111284_a.format(1F / (10f / (tags.getCompoundTag("InfiTool").getInteger("MiningSpeed") / 1.5f)) / 20F) + StatCollector.translateToLocal("attribute.shield.block.time")); int arrowCount = getArrowCount(par1ItemStack); - if (arrowCount > 0) { - par3List.add(String.format("%s%s %s", EnumChatFormatting.GOLD, - arrowCount, StatCollector - .translateToLocal("attribute.shield.arrow.count"))); + if(arrowCount > 0) + { + par3List.add(String.format("%s%s %s", EnumChatFormatting.GOLD, arrowCount, StatCollector.translateToLocal("attribute.shield.arrow.count"))); } } -} \ No newline at end of file +} diff --git a/src/main/java/lance5057/tDefense/core/tools/TinkerWrench.java b/src/main/java/lance5057/tDefense/core/tools/TinkerWrench.java index 6ae9257..bb4b069 100644 --- a/src/main/java/lance5057/tDefense/core/tools/TinkerWrench.java +++ b/src/main/java/lance5057/tDefense/core/tools/TinkerWrench.java @@ -9,101 +9,115 @@ import tconstruct.library.tools.Weapon; import tconstruct.tools.TinkerTools; import buildcraft.api.tools.IToolWrench; -@Optional.InterfaceList({ - @Optional.Interface(modid = "buildcraft", iface = "buildcraft.api.tools.IToolWrench") -}) -public class TinkerWrench extends Weapon implements IToolWrench { - int induceDamage = 0; +@Optional.InterfaceList({@Optional.Interface(modid = "buildcraft", iface = "buildcraft.api.tools.IToolWrench")}) +public class TinkerWrench extends Weapon implements IToolWrench +{ + int induceDamage = 0; - public TinkerWrench() { + public TinkerWrench() + { super(0); this.setUnlocalizedName("tinkerwrench"); } @Override - public Item getHeadItem() { + public Item getHeadItem() + { return TinkerTools.handGuard; } @Override - public Item getHandleItem() { + public Item getHandleItem() + { return TinkerTools.toolRod; } @Override - public Item getAccessoryItem() { + public Item getAccessoryItem() + { return TinkerTools.binding; } @Override - public int durabilityTypeAccessory() { + public int durabilityTypeAccessory() + { return 2; } @Override - public float getRepairCost() { + public float getRepairCost() + { return 1.0f; } @Override - public float getDurabilityModifier() { + public float getDurabilityModifier() + { return 0.1f; } @Override - public float getDamageModifier() { + public float getDamageModifier() + { return 0.4f; } @Override - public int getPartAmount() { + public int getPartAmount() + { return 3; } @Override - public String getIconSuffix(int partType) { - switch (partType) { - case 0: - return "_wrench_head"; - case 1: - return "_wrench_head_broken"; - case 2: - return "_wrench_handle"; - case 3: - return "_wrench_binding"; - default: - return ""; + public String getIconSuffix(int partType) + { + switch(partType) + { + case 0: + return "_wrench_head"; + case 1: + return "_wrench_head_broken"; + case 2: + return "_wrench_handle"; + case 3: + return "_wrench_binding"; + default: + return ""; } } @Override - public String getEffectSuffix() { + public String getEffectSuffix() + { return "_wrench_effect"; } @Override - public String getDefaultFolder() { + public String getDefaultFolder() + { return "wrench"; } @Override @Optional.Method(modid = "buildcraft") - public boolean canWrench(EntityPlayer player, int x, int y, int z) { - NBTTagCompound tags = player.inventory.getCurrentItem() - .getTagCompound().getCompoundTag("InfiTool"); + public boolean canWrench(EntityPlayer player, int x, int y, int z) + { + NBTTagCompound tags = player.inventory.getCurrentItem().getTagCompound().getCompoundTag("InfiTool"); - if (!tags.getBoolean("Broken")) { + if(!tags.getBoolean("Broken")) + { return true; } return false; } @Override - public void wrenchUsed(EntityPlayer player, int x, int y, int z) { + @Optional.Method(modid = "buildcraft") + public void wrenchUsed(EntityPlayer player, int x, int y, int z) + { player.swingItem(); - AbilityHelper.damageTool(player.inventory.getCurrentItem(), 1, player, - false); + AbilityHelper.damageTool(player.inventory.getCurrentItem(), 1, player, false); } -} \ No newline at end of file +} diff --git a/src/main/java/lance5057/tDefense/core/tools/TinkerZweihander.java b/src/main/java/lance5057/tDefense/core/tools/TinkerZweihander.java index 6c476ad..c6b2cef 100644 --- a/src/main/java/lance5057/tDefense/core/tools/TinkerZweihander.java +++ b/src/main/java/lance5057/tDefense/core/tools/TinkerZweihander.java @@ -20,138 +20,152 @@ import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -@Optional.InterfaceList({ - @Optional.Interface(modid = "battlegear2", iface = "mods.battlegear2.api.weapons.IBattlegearWeapon"), -}) +@Optional.InterfaceList({@Optional.Interface(modid = "battlegear2", iface = "mods.battlegear2.api.weapons.IBattlegearWeapon"),}) +public class TinkerZweihander extends Weapon +{ -public class TinkerZweihander extends Weapon { - - public TinkerZweihander(int baseDamage) { - super(5); + public TinkerZweihander(int baseDamage) + { + super(3); this.setUnlocalizedName("zweihander"); } @Override - public Item getHeadItem() { + public Item getHeadItem() + { return TinkerTools.largeSwordBlade; } @Override - public Item getHandleItem() { + public Item getHandleItem() + { return TinkerTools.toughRod; } @Override - public Item getAccessoryItem() { + public Item getAccessoryItem() + { return TinkerTools.wideGuard; } @Override - public Item getExtraItem() { + public Item getExtraItem() + { return TinkerTools.swordBlade; } @Override - public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player) - { + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) + { if(!player.isPotionActive(Potion.moveSlowdown)) { List entities = player.worldObj.getEntitiesWithinAABBExcludingEntity(player, AxisAlignedBB.getBoundingBox(player.posX - 2, player.posY - 2, player.posZ - 2, player.posX + 2, player.posY + 2, player.posZ + 2)); - - for(int i = 0; i fireballs = (ArrayList) world.getEntitiesWithinAABB(EntityFireball.class, boundingBox); - for (EntityFireball fireball : fireballs) - { - if (fireball.getDistanceSqToEntity(((EntityLivingBase)entity)) <= 25) - { - Vec3 playerlook = ((EntityLivingBase)entity).getLookVec(); - - fireball.motionX = playerlook.xCoord; - fireball.motionY = playerlook.yCoord; - fireball.motionZ = playerlook.zCoord; - fireball.accelerationX = fireball.motionX * 0.1D; + if(((IBattlePlayer) entity).isBlockingWithShield()) + { + AxisAlignedBB boundingBox = AxisAlignedBB.getBoundingBox(((EntityLivingBase) entity).posX - 3, ((EntityLivingBase) entity).posY - 3, ((EntityLivingBase) entity).posZ - 3, ((EntityLivingBase) entity).posX + 3, ((EntityLivingBase) entity).posY + 3, ((EntityLivingBase) entity).posZ + 3); + + ArrayList fireballs = (ArrayList) world.getEntitiesWithinAABB(EntityFireball.class, boundingBox); + for(EntityFireball fireball : fireballs) + { + if(fireball.getDistanceSqToEntity(((EntityLivingBase) entity)) <= 25) + { + Vec3 playerlook = ((EntityLivingBase) entity).getLookVec(); + + fireball.motionX = playerlook.xCoord; + fireball.motionY = playerlook.yCoord; + fireball.motionZ = playerlook.zCoord; + fireball.accelerationX = fireball.motionX * 0.1D; fireball.accelerationY = fireball.motionY * 0.1D; fireball.accelerationZ = fireball.motionZ * 0.1D; - - fireball.shootingEntity = ((EntityLivingBase)entity); - - ((EntityLivingBase)entity).worldObj.playSoundAtEntity(((EntityLivingBase)entity), "battlegear2:shield", 1, 1); - } - } + + fireball.shootingEntity = ((EntityLivingBase) entity); + + ((EntityLivingBase) entity).worldObj.playSoundAtEntity(((EntityLivingBase) entity), "battlegear2:shield", 1, 1); + } + } } } diff --git a/src/main/java/lance5057/tDefense/core/tools/modifiers/Botania/modifierCorpseIvy.java b/src/main/java/lance5057/tDefense/core/tools/modifiers/Botania/modifierCorpseIvy.java index b2211b3..7335e93 100644 --- a/src/main/java/lance5057/tDefense/core/tools/modifiers/Botania/modifierCorpseIvy.java +++ b/src/main/java/lance5057/tDefense/core/tools/modifiers/Botania/modifierCorpseIvy.java @@ -11,57 +11,57 @@ import tconstruct.modifiers.tools.ItemModTypeFilter; public class modifierCorpseIvy extends ItemModTypeFilter { - String tooltipName; - String guiType; + String tooltipName; + String guiType; - public modifierCorpseIvy(String type, int effect, ItemStack[] items, int[] values) - { - super(effect, "corpseivy", items, values); - tooltipName = "\u00A7fCorpse Drinker"; - guiType = type; - } + public modifierCorpseIvy(String type, int effect, ItemStack[] items, int[] values) + { + super(effect, "corpseivy", items, values); + tooltipName = "\u00A7fCorpse Drinker"; + guiType = type; + } - @Override - protected boolean canModify (ItemStack tool, ItemStack[] input) - { - NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - - List list = Arrays.asList(((ToolCore)tool.getItem()).getTraits()); - if (list.contains("weapon")) + @Override + protected boolean canModify(ItemStack tool, ItemStack[] input) + { + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + + List list = Arrays.asList(((ToolCore) tool.getItem()).getTraits()); + if(list.contains("weapon")) { - return tags.getInteger("Modifiers") > 0; + return tags.getInteger("Modifiers") > 0; } - - return false; - } - @Override - public void modify (ItemStack[] input, ItemStack tool) - { - NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - int increase = matchingAmount(input); - if (tags.hasKey(key)) - { - int[] keyPair = tags.getIntArray(key); + return false; + } + + @Override + public void modify(ItemStack[] input, ItemStack tool) + { + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + int increase = matchingAmount(input); + if(tags.hasKey(key)) + { + int[] keyPair = tags.getIntArray(key); - updateModTag(tool, keyPair); + updateModTag(tool, keyPair); - } - else - { - int modifiers = tags.getInteger("Modifiers"); - modifiers -= 1; - tags.setInteger("Modifiers", modifiers); - String modName = "\u00A76" + guiType; - int tooltipIndex = addToolTip(tool, tooltipName, modName); - } - } + } + else + { + int modifiers = tags.getInteger("Modifiers"); + modifiers -= 1; + tags.setInteger("Modifiers", modifiers); + String modName = "\u00A76" + guiType; + int tooltipIndex = addToolTip(tool, tooltipName, modName); + } + } - void updateModTag (ItemStack tool, int[] keys) - { - NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - String tip = "ModifierTip" + keys[2]; - String modName = "\u00A76" + guiType; - tags.setString(tip, modName); - } + void updateModTag(ItemStack tool, int[] keys) + { + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + String tip = "ModifierTip" + keys[2]; + String modName = "\u00A76" + guiType; + tags.setString(tip, modName); + } } diff --git a/src/main/java/lance5057/tDefense/core/tools/modifiers/Modifiers.java b/src/main/java/lance5057/tDefense/core/tools/modifiers/Modifiers.java index 8f1187e..5b2705b 100644 --- a/src/main/java/lance5057/tDefense/core/tools/modifiers/Modifiers.java +++ b/src/main/java/lance5057/tDefense/core/tools/modifiers/Modifiers.java @@ -4,11 +4,12 @@ import lance5057.tDefense.Reference; import lance5057.tDefense.TinkersDefense; import lance5057.tDefense.armor.modifiers.ArmorMods; import lance5057.tDefense.core.tools.modifiers.ActiveToolMods.TDefenseActiveToolMod; -import lance5057.tDefense.core.tools.modifiers.shields.modifierCrestofBlades; -import lance5057.tDefense.core.tools.modifiers.shields.modifierCrestofFeathers; -import lance5057.tDefense.core.tools.modifiers.shields.modifierCrestofLegends; -import lance5057.tDefense.core.tools.modifiers.shields.modifierCrestofMirrors; -import lance5057.tDefense.core.tools.modifiers.weapons.modifierDaze; +import lance5057.tDefense.core.tools.modifiers.TDefense.modifierSoulBound; +import lance5057.tDefense.core.tools.modifiers.TDefense.shields.modifierCrestofBlades; +import lance5057.tDefense.core.tools.modifiers.TDefense.shields.modifierCrestofFeathers; +import lance5057.tDefense.core.tools.modifiers.TDefense.shields.modifierCrestofLegends; +import lance5057.tDefense.core.tools.modifiers.TDefense.shields.modifierCrestofMirrors; +import lance5057.tDefense.core.tools.modifiers.TDefense.weapons.modifierDaze; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; @@ -17,47 +18,50 @@ import tconstruct.library.TConstructRegistry; import tconstruct.library.client.TConstructClientRegistry; import tconstruct.library.crafting.ModifyBuilder; import tconstruct.library.tools.ToolCore; +import tconstruct.modifiers.tools.ModBoolean; import cpw.mods.fml.common.registry.GameRegistry; -public class Modifiers +public class Modifiers { - public static Item item_relic; - public static ArmorMods AMod; - + public static Item item_relic; + public static Item itemSoulChain; + public static ArmorMods AMod; + public void init() { AMod = new ArmorMods(); - - item_relic = new Item().setCreativeTab(TinkersDefense.tabName).setMaxStackSize(1) - .setUnlocalizedName("AncientRelic") - .setTextureName(Reference.MOD_ID + ":AncientRelic"); + + item_relic = new Item().setCreativeTab(TinkersDefense.tabName).setMaxStackSize(1).setUnlocalizedName("AncientRelic").setTextureName(Reference.MOD_ID + ":AncientRelic"); + + itemSoulChain = new Item().setCreativeTab(TinkersDefense.tabName).setMaxStackSize(1).setUnlocalizedName("SoulChain").setTextureName(Reference.MOD_ID + ":SoulChain"); + GameRegistry.registerItem(item_relic, "Ancient Relic"); - - ModifyBuilder.registerModifier(new modifierDaze("Daze", TinkersDefense.config.DazeID, new ItemStack[] { new ItemStack(Blocks.light_weighted_pressure_plate), new ItemStack(Items.potionitem,1,8202)}, - new int[] {1,0})); - + GameRegistry.registerItem(itemSoulChain, "Soul Chain"); + + ModifyBuilder.registerModifier(new modifierDaze("Daze", TinkersDefense.config.DazeID, new ItemStack[] {new ItemStack(Blocks.light_weighted_pressure_plate), new ItemStack(Items.potionitem, 1, 8202)}, new int[] {1, 0})); + //ModifyBuilder.registerModifier(new modifierTorchArrow(new ItemStack[] {new ItemStack(Blocks.glowstone)}, 12)); - - ModifyBuilder.registerModifier(new modifierCrestofFeathers("Crest of Feathers", TinkersDefense.config.CrestFeathersID, new ItemStack[] { new ItemStack(Items.feather)}, - new int[] {1})); - - ModifyBuilder.registerModifier(new modifierCrestofMirrors("Crest of Mirrors", TinkersDefense.config.CrestMirrorsID, new ItemStack[] { new ItemStack(Blocks.glass_pane)}, - new int[] {1})); - - ModifyBuilder.registerModifier(new modifierCrestofLegends("Crest of Legends", TinkersDefense.config.CrestLegendsID, new ItemStack[] { new ItemStack(item_relic)}, - new int[] {1})); - - ModifyBuilder.registerModifier(new modifierCrestofBlades("Crest of Blades", TinkersDefense.config.CrestBladesID, new ItemStack[] { new ItemStack(Items.iron_sword)},new int[] {1})); - + + ModifyBuilder.registerModifier(new modifierCrestofFeathers("Crest of Feathers", TinkersDefense.config.CrestFeathersID, new ItemStack[] {new ItemStack(Items.feather)}, new int[] {1})); + + ModifyBuilder.registerModifier(new modifierCrestofMirrors("Crest of Mirrors", TinkersDefense.config.CrestMirrorsID, new ItemStack[] {new ItemStack(Blocks.glass_pane)}, new int[] {1})); + + ModifyBuilder.registerModifier(new modifierCrestofLegends("Crest of Legends", TinkersDefense.config.CrestLegendsID, new ItemStack[] {new ItemStack(item_relic)}, new int[] {1})); + + ModifyBuilder.registerModifier(new modifierCrestofBlades("Crest of Blades", TinkersDefense.config.CrestBladesID, new ItemStack[] {new ItemStack(Items.iron_sword)}, new int[] {1})); + + ModifyBuilder.registerModifier(new modifierSoulBound(new ItemStack[] {new ItemStack(itemSoulChain)}, TinkersDefense.config.SoulBoundID, "Soulbound", "\u00A7b", "Soulbound")); + TConstructRegistry.registerActiveToolMod(new TDefenseActiveToolMod()); - - for (ToolCore tool : TConstructRegistry.getToolMapping()) - { + + for(ToolCore tool : TConstructRegistry.getToolMapping()) + { TConstructClientRegistry.addEffectRenderMapping(tool, TinkersDefense.config.DazeID, "tinker", "daze", true); TConstructClientRegistry.addEffectRenderMapping(tool, TinkersDefense.config.CrestFeathersID, "tinker", "feathers", true); TConstructClientRegistry.addEffectRenderMapping(tool, TinkersDefense.config.CrestMirrorsID, "tinker", "mirrors", true); TConstructClientRegistry.addEffectRenderMapping(tool, TinkersDefense.config.CrestLegendsID, "tinker", "legends", true); TConstructClientRegistry.addEffectRenderMapping(tool, TinkersDefense.config.CrestBladesID, "tinker", "blades", true); - } + TConstructClientRegistry.addEffectRenderMapping(tool, TinkersDefense.config.SoulBoundID, "tinker", "soulbound", true); + } } } diff --git a/src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/modifierSoulBound.java b/src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/modifierSoulBound.java new file mode 100644 index 0000000..43604b1 --- /dev/null +++ b/src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/modifierSoulBound.java @@ -0,0 +1,29 @@ +package lance5057.tDefense.core.tools.modifiers.TDefense; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import tconstruct.modifiers.tools.ModBoolean; + +public class modifierSoulBound extends ModBoolean +{ + String c; + String tip; + + public modifierSoulBound(ItemStack[] items, int effect, String tag, String color, String tipname) + { + super(items, effect, tag, color, tipname); + c = color; + tip = tipname; + } + + @Override + public void modify(ItemStack[] input, ItemStack tool) + { + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + + tags.setBoolean(key, true); + + addToolTip(tool, c + tip, c + key); + } + +} diff --git a/src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/shields/modifierCrestofBlades.java b/src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/shields/modifierCrestofBlades.java new file mode 100644 index 0000000..466de59 --- /dev/null +++ b/src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/shields/modifierCrestofBlades.java @@ -0,0 +1,90 @@ +package lance5057.tDefense.core.tools.modifiers.TDefense.shields; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import tconstruct.modifiers.tools.ItemModTypeFilter; + +public class modifierCrestofBlades extends ItemModTypeFilter +{ + String tooltipName; + int max = 5; + String guiType; + + public modifierCrestofBlades(String type, int effect, ItemStack[] items, int[] values) + { + super(effect, "Blades", items, values); + tooltipName = "\u00A7fBlades"; + guiType = type; + } + + @Override + protected boolean canModify(ItemStack tool, ItemStack[] input) + { + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + if(!tags.hasKey(key)) + return tags.getInteger("Modifiers") > 0 && matchingAmount(input) <= max; + + if(matchingAmount(input) > max) + return false; + + int keyPair[] = tags.getIntArray(key); + if(keyPair[0] + matchingAmount(input) <= keyPair[1]) + return true; + + // else if (keyPair[0] == keyPair[1]) + // return tags.getInteger("Modifiers") > 0; + + else + return false; + } + + @Override + public void modify(ItemStack[] input, ItemStack tool) + { + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + int increase = matchingAmount(input); + int[] keyPair; + int current = 0; + if(tags.hasKey(key)) + { + keyPair = tags.getIntArray(key); + + if(keyPair[0] % max == 0) + { + keyPair[0] += increase; + keyPair[1] += max; + tags.setIntArray(key, keyPair); + + int modifiers = tags.getInteger("Modifiers"); + modifiers -= 1; + tags.setInteger("Modifiers", modifiers); + } + else + { + keyPair[0] += increase; + tags.setIntArray(key, keyPair); + } + updateModTag(tool, keyPair); + + } + else + { + int modifiers = tags.getInteger("Modifiers"); + modifiers -= 1; + tags.setInteger("Modifiers", modifiers); + String modName = "\u00A76" + guiType + " (" + increase + "/" + max + ")"; + int tooltipIndex = addToolTip(tool, tooltipName, modName); + keyPair = new int[] {increase, max, tooltipIndex}; + tags.setIntArray(key, keyPair); + } + + } + + void updateModTag(ItemStack tool, int[] keys) + { + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + String tip = "ModifierTip" + keys[2]; + String modName = "\u00A76" + guiType + " (" + keys[0] + "/" + keys[1] + ")"; + tags.setString(tip, modName); + } +} diff --git a/src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/shields/modifierCrestofFeathers.java b/src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/shields/modifierCrestofFeathers.java new file mode 100644 index 0000000..65b81a6 --- /dev/null +++ b/src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/shields/modifierCrestofFeathers.java @@ -0,0 +1,129 @@ +package lance5057.tDefense.core.tools.modifiers.TDefense.shields; + +import java.util.Arrays; +import java.util.List; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import tconstruct.library.tools.ToolCore; +import tconstruct.modifiers.tools.ItemModTypeFilter; + +public class modifierCrestofFeathers extends ItemModTypeFilter +{ + String tooltipName; + int max = 10; + String guiType; + + public modifierCrestofFeathers(String type, int effect, ItemStack[] items, int[] values) + { + super(effect, "Feathers", items, values); + tooltipName = "\u00A7fCrest of Feathers"; + guiType = type; + } + + @Override + protected boolean canModify(ItemStack tool, ItemStack[] input) + { + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + List list = Arrays.asList(((ToolCore) tool.getItem()).getTraits()); + + if(list.contains("shield")) + { + if(!tags.hasKey(key)) + return tags.getInteger("Modifiers") > 0 && matchingAmount(input) <= max; + + if(matchingAmount(input) > max) + return false; + + int keyPair[] = tags.getIntArray(key); + if(keyPair[0] + matchingAmount(input) <= keyPair[1]) + return true; + + else if(keyPair[0] == keyPair[1]) + return tags.getInteger("Modifiers") > 0; + + else + return false; + } + return false; + } + + @Override + public void modify(ItemStack[] input, ItemStack tool) + { + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + + int increase = matchingAmount(input); + int[] keyPair; + int current = 0; + if(tags.hasKey(key)) + { + keyPair = tags.getIntArray(key); + + if(keyPair[0] % max == 0) + { + keyPair[0] += increase; + keyPair[1] += max; + tags.setIntArray(key, keyPair); + + int modifiers = tags.getInteger("Modifiers"); + modifiers -= 1; + tags.setInteger("Modifiers", modifiers); + } + else + { + keyPair[0] += increase; + tags.setIntArray(key, keyPair); + } + updateModTag(tool, keyPair); + + } + else + { + int modifiers = tags.getInteger("Modifiers"); + modifiers -= 1; + tags.setInteger("Modifiers", modifiers); + String modName = "\u00A76" + guiType + " (" + increase + "/" + max + ")"; + int tooltipIndex = addToolTip(tool, tooltipName, modName); + keyPair = new int[] {increase, max, tooltipIndex}; + tags.setIntArray(key, keyPair); + } + + int miningSpeed = tags.getInteger("MiningSpeed"); + int boost = 8 + ((current - 1) / 50 * 2); + Item temp = tool.getItem(); + if(temp instanceof ToolCore) + { + ToolCore toolcore = (ToolCore) temp; + if(toolcore.durabilityTypeHandle() == 2) + boost += 2; + if(toolcore.durabilityTypeAccessory() == 2) + boost += 2; + if(toolcore.durabilityTypeExtra() == 2) + boost += 2; + } + miningSpeed += (increase * boost); + tags.setInteger("MiningSpeed", miningSpeed); + + String[] type = {"MiningSpeed2", "MiningSpeedHandle", "MiningSpeedExtra"}; + + for(int i = 0; i < 3; i++) + { + if(tags.hasKey(type[i])) + { + int speed = tags.getInteger(type[i]); + speed += (increase * boost); + tags.setInteger(type[i], speed); + } + } + } + + void updateModTag(ItemStack tool, int[] keys) + { + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + String tip = "ModifierTip" + keys[2]; + String modName = "\u00A76" + guiType + " (" + keys[0] + "/" + keys[1] + ")"; + tags.setString(tip, modName); + } +} diff --git a/src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/shields/modifierCrestofLegends.java b/src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/shields/modifierCrestofLegends.java new file mode 100644 index 0000000..f328258 --- /dev/null +++ b/src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/shields/modifierCrestofLegends.java @@ -0,0 +1,60 @@ +package lance5057.tDefense.core.tools.modifiers.TDefense.shields; + +import lance5057.tDefense.core.tools.Shield; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import tconstruct.modifiers.tools.ItemModTypeFilter; + +public class modifierCrestofLegends extends ItemModTypeFilter +{ + String tooltipName; + String guiType; + + public modifierCrestofLegends(String type, int effect, ItemStack[] items, int[] values) + { + super(effect, "Legends", items, values); + tooltipName = "\u00A7fCrest of Legends"; + guiType = type; + } + + @Override + protected boolean canModify(ItemStack tool, ItemStack[] input) + { + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + + if(tool.getItem() instanceof Shield) + return tags.getInteger("Modifiers") > 0; + + return false; + } + + @Override + public void modify(ItemStack[] input, ItemStack tool) + { + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + int increase = matchingAmount(input); + if(tags.hasKey(key)) + { + int[] keyPair = tags.getIntArray(key); + + updateModTag(tool, keyPair); + + } + else + { + int modifiers = tags.getInteger("Modifiers"); + modifiers -= 1; + tags.setInteger("Modifiers", modifiers); + String modName = "\u00A76" + guiType; + int tooltipIndex = addToolTip(tool, tooltipName, modName); + } + } + + void updateModTag(ItemStack tool, int[] keys) + { + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + String tip = "ModifierTip" + keys[2]; + String modName = "\u00A76" + guiType + " (" + keys[0] + "/" + keys[1] + ")"; + tags.setString(tip, modName); + } +} diff --git a/src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/shields/modifierCrestofMirrors.java b/src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/shields/modifierCrestofMirrors.java new file mode 100644 index 0000000..27e547e --- /dev/null +++ b/src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/shields/modifierCrestofMirrors.java @@ -0,0 +1,64 @@ +package lance5057.tDefense.core.tools.modifiers.TDefense.shields; + +import java.util.Arrays; +import java.util.List; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import tconstruct.library.tools.ToolCore; +import tconstruct.modifiers.tools.ModBoolean; + +public class modifierCrestofMirrors extends ModBoolean +{ + String tooltipName; + String guiType; + + public modifierCrestofMirrors(String type, int effect, ItemStack[] items, int[] values) + { + super(items, effect, "Mirrors", "\u00A7", ""); + tooltipName = "\u00A7bCrest of Mirrors"; + guiType = type; + } + + @Override + protected boolean canModify(ItemStack tool, ItemStack[] input) + { + if(tool.getItem() instanceof ToolCore) + { + List list = Arrays.asList(((ToolCore) tool.getItem()).getTraits()); + if(list.contains("shield")) + { + + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + + if(tags.hasKey(key)) + return false; + + return true; + } + } + return false; + + } + + @Override + public void modify(ItemStack[] input, ItemStack tool) + { + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + tags.setBoolean(key, true); + + int modifiers = tags.getInteger("Modifiers"); + modifiers -= 1; + tags.setInteger("Modifiers", modifiers); + + addToolTip(tool, "\u00A7b" + tooltipName, "\u00A7b" + key); + } + + void updateModTag(ItemStack tool, int[] keys) + { + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + String tip = "ModifierTip" + keys[2]; + String modName = "\u00A7b" + guiType; + tags.setString(tip, modName); + } +} diff --git a/src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/weapons/modifierDaze.java b/src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/weapons/modifierDaze.java new file mode 100644 index 0000000..6c4af7a --- /dev/null +++ b/src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/weapons/modifierDaze.java @@ -0,0 +1,97 @@ +package lance5057.tDefense.core.tools.modifiers.TDefense.weapons; + +import java.util.Arrays; +import java.util.List; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import tconstruct.library.tools.ToolCore; +import tconstruct.modifiers.tools.ItemModTypeFilter; + +public class modifierDaze extends ItemModTypeFilter +{ + String tooltipName; + int max = 5; + String guiType; + + public modifierDaze(String type, int effect, ItemStack[] items, int[] values) + { + super(effect, "Daze", items, values); + tooltipName = "\u00A76Daze"; + guiType = type; + } + + @Override + protected boolean canModify(ItemStack tool, ItemStack[] input) + { + if(tool.getItem() instanceof ToolCore) + { + List list = Arrays.asList(((ToolCore) tool.getItem()).getTraits()); + if(list.contains("weapon")) + { + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + if(!tags.hasKey(key)) + return tags.getInteger("Modifiers") > 0 && matchingAmount(input) <= max; + + if(matchingAmount(input) > max) + return false; + + int keyPair[] = tags.getIntArray(key); + if(keyPair[0] + matchingAmount(input) <= keyPair[1]) + return true; + + else if(keyPair[0] == keyPair[1]) + return tags.getInteger("Modifiers") > 0; + } + } + + return false; + } + + @Override + public void modify(ItemStack[] input, ItemStack tool) + { + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + int increase = matchingAmount(input); + if(tags.hasKey(key)) + { + int[] keyPair = tags.getIntArray(key); + + if(keyPair[0] % max == 0) + { + keyPair[0] += increase; + keyPair[1] += max; + tags.setIntArray(key, keyPair); + + int modifiers = tags.getInteger("Modifiers"); + modifiers -= 1; + tags.setInteger("Modifiers", modifiers); + } + else + { + keyPair[0] += increase; + tags.setIntArray(key, keyPair); + } + updateModTag(tool, keyPair); + + } + else + { + int modifiers = tags.getInteger("Modifiers"); + modifiers -= 1; + tags.setInteger("Modifiers", modifiers); + String modName = "\u00A76" + guiType + " (" + increase + "/" + max + ")"; + int tooltipIndex = addToolTip(tool, tooltipName, modName); + int[] keyPair = new int[] {increase, max, tooltipIndex}; + tags.setIntArray(key, keyPair); + } + } + + void updateModTag(ItemStack tool, int[] keys) + { + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + String tip = "ModifierTip" + keys[2]; + String modName = "\u00A76" + guiType + " (" + keys[0] + "/" + keys[1] + ")"; + tags.setString(tip, modName); + } +} diff --git a/src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/weapons/modifierTorchArrow.java b/src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/weapons/modifierTorchArrow.java new file mode 100644 index 0000000..b25778b --- /dev/null +++ b/src/main/java/lance5057/tDefense/core/tools/modifiers/TDefense/weapons/modifierTorchArrow.java @@ -0,0 +1,72 @@ +package lance5057.tDefense.core.tools.modifiers.TDefense.weapons; + +import java.util.Arrays; +import java.util.List; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import tconstruct.library.tools.ToolCore; +import tconstruct.modifiers.tools.ItemModTypeFilter; +import tconstruct.modifiers.tools.ModBoolean; + +public class modifierTorchArrow extends ModBoolean +{ + String tooltipName; + String guiType; + String color; + + public modifierTorchArrow(ItemStack[] items, int effect) + { + super(items, effect, "Torch", "\u00A76", "Torch"); + tooltipName = "\u00A76Daze"; + color = "\u00A76"; + //guiType = type; + } + + @Override + protected boolean canModify(ItemStack tool, ItemStack[] input) + { + if(tool.getItem() instanceof ToolCore) + { + List list = Arrays.asList(((ToolCore) tool.getItem()).getTraits()); + if(list.contains("ammo")) + { + ToolCore toolItem = (ToolCore) tool.getItem(); + if(!validType(toolItem)) + return false; + + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + + return tags.getInteger("Modifiers") > 0 && !tags.getBoolean(key); + } + } + return false; + } + + @Override + public void modify(ItemStack[] input, ItemStack tool) + { + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + tags.setBoolean(key, true); + + int modifiers = tags.getInteger("Modifiers"); + modifiers -= 1; + tags.setInteger("Modifiers", modifiers); + + int attack = tags.getInteger("Attack"); + attack -= 3; + if(attack < 0) + attack = 0; + tags.setInteger("Attack", attack); + + addToolTip(tool, color + tooltipName, color + key); + } + + void updateModTag(ItemStack tool, int[] keys) + { + NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); + String tip = "ModifierTip" + keys[2]; + String modName = color + guiType + " (" + keys[0] + "/" + keys[1] + ")"; + tags.setString(tip, modName); + } +} diff --git a/src/main/java/lance5057/tDefense/core/tools/modifiers/shields/modifierCrestofBlades.java b/src/main/java/lance5057/tDefense/core/tools/modifiers/shields/modifierCrestofBlades.java deleted file mode 100644 index 86b54ad..0000000 --- a/src/main/java/lance5057/tDefense/core/tools/modifiers/shields/modifierCrestofBlades.java +++ /dev/null @@ -1,90 +0,0 @@ -package lance5057.tDefense.core.tools.modifiers.shields; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import tconstruct.modifiers.tools.ItemModTypeFilter; - -public class modifierCrestofBlades extends ItemModTypeFilter -{ - String tooltipName; - int max = 5; - String guiType; - - public modifierCrestofBlades(String type, int effect, ItemStack[] items, int[] values) - { - super(effect, "Blades", items, values); - tooltipName = "\u00A7fBlades"; - guiType = type; - } - - @Override - protected boolean canModify (ItemStack tool, ItemStack[] input) - { - NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - if (!tags.hasKey(key)) - return tags.getInteger("Modifiers") > 0 && matchingAmount(input) <= max; - - if (matchingAmount(input) > max) - return false; - - int keyPair[] = tags.getIntArray(key); - if (keyPair[0] + matchingAmount(input) <= keyPair[1]) - return true; - -// else if (keyPair[0] == keyPair[1]) -// return tags.getInteger("Modifiers") > 0; - - else - return false; - } - - @Override - public void modify (ItemStack[] input, ItemStack tool) - { - NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - int increase = matchingAmount(input); - int[] keyPair; - int current = 0; - if (tags.hasKey(key)) - { - keyPair = tags.getIntArray(key); - - if (keyPair[0] % max == 0) - { - keyPair[0] += increase; - keyPair[1] += max; - tags.setIntArray(key, keyPair); - - int modifiers = tags.getInteger("Modifiers"); - modifiers -= 1; - tags.setInteger("Modifiers", modifiers); - } - else - { - keyPair[0] += increase; - tags.setIntArray(key, keyPair); - } - updateModTag(tool, keyPair); - - } - else - { - int modifiers = tags.getInteger("Modifiers"); - modifiers -= 1; - tags.setInteger("Modifiers", modifiers); - String modName = "\u00A76" + guiType + " (" + increase + "/" + max + ")"; - int tooltipIndex = addToolTip(tool, tooltipName, modName); - keyPair = new int[] { increase, max, tooltipIndex }; - tags.setIntArray(key, keyPair); - } - - } - - void updateModTag (ItemStack tool, int[] keys) - { - NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - String tip = "ModifierTip" + keys[2]; - String modName = "\u00A76" + guiType + " (" + keys[0] + "/" + keys[1] + ")"; - tags.setString(tip, modName); - } -} diff --git a/src/main/java/lance5057/tDefense/core/tools/modifiers/shields/modifierCrestofFeathers.java b/src/main/java/lance5057/tDefense/core/tools/modifiers/shields/modifierCrestofFeathers.java deleted file mode 100644 index 0b82ae4..0000000 --- a/src/main/java/lance5057/tDefense/core/tools/modifiers/shields/modifierCrestofFeathers.java +++ /dev/null @@ -1,119 +0,0 @@ -package lance5057.tDefense.core.tools.modifiers.shields; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import tconstruct.library.tools.ToolCore; -import tconstruct.modifiers.tools.ItemModTypeFilter; - -public class modifierCrestofFeathers extends ItemModTypeFilter -{ - String tooltipName; - int max = 10; - String guiType; - - public modifierCrestofFeathers(String type, int effect, ItemStack[] items, int[] values) - { - super(effect, "Feathers", items, values); - tooltipName = "\u00A7fCrest of Feathers"; - guiType = type; - } - - @Override - protected boolean canModify (ItemStack tool, ItemStack[] input) - { - NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - if (!tags.hasKey(key)) - return tags.getInteger("Modifiers") > 0 && matchingAmount(input) <= max; - - if (matchingAmount(input) > max) - return false; - - int keyPair[] = tags.getIntArray(key); - if (keyPair[0] + matchingAmount(input) <= keyPair[1]) - return true; - - else if (keyPair[0] == keyPair[1]) - return tags.getInteger("Modifiers") > 0; - - else - return false; - } - - @Override - public void modify (ItemStack[] input, ItemStack tool) - { - NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - int increase = matchingAmount(input); - int[] keyPair; - int current = 0; - if (tags.hasKey(key)) - { - keyPair = tags.getIntArray(key); - - if (keyPair[0] % max == 0) - { - keyPair[0] += increase; - keyPair[1] += max; - tags.setIntArray(key, keyPair); - - int modifiers = tags.getInteger("Modifiers"); - modifiers -= 1; - tags.setInteger("Modifiers", modifiers); - } - else - { - keyPair[0] += increase; - tags.setIntArray(key, keyPair); - } - updateModTag(tool, keyPair); - - } - else - { - int modifiers = tags.getInteger("Modifiers"); - modifiers -= 1; - tags.setInteger("Modifiers", modifiers); - String modName = "\u00A76" + guiType + " (" + increase + "/" + max + ")"; - int tooltipIndex = addToolTip(tool, tooltipName, modName); - keyPair = new int[] { increase, max, tooltipIndex }; - tags.setIntArray(key, keyPair); - } - - int miningSpeed = tags.getInteger("MiningSpeed"); - int boost = 8 + ((current - 1) / 50 * 2); - Item temp = tool.getItem(); - if (temp instanceof ToolCore) - { - ToolCore toolcore = (ToolCore) temp; - if (toolcore.durabilityTypeHandle() == 2) - boost += 2; - if (toolcore.durabilityTypeAccessory() == 2) - boost += 2; - if (toolcore.durabilityTypeExtra() == 2) - boost += 2; - } - miningSpeed += (increase * boost); - tags.setInteger("MiningSpeed", miningSpeed); - - String[] type = { "MiningSpeed2", "MiningSpeedHandle", "MiningSpeedExtra" }; - - for (int i = 0; i < 3; i++) - { - if (tags.hasKey(type[i])) - { - int speed = tags.getInteger(type[i]); - speed += (increase * boost); - tags.setInteger(type[i], speed); - } - } - } - - void updateModTag (ItemStack tool, int[] keys) - { - NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - String tip = "ModifierTip" + keys[2]; - String modName = "\u00A76" + guiType + " (" + keys[0] + "/" + keys[1] + ")"; - tags.setString(tip, modName); - } -} diff --git a/src/main/java/lance5057/tDefense/core/tools/modifiers/shields/modifierCrestofLegends.java b/src/main/java/lance5057/tDefense/core/tools/modifiers/shields/modifierCrestofLegends.java deleted file mode 100644 index d1cd350..0000000 --- a/src/main/java/lance5057/tDefense/core/tools/modifiers/shields/modifierCrestofLegends.java +++ /dev/null @@ -1,60 +0,0 @@ -package lance5057.tDefense.core.tools.modifiers.shields; - -import lance5057.tDefense.core.tools.Shield; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import tconstruct.modifiers.tools.ItemModTypeFilter; - -public class modifierCrestofLegends extends ItemModTypeFilter -{ - String tooltipName; - String guiType; - - public modifierCrestofLegends(String type, int effect, ItemStack[] items, int[] values) - { - super(effect, "Legends", items, values); - tooltipName = "\u00A7fCrest of Legends"; - guiType = type; - } - - @Override - protected boolean canModify (ItemStack tool, ItemStack[] input) - { - NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - - if(tool.getItem() instanceof Shield) - return tags.getInteger("Modifiers") > 0; - - return false; - } - - @Override - public void modify (ItemStack[] input, ItemStack tool) - { - NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - int increase = matchingAmount(input); - if (tags.hasKey(key)) - { - int[] keyPair = tags.getIntArray(key); - - updateModTag(tool, keyPair); - - } - else - { - int modifiers = tags.getInteger("Modifiers"); - modifiers -= 1; - tags.setInteger("Modifiers", modifiers); - String modName = "\u00A76" + guiType; - int tooltipIndex = addToolTip(tool, tooltipName, modName); - } - } - - void updateModTag (ItemStack tool, int[] keys) - { - NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - String tip = "ModifierTip" + keys[2]; - String modName = "\u00A76" + guiType + " (" + keys[0] + "/" + keys[1] + ")"; - tags.setString(tip, modName); - } -} diff --git a/src/main/java/lance5057/tDefense/core/tools/modifiers/shields/modifierCrestofMirrors.java b/src/main/java/lance5057/tDefense/core/tools/modifiers/shields/modifierCrestofMirrors.java deleted file mode 100644 index 93d47e2..0000000 --- a/src/main/java/lance5057/tDefense/core/tools/modifiers/shields/modifierCrestofMirrors.java +++ /dev/null @@ -1,64 +0,0 @@ -package lance5057.tDefense.core.tools.modifiers.shields; - -import java.util.Arrays; -import java.util.List; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import tconstruct.library.tools.ToolCore; -import tconstruct.modifiers.tools.ModBoolean; - -public class modifierCrestofMirrors extends ModBoolean -{ - String tooltipName; - String guiType; - - public modifierCrestofMirrors(String type, int effect, ItemStack[] items, int[] values) - { - super(items, effect, "Mirrors", "\u00A7", ""); - tooltipName = "\u00A7bCrest of Mirrors"; - guiType = type; - } - - @Override - protected boolean canModify (ItemStack tool, ItemStack[] input) - { - if (tool.getItem() instanceof ToolCore) - { - List list = Arrays.asList(((ToolCore)tool.getItem()).getTraits()); - if (list.contains("shield")) - { - - NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - - if (tags.hasKey(key)) - return false; - - return true; - } - } - return false; - - } - - @Override - public void modify (ItemStack[] input, ItemStack tool) - { - NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - tags.setBoolean(key, true); - - int modifiers = tags.getInteger("Modifiers"); - modifiers -= 1; - tags.setInteger("Modifiers", modifiers); - - addToolTip(tool, "\u00A7b" + tooltipName, "\u00A7b" + key); - } - - void updateModTag (ItemStack tool, int[] keys) - { - NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - String tip = "ModifierTip" + keys[2]; - String modName = "\u00A7b" + guiType; - tags.setString(tip, modName); - } -} diff --git a/src/main/java/lance5057/tDefense/core/tools/modifiers/weapons/modifierDaze.java b/src/main/java/lance5057/tDefense/core/tools/modifiers/weapons/modifierDaze.java deleted file mode 100644 index 326dc83..0000000 --- a/src/main/java/lance5057/tDefense/core/tools/modifiers/weapons/modifierDaze.java +++ /dev/null @@ -1,97 +0,0 @@ -package lance5057.tDefense.core.tools.modifiers.weapons; - -import java.util.Arrays; -import java.util.List; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import tconstruct.library.tools.ToolCore; -import tconstruct.modifiers.tools.ItemModTypeFilter; - -public class modifierDaze extends ItemModTypeFilter -{ - String tooltipName; - int max = 5; - String guiType; - - public modifierDaze(String type, int effect, ItemStack[] items, int[] values) - { - super(effect, "Daze", items, values); - tooltipName = "\u00A76Daze"; - guiType = type; - } - - @Override - protected boolean canModify (ItemStack tool, ItemStack[] input) - { - if (tool.getItem() instanceof ToolCore) - { - List list = Arrays.asList(((ToolCore)tool.getItem()).getTraits()); - if (list.contains("weapon")) - { - NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - if (!tags.hasKey(key)) - return tags.getInteger("Modifiers") > 0 && matchingAmount(input) <= max; - - if (matchingAmount(input) > max) - return false; - - int keyPair[] = tags.getIntArray(key); - if (keyPair[0] + matchingAmount(input) <= keyPair[1]) - return true; - - else if (keyPair[0] == keyPair[1]) - return tags.getInteger("Modifiers") > 0; - } - } - - return false; - } - - @Override - public void modify (ItemStack[] input, ItemStack tool) - { - NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - int increase = matchingAmount(input); - if (tags.hasKey(key)) - { - int[] keyPair = tags.getIntArray(key); - - if (keyPair[0] % max == 0) - { - keyPair[0] += increase; - keyPair[1] += max; - tags.setIntArray(key, keyPair); - - int modifiers = tags.getInteger("Modifiers"); - modifiers -= 1; - tags.setInteger("Modifiers", modifiers); - } - else - { - keyPair[0] += increase; - tags.setIntArray(key, keyPair); - } - updateModTag(tool, keyPair); - - } - else - { - int modifiers = tags.getInteger("Modifiers"); - modifiers -= 1; - tags.setInteger("Modifiers", modifiers); - String modName = "\u00A76" + guiType + " (" + increase + "/" + max + ")"; - int tooltipIndex = addToolTip(tool, tooltipName, modName); - int[] keyPair = new int[] { increase, max, tooltipIndex }; - tags.setIntArray(key, keyPair); - } - } - - void updateModTag (ItemStack tool, int[] keys) - { - NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - String tip = "ModifierTip" + keys[2]; - String modName = "\u00A76" + guiType + " (" + keys[0] + "/" + keys[1] + ")"; - tags.setString(tip, modName); - } -} \ No newline at end of file diff --git a/src/main/java/lance5057/tDefense/core/tools/modifiers/weapons/modifierTorchArrow.java b/src/main/java/lance5057/tDefense/core/tools/modifiers/weapons/modifierTorchArrow.java deleted file mode 100644 index 09e6d50..0000000 --- a/src/main/java/lance5057/tDefense/core/tools/modifiers/weapons/modifierTorchArrow.java +++ /dev/null @@ -1,72 +0,0 @@ -package lance5057.tDefense.core.tools.modifiers.weapons; - -import java.util.Arrays; -import java.util.List; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import tconstruct.library.tools.ToolCore; -import tconstruct.modifiers.tools.ItemModTypeFilter; -import tconstruct.modifiers.tools.ModBoolean; - -public class modifierTorchArrow extends ModBoolean -{ - String tooltipName; - String guiType; - String color; - - public modifierTorchArrow(ItemStack[] items, int effect) - { - super(items, effect, "Torch", "\u00A76", "Torch"); - tooltipName = "\u00A76Daze"; - color = "\u00A76"; - //guiType = type; - } - - @Override - protected boolean canModify (ItemStack tool, ItemStack[] input) - { - if (tool.getItem() instanceof ToolCore) - { - List list = Arrays.asList(((ToolCore)tool.getItem()).getTraits()); - if (list.contains("ammo")) - { - ToolCore toolItem = (ToolCore) tool.getItem(); - if (!validType(toolItem)) - return false; - - NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - - return tags.getInteger("Modifiers") > 0 && !tags.getBoolean(key); - } - } - return false; - } - - @Override - public void modify (ItemStack[] input, ItemStack tool) - { - NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - tags.setBoolean(key, true); - - int modifiers = tags.getInteger("Modifiers"); - modifiers -= 1; - tags.setInteger("Modifiers", modifiers); - - int attack = tags.getInteger("Attack"); - attack -= 3; - if (attack < 0) - attack = 0; - tags.setInteger("Attack", attack); - - addToolTip(tool, color + tooltipName, color + key); - } - - void updateModTag (ItemStack tool, int[] keys) - { - NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - String tip = "ModifierTip" + keys[2]; - String modName = color + guiType + " (" + keys[0] + "/" + keys[1] + ")"; - tags.setString(tip, modName); - } -} \ No newline at end of file diff --git a/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/Container_FinishingAnvil.java b/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/Container_FinishingAnvil.java index 499e81b..3b775f2 100644 --- a/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/Container_FinishingAnvil.java +++ b/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/Container_FinishingAnvil.java @@ -11,23 +11,23 @@ public class Container_FinishingAnvil extends Container public Container_FinishingAnvil(InventoryPlayer inventoryPlayer, TileEntity_FinishingAnvil te) { addSlotToContainer(new Slot(te, 0, 48, 32)); - - for (int x = 0; x < 9; x++) + + for(int x = 0; x < 9; x++) { addSlotToContainer(new Slot(inventoryPlayer, x, 8 + 18 * x, 142)); } - - for (int y = 0; y < 3; y++) + + for(int y = 0; y < 3; y++) + { + for(int x = 0; x < 9; x++) { - for (int x = 0; x < 9; x++) - { - addSlotToContainer(new Slot(inventoryPlayer, x + y * 9 + 9, 8 + 18 * x, 84 + y * 18)); - } + addSlotToContainer(new Slot(inventoryPlayer, x + y * 9 + 9, 8 + 18 * x, 84 + y * 18)); } + } } - + @Override - public boolean canInteractWith(EntityPlayer p_75145_1_) + public boolean canInteractWith(EntityPlayer p_75145_1_) { return true; } diff --git a/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/FinishingAnvil.java b/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/FinishingAnvil.java index b3bf540..e12586a 100644 --- a/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/FinishingAnvil.java +++ b/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/FinishingAnvil.java @@ -22,127 +22,139 @@ import net.minecraft.world.World; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class FinishingAnvil extends BlockContainer { - public FinishingAnvil() { - super(Material.iron); - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - } - - @Override - public void onBlockAdded(World world, int i, int j, int k) - { - super.onBlockAdded(world, i, j, k); - world.markBlockForUpdate(i, j, k); - } - - @Override - public boolean onBlockActivated(World world, int x, int y, int z, - EntityPlayer player, int metadata, float what, float these, float are) { - TileEntity tileEntity = world.getTileEntity(x, y, z); - if (tileEntity == null || player.isSneaking()) { - return false; - } - //code to open gui explained later - player.openGui(TinkersDefense.instance, TinkersDefense.GUI_ANVIL_INV, player.worldObj, x, y, z); - return true; - } - - @Override - public void breakBlock(World world, int x, int y, int z, Block par5, int par6) { - dropItems(world, x, y, z); - super.breakBlock(world, x, y, z, par5, par6); - } - - private void dropItems(World world, int x, int y, int z){ - Random rand = new Random(); - - TileEntity tileEntity = world.getTileEntity(x, y, z); - if (!(tileEntity instanceof IInventory)) { - return; - } - IInventory inventory = (IInventory) tileEntity; - - for (int i = 0; i < inventory.getSizeInventory(); i++) { - ItemStack item = inventory.getStackInSlot(i); - - if (item != null && item.stackSize > 0) { - float rx = rand.nextFloat() * 0.8F + 0.1F; - float ry = rand.nextFloat() * 0.8F + 0.1F; - float rz = rand.nextFloat() * 0.8F + 0.1F; - - EntityItem entityItem = new EntityItem(world, - x + rx, y + ry, z + rz, - new ItemStack(item.getItem(), item.stackSize, item.getItemDamage())); - - if (item.hasTagCompound()) { - entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy()); - } - - float factor = 0.05F; - entityItem.motionX = rand.nextGaussian() * factor; - entityItem.motionY = rand.nextGaussian() * factor + 0.2F; - entityItem.motionZ = rand.nextGaussian() * factor; - world.spawnEntityInWorld(entityItem); - item.stackSize = 0; - } - } -} +public class FinishingAnvil extends BlockContainer +{ + public FinishingAnvil() + { + super(Material.iron); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } - //You don't want the normal render type, or it wont render properly. - @Override - public int getRenderType() { - return -1; - } - - //It's not an opaque cube, so you need this. - @Override - public boolean isOpaqueCube() { - return false; - } - - //It's not a normal block, so you need this too. - public boolean renderAsNormalBlock() { - return false; - } - - //This is the icon to use for showing the block in your hand. - @SideOnly(Side.CLIENT) - @Override - public void registerBlockIcons(IIconRegister icon) { - this.blockIcon = icon.registerIcon("tinkersdefense:WIP"); - } + @Override + public void onBlockAdded(World world, int i, int j, int k) + { + super.onBlockAdded(world, i, j, k); + world.markBlockForUpdate(i, j, k); + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int metadata, float what, float these, float are) + { + TileEntity tileEntity = world.getTileEntity(x, y, z); + if(tileEntity == null || player.isSneaking()) + { + return false; + } + //code to open gui explained later + player.openGui(TinkersDefense.instance, TinkersDefense.GUI_ANVIL_INV, player.worldObj, x, y, z); + return true; + } @Override - public TileEntity createNewTileEntity(World w, int md) { + public void breakBlock(World world, int x, int y, int z, Block par5, int par6) + { + dropItems(world, x, y, z); + super.breakBlock(world, x, y, z, par5, par6); + } + + private void dropItems(World world, int x, int y, int z) + { + Random rand = new Random(); + + TileEntity tileEntity = world.getTileEntity(x, y, z); + if(!(tileEntity instanceof IInventory)) + { + return; + } + IInventory inventory = (IInventory) tileEntity; + + for(int i = 0; i < inventory.getSizeInventory(); i++) + { + ItemStack item = inventory.getStackInSlot(i); + + if(item != null && item.stackSize > 0) + { + float rx = rand.nextFloat() * 0.8F + 0.1F; + float ry = rand.nextFloat() * 0.8F + 0.1F; + float rz = rand.nextFloat() * 0.8F + 0.1F; + + EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, new ItemStack(item.getItem(), item.stackSize, item.getItemDamage())); + + if(item.hasTagCompound()) + { + entityItem.getEntityItem().setTagCompound((NBTTagCompound) item.getTagCompound().copy()); + } + + float factor = 0.05F; + entityItem.motionX = rand.nextGaussian() * factor; + entityItem.motionY = rand.nextGaussian() * factor + 0.2F; + entityItem.motionZ = rand.nextGaussian() * factor; + world.spawnEntityInWorld(entityItem); + item.stackSize = 0; + } + } + } + + //You don't want the normal render type, or it wont render properly. + @Override + public int getRenderType() + { + return -1; + } + + //It's not an opaque cube, so you need this. + @Override + public boolean isOpaqueCube() + { + return false; + } + + //It's not a normal block, so you need this too. + public boolean renderAsNormalBlock() + { + return false; + } + + //This is the icon to use for showing the block in your hand. + @SideOnly(Side.CLIENT) + @Override + public void registerBlockIcons(IIconRegister icon) + { + this.blockIcon = icon.registerIcon("tinkersdefense:WIP"); + } + + @Override + public TileEntity createNewTileEntity(World w, int md) + { TileEntity_FinishingAnvil te = new TileEntity_FinishingAnvil(); - return te; + return te; } - + @Override - public int onBlockPlaced(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_) - { - int j1 = p_149660_9_; - - if ((p_149660_9_ == 0 || p_149660_5_ == 2) && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH)) - { - j1 = 1; - } - - if ((j1 == 0 || p_149660_5_ == 3) && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH)) - { - j1 = 2; - } - - if ((j1 == 0 || p_149660_5_ == 4) && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST)) - { - j1 = 3; - } - - if ((j1 == 0 || p_149660_5_ == 5) && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST)) - { - j1 = 4; - } - - return j1; - } + public int onBlockPlaced(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_) + { + int j1 = p_149660_9_; + + if((p_149660_9_ == 0 || p_149660_5_ == 2) && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH)) + { + j1 = 1; + } + + if((j1 == 0 || p_149660_5_ == 3) && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH)) + { + j1 = 2; + } + + if((j1 == 0 || p_149660_5_ == 4) && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST)) + { + j1 = 3; + } + + if((j1 == 0 || p_149660_5_ == 5) && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST)) + { + j1 = 4; + } + + return j1; + } } diff --git a/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/Gui_FinishingAnvil.java b/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/Gui_FinishingAnvil.java index e36aab8..a4167bb 100644 --- a/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/Gui_FinishingAnvil.java +++ b/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/Gui_FinishingAnvil.java @@ -17,41 +17,41 @@ import tconstruct.library.tools.ToolCore; public class Gui_FinishingAnvil extends GuiContainer { - private float xSize_lo; - private float ySize_lo; - - private ItemStack bigCopy; - private Boolean isNull = true; - private ItemStack editItem; - private RenderItem bigRender = new RenderItem_FinishingAnvil(this); - - public final TileEntity_FinishingAnvil inventory; - private ResourceLocation forGui; - - private int leftButtonPosX = 0; - private int leftButtonPosY = 0; - private int xLIcon_one, yLIcon_one; - private int xLIcon_two, yLIcon_two; - private int xLIcon_three, yLIcon_three; - private int leftSelect = 0; - - private int rightButtonPosX = 0; - private int rightButtonPosY = 2; - private int xRIcon_one, yRIcon_one; - private int xRIcon_two, yRIcon_two; - private int xRIcon_three, yRIcon_three; - - String[] renders; - - NBTTagCompound tags; - - private static final ResourceLocation iconLocation = new ResourceLocation("tinkersdefense", "textures/gui/finishinganvil.png"); + private float xSize_lo; + private float ySize_lo; + + private ItemStack bigCopy; + private Boolean isNull = true; + private ItemStack editItem; + private RenderItem bigRender = new RenderItem_FinishingAnvil(this); + + public final TileEntity_FinishingAnvil inventory; + private ResourceLocation forGui; + + private int leftButtonPosX = 0; + private int leftButtonPosY = 0; + private int xLIcon_one, yLIcon_one; + private int xLIcon_two, yLIcon_two; + private int xLIcon_three, yLIcon_three; + private int leftSelect = 0; + + private int rightButtonPosX = 0; + private int rightButtonPosY = 2; + private int xRIcon_one, yRIcon_one; + private int xRIcon_two, yRIcon_two; + private int xRIcon_three, yRIcon_three; + + String[] renders; + + NBTTagCompound tags; + + private static final ResourceLocation iconLocation = new ResourceLocation("tinkersdefense", "textures/gui/finishinganvil.png"); public Gui_FinishingAnvil(InventoryPlayer invPlayer, TileEntity_FinishingAnvil te) { super(new Container_FinishingAnvil(invPlayer, te)); this.inventory = te; - + renders = new String[4]; renders[0] = "Head"; renders[1] = "Accessory"; @@ -63,20 +63,20 @@ public class Gui_FinishingAnvil extends GuiContainer public void initGui() { super.initGui(); - this.buttonList.add(new GuiButton(1 ,this.guiLeft+25, this.guiTop+10, 10, 10,"")); - this.buttonList.add(new GuiButton(2 ,this.guiLeft+25, this.guiTop+59, 10, 10,"")); - this.buttonList.add(new GuiButton(3 ,this.guiLeft+47, this.guiTop+49, 18, 18,"")); - - this.buttonList.add(new GuiButton(4 ,this.guiLeft+5, this.guiTop+10, 20, 20,"")); - this.buttonList.add(new GuiButton(5 ,this.guiLeft+5, this.guiTop+30, 20, 20,"")); - this.buttonList.add(new GuiButton(6 ,this.guiLeft+5, this.guiTop+50, 20, 20,"")); - - this.buttonList.add(new GuiButton(7 ,this.guiLeft+120, this.guiTop+10, 10, 10,"")); - this.buttonList.add(new GuiButton(8 ,this.guiLeft+120, this.guiTop+59, 10, 10,"")); - - this.buttonList.add(new GuiButton(9 ,this.guiLeft+130, this.guiTop+10, 20, 20,"")); - this.buttonList.add(new GuiButton(10 ,this.guiLeft+130, this.guiTop+30, 20, 20,"")); - this.buttonList.add(new GuiButton(11 ,this.guiLeft+130, this.guiTop+50, 20, 20,"")); + this.buttonList.add(new GuiButton(1, this.guiLeft + 25, this.guiTop + 10, 10, 10, "")); + this.buttonList.add(new GuiButton(2, this.guiLeft + 25, this.guiTop + 59, 10, 10, "")); + this.buttonList.add(new GuiButton(3, this.guiLeft + 47, this.guiTop + 49, 18, 18, "")); + + this.buttonList.add(new GuiButton(4, this.guiLeft + 5, this.guiTop + 10, 20, 20, "")); + this.buttonList.add(new GuiButton(5, this.guiLeft + 5, this.guiTop + 30, 20, 20, "")); + this.buttonList.add(new GuiButton(6, this.guiLeft + 5, this.guiTop + 50, 20, 20, "")); + + this.buttonList.add(new GuiButton(7, this.guiLeft + 120, this.guiTop + 10, 10, 10, "")); + this.buttonList.add(new GuiButton(8, this.guiLeft + 120, this.guiTop + 59, 10, 10, "")); + + this.buttonList.add(new GuiButton(9, this.guiLeft + 130, this.guiTop + 10, 20, 20, "")); + this.buttonList.add(new GuiButton(10, this.guiLeft + 130, this.guiTop + 30, 20, 20, "")); + this.buttonList.add(new GuiButton(11, this.guiLeft + 130, this.guiTop + 50, 20, 20, "")); } @@ -84,91 +84,111 @@ public class Gui_FinishingAnvil extends GuiContainer protected void actionPerformed(GuiButton button) { if(tags != null) - switch(button.id) - { - case 1: if(this.leftButtonPosX > 0) this.leftButtonPosX--; break; - case 2: if(this.leftButtonPosX+2 < ((ToolCore)bigCopy.getItem()).getPartAmount()) this.leftButtonPosX++; break; - - case 3: - TinkersDefense.INSTANCE.sendToServer(new Message_FinishingAnvil(inventory.xCoord, inventory.yCoord, inventory.zCoord, this.bigCopy)); - break; - - case 4: leftSelect = 0; rightButtonPosY = 2; break; - case 5: leftSelect = 1; rightButtonPosY = 3; break; - case 6: leftSelect = 2; rightButtonPosY = 4; break; - - case 7: if(this.rightButtonPosX > 0) this.rightButtonPosX--; break; - case 8: this.rightButtonPosX++; break; - - case 9: - if(tags.hasKey("Render"+renders[leftSelect])) + switch(button.id) { - tags.setInteger("Render"+renders[leftSelect], bigCopy.getTagCompound().getCompoundTag("InfiTool").getInteger(renders[leftSelect]) + ((rightButtonPosX) * TinkersDefense.config.MaterialIndex)); - if(rightButtonPosX > 0) - tags.setInteger(renders[leftSelect]+"Color", TConstructRegistry.getMaterial(tags.getInteger(renders[leftSelect])).primaryColor()); - else - tags.removeTag(renders[leftSelect]+"Color"); - } - break; - - case 10: - if(tags.hasKey("Render"+renders[leftSelect])) - { - tags.setInteger("Render"+renders[leftSelect], bigCopy.getTagCompound().getCompoundTag("InfiTool").getInteger(renders[leftSelect]) + ((rightButtonPosX + 1) * TinkersDefense.config.MaterialIndex)); - tags.setInteger(renders[leftSelect]+"Color", TConstructRegistry.getMaterial(tags.getInteger(renders[leftSelect])).primaryColor()); - } - break; - - case 11: - if(tags.hasKey("Render"+renders[leftSelect])) - { - tags.setInteger("Render"+renders[leftSelect], bigCopy.getTagCompound().getCompoundTag("InfiTool").getInteger(renders[leftSelect]) + ((rightButtonPosX + 2) * TinkersDefense.config.MaterialIndex)); - tags.setInteger(renders[leftSelect]+"Color", TConstructRegistry.getMaterial(tags.getInteger(renders[leftSelect])).primaryColor()); + case 1: + if(this.leftButtonPosX > 0) + this.leftButtonPosX--; + break; + case 2: + if(this.leftButtonPosX + 2 < ((ToolCore) bigCopy.getItem()).getPartAmount()) + this.leftButtonPosX++; + break; + + case 3: + TinkersDefense.INSTANCE.sendToServer(new Message_FinishingAnvil(inventory.xCoord, inventory.yCoord, inventory.zCoord, this.bigCopy)); + break; + + case 4: + leftSelect = 0; + rightButtonPosY = 2; + break; + case 5: + leftSelect = 1; + rightButtonPosY = 3; + break; + case 6: + leftSelect = 2; + rightButtonPosY = 4; + break; + + case 7: + if(this.rightButtonPosX > 0) + this.rightButtonPosX--; + break; + case 8: + this.rightButtonPosX++; + break; + + case 9: + if(tags.hasKey("Render" + renders[leftSelect])) + { + tags.setInteger("Render" + renders[leftSelect], bigCopy.getTagCompound().getCompoundTag("InfiTool").getInteger(renders[leftSelect]) + ((rightButtonPosX) * TinkersDefense.config.MaterialIndex)); + if(rightButtonPosX > 0) + tags.setInteger(renders[leftSelect] + "Color", TConstructRegistry.getMaterial(tags.getInteger(renders[leftSelect])).primaryColor()); + else + tags.removeTag(renders[leftSelect] + "Color"); + } + break; + + case 10: + if(tags.hasKey("Render" + renders[leftSelect])) + { + tags.setInteger("Render" + renders[leftSelect], bigCopy.getTagCompound().getCompoundTag("InfiTool").getInteger(renders[leftSelect]) + ((rightButtonPosX + 1) * TinkersDefense.config.MaterialIndex)); + tags.setInteger(renders[leftSelect] + "Color", TConstructRegistry.getMaterial(tags.getInteger(renders[leftSelect])).primaryColor()); + } + break; + + case 11: + if(tags.hasKey("Render" + renders[leftSelect])) + { + tags.setInteger("Render" + renders[leftSelect], bigCopy.getTagCompound().getCompoundTag("InfiTool").getInteger(renders[leftSelect]) + ((rightButtonPosX + 2) * TinkersDefense.config.MaterialIndex)); + tags.setInteger(renders[leftSelect] + "Color", TConstructRegistry.getMaterial(tags.getInteger(renders[leftSelect])).primaryColor()); + } + break; } - break; - } } + public void drawScreen(int par1, int par2, float par3) { - - + if(inventory.getStackInSlot(0) != null && isNull == true - /*inventory.getStackInSlot(0).getItem() != this.bigCopy*/) + /*inventory.getStackInSlot(0).getItem() != this.bigCopy*/) { - this.bigCopy = inventory.getStackInSlot(0).copy(); - if(bigCopy.hasTagCompound() && bigCopy.getTagCompound().hasKey("InfiTool")) - tags = bigCopy.getTagCompound().getCompoundTag("InfiTool"); - isNull = false; + this.bigCopy = inventory.getStackInSlot(0).copy(); + if(bigCopy.hasTagCompound() && bigCopy.getTagCompound().hasKey("InfiTool")) + tags = bigCopy.getTagCompound().getCompoundTag("InfiTool"); + isNull = false; } else if(inventory.getStackInSlot(0) == null) { this.bigCopy = null; isNull = true; } - + super.drawScreen(par1, par2, par3); - this.xSize_lo = (float)par1; - this.ySize_lo = (float)par2; + this.xSize_lo = (float) par1; + this.ySize_lo = (float) par2; } protected void drawGuiContainerForegroundLayer(int par1, int par2) { this.forGui = new ResourceLocation("tinkersdefense", "textures/gui/finishinganvil.png"); - + this.xLIcon_one = 0; this.yLIcon_one = 176; this.xLIcon_two = 0; this.yLIcon_two = 176; this.xLIcon_three = 0; this.yLIcon_three = 176; - + this.xRIcon_one = 0; this.yRIcon_one = 176; this.xRIcon_two = 0; this.yRIcon_two = 176; this.xRIcon_three = 0; this.yRIcon_three = 176; - + if(inventory.getStackInSlot(0) != null) { editItem = inventory.getStackInSlot(0); @@ -176,16 +196,16 @@ public class Gui_FinishingAnvil extends GuiContainer { //this.drawTexturedModelRectFromIcon(this.guiLeft+4, this.guiTop+14, // ((ToolCore)this.inventorySlots.inventorySlots.get(0)).getHeadItem(), 16, 16); - + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.forGui = new ResourceLocation("tinkersdefense","textures/gui/"+((ToolCore)editItem.getItem()).getDefaultFolder()+".png"); + this.forGui = new ResourceLocation("tinkersdefense", "textures/gui/" + ((ToolCore) editItem.getItem()).getDefaultFolder() + ".png"); this.xLIcon_one = 32; this.yLIcon_one = 0; this.xLIcon_two = 48; this.yLIcon_two = 0; this.xLIcon_three = 64; this.yLIcon_three = 0; - + this.xRIcon_one = 0; this.yRIcon_one = 0; this.xRIcon_two = 16; @@ -194,34 +214,34 @@ public class Gui_FinishingAnvil extends GuiContainer this.yRIcon_three = 0; } } - + this.mc.getTextureManager().bindTexture(this.forGui); if(inventory.getStackInSlot(0) != null) - this.drawTexturedModalRect(7,12 + (leftSelect * 20),16,0,16,16); - - this.drawTexturedModalRect(7,12,this.xLIcon_one+(this.leftButtonPosX*16),this.yLIcon_one+(this.leftButtonPosY*16),16,16); - this.drawTexturedModalRect(7,32,this.xLIcon_two+(this.leftButtonPosX*16),this.yLIcon_two+(this.leftButtonPosY*16),16,16); - this.drawTexturedModalRect(7,52,this.xLIcon_three+(this.leftButtonPosX*16),this.yLIcon_three+(this.leftButtonPosY*16),16,16); - - this.drawTexturedModalRect(132,12,this.xRIcon_one+(this.rightButtonPosX*16),this.yRIcon_one+(this.rightButtonPosY*16),16,16); - this.drawTexturedModalRect(132,32,this.xRIcon_two+(this.rightButtonPosX*16),this.yRIcon_two+(this.rightButtonPosY*16),16,16); - this.drawTexturedModalRect(132,52,this.xRIcon_three+(this.rightButtonPosX*16),this.yRIcon_three+(this.rightButtonPosY*16),16,16); - + this.drawTexturedModalRect(7, 12 + (leftSelect * 20), 16, 0, 16, 16); + + this.drawTexturedModalRect(7, 12, this.xLIcon_one + (this.leftButtonPosX * 16), this.yLIcon_one + (this.leftButtonPosY * 16), 16, 16); + this.drawTexturedModalRect(7, 32, this.xLIcon_two + (this.leftButtonPosX * 16), this.yLIcon_two + (this.leftButtonPosY * 16), 16, 16); + this.drawTexturedModalRect(7, 52, this.xLIcon_three + (this.leftButtonPosX * 16), this.yLIcon_three + (this.leftButtonPosY * 16), 16, 16); + + this.drawTexturedModalRect(132, 12, this.xRIcon_one + (this.rightButtonPosX * 16), this.yRIcon_one + (this.rightButtonPosY * 16), 16, 16); + this.drawTexturedModalRect(132, 32, this.xRIcon_two + (this.rightButtonPosX * 16), this.yRIcon_two + (this.rightButtonPosY * 16), 16, 16); + this.drawTexturedModalRect(132, 52, this.xRIcon_three + (this.rightButtonPosX * 16), this.yRIcon_three + (this.rightButtonPosY * 16), 16, 16); + bigRender.renderItemAndEffectIntoGUI(fontRendererObj, this.mc.getTextureManager(), bigCopy, 23, 5); } protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(iconLocation); - int k = ((this.width - this.xSize) / 2); - int l = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(k, l, 0, 0, this.xSize+80, this.ySize); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(iconLocation); + int k = ((this.width - this.xSize) / 2); + int l = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(k, l, 0, 0, this.xSize + 80, this.ySize); } - + protected void injectIcons() { - + } } diff --git a/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/ModelFinishingAnvil.java b/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/ModelFinishingAnvil.java index b261efc..cf7253a 100644 --- a/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/ModelFinishingAnvil.java +++ b/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/ModelFinishingAnvil.java @@ -8,54 +8,58 @@ import net.minecraft.entity.Entity; * Armor Anvil - lance5057 * Created using Tabula 4.1.1 */ -public class ModelFinishingAnvil extends ModelBase { - public ModelRenderer Log; - public ModelRenderer HammerHead; - public ModelRenderer HammerHandle; - public ModelRenderer AnvilBase; - public ModelRenderer AnvilStem; - public ModelRenderer AnvilTop; +public class ModelFinishingAnvil extends ModelBase +{ + public ModelRenderer Log; + public ModelRenderer HammerHead; + public ModelRenderer HammerHandle; + public ModelRenderer AnvilBase; + public ModelRenderer AnvilStem; + public ModelRenderer AnvilTop; - public ModelFinishingAnvil() { - this.textureWidth = 64; - this.textureHeight = 64; - this.AnvilTop = new ModelRenderer(this, 0, 22); - this.AnvilTop.setRotationPoint(-4.0F, 6.0F, -6.0F); - this.AnvilTop.addBox(0.0F, 0.0F, 0.0F, 8, 6, 12, 0.0F); - this.HammerHead = new ModelRenderer(this, 15, 21); - this.HammerHead.setRotationPoint(-1.3F, 4.0F, 0.0F); - this.HammerHead.addBox(0.0F, 0.0F, 0.0F, 3, 2, 2, 0.0F); - this.setRotateAngle(HammerHead, 0.091106186954104F, -0.5462880558742251F, 0.0F); - this.AnvilStem = new ModelRenderer(this, 10, 32); - this.AnvilStem.setRotationPoint(-2.0F, 12.0F, -3.0F); - this.AnvilStem.addBox(0.0F, 0.0F, 0.0F, 4, 2, 6, 0.0F); - this.HammerHandle = new ModelRenderer(this, 17, 47); - this.HammerHandle.setRotationPoint(1.0F, 0.5F, -6.0F); - this.HammerHandle.addBox(0.0F, 0.0F, 0.0F, 1, 1, 6, 0.0F); - this.AnvilBase = new ModelRenderer(this, 2, 28); - this.AnvilBase.setRotationPoint(-4.0F, 14.0F, -5.0F); - this.AnvilBase.addBox(0.0F, 0.0F, 0.0F, 8, 2, 10, 0.0F); - this.Log = new ModelRenderer(this, 0, 40); - this.Log.setRotationPoint(-8.0F, 16.0F, -8.0F); - this.Log.addBox(0.0F, 0.0F, 0.0F, 16, 8, 16, 0.0F); - this.HammerHead.addChild(this.HammerHandle); - } + public ModelFinishingAnvil() + { + this.textureWidth = 64; + this.textureHeight = 64; + this.AnvilTop = new ModelRenderer(this, 0, 22); + this.AnvilTop.setRotationPoint(-4.0F, 6.0F, -6.0F); + this.AnvilTop.addBox(0.0F, 0.0F, 0.0F, 8, 6, 12, 0.0F); + this.HammerHead = new ModelRenderer(this, 15, 21); + this.HammerHead.setRotationPoint(-1.3F, 4.0F, 0.0F); + this.HammerHead.addBox(0.0F, 0.0F, 0.0F, 3, 2, 2, 0.0F); + this.setRotateAngle(HammerHead, 0.091106186954104F, -0.5462880558742251F, 0.0F); + this.AnvilStem = new ModelRenderer(this, 10, 32); + this.AnvilStem.setRotationPoint(-2.0F, 12.0F, -3.0F); + this.AnvilStem.addBox(0.0F, 0.0F, 0.0F, 4, 2, 6, 0.0F); + this.HammerHandle = new ModelRenderer(this, 17, 47); + this.HammerHandle.setRotationPoint(1.0F, 0.5F, -6.0F); + this.HammerHandle.addBox(0.0F, 0.0F, 0.0F, 1, 1, 6, 0.0F); + this.AnvilBase = new ModelRenderer(this, 2, 28); + this.AnvilBase.setRotationPoint(-4.0F, 14.0F, -5.0F); + this.AnvilBase.addBox(0.0F, 0.0F, 0.0F, 8, 2, 10, 0.0F); + this.Log = new ModelRenderer(this, 0, 40); + this.Log.setRotationPoint(-8.0F, 16.0F, -8.0F); + this.Log.addBox(0.0F, 0.0F, 0.0F, 16, 8, 16, 0.0F); + this.HammerHead.addChild(this.HammerHandle); + } - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { - this.AnvilTop.render(f5); - this.HammerHead.render(f5); - this.AnvilStem.render(f5); - this.AnvilBase.render(f5); - this.Log.render(f5); - } + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + this.AnvilTop.render(f5); + this.HammerHead.render(f5); + this.AnvilStem.render(f5); + this.AnvilBase.render(f5); + this.Log.render(f5); + } - /** - * This is a helper function from Tabula to set the rotation of model parts - */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } + /** + * This is a helper function from Tabula to set the rotation of model parts + */ + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) + { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } } diff --git a/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/RenderItem_FinishingAnvil.java b/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/RenderItem_FinishingAnvil.java index 8fc450b..0515740 100644 --- a/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/RenderItem_FinishingAnvil.java +++ b/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/RenderItem_FinishingAnvil.java @@ -11,33 +11,34 @@ import org.lwjgl.opengl.GL11; public class RenderItem_FinishingAnvil extends RenderItem { - private Gui_FinishingAnvil anvilGui; + private Gui_FinishingAnvil anvilGui; + RenderItem_FinishingAnvil(Gui_FinishingAnvil gui) { super(); anvilGui = gui; } - - @Override - public void renderItemAndEffectIntoGUI(FontRenderer fontRenderer, TextureManager textureManager, ItemStack itemStack, int x, int y) - { - if (itemStack == null) - { - return; - } - - RenderHelper.enableGUIStandardItemLighting(); - - Slot slot = anvilGui.inventorySlots.getSlotFromInventory(anvilGui.inventory, 0); - - if(slot.getStack() != null) - { - GL11.glPushMatrix(); - - GL11.glScalef(3.0f,3.0f,1.0f); - super.renderItemAndEffectIntoGUI(fontRenderer, textureManager, itemStack, x, y); - - GL11.glPopMatrix(); - } - } + + @Override + public void renderItemAndEffectIntoGUI(FontRenderer fontRenderer, TextureManager textureManager, ItemStack itemStack, int x, int y) + { + if(itemStack == null) + { + return; + } + + RenderHelper.enableGUIStandardItemLighting(); + + Slot slot = anvilGui.inventorySlots.getSlotFromInventory(anvilGui.inventory, 0); + + if(slot.getStack() != null) + { + GL11.glPushMatrix(); + + GL11.glScalef(3.0f, 3.0f, 1.0f); + super.renderItemAndEffectIntoGUI(fontRenderer, textureManager, itemStack, x, y); + + GL11.glPopMatrix(); + } + } } diff --git a/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/Renderer_FinishingAnvil.java b/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/Renderer_FinishingAnvil.java index 06ac9ed..db95e9f 100644 --- a/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/Renderer_FinishingAnvil.java +++ b/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/Renderer_FinishingAnvil.java @@ -10,34 +10,35 @@ import org.lwjgl.opengl.GL11; public class Renderer_FinishingAnvil extends TileEntitySpecialRenderer { - private final ModelFinishingAnvil model; - - public Renderer_FinishingAnvil() { - this.model = new ModelFinishingAnvil(); -} - + private final ModelFinishingAnvil model; + + public Renderer_FinishingAnvil() + { + this.model = new ModelFinishingAnvil(); + } + @Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) { GL11.glPushMatrix(); - - GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); - - ResourceLocation textures = (new ResourceLocation("tinkersdefense:textures/blocks/ArmorAnvil.png")); - - Minecraft.getMinecraft().renderEngine.bindTexture(textures); - - GL11.glPushMatrix(); - - int meta = te.getBlockMetadata(); - - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - - this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); - GL11.glPopMatrix(); - GL11.glPopMatrix(); - + + GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); + + ResourceLocation textures = (new ResourceLocation("tinkersdefense:textures/blocks/ArmorAnvil.png")); + + Minecraft.getMinecraft().renderEngine.bindTexture(textures); + + GL11.glPushMatrix(); + + int meta = te.getBlockMetadata(); + + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + + this.model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); + GL11.glPopMatrix(); + GL11.glPopMatrix(); + } } diff --git a/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/TileEntity_FinishingAnvil.java b/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/TileEntity_FinishingAnvil.java index 7148e03..3e68d51 100644 --- a/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/TileEntity_FinishingAnvil.java +++ b/src/main/java/lance5057/tDefense/finishingAnvil/blocks/finishingAnvil/TileEntity_FinishingAnvil.java @@ -13,55 +13,60 @@ import net.minecraftforge.common.util.Constants; public class TileEntity_FinishingAnvil extends TileEntity implements IInventory { - public static int invSize = 1; - public ItemStack[] inventory; - - private final String name = "Anvil Inventory"; - + public static int invSize = 1; + public ItemStack[] inventory; + + private final String name = "Anvil Inventory"; + public TileEntity_FinishingAnvil() { super(); inventory = new ItemStack[invSize]; } - + @Override public void updateEntity() { super.updateEntity(); } - + @Override - public Packet getDescriptionPacket() { - NBTTagCompound tag = new NBTTagCompound(); - writeToNBT(tag); - return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, tag); + public Packet getDescriptionPacket() + { + NBTTagCompound tag = new NBTTagCompound(); + writeToNBT(tag); + return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, tag); } - + @Override - public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { - readFromNBT(pkt.func_148857_g()); + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) + { + readFromNBT(pkt.func_148857_g()); } - + @Override - public int getSizeInventory() { + public int getSizeInventory() + { return invSize; } @Override - public ItemStack getStackInSlot(int slot) { + public ItemStack getStackInSlot(int slot) + { return inventory[slot]; } @Override - public ItemStack decrStackSize(int slot, int amount) { + public ItemStack decrStackSize(int slot, int amount) + { ItemStack stack = getStackInSlot(slot); - if (stack != null) + if(stack != null) { - if (stack.stackSize > amount) + if(stack.stackSize > amount) { stack = stack.splitStack(amount); - - if (stack.stackSize == 0) + + if(stack.stackSize == 0) { setInventorySlotContents(slot, null); } @@ -70,17 +75,18 @@ public class TileEntity_FinishingAnvil extends TileEntity implements IInventory { setInventorySlotContents(slot, null); } - + this.markDirty(); } return stack; } @Override - public ItemStack getStackInSlotOnClosing(int slot) { + public ItemStack getStackInSlotOnClosing(int slot) + { ItemStack stack = getStackInSlot(slot); - - if (stack != null) + + if(stack != null) { setInventorySlotContents(slot, stack); } @@ -88,82 +94,95 @@ public class TileEntity_FinishingAnvil extends TileEntity implements IInventory } @Override - public void setInventorySlotContents(int slot, ItemStack itemstack) { + public void setInventorySlotContents(int slot, ItemStack itemstack) + { this.inventory[slot] = itemstack; - if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) + if(itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) { - itemstack.stackSize = this.getInventoryStackLimit(); + itemstack.stackSize = this.getInventoryStackLimit(); } - this.markDirty(); + this.markDirty(); } @Override - public String getInventoryName() { + public String getInventoryName() + { return name; } @Override - public boolean hasCustomInventoryName() { + public boolean hasCustomInventoryName() + { return name.length() > 0; } @Override - public int getInventoryStackLimit() { + public int getInventoryStackLimit() + { return 1; } @Override - public boolean isUseableByPlayer(EntityPlayer p_70300_1_) { + public boolean isUseableByPlayer(EntityPlayer p_70300_1_) + { return true; } @Override - public void openInventory() { - + public void openInventory() + { + } @Override - public void closeInventory() { - + public void closeInventory() + { + } @Override - public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) { + public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) + { return true; } - + @Override public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); - writeInventoryToNBT(compound); + writeInventoryToNBT(compound); } - + @Override - public void readFromNBT(NBTTagCompound compound) - { + public void readFromNBT(NBTTagCompound compound) + { super.readFromNBT(compound); - readInventoryFromNBT(compound); - } - - public void readInventoryFromNBT(NBTTagCompound tags) { + readInventoryFromNBT(compound); + } + + public void readInventoryFromNBT(NBTTagCompound tags) + { NBTTagList nbttaglist = tags.getTagList("Items", Constants.NBT.TAG_COMPOUND); - for (int iter = 0; iter < nbttaglist.tagCount(); iter++) { + for(int iter = 0; iter < nbttaglist.tagCount(); iter++) + { NBTTagCompound tagList = (NBTTagCompound) nbttaglist.getCompoundTagAt(iter); byte slotID = tagList.getByte("Slot"); - if (slotID >= 0 && slotID < inventory.length) { + if(slotID >= 0 && slotID < inventory.length) + { inventory[slotID] = ItemStack.loadItemStackFromNBT(tagList); } } } - -public void writeInventoryToNBT(NBTTagCompound tags) { + public void writeInventoryToNBT(NBTTagCompound tags) + { NBTTagList nbttaglist = new NBTTagList(); - for (int iter = 0; iter < inventory.length; iter++) { - if (inventory[iter] != null) { + for(int iter = 0; iter < inventory.length; iter++) + { + if(inventory[iter] != null) + { NBTTagCompound tagList = new NBTTagCompound(); tagList.setByte("Slot", (byte) iter); inventory[iter].writeToNBT(tagList); diff --git a/src/main/java/lance5057/tDefense/finishingAnvil/utilities/Injector.java b/src/main/java/lance5057/tDefense/finishingAnvil/utilities/Injector.java index 61a4393..da9b672 100644 --- a/src/main/java/lance5057/tDefense/finishingAnvil/utilities/Injector.java +++ b/src/main/java/lance5057/tDefense/finishingAnvil/utilities/Injector.java @@ -16,27 +16,27 @@ import tconstruct.library.tools.ToolCore; public class Injector extends ToolCore { - ToolCore tool; - - InjectorLocations injectLoc; - - List heads= new ArrayList(); - List accessorys= new ArrayList(); - List handles = new ArrayList(); - List extras = new ArrayList(); - - public Injector(int baseDamage, ToolCore tool, InjectorLocations injLoc) + ToolCore tool; + + InjectorLocations injectLoc; + + List heads = new ArrayList(); + List accessorys = new ArrayList(); + List handles = new ArrayList(); + List extras = new ArrayList(); + + public Injector(int baseDamage, ToolCore tool, InjectorLocations injLoc) { super(0); this.tool = tool; - + injectLoc = injLoc; - - List temp = injectLoc.getList(tool.getUnlocalizedName().substring(tool.getUnlocalizedName().lastIndexOf('.')+1, tool.getUnlocalizedName().length())); - + + List temp = injectLoc.getList(tool.getUnlocalizedName().substring(tool.getUnlocalizedName().lastIndexOf('.') + 1, tool.getUnlocalizedName().length())); + if(!temp.isEmpty()) { - for(int i = 0; i entry : pb.materialSets.entrySet()) { String icon = "tinkersdefense:"; - icon += tool.getDefaultFolder() + "/" + entry.getKey().toLowerCase() + "/" + heads.get(i); - //toolIcons[i] = icon; - headStrings.put(entry.getValue().materialID+(TinkersDefense.config.MaterialIndex*(i+1)), icon); + icon += tool.getDefaultFolder() + "/" + entry.getKey().toLowerCase() + "/" + heads.get(i); + //toolIcons[i] = icon; + headStrings.put(entry.getValue().materialID + (TinkersDefense.config.MaterialIndex * (i + 1)), icon); } - + addIcons(tool.headStrings, headIcons, iconRegister, heads.get(i), false); - - for(int j = (i+1)*TinkersDefense.config.MaterialIndex; j entry : pb.materialSets.entrySet()) { String icon = "tinkersdefense:"; - icon += tool.getDefaultFolder() + "/" + entry.getKey().toLowerCase() + "/" + accessorys.get(i); - //toolIcons[i] = icon; - accessoryStrings.put(entry.getValue().materialID+(TinkersDefense.config.MaterialIndex*(i+1)), icon); + icon += tool.getDefaultFolder() + "/" + entry.getKey().toLowerCase() + "/" + accessorys.get(i); + //toolIcons[i] = icon; + accessoryStrings.put(entry.getValue().materialID + (TinkersDefense.config.MaterialIndex * (i + 1)), icon); } - + addIcons(accessoryStrings, accessoryIcons, iconRegister, accessorys.get(i), false); - - for(int j = (i+1)*TinkersDefense.config.MaterialIndex; j entry : pb.materialSets.entrySet()) { String icon = "tinkersdefense:"; - icon += tool.getDefaultFolder() + "/" + entry.getKey().toLowerCase() + "/" + handles.get(i); - //toolIcons[i] = icon; - handleStrings.put(entry.getValue().materialID+(TinkersDefense.config.MaterialIndex*(i+1)), icon); + icon += tool.getDefaultFolder() + "/" + entry.getKey().toLowerCase() + "/" + handles.get(i); + //toolIcons[i] = icon; + handleStrings.put(entry.getValue().materialID + (TinkersDefense.config.MaterialIndex * (i + 1)), icon); } - + addIcons(handleStrings, handleIcons, iconRegister, handles.get(i), false); - - for(int j = (i+1)*TinkersDefense.config.MaterialIndex; j list; - + List list; + public InjectorLocations() { list = new ArrayList(); - + //BroadSword list.add("broadsword_dull_head"); list.add("broadsword_elusive_head"); @@ -27,7 +27,7 @@ public class InjectorLocations list.add("broadsword_nofuller_head"); list.add("broadsword_hourglass_head"); list.add("broadsword_flat_head"); - + list.add("broadsword_basket_accessory"); list.add("broadsword_curved_accessory"); list.add("broadsword_elusive_accessory"); @@ -44,49 +44,49 @@ public class InjectorLocations list.add("broadsword_lamenting_accessory"); list.add("broadsword_pixie_accessory"); list.add("broadsword_forked_accessory"); - + list.add("broadsword_ornate_handle"); list.add("broadsword_thick_handle"); list.add("broadsword_short_handle"); - + //Arrow list.add("arrow_broad_head"); list.add("arrow_elven_head"); list.add("arrow_horned_head"); list.add("arrow_trident_head"); list.add("arrow_winged_head"); - + list.add("arrow_bulbous_handle"); list.add("arrow_natural_handle"); - + list.add("arrow_matted_accessory"); list.add("arrow_magic_accessory"); list.add("arrow_pixie_accessory"); list.add("arrow_small_accessory"); - + //Axe list.add("axe_bearded_head"); list.add("axe_broad_head"); list.add("axe_minecraft_head"); list.add("axe_thin_head"); - + //Battleaxe list.add("battleaxe_halbard_head"); list.add("battleaxe_magic_head"); list.add("battleaxe_scythe_head"); - + list.add("battleaxe_magic_extra"); list.add("battleaxe_scythe_extra"); list.add("battleaxe_halbard_extra"); - + list.add("battleaxe_magic_accessory"); list.add("battleaxe_halbard_accessory"); list.add("battleaxe_knob_accessory"); - + //Battlesign list.add("battlesign_small_handle"); list.add("battlesign_smalllong_handle"); - + list.add("battlesign_arrow_head"); list.add("battlesign_caution_head"); list.add("battlesign_noentry_head"); @@ -94,11 +94,11 @@ public class InjectorLocations list.add("battlesign_stop_head"); list.add("battlesign_X_head"); } - + public List getList(String part) { List request = new ArrayList(); - + if(!list.isEmpty()) { for(int i = 0; i < list.size(); i++) @@ -109,7 +109,7 @@ public class InjectorLocations } } } - + return request; } } diff --git a/src/main/java/lance5057/tDefense/models/ModelJewelersBench.java b/src/main/java/lance5057/tDefense/models/ModelJewelersBench.java index 827f232..342b747 100644 --- a/src/main/java/lance5057/tDefense/models/ModelJewelersBench.java +++ b/src/main/java/lance5057/tDefense/models/ModelJewelersBench.java @@ -8,93 +8,97 @@ import net.minecraft.entity.Entity; * JewelersBench - lance5057 * Created using Tabula 4.1.1 */ -public class ModelJewelersBench extends ModelBase { - public ModelRenderer TableSide2; - public ModelRenderer SawBlock1; - public ModelRenderer SawBlock2; - public ModelRenderer SawBlock3; - public ModelRenderer SawBlockClamp; - public ModelRenderer Leg1; - public ModelRenderer Leg2; - public ModelRenderer Leg3; - public ModelRenderer Leg4; - public ModelRenderer TableTop; - public ModelRenderer TableBack; - public ModelRenderer TableSide1; - public ModelRenderer Drawer; - public ModelRenderer Handle; +public class ModelJewelersBench extends ModelBase +{ + public ModelRenderer TableSide2; + public ModelRenderer SawBlock1; + public ModelRenderer SawBlock2; + public ModelRenderer SawBlock3; + public ModelRenderer SawBlockClamp; + public ModelRenderer Leg1; + public ModelRenderer Leg2; + public ModelRenderer Leg3; + public ModelRenderer Leg4; + public ModelRenderer TableTop; + public ModelRenderer TableBack; + public ModelRenderer TableSide1; + public ModelRenderer Drawer; + public ModelRenderer Handle; - public ModelJewelersBench() { - this.textureWidth = 64; - this.textureHeight = 64; - this.SawBlock1 = new ModelRenderer(this, 0, 0); - this.SawBlock1.setRotationPoint(2.0F, 8.2F, -12.0F); - this.SawBlock1.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); - this.Leg4 = new ModelRenderer(this, 0, 0); - this.Leg4.setRotationPoint(6.0F, 10.0F, 6.0F); - this.Leg4.addBox(0.0F, 0.0F, 0.0F, 2, 14, 2, 0.0F); - this.Drawer = new ModelRenderer(this, 0, 46); - this.Drawer.setRotationPoint(-6.0F, 11.5F, -8.0F); - this.Drawer.addBox(0.0F, 0.0F, 0.0F, 12, 2, 16, 0.0F); - this.TableSide2 = new ModelRenderer(this, 0, 0); - this.TableSide2.setRotationPoint(-8.0F, 7.0F, -7.0F); - this.TableSide2.addBox(0.0F, 0.0F, 0.0F, 1, 1, 14, 0.0F); - this.Leg2 = new ModelRenderer(this, 0, 0); - this.Leg2.setRotationPoint(6.0F, 10.0F, -8.0F); - this.Leg2.addBox(0.0F, 0.0F, 0.0F, 2, 14, 2, 0.0F); - this.TableSide1 = new ModelRenderer(this, 0, 0); - this.TableSide1.setRotationPoint(7.0F, 7.0F, -7.0F); - this.TableSide1.addBox(0.0F, 0.0F, 0.0F, 1, 1, 14, 0.0F); - this.SawBlock3 = new ModelRenderer(this, 0, 0); - this.SawBlock3.setRotationPoint(3.0F, 8.2F, -11.0F); - this.SawBlock3.addBox(0.0F, 0.0F, 0.0F, 1, 1, 3, 0.0F); - this.Handle = new ModelRenderer(this, 55, 0); - this.Handle.setRotationPoint(-2.0F, 12.0F, -9.0F); - this.Handle.addBox(0.0F, 0.0F, 0.0F, 4, 1, 1, 0.0F); - this.Leg1 = new ModelRenderer(this, 0, 0); - this.Leg1.setRotationPoint(-8.0F, 10.0F, -8.0F); - this.Leg1.addBox(0.0F, 0.0F, 0.0F, 2, 14, 2, 0.0F); - this.TableTop = new ModelRenderer(this, 0, 28); - this.TableTop.setRotationPoint(-8.0F, 8.0F, -8.0F); - this.TableTop.addBox(0.0F, 0.0F, 0.0F, 16, 2, 16, 0.0F); - this.TableBack = new ModelRenderer(this, 0, 0); - this.TableBack.setRotationPoint(-8.0F, 7.0F, 7.0F); - this.TableBack.addBox(0.0F, 0.0F, 0.0F, 16, 1, 1, 0.0F); - this.SawBlockClamp = new ModelRenderer(this, 54, 0); - this.SawBlockClamp.setRotationPoint(1.5F, 8.0F, -9.0F); - this.SawBlockClamp.addBox(0.0F, 0.0F, 0.0F, 4, 2, 1, 0.0F); - this.Leg3 = new ModelRenderer(this, 0, 0); - this.Leg3.setRotationPoint(-8.0F, 10.0F, 6.0F); - this.Leg3.addBox(0.0F, 0.0F, 0.0F, 2, 14, 2, 0.0F); - this.SawBlock2 = new ModelRenderer(this, 0, 0); - this.SawBlock2.setRotationPoint(4.0F, 8.2F, -12.0F); - this.SawBlock2.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); - } + public ModelJewelersBench() + { + this.textureWidth = 64; + this.textureHeight = 64; + this.SawBlock1 = new ModelRenderer(this, 0, 0); + this.SawBlock1.setRotationPoint(2.0F, 8.2F, -12.0F); + this.SawBlock1.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + this.Leg4 = new ModelRenderer(this, 0, 0); + this.Leg4.setRotationPoint(6.0F, 10.0F, 6.0F); + this.Leg4.addBox(0.0F, 0.0F, 0.0F, 2, 14, 2, 0.0F); + this.Drawer = new ModelRenderer(this, 0, 46); + this.Drawer.setRotationPoint(-6.0F, 11.5F, -8.0F); + this.Drawer.addBox(0.0F, 0.0F, 0.0F, 12, 2, 16, 0.0F); + this.TableSide2 = new ModelRenderer(this, 0, 0); + this.TableSide2.setRotationPoint(-8.0F, 7.0F, -7.0F); + this.TableSide2.addBox(0.0F, 0.0F, 0.0F, 1, 1, 14, 0.0F); + this.Leg2 = new ModelRenderer(this, 0, 0); + this.Leg2.setRotationPoint(6.0F, 10.0F, -8.0F); + this.Leg2.addBox(0.0F, 0.0F, 0.0F, 2, 14, 2, 0.0F); + this.TableSide1 = new ModelRenderer(this, 0, 0); + this.TableSide1.setRotationPoint(7.0F, 7.0F, -7.0F); + this.TableSide1.addBox(0.0F, 0.0F, 0.0F, 1, 1, 14, 0.0F); + this.SawBlock3 = new ModelRenderer(this, 0, 0); + this.SawBlock3.setRotationPoint(3.0F, 8.2F, -11.0F); + this.SawBlock3.addBox(0.0F, 0.0F, 0.0F, 1, 1, 3, 0.0F); + this.Handle = new ModelRenderer(this, 55, 0); + this.Handle.setRotationPoint(-2.0F, 12.0F, -9.0F); + this.Handle.addBox(0.0F, 0.0F, 0.0F, 4, 1, 1, 0.0F); + this.Leg1 = new ModelRenderer(this, 0, 0); + this.Leg1.setRotationPoint(-8.0F, 10.0F, -8.0F); + this.Leg1.addBox(0.0F, 0.0F, 0.0F, 2, 14, 2, 0.0F); + this.TableTop = new ModelRenderer(this, 0, 28); + this.TableTop.setRotationPoint(-8.0F, 8.0F, -8.0F); + this.TableTop.addBox(0.0F, 0.0F, 0.0F, 16, 2, 16, 0.0F); + this.TableBack = new ModelRenderer(this, 0, 0); + this.TableBack.setRotationPoint(-8.0F, 7.0F, 7.0F); + this.TableBack.addBox(0.0F, 0.0F, 0.0F, 16, 1, 1, 0.0F); + this.SawBlockClamp = new ModelRenderer(this, 54, 0); + this.SawBlockClamp.setRotationPoint(1.5F, 8.0F, -9.0F); + this.SawBlockClamp.addBox(0.0F, 0.0F, 0.0F, 4, 2, 1, 0.0F); + this.Leg3 = new ModelRenderer(this, 0, 0); + this.Leg3.setRotationPoint(-8.0F, 10.0F, 6.0F); + this.Leg3.addBox(0.0F, 0.0F, 0.0F, 2, 14, 2, 0.0F); + this.SawBlock2 = new ModelRenderer(this, 0, 0); + this.SawBlock2.setRotationPoint(4.0F, 8.2F, -12.0F); + this.SawBlock2.addBox(0.0F, 0.0F, 0.0F, 1, 1, 4, 0.0F); + } - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { - this.SawBlock1.render(f5); - this.Leg4.render(f5); - this.Drawer.render(f5); - this.TableSide2.render(f5); - this.Leg2.render(f5); - this.TableSide1.render(f5); - this.SawBlock3.render(f5); - this.Handle.render(f5); - this.Leg1.render(f5); - this.TableTop.render(f5); - this.TableBack.render(f5); - this.SawBlockClamp.render(f5); - this.Leg3.render(f5); - this.SawBlock2.render(f5); - } + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + this.SawBlock1.render(f5); + this.Leg4.render(f5); + this.Drawer.render(f5); + this.TableSide2.render(f5); + this.Leg2.render(f5); + this.TableSide1.render(f5); + this.SawBlock3.render(f5); + this.Handle.render(f5); + this.Leg1.render(f5); + this.TableTop.render(f5); + this.TableBack.render(f5); + this.SawBlockClamp.render(f5); + this.Leg3.render(f5); + this.SawBlock2.render(f5); + } - /** - * This is a helper function from Tabula to set the rotation of model parts - */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } + /** + * This is a helper function from Tabula to set the rotation of model parts + */ + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) + { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } } diff --git a/src/main/java/lance5057/tDefense/models/Renderer_JewelersBench.java b/src/main/java/lance5057/tDefense/models/Renderer_JewelersBench.java index 3406cea..bebba3e 100644 --- a/src/main/java/lance5057/tDefense/models/Renderer_JewelersBench.java +++ b/src/main/java/lance5057/tDefense/models/Renderer_JewelersBench.java @@ -10,32 +10,33 @@ import org.lwjgl.opengl.GL11; public class Renderer_JewelersBench extends TileEntitySpecialRenderer { - private final ModelJewelersBench model; - - public Renderer_JewelersBench() { - this.model = new ModelJewelersBench(); -} - + private final ModelJewelersBench model; + + public Renderer_JewelersBench() + { + this.model = new ModelJewelersBench(); + } + @Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) { GL11.glPushMatrix(); - GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); - - ResourceLocation textures = (new ResourceLocation("tinkersdefense:textures/blocks/JewelersBench.png")); - - Minecraft.getMinecraft().renderEngine.bindTexture(textures); - - GL11.glPushMatrix(); - - int meta = te.getBlockMetadata(); - - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - - this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); - GL11.glPopMatrix(); - GL11.glPopMatrix(); - + GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); + + ResourceLocation textures = (new ResourceLocation("tinkersdefense:textures/blocks/JewelersBench.png")); + + Minecraft.getMinecraft().renderEngine.bindTexture(textures); + + GL11.glPushMatrix(); + + int meta = te.getBlockMetadata(); + + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + + this.model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); + GL11.glPopMatrix(); + GL11.glPopMatrix(); + } } diff --git a/src/main/java/lance5057/tDefense/proxy/ClientProxy.java b/src/main/java/lance5057/tDefense/proxy/ClientProxy.java index b9e008a..2e57daa 100644 --- a/src/main/java/lance5057/tDefense/proxy/ClientProxy.java +++ b/src/main/java/lance5057/tDefense/proxy/ClientProxy.java @@ -1,9 +1,11 @@ package lance5057.tDefense.proxy; import lance5057.tDefense.TinkersDefense; -import lance5057.tDefense.armor.renderers.ModelChainArmor; -import lance5057.tDefense.armor.renderers.ModelClothArmor; import lance5057.tDefense.armor.renderers.ModelMask; +import lance5057.tDefense.armor.renderers.heavy.ModelTinkersBreastplate; +import lance5057.tDefense.armor.renderers.heavy.ModelTinkersGrieves; +import lance5057.tDefense.armor.renderers.heavy.ModelTinkersHelm; +import lance5057.tDefense.armor.renderers.heavy.ModelTinkersSabatons; import lance5057.tDefense.core.blocks.crestMount.Renderer_CrestMount; import lance5057.tDefense.core.blocks.crestMount.TileEntity_CrestMount; import lance5057.tDefense.core.renderer.BigFlexibleToolRenderer; @@ -16,71 +18,50 @@ import net.minecraftforge.client.MinecraftForgeClient; import tconstruct.client.FlexibleToolRenderer; import cpw.mods.fml.client.registry.ClientRegistry; -public class ClientProxy extends CommonProxy { +public class ClientProxy extends CommonProxy +{ //public static final ModelSheath sheath = new ModelSheath(); - public static final ModelChainArmor chain = new ModelChainArmor(0.1f); - public static final ModelClothArmor cloth = new ModelClothArmor(); - - public static final ModelMask mask = new ModelMask(null); - + + public static final ModelMask mask = new ModelMask(null); + + public static final ModelTinkersHelm helm = new ModelTinkersHelm(); + public static final ModelTinkersBreastplate breastplate = new ModelTinkersBreastplate(); + public static final ModelTinkersGrieves grieves = new ModelTinkersGrieves(); + public static final ModelTinkersSabatons sabatons = new ModelTinkersSabatons(); + @Override - public void registerRenderers() { + public void registerRenderers() + { FlexibleToolRenderer renderer = new FlexibleToolRenderer(); FlexibleToolRenderer bigrenderer = new BigFlexibleToolRenderer(); - MinecraftForgeClient.registerItemRenderer( - TinkersDefense.tool_roundShield, renderer); - MinecraftForgeClient.registerItemRenderer( - TinkersDefense.tool_heaterShield, renderer); - MinecraftForgeClient.registerItemRenderer(TinkersDefense.tool_wrench, - renderer); - MinecraftForgeClient.registerItemRenderer(TinkersDefense.tool_shears, - renderer); -// MinecraftForgeClient.registerItemRenderer(TinkersDefense.tool_zweihander, -// bigrenderer); - MinecraftForgeClient.registerItemRenderer(TinkersDefense.armor_TinkerHelm, - renderer); - MinecraftForgeClient.registerItemRenderer(TinkersDefense.armor_TinkerBreastplate, - renderer); - MinecraftForgeClient.registerItemRenderer(TinkersDefense.armor_TinkerGrieves, - renderer); - MinecraftForgeClient.registerItemRenderer(TinkersDefense.armor_TinkerSabatons, - renderer); - MinecraftForgeClient.registerItemRenderer(TinkersDefense.armor_TinkerRobe, - renderer); - MinecraftForgeClient.registerItemRenderer(TinkersDefense.armor_TinkerShawl, - renderer); - MinecraftForgeClient.registerItemRenderer(TinkersDefense.armor_TinkerHood, - renderer); - MinecraftForgeClient.registerItemRenderer(TinkersDefense.armor_TinkerShoes, - renderer); - - MinecraftForgeClient.registerItemRenderer(TinkersDefense.armor_TinkerCoif, - renderer); - MinecraftForgeClient.registerItemRenderer(TinkersDefense.armor_TinkerHalberd, - renderer); - MinecraftForgeClient.registerItemRenderer(TinkersDefense.armor_TinkerChausses, - renderer); - MinecraftForgeClient.registerItemRenderer(TinkersDefense.armor_TinkerBoots, - renderer); + MinecraftForgeClient.registerItemRenderer(TinkersDefense.tool_roundShield, renderer); + MinecraftForgeClient.registerItemRenderer(TinkersDefense.tool_heaterShield, renderer); + MinecraftForgeClient.registerItemRenderer(TinkersDefense.tool_wrench, renderer); + MinecraftForgeClient.registerItemRenderer(TinkersDefense.tool_shears, renderer); + MinecraftForgeClient.registerItemRenderer(TinkersDefense.tool_zweihander, bigrenderer); + MinecraftForgeClient.registerItemRenderer(TinkersDefense.armor_TinkerHelm, renderer); + MinecraftForgeClient.registerItemRenderer(TinkersDefense.armor_TinkerBreastplate, renderer); + MinecraftForgeClient.registerItemRenderer(TinkersDefense.armor_TinkerGrieves, renderer); + MinecraftForgeClient.registerItemRenderer(TinkersDefense.armor_TinkerSabatons, renderer); + MinecraftForgeClient.registerItemRenderer(TinkersDefense.armor_TinkerRobe, renderer); + MinecraftForgeClient.registerItemRenderer(TinkersDefense.armor_TinkerShawl, renderer); + MinecraftForgeClient.registerItemRenderer(TinkersDefense.armor_TinkerHood, renderer); + MinecraftForgeClient.registerItemRenderer(TinkersDefense.armor_TinkerShoes, renderer); + + MinecraftForgeClient.registerItemRenderer(TinkersDefense.armor_TinkerCoif, renderer); + MinecraftForgeClient.registerItemRenderer(TinkersDefense.armor_TinkerHalberd, renderer); + MinecraftForgeClient.registerItemRenderer(TinkersDefense.armor_TinkerChausses, renderer); + MinecraftForgeClient.registerItemRenderer(TinkersDefense.armor_TinkerBoots, renderer); + + ClientRegistry.bindTileEntitySpecialRenderer(TileEntity_CrestMount.class, new Renderer_CrestMount()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntity_FinishingAnvil.class, new Renderer_FinishingAnvil()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntity_JewelersBench.class, new Renderer_JewelersBench()); - ClientRegistry.bindTileEntitySpecialRenderer( - TileEntity_CrestMount.class, new Renderer_CrestMount()); - ClientRegistry.bindTileEntitySpecialRenderer( - TileEntity_FinishingAnvil.class, new Renderer_FinishingAnvil()); - ClientRegistry.bindTileEntitySpecialRenderer( - TileEntity_JewelersBench.class, new Renderer_JewelersBench()); - } @Override - public ModelBiped getArmorModel(int id) { - switch (id) { - case 0: - return cloth; - default: - break; - } - return cloth; // default, if whenever you should have passed on a - // wrong id + public ModelBiped getArmorModel(int id) + { + return null; } -} \ No newline at end of file +} diff --git a/src/main/java/lance5057/tDefense/proxy/CommonProxy.java b/src/main/java/lance5057/tDefense/proxy/CommonProxy.java index 361851b..7b39954 100644 --- a/src/main/java/lance5057/tDefense/proxy/CommonProxy.java +++ b/src/main/java/lance5057/tDefense/proxy/CommonProxy.java @@ -13,60 +13,58 @@ import net.minecraft.world.World; import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; -public class CommonProxy implements IGuiHandler +public class CommonProxy implements IGuiHandler { - public void registerRenderers() - { - } - - public void registerTileEntitySpecialRenderer() - { - - } - - public EntityPlayer getPlayerEntity(MessageContext ctx) - { - return ctx.getServerHandler().playerEntity; - } - - public ModelBiped getArmorModel(int id) - { - return null; - } + public void registerRenderers() + { + } - public World getClientWorld() - { - return null; - } + public void registerTileEntitySpecialRenderer() + { - @Override - public Object getServerGuiElement(int ID, EntityPlayer player, - World world, int x, int y, int z) + } + + public EntityPlayer getPlayerEntity(MessageContext ctx) + { + return ctx.getServerHandler().playerEntity; + } + + public ModelBiped getArmorModel(int id) + { + return null; + } + + public World getClientWorld() + { + return null; + } + + @Override + public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) + { + if(ID == TinkersDefense.GUI_CREST_INV) { - if (ID == TinkersDefense.GUI_CREST_INV) - { - return new Container_CrestMount(player.inventory, (TileEntity_CrestMount)world.getTileEntity(x, y, z)); - } - if (ID == TinkersDefense.GUI_ANVIL_INV) - { - return new Container_FinishingAnvil(player.inventory, (TileEntity_FinishingAnvil)world.getTileEntity(x, y, z)); - } - - return null; + return new Container_CrestMount(player.inventory, (TileEntity_CrestMount) world.getTileEntity(x, y, z)); } + if(ID == TinkersDefense.GUI_ANVIL_INV) + { + return new Container_FinishingAnvil(player.inventory, (TileEntity_FinishingAnvil) world.getTileEntity(x, y, z)); + } + + return null; + } - @Override - public Object getClientGuiElement(int ID, EntityPlayer player, - World world, int x, int y, int z) + @Override + public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) + { + if(ID == TinkersDefense.GUI_CREST_INV) + { + return new Gui_CrestMount(player.inventory, (TileEntity_CrestMount) world.getTileEntity(x, y, z)); + } + if(ID == TinkersDefense.GUI_ANVIL_INV) { - if (ID == TinkersDefense.GUI_CREST_INV) - { - return new Gui_CrestMount(player.inventory, (TileEntity_CrestMount)world.getTileEntity(x, y, z)); - } - if (ID == TinkersDefense.GUI_ANVIL_INV) - { - return new Gui_FinishingAnvil(player.inventory, (TileEntity_FinishingAnvil)world.getTileEntity(x, y, z)); - } - return null; + return new Gui_FinishingAnvil(player.inventory, (TileEntity_FinishingAnvil) world.getTileEntity(x, y, z)); } -} \ No newline at end of file + return null; + } +} -- cgit v1.2.3