Work on a seeecret project

This commit is contained in:
WayofTime 2014-04-17 07:06:28 -04:00
parent 97b90eaf63
commit 6e4de4f6e9
58 changed files with 3504 additions and 42 deletions

View file

@ -0,0 +1,18 @@
package WayofTime.alchemicalWizardry.client.book.pages;
import org.w3c.dom.Element;
public class BlankPage extends BookPage
{
@Override
public void readPageFromXML (Element element)
{
}
@Override
public void renderContentLayer (int localwidth, int localheight)
{
}
}

View file

@ -0,0 +1,30 @@
package WayofTime.alchemicalWizardry.client.book.pages;
import org.w3c.dom.Element;
import WayofTime.alchemicalWizardry.client.GuiManual;
public abstract class BookPage
{
protected GuiManual manual;
protected int side;
public void init (GuiManual manual, int side)
{
this.manual = manual;
this.side = side;
}
public abstract void readPageFromXML (Element element);
public void renderBackgroundLayer (int localwidth, int localheight)
{
}
public abstract void renderContentLayer (int localwidth, int localheight);
}

View file

@ -0,0 +1,57 @@
package WayofTime.alchemicalWizardry.client.book.pages;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import WayofTime.alchemicalWizardry.client.BMClientRegistry;
public class ContentsTablePage extends BookPage
{
String text;
String[] iconText;
ItemStack[] icons;
@Override
public void readPageFromXML (Element element)
{
NodeList nodes = element.getElementsByTagName("text");
if (nodes != null)
text = nodes.item(0).getTextContent();
nodes = element.getElementsByTagName("link");
iconText = new String[nodes.getLength()];
icons = new ItemStack[nodes.getLength()];
for (int i = 0; i < nodes.getLength(); i++)
{
NodeList children = nodes.item(i).getChildNodes();
iconText[i] = children.item(1).getTextContent();
icons[i] = BMClientRegistry.getManualIcon(children.item(3).getTextContent());
}
}
@Override
public void renderContentLayer (int localWidth, int localHeight)
{
if (text != null)
manual.fonts.drawString("\u00a7n" + text, localWidth + 25 + manual.fonts.getStringWidth(text) / 2, localHeight + 4, 0);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
manual.renderitem.zLevel = 100;
for (int i = 0; i < icons.length; i++)
{
manual.renderitem.renderItemIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[i], localWidth + 16, localHeight + 18 * i + 18);
int yOffset = 18;
if (iconText[i].length() > 40)
yOffset = 13;
manual.fonts.drawString(iconText[i], localWidth + 38, localHeight + 18 * i + yOffset, 0);
}
manual.renderitem.zLevel = 0;
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
}
}

View file

@ -0,0 +1,105 @@
package WayofTime.alchemicalWizardry.client.book.pages;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import WayofTime.alchemicalWizardry.client.BMClientRegistry;
public class CraftingPage extends BookPage
{
String text;
String size;
ItemStack[] icons;
@Override
public void readPageFromXML (Element element)
{
NodeList nodes = element.getElementsByTagName("text");
if (nodes != null)
text = nodes.item(0).getTextContent();
nodes = element.getElementsByTagName("name");
if (nodes != null)
icons = BMClientRegistry.getRecipeIcons(nodes.item(0).getTextContent());
nodes = element.getElementsByTagName("size");
if (nodes != null)
size = nodes.item(0).getTextContent();
}
@Override
public void renderContentLayer (int localWidth, int localHeight)
{
if (size.equals("two"))
drawCraftingPage(text, icons, 2, localWidth, localHeight + 12);
if (size.equals("three"))
drawCraftingPage(text, icons, 3, localWidth + (side != 1 ? 6 : 0), localHeight + 12);
}
public void drawCraftingPage (String info, ItemStack[] icons, int recipeSize, int localWidth, int localHeight)
{
if (info != null)
manual.fonts.drawString("\u00a7n" + info, localWidth + 50, localHeight + 4, 0);
GL11.glScalef(2f, 2f, 2f);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
manual.renderitem.zLevel = 100;
if (recipeSize == 2)
{
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 126) / 2, (localHeight + 68) / 2);
if (icons[0].stackSize > 1)
manual.renderitem.renderItemOverlayIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 126) / 2, (localHeight + 68) / 2, String.valueOf(icons[0].stackSize));
for (int i = 0; i < icons.length - 1; i++)
{
if (icons[i + 1] != null)
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[i + 1], (localWidth + 14 + 36 * (i % 2)) / 2, (localHeight + 36 * (i / 2) + 52) / 2);
}
}
if (recipeSize == 3)
{
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 138) / 2, (localHeight + 70) / 2);
if (icons[0].stackSize > 1)
manual.renderitem.renderItemOverlayIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 126) / 2, (localHeight + 68) / 2, String.valueOf(icons[0].stackSize));
for (int i = 0; i < icons.length - 1; i++)
{
if (icons[i + 1] != null)
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[i + 1], (localWidth - 2 + 36 * (i % 3)) / 2, (localHeight + 36 * (i / 3) + 34) / 2);
}
}
manual.renderitem.zLevel = 0;
GL11.glScalef(0.5F, 0.5F, 0.5F);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
}
public void renderBackgroundLayer (int localwidth, int localheight)
{
if (size.equals("two"))
drawBackground(2, localwidth, localheight + 12);
if (size.equals("three"))
drawBackground(3, localwidth + (side != 1 ? 6 : 0), localheight + 12);
}
private static final ResourceLocation background = new ResourceLocation("alchemicalwizardry", "textures/gui/bookcrafting.png");
public void drawBackground (int size, int localWidth, int localHeight)
{
manual.getMC().getTextureManager().bindTexture(background);
if (size == 2)
manual.drawTexturedModalRect(localWidth + 8, localHeight + 46, 0, 116, 154, 78);
if (size == 3)
manual.drawTexturedModalRect(localWidth - 8, localHeight + 28, 0, 0, 183, 114);
}
}

View file

@ -0,0 +1,62 @@
package WayofTime.alchemicalWizardry.client.book.pages;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import WayofTime.alchemicalWizardry.client.BMClientRegistry;
public class FurnacePage extends BookPage
{
String text;
ItemStack[] icons;
@Override
public void readPageFromXML (Element element)
{
NodeList nodes = element.getElementsByTagName("text");
if (nodes != null)
text = nodes.item(0).getTextContent();
nodes = element.getElementsByTagName("recipe");
if (nodes != null)
icons = BMClientRegistry.getRecipeIcons(nodes.item(0).getTextContent());
}
@Override
public void renderContentLayer (int localWidth, int localHeight)
{
if (text != null)
manual.fonts.drawString("\u00a7n" + text, localWidth + 50, localHeight + 4, 0);
GL11.glScalef(2f, 2f, 2f);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
manual.renderitem.zLevel = 100;
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, BMClientRegistry.getManualIcon("coal"), (localWidth + 38) / 2, (localHeight + 110) / 2);
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 106) / 2, (localHeight + 74) / 2);
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[1], (localWidth + 38) / 2, (localHeight + 38) / 2);
if (icons[0].stackSize > 1)
manual.renderitem.renderItemOverlayIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 106) / 2, (localHeight + 74) / 2, String.valueOf(icons[0].stackSize));
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("alchemicalWizardry", "textures/gui/bookfurnace.png");
public void renderBackgroundLayer (int localWidth, int localHeight)
{
manual.getMC().getTextureManager().bindTexture(background);
manual.drawTexturedModalRect(localWidth + 32, localHeight + 32, 0, 0, 111, 114);
}
}

View file

@ -0,0 +1,41 @@
package WayofTime.alchemicalWizardry.client.book.pages;
import net.minecraft.util.ResourceLocation;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
public class PicturePage extends BookPage
{
String text;
String location;
@Override
public void readPageFromXML (Element element)
{
NodeList nodes = element.getElementsByTagName("text");
if (nodes != null)
text = nodes.item(0).getTextContent();
nodes = element.getElementsByTagName("location");
if (nodes != null)
location = nodes.item(0).getTextContent();
background = new ResourceLocation(location);
}
@Override
public void renderContentLayer (int localWidth, int localHeight)
{
manual.fonts.drawSplitString(text, localWidth + 8, localHeight, 178, 0);
}
ResourceLocation background;
public void renderBackgroundLayer (int localWidth, int localHeight)
{
manual.getMC().getTextureManager().bindTexture(background);
//manual.getMC().renderEngine.bindTexture(location);
manual.drawTexturedModalRect(localWidth, localHeight + 12, 0, 0, 170, 144);
}
}

View file

@ -0,0 +1,29 @@
package WayofTime.alchemicalWizardry.client.book.pages;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
public class SectionPage extends BookPage
{
String title;
String body;
@Override
public void readPageFromXML (Element element)
{
NodeList nodes = element.getElementsByTagName("title");
if (nodes != null)
title = nodes.item(0).getTextContent();
nodes = element.getElementsByTagName("text");
if (nodes != null)
body = nodes.item(0).getTextContent();
}
@Override
public void renderContentLayer (int localWidth, int localHeight)
{
manual.fonts.drawSplitString("\u00a7n" + title, localWidth + 70, localHeight + 4, 178, 0);
manual.fonts.drawSplitString(body, localWidth, localHeight + 16, 190, 0);
}
}

View file

@ -0,0 +1,57 @@
package WayofTime.alchemicalWizardry.client.book.pages;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import WayofTime.alchemicalWizardry.client.BMClientRegistry;
public class SidebarPage extends BookPage
{
String text;
String[] iconText;
ItemStack[] icons;
@Override
public void readPageFromXML (Element element)
{
NodeList nodes = element.getElementsByTagName("text");
if (nodes != null)
text = nodes.item(0).getTextContent();
nodes = element.getElementsByTagName("item");
iconText = new String[nodes.getLength()];
icons = new ItemStack[nodes.getLength()];
for (int i = 0; i < nodes.getLength(); i++)
{
NodeList children = nodes.item(i).getChildNodes();
iconText[i] = children.item(1).getTextContent();
icons[i] = BMClientRegistry.getManualIcon(children.item(3).getTextContent());
}
}
@Override
public void renderContentLayer (int localWidth, int localHeight)
{
manual.fonts.drawSplitString(text, localWidth, localHeight, 178, 0);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
manual.renderitem.zLevel = 100;
int offset = text.length() / 4 + 10;
for (int i = 0; i < icons.length; i++)
{
manual.renderitem.renderItemIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[i], localWidth + 8, localHeight + 18 * i + offset);
int yOffset = 39;
if (iconText[i].length() > 40)
yOffset = 34;
manual.fonts.drawSplitString(iconText[i], localWidth + 30, localHeight + 18 * i + offset, 140, 0);
}
manual.renderitem.zLevel = 0;
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
}
}

View file

@ -0,0 +1,23 @@
package WayofTime.alchemicalWizardry.client.book.pages;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
public class TextPage extends BookPage
{
String text;
@Override
public void readPageFromXML (Element element)
{
NodeList nodes = element.getElementsByTagName("text");
if (nodes != null)
text = nodes.item(0).getTextContent();
}
@Override
public void renderContentLayer (int localWidth, int localHeight)
{
manual.fonts.drawSplitString(text, localWidth, localHeight, 178, 0);
}
}

View file

@ -0,0 +1,23 @@
package WayofTime.alchemicalWizardry.client.book.pages;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
public class TitlePage extends BookPage
{
String text;
@Override
public void readPageFromXML (Element element)
{
NodeList nodes = element.getElementsByTagName("text");
if (nodes != null)
text = nodes.item(0).getTextContent();
}
@Override
public void renderContentLayer (int localWidth, int localHeight)
{
manual.fonts.drawSplitString(text, localWidth, localHeight, 178, 0);
}
}