2013-07-26 21:18:53 -07:00
|
|
|
package tconstruct.client.pages;
|
|
|
|
|
|
2013-12-13 23:14:46 -05:00
|
|
|
import mantle.client.pages.BookPage;
|
|
|
|
|
import mantle.lib.client.MantleClientRegistry;
|
2013-07-26 21:18:53 -07:00
|
|
|
import net.minecraft.client.renderer.RenderHelper;
|
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
|
import net.minecraft.util.ResourceLocation;
|
2014-01-26 18:36:46 -05:00
|
|
|
import net.minecraft.util.StatCollector;
|
2013-07-26 21:18:53 -07:00
|
|
|
|
|
|
|
|
import org.lwjgl.opengl.GL11;
|
|
|
|
|
import org.lwjgl.opengl.GL12;
|
|
|
|
|
import org.w3c.dom.Element;
|
|
|
|
|
import org.w3c.dom.NodeList;
|
|
|
|
|
|
|
|
|
|
public class ModifierPage extends BookPage
|
|
|
|
|
{
|
|
|
|
|
String type;
|
|
|
|
|
ItemStack[] icons;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void readPageFromXML (Element element)
|
|
|
|
|
{
|
|
|
|
|
NodeList nodes = element.getElementsByTagName("tooltype");
|
|
|
|
|
if (nodes != null)
|
|
|
|
|
type = nodes.item(0).getTextContent();
|
|
|
|
|
|
|
|
|
|
nodes = element.getElementsByTagName("recipe");
|
|
|
|
|
if (nodes != null)
|
2013-12-13 23:14:46 -05:00
|
|
|
icons = MantleClientRegistry.getRecipeIcons(nodes.item(0).getTextContent());
|
2013-07-26 21:18:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2014-01-26 18:36:46 -05:00
|
|
|
public void renderContentLayer (int localWidth, int localHeight, boolean isTranslatable)
|
2013-07-26 21:18:53 -07:00
|
|
|
{
|
2014-01-26 18:36:46 -05:00
|
|
|
String tStation = new String("Tool Station");
|
|
|
|
|
if (isTranslatable)
|
|
|
|
|
tStation = StatCollector.translateToLocal(tStation);
|
|
|
|
|
manual.fonts.drawString("\u00a7n" + tStation, localWidth + 60, localHeight + 4, 0);
|
2013-07-26 21:18:53 -07:00
|
|
|
GL11.glScalef(2f, 2f, 2f);
|
|
|
|
|
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
|
|
|
|
RenderHelper.enableGUIStandardItemLighting();
|
|
|
|
|
|
2013-12-13 23:14:46 -05:00
|
|
|
ItemStack toolstack = MantleClientRegistry.getManualIcon("ironpick");
|
2013-07-26 21:18:53 -07:00
|
|
|
if (type.equals("weapon"))
|
2013-12-13 23:14:46 -05:00
|
|
|
toolstack = MantleClientRegistry.getManualIcon("ironlongsword");
|
2013-07-26 21:18:53 -07:00
|
|
|
|
|
|
|
|
manual.renderitem.zLevel = 100;
|
|
|
|
|
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, toolstack, (localWidth + 54) / 2, (localHeight + 54) / 2);
|
|
|
|
|
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 130) / 2, (localHeight + 54) / 2);
|
|
|
|
|
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[1], (localWidth + 18) / 2, (localHeight + 36) / 2);
|
|
|
|
|
if (icons[2] != null)
|
|
|
|
|
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[2], (localWidth + 18) / 2, (localHeight + 74) / 2);
|
|
|
|
|
manual.renderitem.zLevel = 0;
|
|
|
|
|
|
|
|
|
|
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
|
|
|
|
RenderHelper.disableStandardItemLighting();
|
|
|
|
|
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/bookmodify.png");
|
2013-08-31 05:13:31 -07:00
|
|
|
|
2014-02-17 00:31:43 -05:00
|
|
|
@Override
|
2013-07-26 21:18:53 -07:00
|
|
|
public void renderBackgroundLayer (int localWidth, int localHeight)
|
|
|
|
|
{
|
2013-09-07 01:35:45 -04:00
|
|
|
manual.getMC().getTextureManager().bindTexture(background);
|
2013-07-26 21:18:53 -07:00
|
|
|
manual.drawTexturedModalRect(localWidth + 12, localHeight + 32, 0, 0, 154, 78);
|
|
|
|
|
}
|
|
|
|
|
}
|