Creative Commons Zero

This commit is contained in:
mDiyo 2013-03-23 18:16:05 -07:00
parent 5b707d93f0
commit 85c53e522f
48 changed files with 754 additions and 383 deletions

View File

@ -4,4 +4,5 @@ Modify all the things, then do it again!
Melt down any metals you find.
Turn everything into golems!
Most code is public domain; any alternate licenses are noted where appropriate
Most code is public domain under Creative Commons 0: http://creativecommons.org/publicdomain/zero/1.0/
Any alternate licenses are noted where appropriate

View File

@ -50,6 +50,10 @@
<entry key="item.tconstruct.blankpattern.pattern.name">Blank Pattern</entry>
<entry key="item.tconstruct.blankpattern.cast.name">Blank Cast</entry>
<entry key="item.tconstruct.manual.diary.name">Tinker's Log</entry>
<entry key="item.tconstruct.manual.toolstation.name">Materials and You</entry>
<entry key="item.tconstruct.manual.smeltery.name">Mighty Smelting</entry>
<entry key="item.tconstruct.bucket.Iron.name">Liquid Iron Bucket</entry>
<entry key="item.tconstruct.bucket.Gold.name">Liquid Gold Bucket</entry>
<entry key="item.tconstruct.bucket.Copper.name">Liquid Copper Bucket</entry>

View File

@ -8,25 +8,26 @@ Today is a new day. I finally left home and decided to wander around in the wild
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.</text>
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".</text>
</page>
<page type="text">
<text>Tinker's Log #4:
<text>Tinker's Log #3:
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.
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 #5:
Tinker's Log #4:
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.</text>
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.</text>
</page>
<page type="text">
<text>Tinker's Log #6:
<text>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.</text>
</page>
@ -43,9 +44,11 @@ I made a few more tables with different patterns in them. They look useful for d
<page type="text">
<text>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...
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...</text>
</page>
Tinker's Log #10:
<page type="text">
<text>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.</text>
</page>
@ -105,23 +108,23 @@ One of the villagers was kind enough to give me some random things. Each one loo
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.</text>
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.</text>
</page>
<page type="text">
<text>Tinker's Log #20:
<text>Moss is also a strange one. Somehow it seems to be healing the tool, even to the point where it looks like new.
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 #20:
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.</text>
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.</text>
</page>
<page type="text">
<text>Tinker's Log #22:
<text>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.</text>
</page>
@ -151,6 +154,7 @@ I have all these tools laying around with little notes on what each one does. In
I went exploring and found some new ores today. They're colors I've never seen before, and they don't shatter on impact like iron does. I wonder what I can do with these?
Tinker's Log #28:
The normal furnace is nice for keeping warm, but it leaves something to be desired for processing metal. I've dug a pit and lined it with some clay, gathered lava nearby, and put ore in the center in an attempt to improve on the design. The results were quite interesting.</text>
</page>
<page>

View File

@ -0,0 +1,85 @@
<?xml version="1.0"?>
<book>
<page type="intro">
<text>Mighty Smelting
Make the most of your metals
By Thruul M'gon</text>
</page>
<page type="contents">
<link>
<text>Introduction</text>
<icon>smelterybook</icon>
<jump>3</jump>
</link>
<link>
<text>Smeltery</text>
<icon>smeltery</icon>
<jump>6</jump>
</link>
<link>
<text>Recipes</text>
<icon>blankcast</icon>
<jump>9</jump>
</link>
<link>
<text>Alloys</text>
<icon>liquidiron</icon>
<jump>9</jump>
</link>
<link>
<text>Casting</text>
<icon>castingtable</icon>
<jump>14</jump>
</link>
</page>
<page type="text">
<text>Welcome, puny Tinker, to the world of metalcraft.
</text>
</page>
<page type="text">
<text>Alloys are made when two metals are mixed in precise proportions. Currently known alloys are:
Bronze, made from Copper(3) and Tin(1)
Aluminum Brass, made from Aluminum(3) and Copper(1)
Manyullyn, made from Cobalt(1) and Ardite(1)
Alumite, made from Aluminum(5), Iron(2), and Obsidian(2)</text>
</page>
<page type="text">
<title>Worktables</title>
<text>
In general:
- Tools are made from parts
- Parts are created from materials using a pattern
We will create three separate areas for the creation of tools. The first will be for shaping patterns, the second for crafting parts out of materials, and the last will be the main station for finished products.</text>
</page>
<page type="text">
<text>Blank patterns are where the
</text>
</page>
<page type="craftingrecipe">
<title>Blank Wood Pattern</title>
<recipe>woodpattern</recipe>
</page>
<page type="text">
<text>The Stencil Table is where you shape blank patterns into something useful. This is done by punching a hole in precisely the shape you want the end result to look like. Materials can be place in the hole and combined until they resemble the end product.
</text>
</page>
<page type="craftingrecipe">
<title>Stencil Table</title>
<recipe>stenciltable</recipe>
</page>
<page type="text">
<text></text>
</page>
</book>

View File

@ -7,7 +7,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Random;
import mods.tinker.tconstruct.tools.ToolCore;
import mods.tinker.tconstruct.library.ToolCore;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.enchantment.EnchantmentHelper;

View File

@ -23,7 +23,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
* @author: mDiyo
*/
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.2.1")
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.2.2")
@NetworkMod(serverSideRequired = false, clientSideRequired = true, channels = { "TConstruct" }, packetHandler = mods.tinker.tconstruct.TPacketHandler.class)
public class TConstruct
{

View File

@ -42,6 +42,8 @@ import mods.tinker.tconstruct.items.TitleIcon;
import mods.tinker.tconstruct.items.ToolPart;
import mods.tinker.tconstruct.items.ToolShard;
import mods.tinker.tconstruct.items.ToolStationItemBlock;
import mods.tinker.tconstruct.library.TConstructRegistry;
import mods.tinker.tconstruct.library.ToolCore;
import mods.tinker.tconstruct.logic.CastingTableLogic;
import mods.tinker.tconstruct.logic.FaucetLogic;
import mods.tinker.tconstruct.logic.FrypanLogic;
@ -72,7 +74,6 @@ import mods.tinker.tconstruct.tools.Mattock;
import mods.tinker.tconstruct.tools.Pickaxe;
import mods.tinker.tconstruct.tools.Rapier;
import mods.tinker.tconstruct.tools.Shovel;
import mods.tinker.tconstruct.tools.ToolCore;
import net.minecraft.block.Block;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
@ -195,7 +196,7 @@ public class TContent implements IFuelHandler
BiomeGenBase.desertHills, BiomeGenBase.forestHills, BiomeGenBase.taigaHills, BiomeGenBase.extremeHillsEdge, BiomeGenBase.jungle, BiomeGenBase.jungleHills };
EntityRegistry.addSpawn(UnstableCreeper.class, 8, 4, 6, EnumCreatureType.monster, overworldBiomes);
EntityRegistry.addSpawn(BlueSlime.class, 10, 4, 4, EnumCreatureType.monster, overworldBiomes);
EntityRegistry.addSpawn(MetalSlime.class, 1, 4, 4, EnumCreatureType.monster, overworldBiomes);
//EntityRegistry.addSpawn(MetalSlime.class, 1, 4, 4, EnumCreatureType.monster, overworldBiomes);
}
void registerBlocks ()
@ -286,17 +287,17 @@ public class TContent implements IFuelHandler
manualBook = new PatternManual(PHConstruct.manual);
buckets = new FilledBucket(PHConstruct.buckets);
pickaxe = new Pickaxe(PHConstruct.pickaxe, pickaxeTexture);
shovel = new Shovel(PHConstruct.shovel, shovelTexture);
axe = new Axe(PHConstruct.axe, axeTexture);
broadsword = new Broadsword(PHConstruct.broadsword, broadswordTexture);
longsword = new Longsword(PHConstruct.longsword, longswordTexture);
rapier = new Rapier(PHConstruct.rapier, rapierTexture);
pickaxe = new Pickaxe(PHConstruct.pickaxe);
shovel = new Shovel(PHConstruct.shovel);
axe = new Axe(PHConstruct.axe);
broadsword = new Broadsword(PHConstruct.broadsword);
longsword = new Longsword(PHConstruct.longsword);
rapier = new Rapier(PHConstruct.rapier);
frypan = new FryingPan(PHConstruct.frypan, frypanTexture);
battlesign = new BattleSign(PHConstruct.battlesign, signTexture);
//longbow = new RangedWeapon(PHConstruct.longbow, bowTexture);
mattock = new Mattock(PHConstruct.mattock, mattockTexture);
frypan = new FryingPan(PHConstruct.frypan);
battlesign = new BattleSign(PHConstruct.battlesign);
//longbow = new RangedWeapon(PHConstruct.longbow);
mattock = new Mattock(PHConstruct.mattock);
//lumberaxe = new LumberAxe(PHConstruct.lumberaxe, lumberaxeTexture);
pickaxeHead = new ToolPart(PHConstruct.pickaxeHead, "PickaxeHead", "_pickaxe_head").setUnlocalizedName("tconstruct.PickaxeHead");
@ -704,7 +705,7 @@ public class TContent implements IFuelHandler
}
}
public static String blockTexture = "/tinkertextures/ConstructBlocks.png";
/*public static String blockTexture = "/tinkertextures/ConstructBlocks.png";
public static String blankSprite = "/tinkertextures/blanksprite.png";
public static String liquidTexture = "/tinkertextures/LiquidWhite.png";
@ -726,7 +727,7 @@ public class TContent implements IFuelHandler
public static String signTexture = "/tinkertextures/tools/battlesign/";
public static String bowTexture = "/tinkertextures/tools/bow/";
public static String mattockTexture = "/tinkertextures/tools/mattock/";
public static String lumberaxeTexture = "/tinkertextures/tools/lumberaxe/";
public static String lumberaxeTexture = "/tinkertextures/tools/lumberaxe/";*/
@Override
public int getBurnTime (ItemStack fuel)

View File

@ -0,0 +1,282 @@
package mods.tinker.tconstruct.client;
import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.InputStream;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.Tessellator;
import org.lwjgl.opengl.GL11;
/**
*
* @author TheObliterator
*
* A class to create and draw true type
* fonts onto the Minecraft game engine.
*/
public class CustomFont
{
private int texID;
private int[] xPos;
private int[] yPos;
private int startChar;
private int endChar;
private FontMetrics metrics;
/**
* Instantiates the font, filling in default start
* and end character parameters.
*
* 'new CustomFont(ModLoader.getMinecraftInstance(),
* "Arial", 12);
*
* @param mc The Minecraft instance for the font to be bound to.
* @param fontName The name of the font to be drawn.
* @param size The size of the font to be drawn.
*/
public CustomFont(Minecraft mc, Object font, int size)
{
this(mc, font, size, 0, 4000);
}
/**
* Instantiates the font, pre-rendering a sprite
* font image by using a true type font on a
* bitmap. Then allocating that bitmap to the
* Minecraft rendering engine for later use.
*
* 'new CustomFont(ModLoader.getMinecraftInstance(),
* "Arial", 12, 32, 126);'
*
* @param mc The Minecraft instance for the font to be bound to.
* @param fontName The name of the font to be drawn.
* @param size The size of the font to be drawn.
* @param startChar The starting ASCII character id to be drawable. (Default 32)
* @param endChar The ending ASCII character id to be drawable. (Default 126)
*/
public CustomFont(Minecraft mc, Object font, int size, int startChar, int endChar)
{
this.startChar = startChar;
this.endChar = endChar;
xPos = new int[endChar - startChar];
yPos = new int[endChar - startChar];
// Create a bitmap and fill it with a transparent color as well
// as obtain a Graphics instance which can be drawn on.
// NOTE: It is CRUICIAL that the size of the image is 256x256, if
// it is not the Minecraft engine will not draw it properly.
BufferedImage img = new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB);
Graphics g = img.getGraphics();
try
{
if (font instanceof String)
{
String fontName = (String) font;
if (fontName.contains("/"))
g.setFont(Font.createFont(Font.TRUETYPE_FONT, new File(fontName)).deriveFont((float) size));
else
g.setFont(new Font(fontName, 0, size));
}
else if (font instanceof InputStream)
{
g.setFont(Font.createFont(Font.TRUETYPE_FONT, (InputStream) font).deriveFont((float) size));
}
else if (font instanceof File)
{
g.setFont(Font.createFont(Font.TRUETYPE_FONT, (File) font).deriveFont((float) size));
}
}
catch (Exception e)
{
e.printStackTrace();
}
g.setColor(new Color(255, 255, 255, 0));
g.fillRect(0, 0, 256, 256);
g.setColor(Color.white);
metrics = g.getFontMetrics();
// Draw the specified range of characters onto
// the new bitmap, spacing according to the font
// widths. Also allocating positions of characters
// on the bitmap to two arrays which will be used
// later when drawing.
int x = 2;
int y = 2;
for (int i = startChar; i < endChar; i++)
{
g.drawString("" + ((char) i), x, y + g.getFontMetrics().getAscent());
xPos[i - startChar] = x;
yPos[i - startChar] = y - metrics.getMaxDescent();
x += metrics.stringWidth("" + (char) i) + 2;
if (x >= 250 - metrics.getMaxAdvance())
{
x = 2;
y += metrics.getMaxAscent() + metrics.getMaxDescent() + size / 2;
}
}
// Render the finished bitmap into the Minecraft
// graphics engine.
texID = mc.renderEngine.allocateAndSetupTexture(img);
}
/**
* Draws a given string with an automatically
* calculated shadow below it.
* @param gui The gui/subclass to be drawn on
* @param text The string to be drawn
* @param x The x position to start drawing
* @param y The y position to start drawing
* @param color The color of the non-shadowed text (Hex)
*/
public void drawStringS (Gui gui, String text, int x, int y, int color)
{
int l = color & 0xff000000;
int shade = (color & 0xfcfcfc) >> 2;
shade += l;
drawString(gui, text, x + 1, y + 1, shade);
drawString(gui, text, x, y, color);
}
/**
* Draws a given string onto a gui/subclass.
* @param gui The gui/subclass to be drawn on
* @param text The string to be drawn
* @param x The x position to start drawing
* @param y The y position to start drawing
* @param color The color of the non-shadowed text (Hex)
*/
public void drawString (Gui gui, String text, int x, int y, int color)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glEnable(3553 /*GL_TEXTURE_2D*/);
GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, texID);
float red = (float) (color >> 16 & 0xff) / 255F;
float green = (float) (color >> 8 & 0xff) / 255F;
float blue = (float) (color & 0xff) / 255F;
float alpha = (float) (color >> 24 & 0xff) / 255F;
GL11.glColor4f(red, green, blue, alpha);
int startX = x;
for (int i = 0; i < text.length(); i++)
{
char c = text.charAt(i);
if (c == '\\')
{
char type = text.charAt(i + 1);
if (type == 'n')
{
y += metrics.getAscent() + 2;
x = startX;
}
i++;
continue;
}
drawChar(gui, c, x, y);
x += metrics.getStringBounds("" + c, null).getWidth();
}
}
/**
* Returns the created FontMetrics
* which is used to retrive various
* information about the True Type Font
* @return FontMetrics of the created font.
*/
public FontMetrics getMetrics ()
{
return metrics;
}
/**
* Gets the drawing width of a given
* string of string.
* @param text The string to be measured
* @return The width of the given string.
*/
public int getStringWidth (String text)
{
return (int) getBounds(text).getWidth();
}
/**
* Gets the drawing height of a given
* string of string.
* @param text The string to be measured
* @return The height of the given string.
*/
public int getStringHeight (String text)
{
return (int) getBounds(text).getHeight();
}
/**
* A method that returns a Rectangle that
* contains the width and height demensions
* of the given string.
* @param text The string to be measured
* @return Rectangle containing width and height that
* the text will consume when drawn.
*/
private Rectangle getBounds (String text)
{
int w = 0;
int h = 0;
int tw = 0;
for (int i = 0; i < text.length(); i++)
{
char c = text.charAt(i);
if (c == '\\')
{
char type = text.charAt(i + 1);
if (type == 'n')
{
h += metrics.getAscent() + 2;
if (tw > w)
w = tw;
tw = 0;
}
i++;
continue;
}
tw += metrics.stringWidth("" + c);
}
if (tw > w)
w = tw;
h += metrics.getAscent();
return new Rectangle(0, 0, w, h);
}
/**
* Private drawing method used within other
* drawing methods.
*/
private void drawChar (Gui gui, char c, int x, int y)
{
Rectangle2D bounds = metrics.getStringBounds("" + c, null);
drawTexturedModalRect(x, y, xPos[(byte) c - startChar], yPos[(byte) c - startChar], (int) bounds.getWidth(), (int) bounds.getHeight() + metrics.getMaxDescent());
}
public void drawTexturedModalRect(int x, int y, int u, int v, int width, int height)
{
float offsetWidth = 0.00390625F;
float offsetHeight = 0.00390625F;
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((x + 0), (y + height), 0, ((u + 0) * offsetWidth), ((v + height) * offsetHeight));
tessellator.addVertexWithUV((x + width), (y + height), 0, ((u + width) * offsetWidth), ((v + height) * offsetHeight));
tessellator.addVertexWithUV((x + width), (y + 0), 0, ((u + width) * offsetWidth), ((v + 0) * offsetHeight));
tessellator.addVertexWithUV((x + 0), (y + 0), 0, ((u + 0) * offsetWidth), ((v + 0) * offsetHeight));
tessellator.draw();
}
}

View File

@ -66,7 +66,7 @@ public class SmallFontRenderer extends FontRenderer
/**
* If true, strings should be rendered with Unicode fonts instead of the default.png font
*/
private boolean unicodeFlag;
private boolean unicodeFlag = true;
/**
* If true, the Unicode Bidirectional Algorithm should be run before rendering any string.
@ -112,7 +112,7 @@ public class SmallFontRenderer extends FontRenderer
{
super(gameSettings, textImage, renderEngine, unicode);
this.renderEngine = renderEngine;
this.unicodeFlag = unicode;
//this.unicodeFlag = unicode;
BufferedImage var5;
guiScale = 1;
@ -221,6 +221,7 @@ public class SmallFontRenderer extends FontRenderer
*/
private float renderCharAtPos(int par1, char par2, boolean par3)
{
//return this.renderUnicodeChar(par2, par3);
return par2 == 32 ? 4.0F : (par1 > 0 && !this.unicodeFlag ? this.renderDefaultChar(par1 + 32, par3) : this.renderUnicodeChar(par2, par3));
}
@ -542,15 +543,15 @@ public class SmallFontRenderer extends FontRenderer
float scaleDown = 0.5F;
float scaleUp = 2.0F;
if (guiScale % 2 == 1)
//if (true)
//if (guiScale % 2 == 1)
/*if (true)
{
scaleDown = 2/3F;
scaleUp = 1.5F;
}
GL11.glScalef(scaleDown, scaleDown, 1F);
}*/
//GL11.glScalef(scaleDown, scaleDown, 1F);
float var9 = this.renderCharAtPos(var5, var4, this.italicStyle);
GL11.glScalef(scaleUp,scaleUp, 1F);
//GL11.glScalef(scaleUp,scaleUp, 1F);
if (this.boldStyle)
{
@ -831,14 +832,14 @@ public class SmallFontRenderer extends FontRenderer
this.resetStyles();
this.textColor = par5;
string = this.trimStringNewline(string);
if (this.guiScale % 2 == 0)
{
//if (this.guiScale % 2 == 0)
//{
//posX -= 28;
posX *= 1.32;
/*posX *= 1.32;
posX -= 35;
posY *= 1.2;
length *= 1.32;
}
length *= 1.32;*/
//}
this.renderSplitString(string, posX, posY, length, false);
}

View File

@ -2,7 +2,7 @@ package mods.tinker.tconstruct.client;
import java.util.Random;
import mods.tinker.tconstruct.tools.ToolCore;
import mods.tinker.tconstruct.library.ToolCore;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderBlocks;

View File

@ -10,7 +10,6 @@ import javax.xml.parsers.DocumentBuilderFactory;
import mods.tinker.common.fancyitem.FancyEntityItem;
import mods.tinker.common.fancyitem.FancyItemRender;
import mods.tinker.tconstruct.TConstruct;
import mods.tinker.tconstruct.TConstructRegistry;
import mods.tinker.tconstruct.TContent;
import mods.tinker.tconstruct.TProxyCommon;
import mods.tinker.tconstruct.client.entityrender.CartRender;
@ -23,6 +22,8 @@ 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.logic.CastingTableLogic;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
@ -170,7 +171,7 @@ public class TProxyClient extends TProxyCommon
LanguageRegistry.instance().addStringLocalization("entity.TConstruct.UnstableCreeper.name", "en_US", "Unstable Creeper");
LanguageRegistry.instance().addStringLocalization("entity.TConstruct.EdibleSlime.name", "en_US", "Blue Slime");
LanguageRegistry.instance().addStringLocalization("entity.TConstruct.MetalSlime.name", "en_US", "Metal Slime");
LanguageRegistry.instance().addStringLocalization("item.tconstruct.diary.diary.name", "en_US", "Tinker's Log");
//LanguageRegistry.instance().addStringLocalization("item.tconstruct.diary.diary.name", "en_US", "Tinker's Log");
LanguageRegistry.instance().addStringLocalization("item.tconstruct.Pattern.blank_pattern.name", "en_US", "Blank Pattern");
LanguageRegistry.instance().addStringLocalization("item.tconstruct.Pattern.blank_cast.name", "en_US", "Cast");
//LanguageRegistry.addName(TContent.blankPattern, "Blank Pattern");
@ -213,12 +214,15 @@ public class TProxyClient extends TProxyCommon
public static Document diary;
public static Document volume1;
public static Document smelter;
public void readManuals ()
{
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
diary = readManual("/mods/tinker/resources/manuals/diary.xml", dbFactory);
volume1 = readManual("/mods/tinker/resources/manuals/materials.xml", dbFactory);
smelter = readManual("/mods/tinker/resources/manuals/smeltery.xml", dbFactory);
initManualIcons();
}
Document readManual (String location, DocumentBuilderFactory dbFactory)
@ -237,6 +241,15 @@ public class TProxyClient extends TProxyCommon
return null;
}
}
public void initManualIcons()
{
TConstructClientRegistry.registerManualIcon("smelterybook", new ItemStack(TContent.manualBook, 1, 2));
TConstructClientRegistry.registerManualIcon("smeltery", new ItemStack(TContent.smeltery));
TConstructClientRegistry.registerManualIcon("blankcast", new ItemStack(TContent.blankPattern, 1, 1));
TConstructClientRegistry.registerManualIcon("castingtable", new ItemStack(TContent.searedBlock));
TConstructClientRegistry.registerManualIcon("liquidiron", new ItemStack(TContent.liquidMetalStill));
}
public static Document getManualFromStack (ItemStack stack)
{
@ -246,6 +259,8 @@ public class TProxyClient extends TProxyCommon
return diary;
case 1:
return volume1;
case 2:
return smelter;
}
return null;

View File

@ -1,11 +1,12 @@
package mods.tinker.tconstruct.client.gui;
import mods.tinker.tconstruct.client.SmallFontRenderer;
import mods.tinker.tconstruct.client.TProxyClient;
import mods.tinker.tconstruct.library.TConstructClientRegistry;
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.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
@ -20,148 +21,223 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiManual extends GuiScreen
{
ItemStack itemstackBook;
Document manual;
int bookImageWidth = 166;
int bookImageHeight = 200;
int bookTotalPages = 1;
int currentPage;
int maxPages;
ItemStack itemstackBook;
Document manual;
private RenderItem renderitem = new RenderItem();
int bookImageWidth = 206;
int bookImageHeight = 200;
int bookTotalPages = 1;
int currentPage;
int maxPages;
private TurnPageButton buttonNextPage;
private TurnPageButton buttonPreviousPage;
String pageLeftType;
String pageRightType;
String textLeft;
String textRight;
public GuiManual(ItemStack stack, Document doc)
{
this.itemstackBook = stack;
currentPage = 0; //Stack page
manual = doc;
}
@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.buttonList.clear();
this.initGui();
private TurnPageButton buttonNextPage;
private TurnPageButton buttonPreviousPage;
String pageLeftType;
String textLeft;
ItemStack[] iconsLeft;
String[] multiTextLeft;
int scale = 0;
while (width / (scale + 1) >= 160)
{
scale++;
}
SmallFontRenderer.guiScale = scale;
}
public void initGui()
{
maxPages = manual.getElementsByTagName("page").getLength();
updateText();
int xPos = (this.width) / 2;
this.buttonList.add(this.buttonNextPage = new TurnPageButton(1, xPos+bookImageWidth-50, 180, true));
this.buttonList.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 >= maxPages)
currentPage = maxPages-2;
if (currentPage % 2 == 1)
currentPage--;
if (currentPage < 0)
currentPage = 0;
NodeList nList = manual.getElementsByTagName("page");
Node node = nList.item(currentPage);
String pageRightType;
String textRight;
ItemStack[] iconsRight;
String[] multiTextRight;
//CustomFont font;
//int guiscale;
public GuiManual(ItemStack stack, Document doc)
{
this.mc = Minecraft.getMinecraft();
this.itemstackBook = stack;
currentPage = 0; //Stack page
manual = doc;
//font = new CustomFont(mc, "Times New Roman", 16);
}
@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.buttonList.clear();
this.initGui();
/*int scale = 0;
while (width / (scale + 1) >= 160)
{
scale++;
}
guiscale = scale;*/
//font.scale = scale;
}
public void initGui ()
{
maxPages = manual.getElementsByTagName("page").getLength();
updateText();
int xPos = (this.width) / 2;
this.buttonList.add(this.buttonNextPage = new TurnPageButton(1, xPos + bookImageWidth - 50, 180, true));
this.buttonList.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 >= maxPages - 1)
currentPage = maxPages - 2;
if (currentPage % 2 == 1)
currentPage--;
if (currentPage < 0)
currentPage = 0;
NodeList nList = manual.getElementsByTagName("page");
Node node = nList.item(currentPage);
if (node.getNodeType() == Node.ELEMENT_NODE)
{
Element element = (Element) node;
//System.out.println("TypeL: "+eElement.getAttribute("type"));
pageLeftType = element.getAttribute("type");
NodeList nodes = element.getElementsByTagName("text");
if (nodes != null)
textLeft = nodes.item(0).getTextContent();
//textLeft = element.getElementsByTagName("text").item(0).getTextContent();
if (pageLeftType.equals("text") || pageLeftType.equals("intro"))
{
NodeList nodes = element.getElementsByTagName("text");
if (nodes != null)
textLeft = nodes.item(0).getTextContent();
}
else if (pageLeftType.equals("contents"))
{
NodeList nodes = element.getElementsByTagName("link");
multiTextLeft = new String[nodes.getLength()];
iconsLeft = new ItemStack[nodes.getLength()];
for (int i = 0; i < nodes.getLength(); i++)
{
NodeList children = nodes.item(i).getChildNodes();
multiTextLeft[i] = children.item(0).getTextContent();
iconsLeft[i] = TConstructClientRegistry.getManualIcon(children.item(1).getTextContent());
}
}
}
node = nList.item(currentPage+1);
node = nList.item(currentPage + 1);
if (node != null && node.getNodeType() == Node.ELEMENT_NODE)
{
Element element = (Element) node;
pageRightType = element.getAttribute("type");
NodeList nodes = element.getElementsByTagName("text");
if (nodes != null)
textRight = nodes.item(0).getTextContent();
if (pageRightType.equals("text") || pageRightType.equals("intro"))
{
NodeList nodes = element.getElementsByTagName("text");
if (nodes != null)
textRight = nodes.item(0).getTextContent();
}
else if (pageRightType.equals("contents"))
{
//Minecraft.getMinecraft().getLogAgent().logInfo("Contents!");
NodeList nodes = element.getElementsByTagName("link");
multiTextRight = new String[nodes.getLength()];
iconsRight = new ItemStack[nodes.getLength()];
for (int i = 0; i < nodes.getLength(); i++)
{
NodeList children = nodes.item(i).getChildNodes();
multiTextRight[i] = children.item(1).getTextContent();
iconsRight[i] = TConstructClientRegistry.getManualIcon(children.item(3).getTextContent());
}
}
}
else
{
pageRightType = "blank";
textRight = null;
}
}
}
public void drawScreen(int par1, int par2, float par3)
{
//int texID = this.mc.renderEngine.getTexture();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.renderEngine.bindTexture("/mods/tinker/textures/gui/bookright.png");
int localWidth = (this.width) / 2;
byte localHeight = 8;
this.drawTexturedModalRect(localWidth, localHeight, 0, 0, this.bookImageWidth, this.bookImageHeight);
//texID = this.mc.renderEngine.getTexture("/mods/tinker/textures/gui/bookleft.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
//this.mc.renderEngine.bindTexture(texID);
this.mc.renderEngine.bindTexture("/mods/tinker/textures/gui/bookleft.png");
localWidth = localWidth - this.bookImageWidth;
this.drawTexturedModalRect(localWidth, localHeight, 256 - this.bookImageWidth, 0, this.bookImageWidth, this.bookImageHeight);
super.drawScreen(par1, par2, par3);
public void drawScreen (int par1, int par2, float par3)
{
if (textLeft != null)
{
if (pageLeftType.equals("text"))
drawTextPage(textLeft, localWidth + 80, localHeight + 32);
else if (pageLeftType.equals("intro"))
drawTitlePage(textLeft, localWidth + 80, localHeight + 32);
}
if (textRight != null)
drawTextPage(textRight, localWidth + 320, localHeight + 32);
}
public void drawTextPage(String text, int localWidth, int localHeight)
{
this.fontRenderer.drawSplitString(text, localWidth, localHeight, 200, 0);
}
public void drawTitlePage(String text, int localWidth, int localHeight)
{
this.fontRenderer.drawSplitString(text, localWidth, localHeight, 200, 0);
}
//int texID = this.mc.renderEngine.getTexture();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.renderEngine.bindTexture("/mods/tinker/textures/gui/bookright.png");
int localWidth = (this.width) / 2;
byte localHeight = 8;
this.drawTexturedModalRect(localWidth, localHeight, 0, 0, this.bookImageWidth, this.bookImageHeight);
//texID = this.mc.renderEngine.getTexture("/mods/tinker/textures/gui/bookleft.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
//this.mc.renderEngine.bindTexture(texID);
this.mc.renderEngine.bindTexture("/mods/tinker/textures/gui/bookleft.png");
localWidth = localWidth - this.bookImageWidth;
this.drawTexturedModalRect(localWidth, localHeight, 256 - this.bookImageWidth, 0, this.bookImageWidth, this.bookImageHeight);
super.drawScreen(par1, par2, par3);
//if (textLeft != null)
//{
if (pageLeftType.equals("text"))
{
if (textLeft != null)
drawTextPage(textLeft, localWidth + 16, localHeight + 12);
}
else if (pageLeftType.equals("intro"))
{
if (textLeft != null)
drawTitlePage(textLeft, localWidth + 16, localHeight + 12);
}
else if (pageLeftType.equals("contents"))
drawContentTablePage(iconsLeft, localWidth + 16, localHeight + 12);
//}
//if (textRight != null)
//{
if (pageRightType.equals("text"))
{
if (textRight != null)
drawTextPage(textRight, localWidth + 220, localHeight + 12);
}
else if (pageRightType.equals("intro"))
{
if (textRight != null)
drawTitlePage(textRight, localWidth + 220, localHeight + 12);
}
else if (pageRightType.equals("contents"))
drawContentTablePage(iconsRight, localWidth + 220, localHeight + 12);
//}
}
public void drawTextPage (String text, int localWidth, int localHeight)
{
this.fontRenderer.drawSplitString(text, localWidth, localHeight, 178, 0);
}
public void drawTitlePage (String text, int localWidth, int localHeight)
{
this.fontRenderer.drawSplitString(text, localWidth, localHeight, 178, 0);
}
public void drawContentTablePage (ItemStack[] icons, int localWidth, int localHeight)
{
this.fontRenderer.drawString("\u00a7nTable of Contents", localWidth+50, localHeight+4, 0);
for (int i = 0; i < icons.length; i++)
{
renderitem.renderItemIntoGUI(fontRenderer, mc.renderEngine, icons[i], localWidth+16, localHeight + 18*i + 18);
this.fontRenderer.drawString(multiTextRight[i], localWidth+38, localHeight + 18*i + 18, 0);
}
}
}

View File

@ -1,9 +1,9 @@
package mods.tinker.tconstruct.client.gui;
import mods.tinker.tconstruct.TConstructRegistry;
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.logic.PartCrafterLogic;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;

View File

@ -3,11 +3,11 @@ package mods.tinker.tconstruct.client.gui;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import mods.tinker.tconstruct.TConstructRegistry;
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.logic.ToolStationLogic;
import mods.tinker.tconstruct.tools.ToolCore;
import mods.tinker.tconstruct.tools.Weapon;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.inventory.GuiContainer;

View File

@ -1,6 +1,6 @@
package mods.tinker.tconstruct.container;
import mods.tinker.tconstruct.tools.ToolCore;
import mods.tinker.tconstruct.library.ToolCore;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;

View File

@ -7,9 +7,9 @@ import java.util.List;
import mods.tinker.common.IToolPart;
import mods.tinker.common.ToolMod;
import mods.tinker.tconstruct.TConstructRegistry;
import mods.tinker.tconstruct.ToolMaterial;
import mods.tinker.tconstruct.tools.ToolCore;
import mods.tinker.tconstruct.library.TConstructRegistry;
import mods.tinker.tconstruct.library.ToolCore;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;

View File

@ -1,7 +1,7 @@
package mods.tinker.tconstruct.crafting;
import mods.tinker.tconstruct.TContent;
import mods.tinker.tconstruct.tools.ToolCore;
import mods.tinker.tconstruct.library.ToolCore;
import net.minecraft.item.Item;
/*

View File

@ -1,5 +1,9 @@
package mods.tinker.tconstruct.items;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mods.tinker.tconstruct.TConstruct;
import mods.tinker.tconstruct.TContent;
import mods.tinker.tconstruct.TGuiHandler;
@ -9,12 +13,12 @@ import net.minecraft.world.World;
public class PatternManual extends CraftingItem
{
static String[] name = new String[] {"diary"};
static String[] textureName = new String[] {"tinkerbook_diary"};
static String[] name = new String[] { "diary", "toolstation", "smeltery" };
static String[] textureName = new String[] { "tinkerbook_diary", "tinkerbook_toolstation", "tinkerbook_smeltery" };
public PatternManual(int id)
{
super(id, name, textureName, "materials/");
setUnlocalizedName("tconstruct.diary");
super(id, name, textureName, "");
setUnlocalizedName("tconstruct.manual");
}
@Override
@ -27,5 +31,20 @@ public class PatternManual extends CraftingItem
return stack;
}
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
switch (stack.getItemDamage())
{
case 0:
list.add("\u00a7oBy: Unknown");
break;
case 1:
list.add("\u00a7oBy: Skyla");
break;
case 2:
list.add("\u00a7oBy: Thruul M'gon");
break;
}
}
}

View File

@ -1,5 +1,6 @@
package mods.tinker.tconstruct.tools;
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;
@ -14,9 +15,9 @@ import net.minecraftforge.common.MinecraftForge;
public abstract class DualHarvestTool extends HarvestTool
{
public DualHarvestTool(int itemID, int baseDamage, String tex)
public DualHarvestTool(int itemID, int baseDamage)
{
super(itemID, baseDamage, tex);
super(itemID, baseDamage);
}
@Override

View File

@ -1,4 +1,4 @@
package mods.tinker.tconstruct.tools;
package mods.tinker.tconstruct.library;
import mods.tinker.tconstruct.TContent;
import net.minecraft.enchantment.Enchantment;
@ -19,9 +19,9 @@ import cpw.mods.fml.relauncher.SideOnly;
public abstract class RangedWeapon extends ToolCore
{
public RangedWeapon(int itemID, String texture)
public RangedWeapon(int itemID)
{
super(itemID, 0, texture);
super(itemID, 0);
}
@Override

View File

@ -1,13 +1,15 @@
package mods.tinker.tconstruct.client;
package mods.tinker.tconstruct.library;
import mods.tinker.tconstruct.TConstructRegistry;
import mods.tinker.tconstruct.tools.ToolCore;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureMap;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class TConstructClientRegistry
{
//public static TextureMap itemMap = Minecraft.getMinecraft().renderEngine.field_94155_m;
public static Map<String, ItemStack> manualIcons = new HashMap<String, ItemStack>();
public static ItemStack defaultStack = new ItemStack(Item.ingotIron);
public static void addMaterialRenderMapping (int materialID, String domain, String renderName, boolean useDefaultFolder)
{
@ -37,4 +39,17 @@ public class TConstructClientRegistry
tool.registerEffectPath(materialID, icon);
}
}
public static void registerManualIcon(String name, ItemStack stack)
{
manualIcons.put(name, stack);
}
public static ItemStack getManualIcon (String textContent)
{
ItemStack stack = manualIcons.get(textContent);
if (stack != null)
return stack;
return defaultStack;
}
}

View File

@ -1,10 +1,13 @@
package mods.tinker.tconstruct;
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 mods.tinker.tconstruct.tools.ToolCore;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -19,7 +22,7 @@ public class TConstructRegistry
public static ArrayList<ToolCore> tools = new ArrayList<ToolCore>(20);
public static ArrayList<ToolGuiElement> toolButtons = new ArrayList<ToolGuiElement>(20);
public static HashMap<Integer, ToolMaterial> toolMaterials = new HashMap<Integer, ToolMaterial>(60);
@SideOnly(Side.CLIENT)
public static Map<String, ItemStack> manualIcons = new HashMap<String, ItemStack>();
//Tools
public static void addToolMapping (ToolCore tool)

View File

@ -1,4 +1,4 @@
package mods.tinker.tconstruct.tools;
package mods.tinker.tconstruct.library;
import ic2.api.IBoxable;
import ic2.api.ICustomElectricItem;
@ -12,7 +12,6 @@ import java.util.Random;
import mods.tinker.common.ToolMod;
import mods.tinker.tconstruct.AbilityHelper;
import mods.tinker.tconstruct.TConstruct;
import mods.tinker.tconstruct.TConstructRegistry;
import mods.tinker.tconstruct.TContent;
import mods.tinker.tconstruct.client.TProxyClient;
import mods.tinker.tconstruct.crafting.ToolBuilder;
@ -59,18 +58,16 @@ import cpw.mods.fml.relauncher.SideOnly;
public abstract class ToolCore extends Item implements ICustomElectricItem, IBoxable
{
Random random = new Random();
String toolTexture;
public int damageVsEntity;
protected Random random = new Random();
protected int damageVsEntity;
public ToolCore(int id, int baseDamage, String texture)
public ToolCore(int id, int baseDamage)
{
super(id);
this.maxStackSize = 1;
this.setMaxDamage(100);
this.setUnlocalizedName("InfiTool");
this.setCreativeTab(TConstruct.toolTab);
toolTexture = texture;
damageVsEntity = baseDamage;
TConstructRegistry.addToolMapping(this);
}
@ -242,61 +239,6 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox
return TProxyClient.blankSprite;
}
/*@SideOnly(Side.CLIENT)
public String getIconLocation (ItemStack stack, int renderPass)
{
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
if (renderPass == 0) // Handle
{
return (partTextures.get((Integer) tags.getInteger("RenderHandle")) + getRenderString(renderPass, false));
}
if (renderPass == 1) // Head
{
if (tags.getBoolean("Broken"))
return (partTextures.get((Integer) tags.getInteger("RenderHead")) + getRenderString(renderPass, true));
else
return (partTextures.get((Integer) tags.getInteger("RenderHead")) + getRenderString(renderPass, false));
}
if (renderPass == 2) // Accessory
{
if (tags.hasKey("RenderAccessory"))
{
return (partTextures.get((Integer) tags.getInteger("RenderAccessory")) + getRenderString(renderPass, false));
}
}
return TContent.blankSprite;
}
@SideOnly(Side.CLIENT)
public String getEffectLocation (ItemStack stack, int renderPass)
{
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
if (renderPass == 0)
{
if (tags.hasKey("Effect1"))
return (effectTextures.get((Integer) tags.getInteger("Effect1")) + getEffectString(renderPass));
}
if (renderPass == 1)
{
if (tags.hasKey("Effect2"))
return (effectTextures.get((Integer) tags.getInteger("Effect2")) + getEffectString(renderPass));
}
if (renderPass == 2)
{
if (tags.hasKey("Effect3"))
return (effectTextures.get((Integer) tags.getInteger("Effect3")) + getEffectString(renderPass));
}
return TContent.blankSprite;
}*/
/* Tags and information about the tool */
@Override
@SideOnly(Side.CLIENT)
@ -740,89 +682,4 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox
{
return false;
}
/* Universal Electricity Support
* Disabled due to Calclavia changing UE's api too often
*/
/*@Override
public double getJoules (Object... data)
{
if (data[0] instanceof ItemStack)
{
ItemStack itemStack = (ItemStack) data[0];
if (itemStack.stackTagCompound == null) { return 0; }
int electricityStored = itemStack.stackTagCompound.getInteger("charge");
//itemStack.setItemDamage((int) (getMaxJoules(itemStack) - electricityStored));
itemStack.setItemDamage((int) (1 + (getMaxCharge() - electricityStored) * (itemStack.getMaxDamage() - 1) / getMaxCharge()));
return electricityStored;
}
return -1;
}
@Override
public void setJoules (double joules, Object... data)
{
if (data[0] instanceof ItemStack)
{
ItemStack itemStack = (ItemStack) data[0];
if (itemStack.stackTagCompound == null)
{
itemStack.setTagCompound(new NBTTagCompound());
}
double electricityStored = ( Math.max(Math.min(joules, this.getMaxJoules(itemStack)), 0) );
itemStack.stackTagCompound.setInteger("charge", (int) electricityStored);
//itemStack.setItemDamage((int) (getMaxJoules() - electricityStored));
itemStack.setItemDamage((int) (1 + (getMaxCharge() - electricityStored) * (itemStack.getMaxDamage() - 1) / getMaxCharge()));
}
}
@Override
public double getMaxJoules (Object... data)
{
return 10000;
}
@Override
public double getVoltage ()
{
return 120;
}
@Override
public double onReceive (double amps, double voltage, ItemStack itemStack)
{
double rejectedElectricity = Math.max((this.getJoules(itemStack) + this.getJoules(amps, voltage, 1)) - this.getMaxJoules(itemStack), 0);
this.setJoules(this.getJoules(itemStack) + this.getJoules(amps, voltage, 1) - rejectedElectricity, itemStack);
return rejectedElectricity;
}
public static double getJoules(double amps, double voltage, double seconds)
{
return amps * voltage * seconds;
}
@Override
public double onUse (double joulesNeeded, ItemStack itemStack)
{
double electricityToUse = Math.min(this.getJoules(itemStack), joulesNeeded);
this.setJoules(this.getJoules(itemStack) - electricityToUse, itemStack);
return electricityToUse;
}
@Override
public boolean canReceiveElectricity ()
{
return true;
}
@Override
public boolean canProduceElectricity ()
{
return true;
}*/
}

View File

@ -1,4 +1,4 @@
package mods.tinker.tconstruct.tools;
package mods.tinker.tconstruct.library;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
@ -10,9 +10,9 @@ import net.minecraft.world.World;
public abstract class Weapon extends ToolCore
{
public Weapon(int itemID, int baseDamage, String texture)
public Weapon(int itemID, int baseDamage)
{
super(itemID, baseDamage, texture);
super(itemID, baseDamage);
}
protected float baseSpeed()

View File

@ -213,7 +213,7 @@ public class SmelteryLogic extends InventoryLogic
if (meltingTemps[i] > 20 && this.isStackInSlot(i))
{
if (activeTemps[i] < internalTemp && activeTemps[i] < meltingTemps[i])
activeTemps[i] += 10;
activeTemps[i] += 1;
else if (meltingTemps[i] >= activeTemps[i])
{
if (!worldObj.isRemote)

View File

@ -4,7 +4,7 @@ import java.util.Iterator;
import java.util.Map;
import mods.tinker.common.ToolMod;
import mods.tinker.tconstruct.tools.Weapon;
import mods.tinker.tconstruct.library.Weapon;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.item.ItemStack;

View File

@ -13,9 +13,9 @@ import cpw.mods.fml.relauncher.SideOnly;
public class Axe extends HarvestTool
{
public Axe(int itemID, String tex)
public Axe(int itemID)
{
super(itemID, 3, tex);
super(itemID, 3);
this.setUnlocalizedName("InfiTool.Axe");
}

View File

@ -1,15 +1,16 @@
package mods.tinker.tconstruct.tools;
import mods.tinker.tconstruct.TContent;
import mods.tinker.tconstruct.library.Weapon;
import net.minecraft.item.Item;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BattleSign extends Weapon
{
public BattleSign(int itemID, String tex)
public BattleSign(int itemID)
{
super(itemID, 1, tex);
super(itemID, 1);
this.setUnlocalizedName("InfiTool.Battlesign");
}

View File

@ -1,13 +1,14 @@
package mods.tinker.tconstruct.tools;
import mods.tinker.tconstruct.TContent;
import mods.tinker.tconstruct.library.Weapon;
import net.minecraft.item.Item;
public class Broadsword extends Weapon
{
public Broadsword(int itemID, String tex)
public Broadsword(int itemID)
{
super(itemID, 4, tex);
super(itemID, 4);
this.setUnlocalizedName("InfiTool.Broadsword");
}

View File

@ -2,6 +2,7 @@ package mods.tinker.tconstruct.tools;
import mods.tinker.tconstruct.AbilityHelper;
import mods.tinker.tconstruct.TContent;
import mods.tinker.tconstruct.library.Weapon;
import mods.tinker.tconstruct.logic.EquipLogic;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
@ -15,9 +16,9 @@ import cpw.mods.fml.relauncher.SideOnly;
public class FryingPan extends Weapon
{
public FryingPan(int itemID, String tex)
public FryingPan(int itemID)
{
super(itemID, 2, tex);
super(itemID, 2);
this.setUnlocalizedName("InfiTool.FryingPan");
}

View File

@ -13,9 +13,9 @@ import net.minecraft.world.World;
public class Hammer extends HarvestTool
{
public Hammer(int itemID, String tex)
public Hammer(int itemID)
{
super(itemID, 1, tex);
super(itemID, 4);
this.setUnlocalizedName("InfiTool.Hammer");
setupCoords();
}

View File

@ -1,5 +1,6 @@
package mods.tinker.tconstruct.tools;
import mods.tinker.tconstruct.library.ToolCore;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.item.EntityItem;
@ -15,9 +16,9 @@ import net.minecraftforge.common.MinecraftForge;
public abstract class HarvestTool extends ToolCore
{
public HarvestTool(int itemID, int baseDamage, String tex)
public HarvestTool(int itemID, int baseDamage)
{
super(itemID, baseDamage, tex);
super(itemID, baseDamage);
}
@Override

View File

@ -1,13 +1,14 @@
package mods.tinker.tconstruct.tools;
import mods.tinker.tconstruct.TContent;
import mods.tinker.tconstruct.library.Weapon;
import net.minecraft.item.Item;
public class Longsword extends Weapon
{
public Longsword(int itemID, String tex)
public Longsword(int itemID)
{
super(itemID, 4, tex);
super(itemID, 4);
this.setUnlocalizedName("InfiTool.Longsword");
}

View File

@ -16,9 +16,9 @@ import net.minecraft.world.World;
public class LumberAxe extends HarvestTool
{
public LumberAxe(int itemID, String tex)
public LumberAxe(int itemID)
{
super(itemID, 3, tex);
super(itemID, 3);
this.setUnlocalizedName("InfiTool.LumberAxe");
}

View File

@ -2,6 +2,7 @@ package mods.tinker.tconstruct.tools;
import mods.tinker.tconstruct.AbilityHelper;
import mods.tinker.tconstruct.TContent;
import mods.tinker.tconstruct.library.DualHarvestTool;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@ -10,9 +11,9 @@ import net.minecraft.world.World;
public class Mattock extends DualHarvestTool
{
public Mattock(int itemID, String tex)
public Mattock(int itemID)
{
super(itemID, 3, tex);
super(itemID, 3);
this.setUnlocalizedName("InfiTool.Mattock");
}

View File

@ -6,9 +6,9 @@ import net.minecraft.item.Item;
public class Pickaxe extends HarvestTool
{
public Pickaxe(int itemID, String tex)
public Pickaxe(int itemID)
{
super(itemID, 1, tex);
super(itemID, 1);
this.setUnlocalizedName("InfiTool.Pickaxe");
}

View File

@ -2,6 +2,7 @@ package mods.tinker.tconstruct.tools;
import mods.tinker.tconstruct.AbilityHelper;
import mods.tinker.tconstruct.TContent;
import mods.tinker.tconstruct.library.Weapon;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
@ -11,9 +12,9 @@ import net.minecraft.world.World;
public class Rapier extends Weapon
{
public Rapier(int itemID, String tex)
public Rapier(int itemID)
{
super(itemID, 2, tex);
super(itemID, 2);
this.setUnlocalizedName("InfiTool.Rapier");
}

View File

@ -12,9 +12,9 @@ import cpw.mods.fml.relauncher.SideOnly;
public class Shovel extends HarvestTool
{
public Shovel(int itemID, String tex)
public Shovel(int itemID)
{
super(itemID, 2, tex);
super(itemID, 2);
this.setUnlocalizedName("InfiTool.Shovel");
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

View File

Before

Width:  |  Height:  |  Size: 298 B

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB