diff --git a/mods/tinker/common/InventoryBlock.java b/mods/tinker/common/InventoryBlock.java index adb3c64d..94de53d2 100644 --- a/mods/tinker/common/InventoryBlock.java +++ b/mods/tinker/common/InventoryBlock.java @@ -1,6 +1,7 @@ package mods.tinker.common; -import mods.tinker.tconstruct.TConstruct; +import java.util.Random; + import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; @@ -16,6 +17,7 @@ import net.minecraft.world.World; public abstract class InventoryBlock extends BlockContainer { + protected Random rand = new Random(); protected InventoryBlock(int id, Material material) { super(id, material); @@ -70,13 +72,13 @@ public abstract class InventoryBlock extends BlockContainer if (stack != null && logic.canDropInventorySlot(iter)) { - float jumpX = TConstruct.tRand.nextFloat() * 0.8F + 0.1F; - float jumpY = TConstruct.tRand.nextFloat() * 0.8F + 0.1F; - float jumpZ = TConstruct.tRand.nextFloat() * 0.8F + 0.1F; + float jumpX = rand.nextFloat() * 0.8F + 0.1F; + float jumpY = rand.nextFloat() * 0.8F + 0.1F; + float jumpZ = rand.nextFloat() * 0.8F + 0.1F; while (stack.stackSize > 0) { - int itemSize = TConstruct.tRand.nextInt(21) + 10; + int itemSize = rand.nextInt(21) + 10; if (itemSize > stack.stackSize) { @@ -93,9 +95,9 @@ public abstract class InventoryBlock extends BlockContainer } float offset = 0.05F; - entityitem.motionX = (double) ((float) TConstruct.tRand.nextGaussian() * offset); - entityitem.motionY = (double) ((float) TConstruct.tRand.nextGaussian() * offset + 0.2F); - entityitem.motionZ = (double) ((float) TConstruct.tRand.nextGaussian() * offset); + entityitem.motionX = (double) ((float) rand.nextGaussian() * offset); + entityitem.motionY = (double) ((float) rand.nextGaussian() * offset + 0.2F); + entityitem.motionZ = (double) ((float) rand.nextGaussian() * offset); par1World.spawnEntityInWorld(entityitem); } } diff --git a/mods/tinker/tconstruct/PiercingEntityDamage.java b/mods/tinker/common/PiercingEntityDamage.java similarity index 89% rename from mods/tinker/tconstruct/PiercingEntityDamage.java rename to mods/tinker/common/PiercingEntityDamage.java index ab8749b8..53c625e4 100644 --- a/mods/tinker/tconstruct/PiercingEntityDamage.java +++ b/mods/tinker/common/PiercingEntityDamage.java @@ -1,4 +1,4 @@ -package mods.tinker.tconstruct; +package mods.tinker.common; import net.minecraft.entity.Entity; import net.minecraft.util.EntityDamageSource; diff --git a/mods/tinker/tconstruct/library/RangedWeapon.java b/mods/tinker/tconstruct/RangedWeapon.java similarity index 99% rename from mods/tinker/tconstruct/library/RangedWeapon.java rename to mods/tinker/tconstruct/RangedWeapon.java index b406c2a9..500dbbc8 100644 --- a/mods/tinker/tconstruct/library/RangedWeapon.java +++ b/mods/tinker/tconstruct/RangedWeapon.java @@ -1,6 +1,7 @@ -package mods.tinker.tconstruct.library; +package mods.tinker.tconstruct; import mods.tinker.tconstruct.TContent; +import mods.tinker.tconstruct.library.ToolCore; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.player.EntityPlayer; diff --git a/mods/tinker/tconstruct/TConstruct.java b/mods/tinker/tconstruct/TConstruct.java index 9fd23f97..697fea7b 100644 --- a/mods/tinker/tconstruct/TConstruct.java +++ b/mods/tinker/tconstruct/TConstruct.java @@ -2,6 +2,8 @@ package mods.tinker.tconstruct; import java.util.Random; +import mods.tinker.tconstruct.library.TConstructRegistry; +import mods.tinker.tconstruct.library.TabTools; import mods.tinker.tconstruct.player.TPlayerHandler; import mods.tinker.tconstruct.worldgen.TBaseWorldGenerator; import net.minecraftforge.common.MinecraftForge; @@ -48,9 +50,9 @@ public class TConstruct public void preInit (FMLPreInitializationEvent evt) { PHConstruct.initProps(); - materialTab = new TabTools("TConstructMaterials"); - toolTab = new TabTools("TConstructTools"); - blockTab = new TabTools("TConstructBlocks"); + TConstructRegistry.materialTab = new TabTools("TConstructMaterials"); + TConstructRegistry.toolTab = new TabTools("TConstructTools"); + TConstructRegistry.blockTab = new TabTools("TConstructBlocks"); content = new TContent(); proxy.registerRenderer(); @@ -84,7 +86,4 @@ public class TConstruct public static TContent content; public static Random tRand = new Random(); - public static TabTools toolTab; - public static TabTools materialTab; - public static TabTools blockTab; } diff --git a/mods/tinker/tconstruct/TContent.java b/mods/tinker/tconstruct/TContent.java index 4af10041..ed67f1b2 100644 --- a/mods/tinker/tconstruct/TContent.java +++ b/mods/tinker/tconstruct/TContent.java @@ -278,6 +278,7 @@ public class TContent implements IFuelHandler materials = new CraftingItem(PHConstruct.materials, craftingMaterials, craftingTextures, "materials/").setUnlocalizedName("tconstruct.Materials"); toolRod = new ToolPart(PHConstruct.toolRod, "ToolRod", "_rod").setUnlocalizedName("tconstruct.ToolRod"); + TConstructRegistry.toolRod = toolRod; toolShard = new ToolShard(PHConstruct.toolShard, "ToolShard", "_chunk").setUnlocalizedName("tconstruct.ToolShard"); woodPattern = new Pattern(PHConstruct.woodPattern, "WoodPattern", "pattern_", "materials/").setUnlocalizedName("tconstruct.Pattern"); metalPattern = new MetalPattern(PHConstruct.metalPattern, "MetalPattern", "cast_", "materials/").setUnlocalizedName("tconstruct.MetalPattern"); @@ -325,22 +326,22 @@ public class TContent implements IFuelHandler void registerMaterials () { - TConstructRegistry.addToolMaterial(0, "Wood", 1, 0, 59, 200, 0, 1.0F, 0, 0f); - TConstructRegistry.addToolMaterial(1, "Stone", 1, 1, 131, 400, 1, 0.5F, 0, 1f); - TConstructRegistry.addToolMaterial(2, "Iron", 1, 2, 250, 600, 2, 1.3F, 1, 0f); - TConstructRegistry.addToolMaterial(3, "Flint", 1, 1, 171, 525, 2, 0.7F, 0, 1f); - TConstructRegistry.addToolMaterial(4, "Cactus", 1, 1, 150, 500, 2, 1.0F, 0, -1f); - TConstructRegistry.addToolMaterial(5, "Bone", 1, 1, 200, 400, 1, 1.0F, 0, 0f); - TConstructRegistry.addToolMaterial(6, "Obsidian", 1, 3, 89, 700, 2, 0.8F, 3, 0f); - TConstructRegistry.addToolMaterial(7, "Netherrack", 1, 2, 131, 400, 1, 1.2F, 0, 1f); - TConstructRegistry.addToolMaterial(8, "Slime", 1, 3, 1500, 150, 0, 5.0F, 0, 0f); - TConstructRegistry.addToolMaterial(9, "Paper", 1, 0, 30, 200, 0, 0.3F, 0, 0f); - TConstructRegistry.addToolMaterial(10, "Cobalt", 2, 4, 800, 800, 3, 1.75F, 2, 0f); - TConstructRegistry.addToolMaterial(11, "Ardite", 2, 4, 600, 800, 3, 2.0F, 0, 0f); - TConstructRegistry.addToolMaterial(12, "Manyullyn", 2, 5, 1200, 1000, 4, 2.5F, 0, 0f); - TConstructRegistry.addToolMaterial(13, "Copper", 1, 1, 180, 500, 2, 1.15F, 0, 0f); - TConstructRegistry.addToolMaterial(14, "Bronze", 1, 2, 250, 600, 2, 1.3F, 1, 0f); - TConstructRegistry.addToolMaterial(15, "Alumite", 2, 4, 550, 800, 3, 1.3F, 2, 0f); + TConstructRegistry.addToolMaterial(0, "Wood", 1, 0, 59, 200, 0, 1.0F, 0, 0f, "\u00A7e", ""); + TConstructRegistry.addToolMaterial(1, "Stone", 1, 1, 131, 400, 1, 0.5F, 0, 1f, "", "Shoddy"); + TConstructRegistry.addToolMaterial(2, "Iron", 1, 2, 250, 600, 2, 1.3F, 1, 0f, "\u00A7f", ""); + TConstructRegistry.addToolMaterial(3, "Flint", 1, 1, 171, 525, 2, 0.7F, 0, 1f, "\u00A78", "Shoddy"); + TConstructRegistry.addToolMaterial(4, "Cactus", 1, 1, 150, 500, 2, 1.0F, 0, -1f, "\u00A72", "Spiny"); + TConstructRegistry.addToolMaterial(5, "Bone", 1, 1, 200, 400, 1, 1.0F, 0, 0f, "\u00A7e", ""); + TConstructRegistry.addToolMaterial(6, "Obsidian", 1, 3, 89, 700, 2, 0.8F, 3, 0f, "\u00A7d", ""); + TConstructRegistry.addToolMaterial(7, "Netherrack", 1, 2, 131, 400, 1, 1.2F, 0, 1f, "\u00A74", "Shoddy"); + TConstructRegistry.addToolMaterial(8, "Slime", 1, 3, 1500, 150, 0, 5.0F, 0, 0f, "\u00A7a", ""); + TConstructRegistry.addToolMaterial(9, "Paper", 1, 0, 30, 200, 0, 0.3F, 0, 0f, "\u00A7f", "Writable"); + TConstructRegistry.addToolMaterial(10, "Cobalt", 2, 4, 800, 800, 3, 1.75F, 2, 0f, "\u00A73", ""); + TConstructRegistry.addToolMaterial(11, "Ardite", 2, 4, 600, 800, 3, 2.0F, 0, 0f, "\u00A74", ""); + TConstructRegistry.addToolMaterial(12, "Manyullyn", 2, 5, 1200, 1000, 4, 2.5F, 0, 0f, "\u00A75", "Awareness"); + TConstructRegistry.addToolMaterial(13, "Copper", 1, 1, 180, 500, 2, 1.15F, 0, 0f, "\u00A7c", ""); + TConstructRegistry.addToolMaterial(14, "Bronze", 1, 2, 250, 600, 2, 1.3F, 1, 0f, "\u00A76", ""); + TConstructRegistry.addToolMaterial(15, "Alumite", 2, 4, 550, 800, 3, 1.3F, 2, 0f, "\u00A7d", ""); TConstructRegistry.addToolMaterial(16, "Steel", 2, 3, 750, 800, 3, 1.3F, 2, 0f); //Thaumcraft @@ -375,23 +376,23 @@ public class TContent implements IFuelHandler pb.registerMaterialSet("Wood", new ItemStack(Item.stick, 2), new ItemStack(Item.stick), 0); if (PHConstruct.enableTStone) { - pb.registerFullMaterial(Block.stone, 2, "Stone", 1); + pb.registerFullMaterial(Block.stone, 2, "Stone", new ItemStack(TContent.toolShard, 1, 1), new ItemStack(TContent.toolRod, 1, 1), 1); pb.registerMaterial(Block.cobblestone, 2, "Stone"); } //else //pb.registerMaterialSet("Stone", new ItemStack(TContent.toolShard, 1, 1), new ItemStack(TContent.toolRod, 1, 1), 1); - pb.registerFullMaterial(Item.ingotIron, 2, "Iron", 2); - pb.registerFullMaterial(Item.flint, 2, "Flint", 3); + pb.registerFullMaterial(Item.ingotIron, 2, "Iron", new ItemStack(TContent.toolShard, 1, 2), new ItemStack(TContent.toolRod, 1, 2), 2); + pb.registerFullMaterial(Item.flint, 2, "Flint", new ItemStack(TContent.toolShard, 1, 3), new ItemStack(TContent.toolRod, 1, 3), 3); if (PHConstruct.enableTCactus) - pb.registerFullMaterial(Block.cactus, 2, "Cactus", 4); + pb.registerFullMaterial(Block.cactus, 2, "Cactus", new ItemStack(TContent.toolShard, 1, 4), new ItemStack(TContent.toolRod, 1, 4), 4); else pb.registerMaterialSet("Cactus", new ItemStack(TContent.toolShard, 1, 4), new ItemStack(TContent.toolRod, 1, 4), 4); if (PHConstruct.enableTBone) pb.registerFullMaterial(Item.bone, 2, "Bone", new ItemStack(Item.dyePowder, 1, 15), new ItemStack(Item.bone), 5); else pb.registerMaterialSet("Bone", new ItemStack(Item.dyePowder, 1, 15), new ItemStack(Item.bone), 5); - pb.registerFullMaterial(Block.obsidian, 2, "Obsidian", 6); - pb.registerFullMaterial(Block.netherrack, 2, "Netherrack", 7); + pb.registerFullMaterial(Block.obsidian, 2, "Obsidian", new ItemStack(TContent.toolShard, 1, 6), new ItemStack(TContent.toolRod, 1, 6), 6); + pb.registerFullMaterial(Block.netherrack, 2, "Netherrack", new ItemStack(TContent.toolShard, 1, 7), new ItemStack(TContent.toolRod, 1, 7), 7); pb.registerFullMaterial(new ItemStack(materials, 1, 1), 2, "Slime", new ItemStack(toolShard, 1, 8), new ItemStack(toolRod, 1, 8), 8); pb.registerFullMaterial(new ItemStack(materials, 1, 0), 2, "Paper", new ItemStack(Item.paper, 2), new ItemStack(toolRod, 1, 9), 9); pb.registerMaterialSet("Cobalt", new ItemStack(toolShard, 1, 10), new ItemStack(toolRod, 1, 10), 10); @@ -618,8 +619,8 @@ public class TContent implements IFuelHandler void setupToolTabs () { - TConstruct.materialTab.init(new ItemStack(titleIcon)); - TConstruct.blockTab.init(new ItemStack(woodCrafter)); + TConstructRegistry.materialTab.init(new ItemStack(titleIcon)); + TConstructRegistry.blockTab.init(new ItemStack(woodCrafter)); ItemStack tool = new ItemStack(longsword, 1, 0); NBTTagCompound compound = new NBTTagCompound(); @@ -629,7 +630,8 @@ public class TContent implements IFuelHandler compound.getCompoundTag("InfiTool").setInteger("RenderAccessory", 10); tool.setTagCompound(compound); - TConstruct.toolTab.init(tool); + //TConstruct. + TConstructRegistry.toolTab.init(tool); } public void oreRegistry () diff --git a/mods/tinker/tconstruct/TCraftingHandler.java b/mods/tinker/tconstruct/TCraftingHandler.java index 02413398..37b68be7 100644 --- a/mods/tinker/tconstruct/TCraftingHandler.java +++ b/mods/tinker/tconstruct/TCraftingHandler.java @@ -1,5 +1,6 @@ package mods.tinker.tconstruct; +import mods.tinker.tconstruct.library.AbilityHelper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; diff --git a/mods/tinker/tconstruct/blocks/Landmine.java b/mods/tinker/tconstruct/blocks/Landmine.java index a188184d..283b3f67 100644 --- a/mods/tinker/tconstruct/blocks/Landmine.java +++ b/mods/tinker/tconstruct/blocks/Landmine.java @@ -4,7 +4,7 @@ import java.util.Iterator; import java.util.List; import java.util.Random; -import mods.tinker.tconstruct.TConstruct; +import mods.tinker.tconstruct.library.TConstructRegistry; import net.minecraft.block.Block; import net.minecraft.block.BlockFence; import net.minecraft.block.EnumMobType; @@ -25,7 +25,7 @@ public class Landmine extends Block { super(par1, par4Material); this.triggerMobType = EnumMobType.mobs; - this.setCreativeTab(TConstruct.blockTab); + this.setCreativeTab(TConstructRegistry.blockTab); this.setTickRandomly(true); float var5 = 0.0625F; this.setBlockBounds(var5, 0.0F, var5, 1.0F - var5, 0.03125F, 1.0F - var5); diff --git a/mods/tinker/tconstruct/blocks/LavaTankBlock.java b/mods/tinker/tconstruct/blocks/LavaTankBlock.java index 4463d36a..d5bebca0 100644 --- a/mods/tinker/tconstruct/blocks/LavaTankBlock.java +++ b/mods/tinker/tconstruct/blocks/LavaTankBlock.java @@ -3,8 +3,8 @@ package mods.tinker.tconstruct.blocks; import java.util.List; import mods.tinker.common.IServantLogic; -import mods.tinker.tconstruct.TConstruct; import mods.tinker.tconstruct.client.TankRender; +import mods.tinker.tconstruct.library.TConstructRegistry; import mods.tinker.tconstruct.logic.LavaTankLogic; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; @@ -12,7 +12,6 @@ import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Icon; @@ -31,7 +30,7 @@ public class LavaTankBlock extends BlockContainer { super(id, Material.rock); setHardness(12); - setCreativeTab(TConstruct.blockTab); + setCreativeTab(TConstructRegistry.blockTab); setUnlocalizedName("TConstruct.LavaTank"); setStepSound(Block.soundGlassFootstep); } diff --git a/mods/tinker/tconstruct/blocks/SearedBlock.java b/mods/tinker/tconstruct/blocks/SearedBlock.java index 41cf5aa6..74b1b239 100644 --- a/mods/tinker/tconstruct/blocks/SearedBlock.java +++ b/mods/tinker/tconstruct/blocks/SearedBlock.java @@ -5,6 +5,7 @@ import java.util.List; import mods.tinker.common.InventoryBlock; import mods.tinker.tconstruct.TConstruct; import mods.tinker.tconstruct.client.SearedRender; +import mods.tinker.tconstruct.library.TConstructRegistry; import mods.tinker.tconstruct.logic.CastingTableLogic; import mods.tinker.tconstruct.logic.FaucetLogic; import net.minecraft.block.material.Material; @@ -24,8 +25,7 @@ public class SearedBlock extends InventoryBlock public SearedBlock(int id) { super(id, Material.rock); - this.setCreativeTab(TConstruct.blockTab); - //blockIndexInTexture = 32; + this.setCreativeTab(TConstructRegistry.blockTab); setHardness(12); setStepSound(soundMetalFootstep); } diff --git a/mods/tinker/tconstruct/blocks/SmelteryBlock.java b/mods/tinker/tconstruct/blocks/SmelteryBlock.java index 517aa3d9..e639b843 100644 --- a/mods/tinker/tconstruct/blocks/SmelteryBlock.java +++ b/mods/tinker/tconstruct/blocks/SmelteryBlock.java @@ -10,6 +10,7 @@ import mods.tinker.common.InventoryBlock; import mods.tinker.tconstruct.TConstruct; import mods.tinker.tconstruct.TGuiHandler; import mods.tinker.tconstruct.client.SmelteryRender; +import mods.tinker.tconstruct.library.TConstructRegistry; import mods.tinker.tconstruct.logic.MultiServantLogic; import mods.tinker.tconstruct.logic.SmelteryDrainLogic; import mods.tinker.tconstruct.logic.SmelteryLogic; @@ -30,11 +31,10 @@ public class SmelteryBlock extends InventoryBlock public SmelteryBlock(int id) { super(id, Material.rock); - //blockIndexInTexture = 64; setHardness(12F); setStepSound(soundMetalFootstep); rand = new Random(); - this.setCreativeTab(TConstruct.blockTab); + this.setCreativeTab(TConstructRegistry.blockTab); this.setUnlocalizedName("tconstruct.Smeltery"); } diff --git a/mods/tinker/tconstruct/blocks/TConstructBlock.java b/mods/tinker/tconstruct/blocks/TConstructBlock.java index f4287ea4..ae14f0bd 100644 --- a/mods/tinker/tconstruct/blocks/TConstructBlock.java +++ b/mods/tinker/tconstruct/blocks/TConstructBlock.java @@ -2,7 +2,7 @@ package mods.tinker.tconstruct.blocks; import java.util.List; -import mods.tinker.tconstruct.TConstruct; +import mods.tinker.tconstruct.library.TConstructRegistry; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; @@ -18,7 +18,7 @@ public class TConstructBlock extends Block { super(id, material); setHardness(hardness); - this.setCreativeTab(TConstruct.blockTab); + this.setCreativeTab(TConstructRegistry.blockTab); textureNames = tex; } diff --git a/mods/tinker/tconstruct/blocks/ToolStationBlock.java b/mods/tinker/tconstruct/blocks/ToolStationBlock.java index bc4b59df..5ad15e56 100644 --- a/mods/tinker/tconstruct/blocks/ToolStationBlock.java +++ b/mods/tinker/tconstruct/blocks/ToolStationBlock.java @@ -5,6 +5,7 @@ import java.util.List; import mods.tinker.common.InventoryBlock; import mods.tinker.tconstruct.TConstruct; import mods.tinker.tconstruct.client.TableRender; +import mods.tinker.tconstruct.library.TConstructRegistry; import mods.tinker.tconstruct.logic.PartCrafterLogic; import mods.tinker.tconstruct.logic.PatternChestLogic; import mods.tinker.tconstruct.logic.PatternShaperLogic; @@ -24,7 +25,7 @@ public class ToolStationBlock extends InventoryBlock public ToolStationBlock(int id, Material material) { super(id, material); - this.setCreativeTab(TConstruct.blockTab); + this.setCreativeTab(TConstructRegistry.blockTab); this.setHardness(2f); } diff --git a/mods/tinker/tconstruct/client/TProxyClient.java b/mods/tinker/tconstruct/client/TProxyClient.java index 1180cf53..65e339c6 100644 --- a/mods/tinker/tconstruct/client/TProxyClient.java +++ b/mods/tinker/tconstruct/client/TProxyClient.java @@ -16,14 +16,13 @@ import mods.tinker.tconstruct.client.entityrender.CartRender; import mods.tinker.tconstruct.client.entityrender.CrystalRender; import mods.tinker.tconstruct.client.entityrender.SkylaRender; import mods.tinker.tconstruct.client.entityrender.SlimeRender; -import mods.tinker.tconstruct.client.gui.ToolGuiElement; +import mods.tinker.tconstruct.entity.BlueSlime; import mods.tinker.tconstruct.entity.CartEntity; import mods.tinker.tconstruct.entity.Crystal; -import mods.tinker.tconstruct.entity.BlueSlime; import mods.tinker.tconstruct.entity.Skyla; import mods.tinker.tconstruct.entity.UnstableCreeper; -import mods.tinker.tconstruct.library.TConstructClientRegistry; -import mods.tinker.tconstruct.library.TConstructRegistry; +import mods.tinker.tconstruct.library.client.TConstructClientRegistry; +import mods.tinker.tconstruct.library.client.ToolGuiElement; import mods.tinker.tconstruct.logic.CastingTableLogic; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -74,7 +73,6 @@ import cpw.mods.fml.relauncher.Side; public class TProxyClient extends TProxyCommon { public static SmallFontRenderer smallFontRenderer; - public static Icon blankSprite; public static Icon metalBall; public static Minecraft mc; @@ -338,7 +336,7 @@ public class TProxyClient extends TProxyCommon void addToolButton (int slotType, int xButton, int yButton, int[] xIcons, int[] yIcons, String title, String body) { - TConstructRegistry.toolButtons.add(new ToolGuiElement(slotType, xButton, yButton, xIcons, yIcons, title, body)); + TConstructClientRegistry.addToolButton(new ToolGuiElement(slotType, xButton, yButton, xIcons, yIcons, title, body)); } void addRenderMappings () @@ -348,12 +346,10 @@ public class TProxyClient extends TProxyCommon for (int partIter = 0; partIter < partTypes.length; partIter++) { TConstructClientRegistry.addMaterialRenderMapping(partIter, "tinker", partTypes[partIter], true); - //materialRenderMap(partIter, partTypes[partIter]); } for (int effectIter = 0; effectIter < effectTypes.length; effectIter++) { TConstructClientRegistry.addEffectRenderMapping(effectIter, "tinker", effectTypes[effectIter], true); - //effectRenderMap(effectIter, effectTypes[effectIter]); } } diff --git a/mods/tinker/tconstruct/client/gui/GuiManual.java b/mods/tinker/tconstruct/client/gui/GuiManual.java index 800db644..b63a1b8f 100644 --- a/mods/tinker/tconstruct/client/gui/GuiManual.java +++ b/mods/tinker/tconstruct/client/gui/GuiManual.java @@ -1,7 +1,7 @@ package mods.tinker.tconstruct.client.gui; import mods.tinker.tconstruct.client.TProxyClient; -import mods.tinker.tconstruct.library.TConstructClientRegistry; +import mods.tinker.tconstruct.library.client.TConstructClientRegistry; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiParticle; diff --git a/mods/tinker/tconstruct/client/gui/PartCrafterGui.java b/mods/tinker/tconstruct/client/gui/PartCrafterGui.java index 3b7a1df4..c521efe2 100644 --- a/mods/tinker/tconstruct/client/gui/PartCrafterGui.java +++ b/mods/tinker/tconstruct/client/gui/PartCrafterGui.java @@ -1,9 +1,9 @@ package mods.tinker.tconstruct.client.gui; -import mods.tinker.tconstruct.ToolMaterial; import mods.tinker.tconstruct.container.PartCrafterChestContainer; import mods.tinker.tconstruct.crafting.PatternBuilder; import mods.tinker.tconstruct.library.TConstructRegistry; +import mods.tinker.tconstruct.library.ToolMaterial; import mods.tinker.tconstruct.logic.PartCrafterLogic; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; diff --git a/mods/tinker/tconstruct/client/gui/SmelteryGui.java b/mods/tinker/tconstruct/client/gui/SmelteryGui.java index 7e0c23aa..663add65 100644 --- a/mods/tinker/tconstruct/client/gui/SmelteryGui.java +++ b/mods/tinker/tconstruct/client/gui/SmelteryGui.java @@ -13,7 +13,6 @@ import net.minecraft.network.packet.Packet250CustomPayload; import net.minecraft.util.Icon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.liquids.LiquidStack; import org.lwjgl.input.Mouse; diff --git a/mods/tinker/tconstruct/client/gui/ToolStationGui.java b/mods/tinker/tconstruct/client/gui/ToolStationGui.java index d529358a..9350adfe 100644 --- a/mods/tinker/tconstruct/client/gui/ToolStationGui.java +++ b/mods/tinker/tconstruct/client/gui/ToolStationGui.java @@ -3,10 +3,11 @@ package mods.tinker.tconstruct.client.gui; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; +import mods.tinker.tconstruct.library.client.ToolGuiElement; import mods.tinker.tconstruct.container.ToolStationContainer; -import mods.tinker.tconstruct.library.TConstructRegistry; import mods.tinker.tconstruct.library.ToolCore; import mods.tinker.tconstruct.library.Weapon; +import mods.tinker.tconstruct.library.client.TConstructClientRegistry; import mods.tinker.tconstruct.logic.ToolStationLogic; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiTextField; @@ -71,14 +72,14 @@ public class ToolStationGui extends GuiContainer int cornerY = (this.height - this.ySize) / 2; this.buttonList.clear(); - ToolGuiElement repair = TConstructRegistry.toolButtons.get(0); + ToolGuiElement repair = TConstructClientRegistry.toolButtons.get(0); GuiButtonTool repairButton = new GuiButtonTool(0, cornerX - 110, cornerY, repair.buttonIconX, repair.buttonIconY, repair.texture); // Repair repairButton.enabled = false; this.buttonList.add(repairButton); - for (int iter = 1; iter < TConstructRegistry.toolButtons.size(); iter++) + for (int iter = 1; iter < TConstructClientRegistry.toolButtons.size(); iter++) { - ToolGuiElement element = TConstructRegistry.toolButtons.get(iter); + ToolGuiElement element = TConstructClientRegistry.toolButtons.get(iter); GuiButtonTool button = new GuiButtonTool(iter, cornerX - 110 + 22 * (iter % 5), cornerY + 22 * (iter / 5), element.buttonIconX, element.buttonIconY, element.texture); // Repair this.buttonList.add(button); } @@ -90,7 +91,7 @@ public class ToolStationGui extends GuiContainer guiType = button.id; button.enabled = false; - ToolGuiElement element = TConstructRegistry.toolButtons.get(guiType); + ToolGuiElement element = TConstructClientRegistry.toolButtons.get(guiType); setSlotType(element.slotType); iconX = element.iconsX; iconY = element.iconsY; diff --git a/mods/tinker/tconstruct/crafting/PatternBuilder.java b/mods/tinker/tconstruct/crafting/PatternBuilder.java index 75d5fb62..104cbb12 100644 --- a/mods/tinker/tconstruct/crafting/PatternBuilder.java +++ b/mods/tinker/tconstruct/crafting/PatternBuilder.java @@ -6,8 +6,6 @@ import java.util.HashMap; import java.util.List; import mods.tinker.common.IPattern; -import mods.tinker.tconstruct.TContent; -import mods.tinker.tconstruct.items.Pattern; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -60,7 +58,7 @@ public class PatternBuilder if (toolPart != null) { - int patternValue = ((Pattern) pattern.getItem()).getPatternCost(pattern.getItemDamage()); + int patternValue = ((IPattern) pattern.getItem()).getPatternCost(pattern.getItemDamage()); int totalMaterial = key.value * material.stackSize; if (totalMaterial < patternValue) // Not enough material @@ -217,7 +215,7 @@ public class PatternBuilder registerFullMaterial(new ItemStack(material, 1, -1), value, key, shard, rod, materialID); } - public void registerFullMaterial (Block material, int value, String key, int materialID) + /*public void registerFullMaterial (Block material, int value, String key, int materialID) { registerFullMaterial(new ItemStack(material, 1, -1), value, key, new ItemStack(TContent.toolShard, 1, materialID), new ItemStack(TContent.toolRod, 1, materialID), materialID); } @@ -225,5 +223,5 @@ public class PatternBuilder public void registerFullMaterial (Item material, int value, String key, int materialID) { registerFullMaterial(new ItemStack(material, 1, -1), value, key, new ItemStack(TContent.toolShard, 1, materialID), new ItemStack(TContent.toolRod, 1, materialID), materialID); - } + }*/ } \ No newline at end of file diff --git a/mods/tinker/tconstruct/crafting/ToolBuilder.java b/mods/tinker/tconstruct/crafting/ToolBuilder.java index 45cdb48d..385c9af8 100644 --- a/mods/tinker/tconstruct/crafting/ToolBuilder.java +++ b/mods/tinker/tconstruct/crafting/ToolBuilder.java @@ -7,9 +7,9 @@ import java.util.List; import mods.tinker.common.IToolPart; import mods.tinker.common.ToolMod; -import mods.tinker.tconstruct.ToolMaterial; import mods.tinker.tconstruct.library.TConstructRegistry; import mods.tinker.tconstruct.library.ToolCore; +import mods.tinker.tconstruct.library.ToolMaterial; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -102,18 +102,11 @@ public class ToolBuilder if (accessory != -1) accessoryMat = TConstructRegistry.getMaterial(accessory); - //System.out.println("Head: "+headMat+" Handle: "+handleMat); int durability = (int) (headMat.durability() * handleMat.handleDurability() * item.getDurabilityModifier()); if (accessoryStack != null && (item.getHeadType() == 2 || item.getHeadType() == 3) ) durability = (int) ((headMat.durability() + accessoryMat.durability())/2 * handleMat.handleDurability() * item.getDurabilityModifier()); - { - /*Item accessoryItem = accessoryStack.getItem(); - if (accessoryItem instanceof ToolPart && ((ToolPart)accessoryItem).isHead) //Two heads - durability = (int) ((EnumMaterial.durability(head) + EnumMaterial.durability(accessory))/2 * EnumMaterial.handleDurability(handle) * item.getDurabilityModifier());*/ - } ItemStack tool = new ItemStack(item); - //System.out.println("Stack name: "+tool); NBTTagCompound compound = new NBTTagCompound(); compound.setCompoundTag("InfiTool", new NBTTagCompound()); compound.getCompoundTag("InfiTool").setInteger("Head", head); @@ -166,25 +159,6 @@ public class ToolBuilder return tool; } - - /*public ItemStack modifyTool (ItemStack input, ItemStack topSlot, ItemStack bottomSlot) - { - ItemStack tool = input.copy(); - NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); - tags.removeTag("Built"); - - for (ToolMod mod : toolMods) - { - ItemStack[] slots = new ItemStack[] {topSlot, bottomSlot}; - if (mod.matches(slots, tool)) - { - mod.modify(slots, tool); - mod.addMatchingEffect(tool); - } - } - - return tool; - }*/ public ItemStack modifyTool (ItemStack input, ItemStack topSlot, ItemStack bottomSlot) { diff --git a/mods/tinker/tconstruct/crafting/ToolRecipe.java b/mods/tinker/tconstruct/crafting/ToolRecipe.java index bfab5628..704a3bbd 100644 --- a/mods/tinker/tconstruct/crafting/ToolRecipe.java +++ b/mods/tinker/tconstruct/crafting/ToolRecipe.java @@ -1,6 +1,6 @@ package mods.tinker.tconstruct.crafting; -import mods.tinker.tconstruct.TContent; +import mods.tinker.tconstruct.library.TConstructRegistry; import mods.tinker.tconstruct.library.ToolCore; import net.minecraft.item.Item; @@ -31,14 +31,14 @@ public class ToolRecipe public boolean validHandle(Item handle) { - return (handle == TContent.toolRod || handle == Item.stick || handle == Item.bone); + return (handle == TConstructRegistry.toolRod || handle == Item.stick || handle == Item.bone); } public boolean validAccessory(Item acc) { if (accessory == null && acc == null) return true; - else if (accessory == TContent.toolRod) + else if (accessory == TConstructRegistry.toolRod) return validHandle(acc); else if (accessory == acc) return true; diff --git a/mods/tinker/tconstruct/items/CraftingItem.java b/mods/tinker/tconstruct/items/CraftingItem.java index c18c6a59..b09b9fba 100644 --- a/mods/tinker/tconstruct/items/CraftingItem.java +++ b/mods/tinker/tconstruct/items/CraftingItem.java @@ -2,7 +2,7 @@ package mods.tinker.tconstruct.items; import java.util.List; -import mods.tinker.tconstruct.TConstruct; +import mods.tinker.tconstruct.library.TConstructRegistry; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; @@ -21,7 +21,7 @@ public class CraftingItem extends Item public CraftingItem(int id, String[] names, String[] tex, String f) { super(id); - this.setCreativeTab(TConstruct.materialTab); + this.setCreativeTab(TConstructRegistry.materialTab); this.setMaxDamage(0); this.setHasSubtypes(true); textureNames = tex; diff --git a/mods/tinker/tconstruct/items/TitleIcon.java b/mods/tinker/tconstruct/items/TitleIcon.java index cc30e25e..90b6a4bf 100644 --- a/mods/tinker/tconstruct/items/TitleIcon.java +++ b/mods/tinker/tconstruct/items/TitleIcon.java @@ -1,9 +1,9 @@ package mods.tinker.tconstruct.items; import mods.tinker.tconstruct.client.TProxyClient; +import mods.tinker.tconstruct.library.ToolCore; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.item.Item; -import net.minecraft.util.Icon; public class TitleIcon extends Item { @@ -15,7 +15,7 @@ public class TitleIcon extends Item @Override public void updateIcons (IconRegister iconRegister) { - TProxyClient.blankSprite = iconRegister.registerIcon("tinker:blanksprite"); + ToolCore.blankSprite = iconRegister.registerIcon("tinker:blanksprite"); TProxyClient.metalBall = iconRegister.registerIcon("tinker:metalball"); iconIndex = iconRegister.registerIcon("tinker:tparts"); } diff --git a/mods/tinker/tconstruct/AbilityHelper.java b/mods/tinker/tconstruct/library/AbilityHelper.java similarity index 98% rename from mods/tinker/tconstruct/AbilityHelper.java rename to mods/tinker/tconstruct/library/AbilityHelper.java index 9e472adb..7801d012 100644 --- a/mods/tinker/tconstruct/AbilityHelper.java +++ b/mods/tinker/tconstruct/library/AbilityHelper.java @@ -1,4 +1,4 @@ -package mods.tinker.tconstruct; +package mods.tinker.tconstruct.library; import ic2.api.ICustomElectricItem; import ic2.api.IElectricItem; @@ -7,7 +7,7 @@ import java.util.Iterator; import java.util.List; import java.util.Random; -import mods.tinker.tconstruct.library.ToolCore; +import mods.tinker.common.PiercingEntityDamage; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.enchantment.EnchantmentHelper; @@ -248,7 +248,6 @@ public class AbilityHelper { int damage = tags.getCompoundTag("InfiTool").getInteger("Damage"); int damageTrue = damage + dam; - //System.out.println("Damaging tool, damageTrue "+damageTrue+", ignoring charge: "+ignoreCharge); int maxDamage = tags.getCompoundTag("InfiTool").getInteger("TotalDurability"); if (damage + dam <= 0) { diff --git a/mods/tinker/tconstruct/library/DualHarvestTool.java b/mods/tinker/tconstruct/library/DualHarvestTool.java index 9d165afd..b9a51c1f 100644 --- a/mods/tinker/tconstruct/library/DualHarvestTool.java +++ b/mods/tinker/tconstruct/library/DualHarvestTool.java @@ -1,6 +1,5 @@ package mods.tinker.tconstruct.library; -import mods.tinker.tconstruct.tools.HarvestTool; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.item.EntityItem; diff --git a/mods/tinker/tconstruct/tools/HarvestTool.java b/mods/tinker/tconstruct/library/HarvestTool.java similarity index 97% rename from mods/tinker/tconstruct/tools/HarvestTool.java rename to mods/tinker/tconstruct/library/HarvestTool.java index c0181903..ddf81cb4 100644 --- a/mods/tinker/tconstruct/tools/HarvestTool.java +++ b/mods/tinker/tconstruct/library/HarvestTool.java @@ -1,6 +1,5 @@ -package mods.tinker.tconstruct.tools; +package mods.tinker.tconstruct.library; -import mods.tinker.tconstruct.library.ToolCore; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.item.EntityItem; diff --git a/mods/tinker/tconstruct/library/TConstructRegistry.java b/mods/tinker/tconstruct/library/TConstructRegistry.java index 07414df3..3d78ec77 100644 --- a/mods/tinker/tconstruct/library/TConstructRegistry.java +++ b/mods/tinker/tconstruct/library/TConstructRegistry.java @@ -2,14 +2,8 @@ package mods.tinker.tconstruct.library; import java.util.ArrayList; import java.util.HashMap; -import java.util.Map; -import net.minecraft.item.ItemStack; - -import mods.tinker.tconstruct.ToolMaterial; -import mods.tinker.tconstruct.client.gui.ToolGuiElement; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.item.Item; /** A registry to store any relevant API work * @@ -20,9 +14,12 @@ public class TConstructRegistry { public static TConstructRegistry instance = new TConstructRegistry(); public static ArrayList tools = new ArrayList(20); - public static ArrayList toolButtons = new ArrayList(20); public static HashMap toolMaterials = new HashMap(60); - public static Map manualIcons = new HashMap(); + + public static TabTools toolTab; + public static TabTools materialTab; + public static TabTools blockTab; + public static Item toolRod; //Tools public static void addToolMapping (ToolCore tool) @@ -35,34 +32,18 @@ public class TConstructRegistry return tools; } - //Rendering - - //itemMap.updateIcons - - - /*public static void addMaterialRenderMapping(int materialID, String textureLocation) - { - for (ToolCore tool : TConstructRegistry.getToolMapping()) - { - tool.partTextures.put(materialID, textureLocation); - } - } - - public static void addEffectRenderMapping(int materialID, String textureLocation) - { - for (ToolCore tool : TConstructRegistry.getToolMapping()) - { - tool.effectTextures.put(materialID, textureLocation); - } - }*/ - //Materials public static void addToolMaterial (int materialID, String materialName, int craftingTier, int harvestLevel, int durability, int miningspeed, int attack, float handleModifier, int reinforced, float shoddy) + { + addToolMaterial(materialID, materialName, craftingTier, harvestLevel, durability, miningspeed, attack, handleModifier, reinforced, shoddy, "", ""); + } + + public static void addToolMaterial (int materialID, String materialName, int craftingTier, int harvestLevel, int durability, int miningspeed, int attack, float handleModifier, int reinforced, float shoddy, String style, String ability) { ToolMaterial mat = toolMaterials.get(materialID); if (mat == null) { - toolMaterials.put(materialID, new ToolMaterial(materialName, craftingTier, harvestLevel, durability, miningspeed, attack, handleModifier, reinforced, shoddy)); + toolMaterials.put(materialID, new ToolMaterial(materialName, craftingTier, harvestLevel, durability, miningspeed, attack, handleModifier, reinforced, shoddy, style, ability)); } else throw new RuntimeException("TConstruct material ID " + materialID + " is already occupied by " + mat.materialName); @@ -72,20 +53,4 @@ public class TConstructRegistry { return (toolMaterials.get(key)); } - - //Gui - public static void addToolButton (ToolGuiElement element) - { - toolButtons.add(element); - } - - public static void addToolButton (int slotType, int xButton, int yButton, int[] xIcons, int[] yIcons, String title, String body, String texture) - { - toolButtons.add(new ToolGuiElement(slotType, xButton, yButton, xIcons, yIcons, title, body, texture)); - } - - public static ArrayList getToolButtons () - { - return toolButtons; - } } diff --git a/mods/tinker/tconstruct/TabTools.java b/mods/tinker/tconstruct/library/TabTools.java similarity index 89% rename from mods/tinker/tconstruct/TabTools.java rename to mods/tinker/tconstruct/library/TabTools.java index feb47c65..ee08a100 100644 --- a/mods/tinker/tconstruct/TabTools.java +++ b/mods/tinker/tconstruct/library/TabTools.java @@ -1,4 +1,4 @@ -package mods.tinker.tconstruct; +package mods.tinker.tconstruct.library; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; diff --git a/mods/tinker/tconstruct/library/ToolCore.java b/mods/tinker/tconstruct/library/ToolCore.java index 471622b0..ebc12216 100644 --- a/mods/tinker/tconstruct/library/ToolCore.java +++ b/mods/tinker/tconstruct/library/ToolCore.java @@ -10,10 +10,6 @@ import java.util.Map; import java.util.Random; import mods.tinker.common.ToolMod; -import mods.tinker.tconstruct.AbilityHelper; -import mods.tinker.tconstruct.TConstruct; -import mods.tinker.tconstruct.TContent; -import mods.tinker.tconstruct.client.TProxyClient; import mods.tinker.tconstruct.crafting.ToolBuilder; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IconRegister; @@ -60,6 +56,7 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox { protected Random random = new Random(); protected int damageVsEntity; + public static Icon blankSprite; public ToolCore(int id, int baseDamage) { @@ -67,7 +64,7 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox this.maxStackSize = 1; this.setMaxDamage(100); this.setUnlocalizedName("InfiTool"); - this.setCreativeTab(TConstruct.toolTab); + this.setCreativeTab(TConstructRegistry.toolTab); damageVsEntity = baseDamage; TConstructRegistry.addToolMapping(this); } @@ -236,7 +233,7 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox } } - return TProxyClient.blankSprite; + return blankSprite; } /* Tags and information about the tool */ @@ -274,21 +271,24 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox list.add("\u00A7oBroken"); else { - int head = tags.getCompoundTag("InfiTool").getInteger("Head") + 1; - int handle = tags.getCompoundTag("InfiTool").getInteger("Handle") + 1; - int binding = tags.getCompoundTag("InfiTool").getInteger("Accessory") + 1; + int head = tags.getCompoundTag("InfiTool").getInteger("Head"); + int handle = tags.getCompoundTag("InfiTool").getInteger("Handle"); + int binding = tags.getCompoundTag("InfiTool").getInteger("Accessory"); String headName = getAbilityNameForType(head); if (!headName.equals("")) - list.add(getColorCodeForType(head) + headName); + list.add(getStyleForType(head) + headName); String handleName = getAbilityNameForType(handle); if (!handleName.equals("") && handle != head) - list.add(getColorCodeForType(handle) + handleName); + list.add(getStyleForType(handle) + handleName); - String bindingName = getAbilityNameForType(binding); - if (!bindingName.equals("") && binding != head && binding != handle) - list.add(getColorCodeForType(binding) + bindingName); + if (getPartAmount() >= 3) + { + String bindingName = getAbilityNameForType(binding); + if (!bindingName.equals("") && binding != head && binding != handle) + list.add(getStyleForType(binding) + bindingName); + } String reinforced = getReinforcedName(head, handle, binding); if (!reinforced.equals("")) @@ -313,99 +313,94 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox } } - public static String getColorCodeForType (int type) //TODO: unhardcode this + public static String getStyleForType (int type) { - String colorCode = "\u00A7"; - switch (type) - { - case 1: - return colorCode + "e"; //Wood - case 2: - return ""; //Stone - case 3: - return colorCode + "f"; //Iron - case 4: - return colorCode + "8"; //Flint - case 5: - return colorCode + "2"; //Cactus - case 6: - return colorCode + "e"; //Bone - case 7: - return colorCode + "d"; //Obsidian - case 8: - return colorCode + "4"; //Netherrack - case 9: - return colorCode + "a"; //Slime - case 10: - return colorCode + "f"; //Paper - case 11: - return colorCode + "3"; //Cobalt - case 12: - return colorCode + "4"; //Ardite - case 13: - return colorCode + "5"; //Manyullyn - case 14: - return colorCode + "c"; //Copper - case 15: - return colorCode + "6"; //Bronze - } - return colorCode; + return TConstructRegistry.getMaterial(type).style(); } - public String getAbilityNameForType (int type)//TODO: unhardcode this + public String getAbilityNameForType (int type) { - switch (type) - { - case 1: - return ""; //Wood - case 2: - return "Shoddy"; //Stone - case 3: - return ""; //Iron - case 4: - return "Shoddy"; //Flint - case 5: - return "Spiny"; //Cactus - case 6: - return ""; //Bone - case 7: - return ""; //Obsidian - case 8: - return "Shoddy"; //Netherrack - case 9: - return ""; //Slime - case 10: - return "Writable"; //Paper - case 11: - return ""; //Cobalt - case 12: - return ""; //Ardite - case 13: - return "Awareness"; //Manyullyn - case 14: - return ""; //Copper - case 15: - return ""; //Bronze - default: - return ""; - } + return TConstructRegistry.getMaterial(type).ability(); } - //This method is temporary - public static String getReinforcedName (int head, int handle, int accessory) //TODO: unhardcode this + public String getReinforcedName (int head, int handle, int accessory) { - if (head == 7 || handle == 7 || accessory == 7) - return "\u00A7dReinforced III"; - else if (head == 11 || handle == 11 || accessory == 11) - return "\u00A73Reinforced II"; - else if (head == 3 || handle == 3 || accessory == 3) - return "\u00A7fReinforced I"; - else if (head == 15 || handle == 15 || accessory == 15) - return "\u00A76Reinforced I"; + ToolMaterial headMat = TConstructRegistry.getMaterial(head); + ToolMaterial handleMat = TConstructRegistry.getMaterial(handle); + ToolMaterial accessoryMat = TConstructRegistry.getMaterial(accessory); + + int reinforced = 0; + String style = ""; + int current = headMat.reinforced(); + if (current > 0) + { + style = headMat.style(); + reinforced = current; + } + current = handleMat.reinforced(); + if (current > 0 && current > reinforced) + { + style = handleMat.style(); + reinforced = current; + } + if (getPartAmount() >= 3) + { + current = accessoryMat.reinforced(); + if (current > 0 && current > reinforced) + { + style = accessoryMat.style(); + reinforced = current; + } + } + + if (reinforced > 0) + { + return style + getReinforcedString(reinforced); + } return ""; } - static String[] toolMaterialNames = { "Wooden ", "Stone ", "Iron ", "Flint ", "Cactus ", "Bone ", "Obsidian ", "Nethrrack ", "Slime ", "Paper ", "Cobalt ", "Ardite ", "Manyullyn ", "Copper ", "Bronze ", "Alumite ", "Steel " }; + String getReinforcedString (int reinforced) + { + String ret = "Reinforced "; + switch (reinforced) + { + case 1: + ret += "I"; + break; + case 2: + ret += "II"; + break; + case 3: + ret += "III"; + break; + case 4: + ret += "IV"; + break; + case 5: + ret += "V"; + break; + case 6: + ret += "VI"; + break; + case 7: + ret += "VII"; + break; + case 8: + ret += "VIII"; + break; + case 9: + ret += "IX"; + break; + default: + ret += "X"; + break; + } + return ret; + } + + static String[] toolMaterialNames = { "Wooden ", "Stone ", "Iron ", "Flint ", "Cactus ", "Bone ", "Obsidian ", "Nethrrack ", "Slime ", "Paper ", "Cobalt ", "Ardite ", "Manyullyn ", "Copper ", + "Bronze ", "Alumite ", "Steel " }; /* Creative mode tools */ public void getSubItems (int id, CreativeTabs tab, List list) @@ -426,7 +421,7 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox protected Item getHandleItem () { - return TContent.toolRod; + return TConstructRegistry.toolRod; } public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5) @@ -487,8 +482,6 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox @Override public boolean hitEntity (ItemStack stack, EntityLiving mob, EntityLiving player) { - //AbilityHelper.hitEntity(stack, mob, player); - //AbilityHelper.damageTool(stack, 1, player, false); return true; } @@ -531,7 +524,7 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox return 1f; } - public int getDamageVsEntity (Entity par1Entity) //Redundant + public int getDamageVsEntity (Entity par1Entity) { return this.damageVsEntity; } @@ -603,7 +596,7 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox public int charge (ItemStack stack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate) { NBTTagCompound tags = stack.getTagCompound(); - if (!tags.hasKey("charge")) //|| !tags.getCompoundTag("InfiTool").getBoolean("Electric")) + if (!tags.hasKey("charge")) return 0; if (amount > 0) @@ -639,7 +632,7 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox public int discharge (ItemStack stack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate) { NBTTagCompound tags = stack.getTagCompound(); - if (!tags.hasKey("charge"))// || !tags.getCompoundTag("InfiTool").getBoolean("Electric")) + if (!tags.hasKey("charge")) return 0; if (amount > 0) diff --git a/mods/tinker/tconstruct/ToolMaterial.java b/mods/tinker/tconstruct/library/ToolMaterial.java similarity index 57% rename from mods/tinker/tconstruct/ToolMaterial.java rename to mods/tinker/tconstruct/library/ToolMaterial.java index ba90d58a..5add17ad 100644 --- a/mods/tinker/tconstruct/ToolMaterial.java +++ b/mods/tinker/tconstruct/library/ToolMaterial.java @@ -1,28 +1,10 @@ -package mods.tinker.tconstruct; +package mods.tinker.tconstruct.library; /** * This class is temporary. A full material registry is planned */ public class ToolMaterial -{ - /*Wood (0, 59, 200, 0, 1.0F, 0, 0), - Stone (1, 131, 400, 1, 0.5F, 0, 1f), - Iron (2, 250, 600, 2, 1.3F, 1, 0), - Flint (1, 171, 525, 2, 0.7F, 0, 1f), - Cactus (1, 150, 500, 2, 1.0F, 0, -1f), - Bone (1, 200, 500, 2, 1.0F, 0, 0), - Obsidian (3, 89, 700, 2, 0.8F, 3, 0), - Netherrack (2, 131, 400, 1, 1.2F, 0, 1f), - Slime (3, 1500, 150, 0, 5.0F, 0, 0), - Paper (0, 131, 200, 0, 0.1F, 0, 0), - Cobalt (4, 800, 800, 3, 1.8F, 2, 0), - Ardite (4, 800, 800, 3, 1.8F, 0, 0), - Manyullyn (5, 1200, 1000, 4, 2.5F, 0, 0), - Copper (1, 180, 500, 2, 1.15F, 0, 0), - Bronze (2, 250, 600, 2, 1.3F, 1, 0), - Demonite (5, 1790, 900, 5, 1.66F, 0, 0), - Holyshell (5, 1000, 700, 1, 1.5F, 0, 0);*/ - - //mining level, durability, mining speed, baseDamage, handle modifier, Reinforced level, shoddy/spiny level +{ + //mining level, durability, mining speed, baseDamage, handle modifier, Reinforced level, shoddy/spiny level, color/style on name public final String materialName; public final int craftingTier; @@ -33,18 +15,27 @@ public class ToolMaterial public final float handleModifier; public final int reinforced; public final float shoddy; + public final String tipStyle; + public final String ability; + + public ToolMaterial(String name, int tier, int level, int durability, int speed, int damage, float handle, int reinforced, float shoddy) + { + this(name, reinforced, reinforced, reinforced, reinforced, reinforced, shoddy, reinforced, shoddy, "", ""); + } - public ToolMaterial(String name, int tier, int level, int dur, int speed, int damage, float handle, int unb, float shd) + public ToolMaterial(String name, int tier, int level, int durability, int speed, int damage, float handle, int reinforced, float shoddy, String style, String ability) { this.materialName = name; this.craftingTier = tier; this.harvestLevel = level; - this.durability = dur; + this.durability = durability; this.miningspeed = speed; this.attack = damage; this.handleModifier = handle; - this.reinforced = unb; - this.shoddy = shd; + this.reinforced = reinforced; + this.shoddy = shoddy; + this.tipStyle = style; + this.ability = ability; } public String name() @@ -91,4 +82,15 @@ public class ToolMaterial { return this.shoddy; } + + public String style() + { + System.out.println("Style: "+this.tipStyle); + return this.tipStyle; + } + + public String ability() + { + return this.ability; + } } diff --git a/mods/tinker/tconstruct/library/TConstructClientRegistry.java b/mods/tinker/tconstruct/library/client/TConstructClientRegistry.java similarity index 68% rename from mods/tinker/tconstruct/library/TConstructClientRegistry.java rename to mods/tinker/tconstruct/library/client/TConstructClientRegistry.java index e89b78de..277cbbfd 100644 --- a/mods/tinker/tconstruct/library/TConstructClientRegistry.java +++ b/mods/tinker/tconstruct/library/client/TConstructClientRegistry.java @@ -1,13 +1,17 @@ -package mods.tinker.tconstruct.library; +package mods.tinker.tconstruct.library.client; +import java.util.ArrayList; import java.util.HashMap; import java.util.Map; +import mods.tinker.tconstruct.library.TConstructRegistry; +import mods.tinker.tconstruct.library.ToolCore; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public class TConstructClientRegistry { + public static ArrayList toolButtons = new ArrayList(20); public static Map manualIcons = new HashMap(); public static ItemStack defaultStack = new ItemStack(Item.ingotIron); @@ -52,4 +56,20 @@ public class TConstructClientRegistry return stack; return defaultStack; } + + //Gui + public static void addToolButton (ToolGuiElement element) + { + toolButtons.add(element); + } + + public static void addToolButton (int slotType, int xButton, int yButton, int[] xIcons, int[] yIcons, String title, String body, String texture) + { + toolButtons.add(new ToolGuiElement(slotType, xButton, yButton, xIcons, yIcons, title, body, texture)); + } + + public static ArrayList getToolButtons () + { + return toolButtons; + } } diff --git a/mods/tinker/tconstruct/client/gui/ToolGuiElement.java b/mods/tinker/tconstruct/library/client/ToolGuiElement.java similarity index 94% rename from mods/tinker/tconstruct/client/gui/ToolGuiElement.java rename to mods/tinker/tconstruct/library/client/ToolGuiElement.java index 81e69e8f..fffbf931 100644 --- a/mods/tinker/tconstruct/client/gui/ToolGuiElement.java +++ b/mods/tinker/tconstruct/library/client/ToolGuiElement.java @@ -1,4 +1,4 @@ -package mods.tinker.tconstruct.client.gui; +package mods.tinker.tconstruct.library.client; public class ToolGuiElement { diff --git a/mods/tinker/tconstruct/player/TPlayerHandler.java b/mods/tinker/tconstruct/player/TPlayerHandler.java index 6434856d..b005fb6d 100644 --- a/mods/tinker/tconstruct/player/TPlayerHandler.java +++ b/mods/tinker/tconstruct/player/TPlayerHandler.java @@ -4,10 +4,10 @@ import java.lang.ref.WeakReference; import java.util.HashMap; import java.util.Random; -import mods.tinker.tconstruct.AbilityHelper; import mods.tinker.tconstruct.PHConstruct; import mods.tinker.tconstruct.TContent; import mods.tinker.tconstruct.client.TProxyClient; +import mods.tinker.tconstruct.library.AbilityHelper; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; diff --git a/mods/tinker/tconstruct/tools/Axe.java b/mods/tinker/tconstruct/tools/Axe.java index d119dd00..ab5a3cf4 100644 --- a/mods/tinker/tconstruct/tools/Axe.java +++ b/mods/tinker/tconstruct/tools/Axe.java @@ -1,7 +1,8 @@ package mods.tinker.tconstruct.tools; -import mods.tinker.tconstruct.AbilityHelper; import mods.tinker.tconstruct.TContent; +import mods.tinker.tconstruct.library.AbilityHelper; +import mods.tinker.tconstruct.library.HarvestTool; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.EntityLiving; diff --git a/mods/tinker/tconstruct/tools/FryingPan.java b/mods/tinker/tconstruct/tools/FryingPan.java index f86c7076..2b0a1629 100644 --- a/mods/tinker/tconstruct/tools/FryingPan.java +++ b/mods/tinker/tconstruct/tools/FryingPan.java @@ -1,7 +1,7 @@ package mods.tinker.tconstruct.tools; -import mods.tinker.tconstruct.AbilityHelper; import mods.tinker.tconstruct.TContent; +import mods.tinker.tconstruct.library.AbilityHelper; import mods.tinker.tconstruct.library.Weapon; import mods.tinker.tconstruct.logic.EquipLogic; import net.minecraft.entity.EntityLiving; diff --git a/mods/tinker/tconstruct/tools/Hammer.java b/mods/tinker/tconstruct/tools/Hammer.java index 0d1e6640..13ea6459 100644 --- a/mods/tinker/tconstruct/tools/Hammer.java +++ b/mods/tinker/tconstruct/tools/Hammer.java @@ -2,14 +2,9 @@ package mods.tinker.tconstruct.tools; import java.util.ArrayList; -import mods.tinker.tconstruct.AbilityHelper; -import net.minecraft.block.Block; +import mods.tinker.tconstruct.library.HarvestTool; import net.minecraft.block.material.Material; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; public class Hammer extends HarvestTool { diff --git a/mods/tinker/tconstruct/tools/LumberAxe.java b/mods/tinker/tconstruct/tools/LumberAxe.java index 5b3151a7..f9aad8f6 100644 --- a/mods/tinker/tconstruct/tools/LumberAxe.java +++ b/mods/tinker/tconstruct/tools/LumberAxe.java @@ -2,8 +2,9 @@ package mods.tinker.tconstruct.tools; import java.util.List; -import mods.tinker.tconstruct.AbilityHelper; import mods.tinker.tconstruct.TContent; +import mods.tinker.tconstruct.library.AbilityHelper; +import mods.tinker.tconstruct.library.HarvestTool; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; diff --git a/mods/tinker/tconstruct/tools/Mattock.java b/mods/tinker/tconstruct/tools/Mattock.java index ccb3cad9..67d0db43 100644 --- a/mods/tinker/tconstruct/tools/Mattock.java +++ b/mods/tinker/tconstruct/tools/Mattock.java @@ -1,7 +1,7 @@ package mods.tinker.tconstruct.tools; -import mods.tinker.tconstruct.AbilityHelper; import mods.tinker.tconstruct.TContent; +import mods.tinker.tconstruct.library.AbilityHelper; import mods.tinker.tconstruct.library.DualHarvestTool; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; diff --git a/mods/tinker/tconstruct/tools/Pickaxe.java b/mods/tinker/tconstruct/tools/Pickaxe.java index 488e0b16..b50cd8db 100644 --- a/mods/tinker/tconstruct/tools/Pickaxe.java +++ b/mods/tinker/tconstruct/tools/Pickaxe.java @@ -1,6 +1,7 @@ package mods.tinker.tconstruct.tools; import mods.tinker.tconstruct.TContent; +import mods.tinker.tconstruct.library.HarvestTool; import net.minecraft.block.material.Material; import net.minecraft.item.Item; diff --git a/mods/tinker/tconstruct/tools/Rapier.java b/mods/tinker/tconstruct/tools/Rapier.java index ba9ab393..d7b6b8e9 100644 --- a/mods/tinker/tconstruct/tools/Rapier.java +++ b/mods/tinker/tconstruct/tools/Rapier.java @@ -1,7 +1,7 @@ package mods.tinker.tconstruct.tools; -import mods.tinker.tconstruct.AbilityHelper; import mods.tinker.tconstruct.TContent; +import mods.tinker.tconstruct.library.AbilityHelper; import mods.tinker.tconstruct.library.Weapon; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; diff --git a/mods/tinker/tconstruct/tools/Shovel.java b/mods/tinker/tconstruct/tools/Shovel.java index 7ba027c7..926f7abd 100644 --- a/mods/tinker/tconstruct/tools/Shovel.java +++ b/mods/tinker/tconstruct/tools/Shovel.java @@ -1,12 +1,9 @@ package mods.tinker.tconstruct.tools; import mods.tinker.tconstruct.TContent; -import mods.tinker.tconstruct.client.TProxyClient; +import mods.tinker.tconstruct.library.HarvestTool; import net.minecraft.block.material.Material; import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.Icon; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; diff --git a/test/XinStick.java b/test/XinStick.java index 462b2f8e..863ff55f 100644 --- a/test/XinStick.java +++ b/test/XinStick.java @@ -1,6 +1,5 @@ package test; -import mods.tinker.tconstruct.entity.BlueSlime; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; @@ -28,7 +27,7 @@ public class XinStick extends Item //spawnItem(player.posX, player.posY, player.posZ, tool, world); //CartEntity cart = new CartEntity(world, 1); //cart.cartType = 1; - spawnEntity(player.posX, player.posY+1, player.posZ, new BlueSlime(world), world, player); + //spawnEntity(player.posX, player.posY+1, player.posZ, new BlueSlime(world), world, player); return stack; }