diff --git a/resources/manuals/diary.xml b/resources/manuals/diary.xml new file mode 100644 index 00000000..70b9c0e5 --- /dev/null +++ b/resources/manuals/diary.xml @@ -0,0 +1,148 @@ + + + + +Tinker's Log #1: + +Today is a new day. I finally left home and decided to wander around in the wilderness until I find a good place to call my home. + +Tinker's Log #2: + +I've decided to keep a log of my creations and machinations, as well as some insights into what I'm doing. I haven't actually built anything yet. There is a small cave I can board up for the night. I created a stone pickaxe affectionately called "Betsy". + +Tinker's Log #3: + +The night is scary. Creepers are everywhere, the zombies are banging on my door, bats block out the sky... it is not fun being alone out here. I want to hide in the corner and cry until they leave. This log doesn't help take my mind off of anything. + + + +Tinker's Log #4: + +Betsy didn't last long. She just crumpled into dust suddenly and the handle shattered. My parents told me this would happen and this was normal, but it still seems so wrong. If I could make the pickaxe a little better perhaps, maybe I could repair it. + +Tinker's Log #5: + +I've spent the past three days looking for paper and ink. Squids were easy enough to find, but the sugar cane was buried deep in a ravine next to a creeper nest. Eventually I dropped rocks on the creepers and watched them explode out of surprise. My eyebrow will grow back in time. + + + +Tinker's Log #6: +Waiting on sugar cane to grow. Not much else today. + + + +Tinker's Log #7: + +I've sketched out plans for a new workbench. It's a little strange. The center of the workbench is missing, but sturdy, and there are grooves in the top for supplies. I think I will call it a "table". + +Tinker's Log #8: + +I made a few more tables with different patterns in them. They look useful for different things, so I put different materials and tools by each one. Perhaps I will come up with a use for them in time. + + + +Tinker's Log #9: + +To make tools, you need to know what you're making. The pickaxe and shovel are easy enough to make with practice, the best crafters in my village told me, but I can't seem to make any good ones. Out of frustration I punched a hole in a wooden board. And another. And a few more. By the end I had something that resembled an axe, and that gave me a few ideas... + +Tinker's Log #10: + +I punched holes in a few boards carefully in different shapes. I spent a lot of time making them, so they look really good. They all resemble the parts of tools that I can remember: heads, handles, bindings, pieces, and some others. They look really useful, so I placed them by a table for later. + + + +Tinker's Log #11: + +I grabbed a few of the boards and started to make tool parts using them as an outline. The parts themselves feel sturdy, and when I put them together the end result felt a lot better than Betsy did. They're made completely out of stone, something even the finest crafters could never manage. This feels like a great accomplishment. + +Tinker's Log #12: + +Perhaps making a tool completely out of stone wasn't the best idea. It didn't last very long. On the upside, instead of shattering into dust only the tip scratched off. I glued a new tip on the head and it seemed good as new. + + + +Tinker's Log #13: + +I wanted to make a few more tools, but the boards with tool shapes in them went everywhere! I ended up breaking a few out of frustration. They don't fit very well in my chest either. I took a few of them, added a few slots to the bottom of the chest, placed it by my table and called it good. + +I also named them "Patterns", the chest a "Pattern Chest". I'm still angry at them, and it took so long to make new ones... + + + +Tinker's Log #14 + +Today I learned just how hard it was to shape iron. First you have to dig it out of the earth. A wooden pickaxe will break the ore; this I found out the hard way. Once you do get that ore there isn't much to do with it besides throw it in the furnace. Melting the iron and the stone seems inefficient, but I do need the metal more than I care about the waste. + +I shaped a few of the bars into tools, and they felt strong. Much stronger, in fact, than the ones back at the village. I've named the pickaxe "Krug" after some of the stories Nana used to tell me at night. How I miss her... + + + +Tinker's Log #15: + +This place holds little for me now. I've packed up my things, grabbed what resources I can carry, and set off. The tables and patterns will have to stay behind. I can't possibly carry them with all the food I have. + +Tinker's Log #16: + +A week later and I've finally found some others to visit. Some of them seem nice, most don't look like me. A few of them have things I never could have dreamed of. They've pointed me at a patch of land that was quiet and secluded. There I should be able to work, for I have ideas from the journey. + + + +Tinker's Log #17: + +After three days and nights of fending off zombies, I've finally created a house. It has a few rooms, a basement, but most importantly a workshop. All of the tables and patterns I had before are here, as well as a few others I wanted to try out from the trip. + +There's a round one I can cook food with and one that's just as good as any hoe, but can chop trees or actually dig the ground up. The villagers tell me these are named "Frying Pan" and "Mattock". The Frying Pan seems heavy enough to smack creepers with. I have a sword named "Shimmer" that I want to alter somehow. + + + +Tinker's Log #18: + +One of the villagers was kind enough to give me some random things. Each one looks useful in their own right. I was lucky enough to find a few diamonds earlier, and I have a few more tools in storage. This should be fun. + + + +Tinker's Log #19: + +After some heavy experimentation, I've ended up with some things that look amazing and others that look less useful than they actually are. A diamond tip on a pickaxe makes for a wondefully hard mining tool, and an emerald on a sword hilt somehow makes it stay together longer, but some things don't do anything. + +Adding flowers to a tool does nothing; they don't even stay on the thing. Mushrooms have a similar effect, and adding more material to a tool just makes it heavier. You wouldn't think redstone would do anything. I've coated a shovel so much that it looks deep red. However, it slides through dirt as if the dirt wasn't there. + +Moss is also a strange one. Somehow it seems to be healing the tool, even to the point where it looks like new. + + + +Tinker's Log #20: + +I tried to make some tools out of gold, like the crafters in my village used to, but instead it broke the table. Some of the villages laughed at me for such an idea... if only they knew. + +Tinker's Log #21: + +Some of these tools are more useful than I thought. Adding blaze powder to a weapon seems to give it some kind of burning effect. Lapis has this strange quality of being able to find more materials in the same area, even if I know exactly what I'm looking at. + + + +Tinker's Log #22: + +I have some ideas for creating tools, but for that I need a large place to create them. The furnace is inadequate, and I need a lot of stone. Combining lava with coal and netherrack seems to instantly cook stone as I mine it, up to the point where I can bypass the furnace entirely. + + + +Tinker's Log #23: + +Today I made something strange. It's round, wooden, and doesn't look like anything I've ever seen. Someone came by and said it was a "wheel" and that they were great fun to roll around. I wonder what else it could be used for? + +Tinker's Log #24: + +I made a few more of the wheels to get some practice in. I had some fun rolling them around, rolling them in pairs, and then one ended up beside my boat. It just looked so natural I had to start putting them together. + + + +Tinker's Log #25: + +I think I'm on to something here. Combining the boat with the wheel made it work something like a minecart, only I can pull it around places. It feels a little small though. + +Tinker's Log #26: + +I have all these tools laying around with little notes on what each one does. Instead of leaving them scattered about, I think I will create one place to store them. + + \ No newline at end of file diff --git a/resources/tinkertextures/gui/book.png b/resources/tinkertextures/gui/book.png new file mode 100644 index 00000000..e1457b81 Binary files /dev/null and b/resources/tinkertextures/gui/book.png differ diff --git a/resources/tinkertextures/gui/bookleft.png b/resources/tinkertextures/gui/bookleft.png new file mode 100644 index 00000000..fb7c2229 Binary files /dev/null and b/resources/tinkertextures/gui/bookleft.png differ diff --git a/resources/tinkertextures/gui/bookright.png b/resources/tinkertextures/gui/bookright.png new file mode 100644 index 00000000..a0a179c0 Binary files /dev/null and b/resources/tinkertextures/gui/bookright.png differ diff --git a/resources/tinkertextures/materials.png b/resources/tinkertextures/materials.png index a309fe0c..1f23e5e0 100644 Binary files a/resources/tinkertextures/materials.png and b/resources/tinkertextures/materials.png differ diff --git a/tinker/tconstruct/AbilityHelper.java b/tinker/tconstruct/AbilityHelper.java index fead24bc..cb110357 100644 --- a/tinker/tconstruct/AbilityHelper.java +++ b/tinker/tconstruct/AbilityHelper.java @@ -215,7 +215,7 @@ public class AbilityHelper player.addStat(StatList.damageDealtStat, damage); - if (fireAspect > 0 && causedDamage) + if ((fireAspect > 0 || toolTags.hasKey("Fiery")) && causedDamage) { fireAspect *= 4; if (toolTags.hasKey("Fiery")) diff --git a/tinker/tconstruct/PHConstruct.java b/tinker/tconstruct/PHConstruct.java index 1e93340d..0a02742d 100644 --- a/tinker/tconstruct/PHConstruct.java +++ b/tinker/tconstruct/PHConstruct.java @@ -49,13 +49,12 @@ public class PHConstruct { searedBrick = config.getBlock("Seared Brick", 1477).getInt(1477); axle = config.getBlock("Axle", 1478).getInt(1478); + manual = config.getItem("Patterns and Misc", "Tinker's Manual", 14018).getInt(14018); blankPattern = config.getItem("Patterns and Misc", "Blank Patterns", 14019).getInt(14019); materials = config.getItem("Patterns and Misc", "Materials", 14020).getInt(14020); toolRod = config.getItem("Patterns and Misc", "Tool Rod", 14021).getInt(14021); toolShard = config.getItem("Patterns and Misc", "Tool Shard", 14022).getInt(14022); woodPattern = config.getItem("Patterns and Misc", "Wood Pattern", 14023).getInt(14023); - //stonePattern = config.getItem("Patterns and Misc", "Stone Pattern", 14024).getInt(14024); - //netherPattern = config.getItem("Patterns and Misc", "Nether Pattern", 14025).getInt(14025); pickaxeHead = config.getItem("Tool Parts", "Pickaxe Head", 14026).getInt(14026); shovelHead = config.getItem("Tool Parts", "Shovel Head", 14027).getInt(14027); @@ -108,8 +107,8 @@ public class PHConstruct { public static int toolRod; public static int toolShard; public static int woodPattern; - //public static int stonePattern; - //public static int netherPattern; + + public static int manual; //Tools public static int pickaxe; diff --git a/tinker/tconstruct/TConstruct.java b/tinker/tconstruct/TConstruct.java index 8abe3c9e..04467c97 100644 --- a/tinker/tconstruct/TConstruct.java +++ b/tinker/tconstruct/TConstruct.java @@ -28,7 +28,7 @@ import cpw.mods.fml.common.network.NetworkRegistry; * @author: mDiyo */ -@Mod(modid = "TConstruct", name = "TConstruct", version = "mc1.4.7_1.0.7") +@Mod(modid = "TConstruct", name = "TConstruct", version = "1.4.7_1.1.0") @NetworkMod(serverSideRequired = false, clientSideRequired = true, channels={"TConstruct"}, packetHandler = tinker.tconstruct.TConstructPacketHandler.class) public class TConstruct { @@ -63,6 +63,7 @@ public class TConstruct { proxy.addNames(); proxy.registerRenderer(); + proxy.readManuals(); content.modIntegration(); ArrayList copperIngots = OreDictionary.getOres("ingotCopper"); diff --git a/tinker/tconstruct/TConstructContent.java b/tinker/tconstruct/TConstructContent.java index 7b15f8d1..7054c986 100644 --- a/tinker/tconstruct/TConstructContent.java +++ b/tinker/tconstruct/TConstructContent.java @@ -1,5 +1,10 @@ package tinker.tconstruct; +import java.io.File; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.Item; @@ -8,6 +13,12 @@ import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.oredict.ShapedOreRecipe; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + import tinker.common.IPattern; import tinker.tconstruct.blocks.EquipBlock; import tinker.tconstruct.blocks.TConstructBlock; @@ -18,6 +29,7 @@ import tinker.tconstruct.crafting.ToolBuilder; import tinker.tconstruct.items.CraftingItem; import tinker.tconstruct.items.Materials; import tinker.tconstruct.items.Pattern; +import tinker.tconstruct.items.PatternManual; import tinker.tconstruct.items.ToolPart; import tinker.tconstruct.modifiers.ModBlaze; import tinker.tconstruct.modifiers.ModBoolean; @@ -51,6 +63,8 @@ public class TConstructContent implements IFuelHandler public static Item toolRod; public static Item toolShard; public static Item woodPattern; + + public static Item manualBook; //public static Item stonePattern; //public static Item netherPattern; @@ -109,7 +123,7 @@ public class TConstructContent implements IFuelHandler setupToolTabs(); addToolButtons(); GameRegistry.registerFuelHandler(this); - } + } void createEntities () { @@ -156,6 +170,8 @@ public class TConstructContent implements IFuelHandler //stonePattern = new Pattern(PHTools.stonePattern, 64, patternTexture).setItemName("tconstruct.Pattern"); //netherPattern = new Pattern(PHTools.netherPattern, 128, patternTexture).setItemName("tconstruct.Pattern"); + manualBook = new PatternManual(PHConstruct.manual); + pickaxe = new Pickaxe(PHConstruct.pickaxe, pickaxeTexture); shovel = new Shovel(PHConstruct.shovel, shovelTexture); axe = new Axe(PHConstruct.axe, axeTexture); @@ -202,7 +218,7 @@ public class TConstructContent implements IFuelHandler { for (ToolCore tool : TConstructRegistry.getToolMapping()) { - tool.partTextures.put(materialID, tool.getTextureFile() + partialLocation); + tool.partTextures.put(materialID, tool.getToolTextureFile() + partialLocation); } } @@ -210,28 +226,28 @@ public class TConstructContent implements IFuelHandler { for (ToolCore tool : TConstructRegistry.getToolMapping()) { - tool.effectTextures.put(materialID, tool.getTextureFile() + partialLocation); + tool.effectTextures.put(materialID, tool.getToolTextureFile() + partialLocation); } } 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, 500, 2, 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, 131, 200, 0, 0.1F, 0, 0f); - TConstructRegistry.addToolMaterial(10, "Cobalt", 2, 4, 800, 800, 3, 1.8F, 2, 0f); - TConstructRegistry.addToolMaterial(11, "Ardite", 2, 4, 800, 800, 3, 1.8F, 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(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, 500, 2, 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, 131, 200, 0, 0.1F, 0, 0f); + TConstructRegistry.addToolMaterial(10, "Cobalt", 2, 4, 800, 800, 3, 1.8F, 2, 0f); + TConstructRegistry.addToolMaterial(11, "Ardite", 2, 4, 800, 800, 3, 1.8F, 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); + PatternBuilder pb = PatternBuilder.instance; pb.registerFullMaterial(Block.planks, 2, "Wood", new ItemStack(Item.stick), new ItemStack(Item.stick), 0); pb.registerFullMaterial(Block.stone, 2, "Stone", 1); @@ -308,6 +324,7 @@ public class TConstructContent implements IFuelHandler GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(woodCrafter, 1, 10), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', "plankWood")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blankPattern, 1, 0), "ps", "sp", 'p', "plankWood", 's', Item.stick)); + GameRegistry.addRecipe(new ItemStack(manualBook), "wp", 'w', new ItemStack(blankPattern, 1, 0), 'p', Item.paper); /*GameRegistry.addRecipe(new ItemStack(stonePattern, 1, 0), "ps", "sp", 'p', Block.cobblestone, 's', new ItemStack(toolRod, 1, 1)); GameRegistry.addRecipe(new ItemStack(stonePattern, 1, 0), "ps", "sp", 'p', Block.stone, 's', new ItemStack(toolRod, 1, 1)); GameRegistry.addRecipe(new ItemStack(netherPattern, 1, 0), "ps", "sp", 'p', Block.netherrack, 's', new ItemStack(toolRod, 1, 7));*/ @@ -412,7 +429,7 @@ public class TConstructContent implements IFuelHandler modE.circuits.add(electronicCircuit); /* Thaumcraft */ - Object obj = getItem("itemResource", "thaumcraft.common.Config"); + //Object obj = getItem("itemResource", "thaumcraft.common.Config"); } public static Object getItem (String name, String classPackage) diff --git a/tinker/tconstruct/TConstructGuiHandler.java b/tinker/tconstruct/TConstructGuiHandler.java index e223d287..8bd605d1 100644 --- a/tinker/tconstruct/TConstructGuiHandler.java +++ b/tinker/tconstruct/TConstructGuiHandler.java @@ -5,6 +5,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import tinker.common.InventoryLogic; import tinker.tconstruct.client.gui.FrypanGui; +import tinker.tconstruct.client.gui.GuiManual; import tinker.tconstruct.client.gui.PartCrafterGui; import tinker.tconstruct.client.gui.PatternChestGui; import tinker.tconstruct.client.gui.PatternShaperGui; @@ -27,10 +28,13 @@ public class TConstructGuiHandler implements IGuiHandler public static int frypanID = 4; public static int smeltery = 7; + public static int manualGui = -1; @Override public Object getServerGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z) { + if (ID < 0) + return null; TileEntity tile = world.getBlockTileEntity(x, y, z); if (tile != null && tile instanceof InventoryLogic) @@ -53,6 +57,8 @@ public class TConstructGuiHandler implements IGuiHandler return new SmelteryGui(player.inventory, (SmelteryLogic) world.getBlockTileEntity(x, y, z), world, x, y, z); if (ID == pshaperID) return new PatternShaperGui(player.inventory, (PatternShaperLogic) world.getBlockTileEntity(x, y, z), world, x, y, z); + if (ID == manualGui) + return new GuiManual(player.getCurrentEquippedItem()); return null; } diff --git a/tinker/tconstruct/TProxyCommon.java b/tinker/tconstruct/TProxyCommon.java index 5b0387ba..856ce884 100644 --- a/tinker/tconstruct/TProxyCommon.java +++ b/tinker/tconstruct/TProxyCommon.java @@ -14,6 +14,8 @@ public class TProxyCommon /* Ties an internal name to a visible one. Does nothing server-side */ public void addNames() {} + public void readManuals() {} + public File getLocation() { return new File("."); diff --git a/tinker/tconstruct/client/SmallFontRenderer.java b/tinker/tconstruct/client/SmallFontRenderer.java new file mode 100644 index 00000000..5641d75d --- /dev/null +++ b/tinker/tconstruct/client/SmallFontRenderer.java @@ -0,0 +1,1041 @@ +package tinker.tconstruct.client; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.InputStream; +import java.text.Bidi; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.Random; + +import javax.imageio.ImageIO; + +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.RenderEngine; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.util.ChatAllowedCharacters; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class SmallFontRenderer extends FontRenderer +{ + /** Array of width of all the characters in default.png */ + private int[] charWidth = new int[256]; + public int fontTextureName = 0; + + /** the height in pixels of default text */ + public int FONT_HEIGHT = 9; + public Random fontRandom = new Random(); + + /** + * Array of the start/end column (in upper/lower nibble) for every glyph in the /font directory. + */ + private byte[] glyphWidth = new byte[65536]; + + /** + * Array of GL texture ids for loaded glyph_XX.png images. Indexed by Unicode block (group of 256 chars). + */ + private final int[] glyphTextureName = new int[256]; + + /** + * Array of RGB triplets defining the 16 standard chat colors followed by 16 darker version of the same colors for + * drop shadows. + */ + private int[] colorCode = new int[32]; + + /** + * The currently bound GL texture ID. Avoids unnecessary glBindTexture() for the same texture if it's already bound. + */ + private int boundTextureName; + + /** The RenderEngine used to load and setup glyph textures. */ + private final RenderEngine renderEngine; + + /** Current X coordinate at which to draw the next character. */ + private float posX; + + /** Current Y coordinate at which to draw the next character. */ + private float posY; + + /** + * If true, strings should be rendered with Unicode fonts instead of the default.png font + */ + private boolean unicodeFlag; + + /** + * If true, the Unicode Bidirectional Algorithm should be run before rendering any string. + */ + private boolean bidiFlag; + + /** Used to specify new red value for the current color. */ + private float red; + + /** Used to specify new blue value for the current color. */ + private float blue; + + /** Used to specify new green value for the current color. */ + private float green; + + /** Used to speify new alpha value for the current color. */ + private float alpha; + + /** Text color of the currently rendering string. */ + private int textColor; + + /** Set if the "k" style (random) is active in currently rendering string */ + private boolean randomStyle = false; + + /** Set if the "l" style (bold) is active in currently rendering string */ + private boolean boldStyle = false; + + /** Set if the "o" style (italic) is active in currently rendering string */ + private boolean italicStyle = false; + + /** + * Set if the "n" style (underlined) is active in currently rendering string + */ + private boolean underlineStyle = false; + + /** + * Set if the "m" style (strikethrough) is active in currently rendering string + */ + private boolean strikethroughStyle = false; + public static int guiScale; + + public SmallFontRenderer(GameSettings gameSettings, String textImage, RenderEngine renderEngine, boolean unicode) + { + super(gameSettings, textImage, renderEngine, unicode); + this.renderEngine = renderEngine; + this.unicodeFlag = unicode; + BufferedImage var5; + guiScale = 1; + + try + { + var5 = ImageIO.read(RenderEngine.class.getResourceAsStream(textImage)); + InputStream var6 = RenderEngine.class.getResourceAsStream("/font/glyph_sizes.bin"); + var6.read(this.glyphWidth); + } + catch (IOException var18) + { + throw new RuntimeException(var18); + } + + int var19 = var5.getWidth(); + int var7 = var5.getHeight(); + int[] var8 = new int[var19 * var7]; + var5.getRGB(0, 0, var19, var7, var8, 0, var19); + int var9 = 0; + int var10; + int var11; + int var12; + int var13; + int var15; + int var16; + + while (var9 < 256) + { + var10 = var9 % 16; + var11 = var9 / 16; + var12 = 7; + + while (true) + { + if (var12 >= 0) + { + var13 = var10 * 8 + var12; + boolean var14 = true; + + for (var15 = 0; var15 < 8 && var14; ++var15) + { + var16 = (var11 * 8 + var15) * var19; + int var17 = var8[var13 + var16] & 255; + + if (var17 > 0) + { + var14 = false; + } + } + + if (var14) + { + --var12; + continue; + } + } + + if (var9 == 32) + { + var12 = 2; + } + + this.charWidth[var9] = var12 + 2; + ++var9; + break; + } + } + + this.fontTextureName = renderEngine.allocateAndSetupTexture(var5); + + for (var9 = 0; var9 < 32; ++var9) + { + var10 = (var9 >> 3 & 1) * 85; + var11 = (var9 >> 2 & 1) * 170 + var10; + var12 = (var9 >> 1 & 1) * 170 + var10; + var13 = (var9 >> 0 & 1) * 170 + var10; + + if (var9 == 6) + { + var11 += 85; + } + + if (gameSettings.anaglyph) + { + int var20 = (var11 * 30 + var12 * 59 + var13 * 11) / 100; + var15 = (var11 * 30 + var12 * 70) / 100; + var16 = (var11 * 30 + var13 * 70) / 100; + var11 = var20; + var12 = var15; + var13 = var16; + } + + if (var9 >= 16) + { + var11 /= 4; + var12 /= 4; + var13 /= 4; + } + + this.colorCode[var9] = (var11 & 255) << 16 | (var12 & 255) << 8 | var13 & 255; + } + } + + /** + * Pick how to render a single character and return the width used. + */ + private float renderCharAtPos(int par1, char par2, boolean par3) + { + return par2 == 32 ? 4.0F : (par1 > 0 && !this.unicodeFlag ? this.renderDefaultChar(par1 + 32, par3) : this.renderUnicodeChar(par2, par3)); + } + + /** + * Render a single character with the default.png font at current (posX,posY) location... + */ + private float renderDefaultChar(int par1, boolean par2) + { + float var3 = (float)(par1 % 16 * 8); + float var4 = (float)(par1 / 16 * 8); + float var5 = par2 ? 1.0F : 0.0F; + + if (this.boundTextureName != this.fontTextureName) + { + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.fontTextureName); + this.boundTextureName = this.fontTextureName; + } + + float var6 = (float)this.charWidth[par1] - 0.01F; + GL11.glBegin(GL11.GL_TRIANGLE_STRIP); + GL11.glTexCoord2f(var3 / 128.0F, var4 / 128.0F); + GL11.glVertex3f(this.posX + var5, this.posY, 0.0F); + GL11.glTexCoord2f(var3 / 128.0F, (var4 + 7.99F) / 128.0F); + GL11.glVertex3f(this.posX - var5, this.posY + 7.99F, 0.0F); + GL11.glTexCoord2f((var3 + var6) / 128.0F, var4 / 128.0F); + GL11.glVertex3f(this.posX + var6 + var5, this.posY, 0.0F); + GL11.glTexCoord2f((var3 + var6) / 128.0F, (var4 + 7.99F) / 128.0F); + GL11.glVertex3f(this.posX + var6 - var5, this.posY + 7.99F, 0.0F); + GL11.glEnd(); + return (float)this.charWidth[par1]; + } + + /** + * Load one of the /font/glyph_XX.png into a new GL texture and store the texture ID in glyphTextureName array. + */ + private void loadGlyphTexture(int par1) + { + String var3 = String.format("/font/glyph_%02X.png", new Object[] {Integer.valueOf(par1)}); + BufferedImage var2; + + try + { + var2 = ImageIO.read(RenderEngine.class.getResourceAsStream(var3)); + } + catch (IOException var5) + { + throw new RuntimeException(var5); + } + + this.glyphTextureName[par1] = this.renderEngine.allocateAndSetupTexture(var2); + this.boundTextureName = this.glyphTextureName[par1]; + } + + /** + * Render a single Unicode character at current (posX,posY) location using one of the /font/glyph_XX.png files... + */ + private float renderUnicodeChar(char par1, boolean par2) + { + if (this.glyphWidth[par1] == 0) + { + return 0.0F; + } + else + { + int var3 = par1 / 256; + + if (this.glyphTextureName[var3] == 0) + { + this.loadGlyphTexture(var3); + } + + if (this.boundTextureName != this.glyphTextureName[var3]) + { + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.glyphTextureName[var3]); + this.boundTextureName = this.glyphTextureName[var3]; + } + + int var4 = this.glyphWidth[par1] >>> 4; + int var5 = this.glyphWidth[par1] & 15; + float var6 = (float)var4; + float var7 = (float)(var5 + 1); + float var8 = (float)(par1 % 16 * 16) + var6; + float var9 = (float)((par1 & 255) / 16 * 16); + float var10 = var7 - var6 - 0.02F; + float var11 = par2 ? 1.0F : 0.0F; + GL11.glBegin(GL11.GL_TRIANGLE_STRIP); + GL11.glTexCoord2f(var8 / 256.0F, var9 / 256.0F); + GL11.glVertex3f(this.posX + var11, this.posY, 0.0F); + GL11.glTexCoord2f(var8 / 256.0F, (var9 + 15.98F) / 256.0F); + GL11.glVertex3f(this.posX - var11, this.posY + 7.99F, 0.0F); + GL11.glTexCoord2f((var8 + var10) / 256.0F, var9 / 256.0F); + GL11.glVertex3f(this.posX + var10 / 2.0F + var11, this.posY, 0.0F); + GL11.glTexCoord2f((var8 + var10) / 256.0F, (var9 + 15.98F) / 256.0F); + GL11.glVertex3f(this.posX + var10 / 2.0F - var11, this.posY + 7.99F, 0.0F); + GL11.glEnd(); + return (var7 - var6) / 2.0F + 1.0F; + } + } + + /** + * Draws the specified string with a shadow. + */ + public int drawStringWithShadow(String par1Str, int par2, int par3, int par4) + { + return this.drawString(par1Str, par2, par3, par4, true); + } + + /** + * Draws the specified string. + */ + public int drawString(String par1Str, int par2, int par3, int par4) + { + return this.drawString(par1Str, par2, par3, par4, false); + } + + /** + * Draws the specified string. Args: string, x, y, color, dropShadow + */ + public int drawString(String par1Str, int par2, int par3, int par4, boolean par5) + { + this.resetStyles(); + + if (this.bidiFlag) + { + par1Str = this.bidiReorder(par1Str); + } + + int var6; + + if (par5) + { + var6 = this.renderString(par1Str, par2 + 1, par3 + 1, par4, true); + var6 = Math.max(var6, this.renderString(par1Str, par2, par3, par4, false)); + } + else + { + var6 = this.renderString(par1Str, par2, par3, par4, false); + } + + return var6; + } + + /** + * Apply Unicode Bidirectional Algorithm to string and return a new possibly reordered string for visual rendering. + */ + private String bidiReorder(String par1Str) + { + if (par1Str != null && Bidi.requiresBidi(par1Str.toCharArray(), 0, par1Str.length())) + { + Bidi var2 = new Bidi(par1Str, -2); + byte[] var3 = new byte[var2.getRunCount()]; + String[] var4 = new String[var3.length]; + int var7; + + for (int var5 = 0; var5 < var3.length; ++var5) + { + int var6 = var2.getRunStart(var5); + var7 = var2.getRunLimit(var5); + int var8 = var2.getRunLevel(var5); + String var9 = par1Str.substring(var6, var7); + var3[var5] = (byte)var8; + var4[var5] = var9; + } + + String[] var11 = (String[])var4.clone(); + Bidi.reorderVisually(var3, 0, var4, 0, var3.length); + StringBuilder var12 = new StringBuilder(); + var7 = 0; + + while (var7 < var4.length) + { + byte var13 = var3[var7]; + int var14 = 0; + + while (true) + { + if (var14 < var11.length) + { + if (!var11[var14].equals(var4[var7])) + { + ++var14; + continue; + } + + var13 = var3[var14]; + } + + if ((var13 & 1) == 0) + { + var12.append(var4[var7]); + } + else + { + for (var14 = var4[var7].length() - 1; var14 >= 0; --var14) + { + char var10 = var4[var7].charAt(var14); + + if (var10 == 40) + { + var10 = 41; + } + else if (var10 == 41) + { + var10 = 40; + } + + var12.append(var10); + } + } + + ++var7; + break; + } + } + + return var12.toString(); + } + else + { + return par1Str; + } + } + + /** + * Reset all style flag fields in the class to false; called at the start of string rendering + */ + private void resetStyles() + { + this.randomStyle = false; + this.boldStyle = false; + this.italicStyle = false; + this.underlineStyle = false; + this.strikethroughStyle = false; + } + + /** + * Render a single line string at the current (posX,posY) and update posX + */ + private void renderStringAtPos(String par1Str, boolean par2) + { + for (int var3 = 0; var3 < par1Str.length(); ++var3) + { + char var4 = par1Str.charAt(var3); + int var5; + int var6; + + if (var4 == 167 && var3 + 1 < par1Str.length()) + { + var5 = "0123456789abcdefklmnor".indexOf(par1Str.toLowerCase().charAt(var3 + 1)); + + if (var5 < 16) + { + this.randomStyle = false; + this.boldStyle = false; + this.strikethroughStyle = false; + this.underlineStyle = false; + this.italicStyle = false; + + if (var5 < 0 || var5 > 15) + { + var5 = 15; + } + + if (par2) + { + var5 += 16; + } + + var6 = this.colorCode[var5]; + this.textColor = var6; + GL11.glColor4f((float)(var6 >> 16) / 255.0F, (float)(var6 >> 8 & 255) / 255.0F, (float)(var6 & 255) / 255.0F, this.alpha); + } + else if (var5 == 16) + { + this.randomStyle = true; + } + else if (var5 == 17) + { + this.boldStyle = true; + } + else if (var5 == 18) + { + this.strikethroughStyle = true; + } + else if (var5 == 19) + { + this.underlineStyle = true; + } + else if (var5 == 20) + { + this.italicStyle = true; + } + else if (var5 == 21) + { + this.randomStyle = false; + this.boldStyle = false; + this.strikethroughStyle = false; + this.underlineStyle = false; + this.italicStyle = false; + GL11.glColor4f(this.red, this.blue, this.green, this.alpha); + } + + ++var3; + } + else + { + var5 = ChatAllowedCharacters.allowedCharacters.indexOf(var4); + + if (this.randomStyle && var5 > 0) + { + do + { + var6 = this.fontRandom.nextInt(ChatAllowedCharacters.allowedCharacters.length()); + } + while (this.charWidth[var5 + 32] != this.charWidth[var6 + 32]); + + var5 = var6; + } + + float scaleDown = 0.5F; + float scaleUp = 2.0F; + if (guiScale % 2 == 1) + //if (true) + { + scaleDown = 2/3F; + scaleUp = 1.5F; + } + GL11.glScalef(scaleDown, scaleDown, 1F); + float var9 = this.renderCharAtPos(var5, var4, this.italicStyle); + GL11.glScalef(scaleUp,scaleUp, 1F); + + if (this.boldStyle) + { + ++this.posX; + this.renderCharAtPos(var5, var4, this.italicStyle); + --this.posX; + ++var9; + } + + Tessellator var7; + + if (this.strikethroughStyle) + { + var7 = Tessellator.instance; + GL11.glDisable(GL11.GL_TEXTURE_2D); + var7.startDrawingQuads(); + var7.addVertex((double)this.posX, (double)(this.posY + (float)(this.FONT_HEIGHT / 2)), 0.0D); + var7.addVertex((double)(this.posX + var9), (double)(this.posY + (float)(this.FONT_HEIGHT / 2)), 0.0D); + var7.addVertex((double)(this.posX + var9), (double)(this.posY + (float)(this.FONT_HEIGHT / 2) - 1.0F), 0.0D); + var7.addVertex((double)this.posX, (double)(this.posY + (float)(this.FONT_HEIGHT / 2) - 1.0F), 0.0D); + var7.draw(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + if (this.underlineStyle) + { + var7 = Tessellator.instance; + GL11.glDisable(GL11.GL_TEXTURE_2D); + var7.startDrawingQuads(); + int var8 = this.underlineStyle ? -1 : 0; + var7.addVertex((double)(this.posX + (float)var8), (double)(this.posY + (float)this.FONT_HEIGHT), 0.0D); + var7.addVertex((double)(this.posX + var9), (double)(this.posY + (float)this.FONT_HEIGHT), 0.0D); + var7.addVertex((double)(this.posX + var9), (double)(this.posY + (float)this.FONT_HEIGHT - 1.0F), 0.0D); + var7.addVertex((double)(this.posX + (float)var8), (double)(this.posY + (float)this.FONT_HEIGHT - 1.0F), 0.0D); + var7.draw(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + this.posX += (float)((int)var9); + } + } + } + + /** + * Render string either left or right aligned depending on bidiFlag + */ + private int renderStringAligned(String par1Str, int par2, int par3, int par4, int par5, boolean par6) + { + if (this.bidiFlag) + { + par1Str = this.bidiReorder(par1Str); + int var7 = this.getStringWidth(par1Str); + par2 = par2 + par4 - var7; + } + + return this.renderString(par1Str, par2, par3, par5, par6); + } + + /** + * Render single line string by setting GL color, current (posX,posY), and calling renderStringAtPos() + */ + private int renderString(String par1Str, int par2, int par3, int par4, boolean par5) + { + if (par1Str == null) + { + return 0; + } + else + { + this.boundTextureName = 0; + + if ((par4 & -67108864) == 0) + { + par4 |= -16777216; + } + + if (par5) + { + par4 = (par4 & 16579836) >> 2 | par4 & -16777216; + } + + this.red = (float)(par4 >> 16 & 255) / 255.0F; + this.blue = (float)(par4 >> 8 & 255) / 255.0F; + this.green = (float)(par4 & 255) / 255.0F; + this.alpha = (float)(par4 >> 24 & 255) / 255.0F; + GL11.glColor4f(this.red, this.blue, this.green, this.alpha); + this.posX = (float)par2; + this.posY = (float)par3; + this.renderStringAtPos(par1Str, par5); + return (int)this.posX; + } + } + + /** + * Returns the width of this string. Equivalent of FontMetrics.stringWidth(String s). + */ + public int getStringWidth(String par1Str) + { + if (par1Str == null) + { + return 0; + } + else + { + int var2 = 0; + boolean var3 = false; + + for (int var4 = 0; var4 < par1Str.length(); ++var4) + { + char var5 = par1Str.charAt(var4); + int var6 = this.getCharWidth(var5); + + if (var6 < 0 && var4 < par1Str.length() - 1) + { + ++var4; + var5 = par1Str.charAt(var4); + + if (var5 != 108 && var5 != 76) + { + if (var5 == 114 || var5 == 82) + { + var3 = false; + } + } + else + { + var3 = true; + } + + var6 = 0; + } + + var2 += var6; + + if (var3) + { + ++var2; + } + } + + return var2; + } + } + + /** + * Returns the width of this character as rendered. + */ + public int getCharWidth(char par1) + { + if (par1 == 167) + { + return -1; + } + else if (par1 == 32) + { + return 4; + } + else + { + int var2 = ChatAllowedCharacters.allowedCharacters.indexOf(par1); + + if (var2 >= 0 && !this.unicodeFlag) + { + return this.charWidth[var2 + 32]; + } + else if (this.glyphWidth[par1] != 0) + { + int var3 = this.glyphWidth[par1] >>> 4; + int var4 = this.glyphWidth[par1] & 15; + + if (var4 > 7) + { + var4 = 15; + var3 = 0; + } + + ++var4; + return (var4 - var3) / 2 + 1; + } + else + { + return 0; + } + } + } + + /** + * Trims a string to fit a specified Width. + */ + public String trimStringToWidth(String par1Str, int par2) + { + return this.trimStringToWidth(par1Str, par2, false); + } + + /** + * Trims a string to a specified width, and will reverse it if par3 is set. + */ + public String trimStringToWidth(String par1Str, int par2, boolean par3) + { + StringBuilder var4 = new StringBuilder(); + int var5 = 0; + int var6 = par3 ? par1Str.length() - 1 : 0; + int var7 = par3 ? -1 : 1; + boolean var8 = false; + boolean var9 = false; + + for (int var10 = var6; var10 >= 0 && var10 < par1Str.length() && var5 < par2; var10 += var7) + { + char var11 = par1Str.charAt(var10); + int var12 = this.getCharWidth(var11); + + if (var8) + { + var8 = false; + + if (var11 != 108 && var11 != 76) + { + if (var11 == 114 || var11 == 82) + { + var9 = false; + } + } + else + { + var9 = true; + } + } + else if (var12 < 0) + { + var8 = true; + } + else + { + var5 += var12; + + if (var9) + { + ++var5; + } + } + + if (var5 > par2) + { + break; + } + + if (par3) + { + var4.insert(0, var11); + } + else + { + var4.append(var11); + } + } + + return var4.toString(); + } + + /** + * Remove all newline characters from the end of the string + */ + private String trimStringNewline(String par1Str) + { + while (par1Str != null && par1Str.endsWith("\n")) + { + par1Str = par1Str.substring(0, par1Str.length() - 1); + } + + return par1Str; + } + + /** + * Splits and draws a String with wordwrap (maximum length is parameter k) + */ + public void drawSplitString(String string, int posX, int posY, int length, int par5) + { + this.resetStyles(); + this.textColor = par5; + string = this.trimStringNewline(string); + if (this.guiScale % 2 == 0) + { + //posX -= 28; + posX *= 1.32; + posX -= 35; + posY *= 1.2; + length *= 1.32; + } + this.renderSplitString(string, posX, posY, length, false); + } + + /** + * Perform actual work of rendering a multi-line string with wordwrap and with darker drop shadow color if flag is + * set + */ + private void renderSplitString(String par1Str, int par2, int par3, int par4, boolean par5) + { + List var6 = this.listFormattedStringToWidth(par1Str, par4); + + for (Iterator var7 = var6.iterator(); var7.hasNext(); par3 += this.FONT_HEIGHT) + { + String var8 = (String)var7.next(); + this.renderStringAligned(var8, par2, par3, par4, this.textColor, par5); + } + } + + /** + * Returns the width of the wordwrapped String (maximum length is parameter k) + */ + public int splitStringWidth(String par1Str, int par2) + { + return this.FONT_HEIGHT * this.listFormattedStringToWidth(par1Str, par2).size(); + } + + /** + * Set unicodeFlag controlling whether strings should be rendered with Unicode fonts instead of the default.png + * font. + */ + public void setUnicodeFlag(boolean par1) + { + this.unicodeFlag = par1; + } + + /** + * Get unicodeFlag controlling whether strings should be rendered with Unicode fonts instead of the default.png + * font. + */ + public boolean getUnicodeFlag() + { + return this.unicodeFlag; + } + + /** + * Set bidiFlag to control if the Unicode Bidirectional Algorithm should be run before rendering any string. + */ + public void setBidiFlag(boolean par1) + { + this.bidiFlag = par1; + } + + /** + * Breaks a string into a list of pieces that will fit a specified width. + */ + public List listFormattedStringToWidth(String par1Str, int par2) + { + return Arrays.asList(this.wrapFormattedString(par1Str, par2).split("\n")); + } + + /** + * Inserts newline and formatting into a string to wrap it within the specified width. + */ + String wrapFormattedString(String par1Str, int par2) + { + int var3 = this.sizeStringToWidth(par1Str, par2); + + if (par1Str.length() <= var3) + { + return par1Str; + } + else + { + String var4 = par1Str.substring(0, var3); + char var5 = par1Str.charAt(var3); + boolean var6 = var5 == 32 || var5 == 10; + String var7 = getFormatFromString(var4) + par1Str.substring(var3 + (var6 ? 1 : 0)); + return var4 + "\n" + this.wrapFormattedString(var7, par2); + } + } + + /** + * Determines how many characters from the string will fit into the specified width. + */ + private int sizeStringToWidth(String par1Str, int par2) + { + int var3 = par1Str.length(); + int var4 = 0; + int var5 = 0; + int var6 = -1; + + for (boolean var7 = false; var5 < var3; ++var5) + { + char var8 = par1Str.charAt(var5); + + switch (var8) + { + case 10: + --var5; + break; + case 167: + if (var5 < var3 - 1) + { + ++var5; + char var9 = par1Str.charAt(var5); + + if (var9 != 108 && var9 != 76) + { + if (var9 == 114 || var9 == 82 || isFormatColor(var9)) + { + var7 = false; + } + } + else + { + var7 = true; + } + } + + break; + case 32: + var6 = var5; + default: + var4 += this.getCharWidth(var8); + + if (var7) + { + ++var4; + } + } + + if (var8 == 10) + { + ++var5; + var6 = var5; + break; + } + + if (var4 > par2) + { + break; + } + } + + return var5 != var3 && var6 != -1 && var6 < var5 ? var6 : var5; + } + + /** + * Checks if the char code is a hexadecimal character, used to set colour. + */ + private static boolean isFormatColor(char par0) + { + return par0 >= 48 && par0 <= 57 || par0 >= 97 && par0 <= 102 || par0 >= 65 && par0 <= 70; + } + + /** + * Checks if the char code is O-K...lLrRk-o... used to set special formatting. + */ + private static boolean isFormatSpecial(char par0) + { + return par0 >= 107 && par0 <= 111 || par0 >= 75 && par0 <= 79 || par0 == 114 || par0 == 82; + } + + /** + * Digests a string for nonprinting formatting characters then returns a string containing only that formatting. + */ + private static String getFormatFromString(String par0Str) + { + String var1 = ""; + int var2 = -1; + int var3 = par0Str.length(); + + while ((var2 = par0Str.indexOf(167, var2 + 1)) != -1) + { + if (var2 < var3 - 1) + { + char var4 = par0Str.charAt(var2 + 1); + + if (isFormatColor(var4)) + { + var1 = "\u00a7" + var4; + } + else if (isFormatSpecial(var4)) + { + var1 = var1 + "\u00a7" + var4; + } + } + } + + return var1; + } + + /** + * Get bidiFlag that controls if the Unicode Bidirectional Algorithm should be run before rendering any string + */ + public boolean getBidiFlag() + { + return this.bidiFlag; + } +} diff --git a/tinker/tconstruct/client/SuperCustomToolRenderer.java b/tinker/tconstruct/client/SuperCustomToolRenderer.java index 5ed0f3e4..2ba83344 100644 --- a/tinker/tconstruct/client/SuperCustomToolRenderer.java +++ b/tinker/tconstruct/client/SuperCustomToolRenderer.java @@ -72,7 +72,7 @@ public class SuperCustomToolRenderer implements IItemRenderer GL11.glDisable(GL11.GL_LIGHTING); - for (int renderPass = 0; renderPass < Item.itemsList[tool.itemID].getRenderPasses(itemDamage); renderPass++) + for (int renderPass = 0; renderPass < tool.getRenderPasses(itemDamage); renderPass++) { String texturePath = tool.getIconLocation(stack, renderPass); renderEngine.bindTexture(renderEngine.getTexture(texturePath)); @@ -327,7 +327,7 @@ public class SuperCustomToolRenderer implements IItemRenderer this.func_77020_a(entity, 0, var13, 0, var19 * var17, var20 * var17, var21 * var17, renderPass, true); } - for (renderPass = 0; renderPass < tool.getRenderPasses(var10.getItemDamage()); ++renderPass) + for (renderPass = 0; renderPass < 3; ++renderPass) { this.random.setSeed(187L); var17 = 1.0F; diff --git a/tinker/tconstruct/client/TProxyClient.java b/tinker/tconstruct/client/TProxyClient.java index ff96249c..cf96480e 100644 --- a/tinker/tconstruct/client/TProxyClient.java +++ b/tinker/tconstruct/client/TProxyClient.java @@ -2,10 +2,19 @@ package tinker.tconstruct.client; import java.io.File; +import java.io.InputStream; +import java.net.URL; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; import net.minecraft.client.Minecraft; import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.client.MinecraftForgeClient; + +import org.w3c.dom.Document; + +import tinker.tconstruct.TConstruct; import tinker.tconstruct.TConstructContent; import tinker.tconstruct.TConstructRegistry; import tinker.tconstruct.TProxyCommon; @@ -15,9 +24,12 @@ import cpw.mods.fml.common.registry.LanguageRegistry; public class TProxyClient extends TProxyCommon { + public static SmallFontRenderer smallFontRenderer; /* Registers any rendering code. */ public void registerRenderer() { + Minecraft mc = Minecraft.getMinecraft(); + smallFontRenderer = new SmallFontRenderer(mc.gameSettings, "/font/default.png", mc.renderEngine, false); RenderingRegistry.registerBlockHandler(new TableRender()); //RenderingRegistry.registerBlockHandler(new TankRender()); RenderingRegistry.registerBlockHandler(new FrypanRender()); @@ -83,6 +95,7 @@ public class TProxyClient extends TProxyCommon } //LanguageRegistry.addName(TConstructContent.smeltery, "Smeltery"); + LanguageRegistry.addName(TConstructContent.manualBook, "Tinker's Log"); LanguageRegistry.addName(TConstructContent.blankPattern, "Blank Pattern"); LanguageRegistry.addName(TConstructContent.pickaxe, "Pickaxe"); LanguageRegistry.addName(TConstructContent.shovel, "Shovel"); @@ -102,6 +115,26 @@ public class TProxyClient extends TProxyCommon return Minecraft.getMinecraftDir(); } + public static Document volume1; + + public void readManuals () + { + try + { + InputStream stream = TConstruct.class.getResourceAsStream("/manuals/diary.xml"); + DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); + Document doc = dBuilder.parse(stream); + doc.getDocumentElement().normalize(); + + volume1 = doc; + } + catch (Exception e) + { + e.printStackTrace(); + } + } + public static final String[] materialItemInternalNames = new String[] { "PaperStack", "SlimeCrystal", "SearedBrick", "CobaltIngot", "ArditeIngot", "ManyullynIngot", "Mossball", "LavaCrystal", "NecroticBone" }; diff --git a/tinker/tconstruct/client/gui/GuiManual.java b/tinker/tconstruct/client/gui/GuiManual.java new file mode 100644 index 00000000..9b001018 --- /dev/null +++ b/tinker/tconstruct/client/gui/GuiManual.java @@ -0,0 +1,136 @@ +package tinker.tconstruct.client.gui; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiParticle; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.item.ItemStack; + +import org.lwjgl.opengl.GL11; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import tinker.tconstruct.client.SmallFontRenderer; +import tinker.tconstruct.client.TProxyClient; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class GuiManual extends GuiScreen +{ + ItemStack itemstackBook; + int bookImageWidth = 166; + int bookImageHeight = 200; + int bookTotalPages = 1; + int currentPage; + int maxPages; + + private TurnPageButton buttonNextPage; + private TurnPageButton buttonPreviousPage; + String textLeft; + String textRight; + + public GuiManual(ItemStack stack) + { + this.itemstackBook = stack; + currentPage = 0; //Stack page + } + + @Override + public void setWorldAndResolution(Minecraft minecraft, int w, int h) + { + this.guiParticles = new GuiParticle(minecraft); + this.mc = minecraft; + this.fontRenderer = TProxyClient.smallFontRenderer; + this.width = w; + this.height = h; + this.controlList.clear(); + this.initGui(); + + + int scale = 0; + + while (width / (scale + 1) >= 160) + { + scale++; + } + + SmallFontRenderer.guiScale = scale; + } + + public void initGui() + { + maxPages = TProxyClient.volume1.getElementsByTagName("page").getLength(); + updateText(); + int xPos = (this.width) / 2; + this.controlList.add(this.buttonNextPage = new TurnPageButton(1, xPos+bookImageWidth-50, 180, true)); + this.controlList.add(this.buttonPreviousPage = new TurnPageButton(2, xPos-bookImageWidth+24, 180, false)); + } + + protected void actionPerformed(GuiButton button) + { + if (button.enabled) + { + if (button.id == 1) + currentPage += 2; + if (button.id == 2) + currentPage -= 2; + + updateText(); + } + } + + void updateText() + { + if (currentPage < 0) + currentPage = 0; + if (currentPage >= maxPages) + currentPage = maxPages-2; + if (currentPage % 2 == 1) + currentPage--; + + //Document doc = TProxyClient.volume1; + NodeList nList = TProxyClient.volume1.getElementsByTagName("page"); + + Node nNode = nList.item(currentPage); + if (nNode.getNodeType() == Node.ELEMENT_NODE) + { + Element eElement = (Element) nNode; + textLeft = eElement.getElementsByTagName("text").item(0).getTextContent(); + } + + nNode = nList.item(currentPage+1); + if (nNode != null && nNode.getNodeType() == Node.ELEMENT_NODE) + { + Element eElement = (Element) nNode; + textRight = eElement.getElementsByTagName("text").item(0).getTextContent(); + } + else + textRight = null; + } + + public void drawScreen(int par1, int par2, float par3) + { + + int texID = this.mc.renderEngine.getTexture("/tinkertextures/gui/bookright.png"); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.renderEngine.bindTexture(texID); + int var5 = (this.width) / 2; + byte var6 = 8; + this.drawTexturedModalRect(var5, var6, 0, 0, this.bookImageWidth, this.bookImageHeight); + + texID = this.mc.renderEngine.getTexture("/tinkertextures/gui/bookleft.png"); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.renderEngine.bindTexture(texID); + var5 = var5 - this.bookImageWidth; + this.drawTexturedModalRect(var5, var6, 256 - this.bookImageWidth, 0, this.bookImageWidth, this.bookImageHeight); + + if (textLeft != null) + this.fontRenderer.drawSplitString(textLeft, (var5 + 80), var6 + 16 + 16, 200, 0); + if (textRight != null) + this.fontRenderer.drawSplitString(textRight, (var5 + 320), var6 + 16 + 16, 200, 0); + super.drawScreen(par1, par2, par3); + } +} diff --git a/tinker/tconstruct/client/gui/PartCrafterGui.java b/tinker/tconstruct/client/gui/PartCrafterGui.java index 46d898f5..5cd32a71 100644 --- a/tinker/tconstruct/client/gui/PartCrafterGui.java +++ b/tinker/tconstruct/client/gui/PartCrafterGui.java @@ -10,6 +10,7 @@ import org.lwjgl.opengl.GL11; import tinker.tconstruct.TConstructRegistry; import tinker.tconstruct.ToolMaterial; +import tinker.tconstruct.container.PartCrafterChestContainer; import tinker.tconstruct.crafting.PatternBuilder; import tinker.tconstruct.logic.PartCrafterLogic; @@ -26,7 +27,7 @@ public class PartCrafterGui extends GuiContainer { super(partlogic.getGuiContainer(inventoryplayer, world, x, y, z)); logic = partlogic; - drawChestPart = ((PartCrafterContainer)inventorySlots).largeInventory; + drawChestPart = inventorySlots instanceof PartCrafterChestContainer; title = "\u00A7nTool Part Crafting"; } diff --git a/tinker/tconstruct/client/gui/PatternShaperGui.java b/tinker/tconstruct/client/gui/PatternShaperGui.java index 7f83fdb4..48e70a0d 100644 --- a/tinker/tconstruct/client/gui/PatternShaperGui.java +++ b/tinker/tconstruct/client/gui/PatternShaperGui.java @@ -16,6 +16,7 @@ import org.lwjgl.opengl.GL11; import cpw.mods.fml.common.network.PacketDispatcher; import tinker.tconstruct.TConstructContent; +import tinker.tconstruct.container.PatternShaperContainer; import tinker.tconstruct.logic.PatternShaperLogic; public class PatternShaperGui extends GuiContainer diff --git a/tinker/tconstruct/client/gui/ToolStationGui.java b/tinker/tconstruct/client/gui/ToolStationGui.java index 3faf4f93..3e55f2d9 100644 --- a/tinker/tconstruct/client/gui/ToolStationGui.java +++ b/tinker/tconstruct/client/gui/ToolStationGui.java @@ -17,6 +17,7 @@ import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; import tinker.tconstruct.TConstructRegistry; +import tinker.tconstruct.container.ToolStationContainer; import tinker.tconstruct.logic.ToolStationLogic; import tinker.tconstruct.tools.ToolCore; import tinker.tconstruct.tools.Weapon; diff --git a/tinker/tconstruct/client/gui/TurnPageButton.java b/tinker/tconstruct/client/gui/TurnPageButton.java new file mode 100644 index 00000000..06d4fca9 --- /dev/null +++ b/tinker/tconstruct/client/gui/TurnPageButton.java @@ -0,0 +1,51 @@ +package tinker.tconstruct.client.gui; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class TurnPageButton extends GuiButton +{ + /** + * True for pointing right (next page), false for pointing left (previous page). + */ + private final boolean nextPage; + + public TurnPageButton(int par1, int par2, int par3, boolean par4) + { + super(par1, par2, par3, 23, 13, ""); + this.nextPage = par4; + } + + /** + * Draws this button to the screen. + */ + public void drawButton(Minecraft par1Minecraft, int par2, int par3) + { + if (this.drawButton) + { + boolean var4 = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height; + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + par1Minecraft.renderEngine.bindTexture(par1Minecraft.renderEngine.getTexture("/tinkertextures/gui/bookleft.png")); + int var5 = 0; + int var6 = 192; + + if (var4) + { + var5 += 23; + } + + if (!this.nextPage) + { + var6 += 13; + } + + this.drawTexturedModalRect(this.xPosition, this.yPosition, var5, var6, 23, 13); + } + } +} diff --git a/tinker/tconstruct/client/gui/FrypanContainer.java b/tinker/tconstruct/container/FrypanContainer.java similarity index 98% rename from tinker/tconstruct/client/gui/FrypanContainer.java rename to tinker/tconstruct/container/FrypanContainer.java index 3f1476b8..3bcab9c5 100644 --- a/tinker/tconstruct/client/gui/FrypanContainer.java +++ b/tinker/tconstruct/container/FrypanContainer.java @@ -1,4 +1,4 @@ -package tinker.tconstruct.client.gui; +package tinker.tconstruct.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; diff --git a/tinker/tconstruct/client/gui/PartCrafterChestContainer.java b/tinker/tconstruct/container/PartCrafterChestContainer.java similarity index 86% rename from tinker/tconstruct/client/gui/PartCrafterChestContainer.java rename to tinker/tconstruct/container/PartCrafterChestContainer.java index e4a7c3b3..f5c404e8 100644 --- a/tinker/tconstruct/client/gui/PartCrafterChestContainer.java +++ b/tinker/tconstruct/container/PartCrafterChestContainer.java @@ -1,20 +1,25 @@ -package tinker.tconstruct.client.gui; +package tinker.tconstruct.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import tinker.common.IPattern; import tinker.tconstruct.logic.PartCrafterLogic; import tinker.tconstruct.logic.PatternChestLogic; -public class PartCrafterChestContainer extends PartCrafterContainer +public class PartCrafterChestContainer extends Container { protected PatternChestLogic patternLogic; + protected InventoryPlayer invPlayer; + protected PartCrafterLogic logic; + protected Slot[] input; + protected Slot[] inventory; + public boolean largeInventory; public PartCrafterChestContainer(InventoryPlayer inventoryplayer, PartCrafterLogic partLogic, PatternChestLogic pLogic) { - super (inventoryplayer, partLogic); + logic = partLogic; patternLogic = pLogic; largeInventory = true; @@ -48,6 +53,12 @@ public class PartCrafterChestContainer extends PartCrafterContainer } + @Override + public boolean canInteractWith(EntityPlayer var1) + { + return true; + } + @Override public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { @@ -78,7 +89,7 @@ public class PartCrafterChestContainer extends PartCrafterContainer } slot.onSlotChanged(); } - System.out.println("Returning stack"); + return stack; } } diff --git a/tinker/tconstruct/client/gui/PartCrafterContainer.java b/tinker/tconstruct/container/PartCrafterContainer.java similarity index 96% rename from tinker/tconstruct/client/gui/PartCrafterContainer.java rename to tinker/tconstruct/container/PartCrafterContainer.java index 97742e2f..c0c99f8a 100644 --- a/tinker/tconstruct/client/gui/PartCrafterContainer.java +++ b/tinker/tconstruct/container/PartCrafterContainer.java @@ -1,4 +1,4 @@ -package tinker.tconstruct.client.gui; +package tinker.tconstruct.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -79,7 +79,7 @@ public class PartCrafterContainer extends Container } slot.onSlotChanged(); } - + System.out.println("Returning stack"); return stack; } } diff --git a/tinker/tconstruct/client/gui/PatternChestContainer.java b/tinker/tconstruct/container/PatternChestContainer.java similarity index 98% rename from tinker/tconstruct/client/gui/PatternChestContainer.java rename to tinker/tconstruct/container/PatternChestContainer.java index db0e38c8..59bb171c 100644 --- a/tinker/tconstruct/client/gui/PatternChestContainer.java +++ b/tinker/tconstruct/container/PatternChestContainer.java @@ -1,4 +1,4 @@ -package tinker.tconstruct.client.gui; +package tinker.tconstruct.container; import tinker.common.IPattern; import tinker.tconstruct.logic.PatternChestLogic; diff --git a/tinker/tconstruct/client/gui/PatternShaperContainer.java b/tinker/tconstruct/container/PatternShaperContainer.java similarity index 98% rename from tinker/tconstruct/client/gui/PatternShaperContainer.java rename to tinker/tconstruct/container/PatternShaperContainer.java index 9846ec5d..99b88133 100644 --- a/tinker/tconstruct/client/gui/PatternShaperContainer.java +++ b/tinker/tconstruct/container/PatternShaperContainer.java @@ -1,4 +1,4 @@ -package tinker.tconstruct.client.gui; +package tinker.tconstruct.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; diff --git a/tinker/tconstruct/client/gui/SlotOnlyTake.java b/tinker/tconstruct/container/SlotOnlyTake.java similarity index 93% rename from tinker/tconstruct/client/gui/SlotOnlyTake.java rename to tinker/tconstruct/container/SlotOnlyTake.java index d455fab5..c2f3f192 100644 --- a/tinker/tconstruct/client/gui/SlotOnlyTake.java +++ b/tinker/tconstruct/container/SlotOnlyTake.java @@ -1,4 +1,4 @@ -package tinker.tconstruct.client.gui; +package tinker.tconstruct.container; import tinker.tconstruct.items.Pattern; import net.minecraft.entity.player.EntityPlayer; diff --git a/tinker/tconstruct/client/gui/SlotPartBuilder.java b/tinker/tconstruct/container/SlotPartBuilder.java similarity index 90% rename from tinker/tconstruct/client/gui/SlotPartBuilder.java rename to tinker/tconstruct/container/SlotPartBuilder.java index ea127c4f..e0fd813a 100644 --- a/tinker/tconstruct/client/gui/SlotPartBuilder.java +++ b/tinker/tconstruct/container/SlotPartBuilder.java @@ -1,4 +1,4 @@ -package tinker.tconstruct.client.gui; +package tinker.tconstruct.container; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; diff --git a/tinker/tconstruct/client/gui/SlotPattern.java b/tinker/tconstruct/container/SlotPattern.java similarity index 93% rename from tinker/tconstruct/client/gui/SlotPattern.java rename to tinker/tconstruct/container/SlotPattern.java index e83dd737..518c8094 100644 --- a/tinker/tconstruct/client/gui/SlotPattern.java +++ b/tinker/tconstruct/container/SlotPattern.java @@ -1,4 +1,4 @@ -package tinker.tconstruct.client.gui; +package tinker.tconstruct.container; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; diff --git a/tinker/tconstruct/client/gui/SlotTool.java b/tinker/tconstruct/container/SlotTool.java similarity index 98% rename from tinker/tconstruct/client/gui/SlotTool.java rename to tinker/tconstruct/container/SlotTool.java index 9c163d89..1a136ec9 100644 --- a/tinker/tconstruct/client/gui/SlotTool.java +++ b/tinker/tconstruct/container/SlotTool.java @@ -1,4 +1,4 @@ -package tinker.tconstruct.client.gui; +package tinker.tconstruct.container; import tinker.tconstruct.tools.ToolCore; import net.minecraft.entity.item.EntityXPOrb; diff --git a/tinker/tconstruct/client/gui/SmelteryContainer.java b/tinker/tconstruct/container/SmelteryContainer.java similarity index 98% rename from tinker/tconstruct/client/gui/SmelteryContainer.java rename to tinker/tconstruct/container/SmelteryContainer.java index b4c79315..fdbc24bf 100644 --- a/tinker/tconstruct/client/gui/SmelteryContainer.java +++ b/tinker/tconstruct/container/SmelteryContainer.java @@ -1,4 +1,4 @@ -package tinker.tconstruct.client.gui; +package tinker.tconstruct.container; import tinker.tconstruct.logic.SmelteryLogic; import net.minecraft.entity.player.EntityPlayer; diff --git a/tinker/tconstruct/client/gui/ToolStationContainer.java b/tinker/tconstruct/container/ToolStationContainer.java similarity index 99% rename from tinker/tconstruct/client/gui/ToolStationContainer.java rename to tinker/tconstruct/container/ToolStationContainer.java index 772fd7b0..c1c14e0b 100644 --- a/tinker/tconstruct/client/gui/ToolStationContainer.java +++ b/tinker/tconstruct/container/ToolStationContainer.java @@ -1,4 +1,4 @@ -package tinker.tconstruct.client.gui; +package tinker.tconstruct.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; diff --git a/tinker/tconstruct/crafting/PatternBuilder.java b/tinker/tconstruct/crafting/PatternBuilder.java index 3d15a85e..b9f4f2ed 100644 --- a/tinker/tconstruct/crafting/PatternBuilder.java +++ b/tinker/tconstruct/crafting/PatternBuilder.java @@ -56,7 +56,6 @@ public class PatternBuilder MaterialSet mat = (MaterialSet) materialSets.get(key.key); ItemStack toolPart = getMatchingPattern(pattern, mat); - System.out.println("toolPart "+toolPart); if (key != null && toolPart != null) { int patternValue = ((Pattern)pattern.getItem()).getPatternCost(pattern.getItemDamage()); diff --git a/tinker/tconstruct/crafting/ToolBuilder.java b/tinker/tconstruct/crafting/ToolBuilder.java index 3398dd5d..712c2001 100644 --- a/tinker/tconstruct/crafting/ToolBuilder.java +++ b/tinker/tconstruct/crafting/ToolBuilder.java @@ -102,7 +102,7 @@ public class ToolBuilder if (accessory != -1) accessoryMat = TConstructRegistry.getMaterial(accessory); - System.out.println("Head: "+headMat+" Handle: "+handleMat); + //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()); diff --git a/tinker/tconstruct/items/PatternManual.java b/tinker/tconstruct/items/PatternManual.java new file mode 100644 index 00000000..5757bc6f --- /dev/null +++ b/tinker/tconstruct/items/PatternManual.java @@ -0,0 +1,29 @@ +package tinker.tconstruct.items; + +import java.util.List; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import tinker.tconstruct.TConstruct; +import tinker.tconstruct.TConstructContent; +import tinker.tconstruct.TConstructGuiHandler; + +public class PatternManual extends CraftingItem +{ + + public PatternManual(int id) + { + super(id, 144, TConstructContent.craftingTexture); + setItemName("tconstruct.PatternManual"); + } + + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) + { + player.openGui(TConstruct.instance, TConstructGuiHandler.manualGui, world, 0, 0, 0); + return stack; + } +} diff --git a/tinker/tconstruct/logic/FrypanLogic.java b/tinker/tconstruct/logic/FrypanLogic.java index d439d852..c69e536d 100644 --- a/tinker/tconstruct/logic/FrypanLogic.java +++ b/tinker/tconstruct/logic/FrypanLogic.java @@ -16,7 +16,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import tinker.common.IActiveLogic; import tinker.common.InventoryLogic; -import tinker.tconstruct.client.gui.FrypanContainer; +import tinker.tconstruct.container.FrypanContainer; import cpw.mods.fml.common.registry.GameRegistry; /* Slots diff --git a/tinker/tconstruct/logic/PartCrafterLogic.java b/tinker/tconstruct/logic/PartCrafterLogic.java index 2368ea82..c4866547 100644 --- a/tinker/tconstruct/logic/PartCrafterLogic.java +++ b/tinker/tconstruct/logic/PartCrafterLogic.java @@ -8,8 +8,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import tinker.common.InventoryLogic; import tinker.tconstruct.TConstructContent; -import tinker.tconstruct.client.gui.PartCrafterChestContainer; -import tinker.tconstruct.client.gui.PartCrafterContainer; +import tinker.tconstruct.container.PartCrafterChestContainer; +import tinker.tconstruct.container.PartCrafterContainer; import tinker.tconstruct.crafting.PatternBuilder; import tinker.tconstruct.items.Pattern; diff --git a/tinker/tconstruct/logic/PatternChestLogic.java b/tinker/tconstruct/logic/PatternChestLogic.java index 5ce7a297..d50391eb 100644 --- a/tinker/tconstruct/logic/PatternChestLogic.java +++ b/tinker/tconstruct/logic/PatternChestLogic.java @@ -4,7 +4,7 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.world.World; import tinker.common.InventoryLogic; -import tinker.tconstruct.client.gui.PatternChestContainer; +import tinker.tconstruct.container.PatternChestContainer; public class PatternChestLogic extends InventoryLogic { diff --git a/tinker/tconstruct/logic/PatternShaperLogic.java b/tinker/tconstruct/logic/PatternShaperLogic.java index 4108e80b..6b1b7307 100644 --- a/tinker/tconstruct/logic/PatternShaperLogic.java +++ b/tinker/tconstruct/logic/PatternShaperLogic.java @@ -6,7 +6,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; import tinker.common.InventoryLogic; import tinker.tconstruct.TConstructContent; -import tinker.tconstruct.client.gui.PatternShaperContainer; +import tinker.tconstruct.container.PatternShaperContainer; public class PatternShaperLogic extends InventoryLogic { diff --git a/tinker/tconstruct/logic/SmelteryLogic.java b/tinker/tconstruct/logic/SmelteryLogic.java index 33e83664..e6262aed 100644 --- a/tinker/tconstruct/logic/SmelteryLogic.java +++ b/tinker/tconstruct/logic/SmelteryLogic.java @@ -17,7 +17,7 @@ import tinker.common.IActiveLogic; import tinker.common.IFacingLogic; import tinker.common.InventoryLogic; import tinker.tconstruct.TConstructContent; -import tinker.tconstruct.client.gui.SmelteryContainer; +import tinker.tconstruct.container.SmelteryContainer; import tinker.tconstruct.crafting.Smeltery; /* Simple class for storing items in the block diff --git a/tinker/tconstruct/logic/ToolStationLogic.java b/tinker/tconstruct/logic/ToolStationLogic.java index ad05de36..8d7bec90 100644 --- a/tinker/tconstruct/logic/ToolStationLogic.java +++ b/tinker/tconstruct/logic/ToolStationLogic.java @@ -11,7 +11,7 @@ import net.minecraft.network.packet.Packet; import net.minecraft.network.packet.Packet132TileEntityData; import net.minecraft.world.World; import tinker.common.InventoryLogic; -import tinker.tconstruct.client.gui.ToolStationContainer; +import tinker.tconstruct.container.ToolStationContainer; import tinker.tconstruct.crafting.ToolBuilder; /* Simple class for storing items in the block diff --git a/tinker/tconstruct/modifiers/ModBlaze.java b/tinker/tconstruct/modifiers/ModBlaze.java index f476b351..af5d2d16 100644 --- a/tinker/tconstruct/modifiers/ModBlaze.java +++ b/tinker/tconstruct/modifiers/ModBlaze.java @@ -75,6 +75,7 @@ public class ModBlaze extends ToolMod int fiery = tags.getInteger("Fiery"); fiery += (increase); + System.out.println("Fiery "+fiery); tags.setInteger("Fiery", fiery); } diff --git a/tinker/tconstruct/tools/ToolCore.java b/tinker/tconstruct/tools/ToolCore.java index ed0c1b3f..ebc8c33a 100644 --- a/tinker/tconstruct/tools/ToolCore.java +++ b/tinker/tconstruct/tools/ToolCore.java @@ -99,6 +99,11 @@ public abstract class ToolCore extends Item @Override public String getTextureFile () //Repurposed for default texture locations + { + return TConstructContent.craftingTexture; + } + + public String getToolTextureFile () { return toolTexture; } @@ -468,7 +473,7 @@ public abstract class ToolCore extends Item if (tags.hasKey("Moss")) { int chance = tags.getInteger("Moss"); - if (random.nextInt(800) < chance) + if (random.nextInt(2000) < chance) { AbilityHelper.damageTool(stack, -1, (EntityLiving) entity, true); }