Moved to RebornCore

This commit is contained in:
modmuss50 2015-11-08 12:15:45 +00:00
parent 50a830a101
commit 8abf6e5282
313 changed files with 3987 additions and 16508 deletions

View file

@ -1,8 +1,5 @@
package techreborn.pda;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
@ -11,175 +8,170 @@ import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import techreborn.init.ModBlocks;
import techreborn.init.ModItems;
import techreborn.pda.pages.ContentsPage;
import techreborn.pda.pages.CraftingInfoPage;
import techreborn.pda.pages.IndexPage;
import techreborn.pda.pages.ItemsPage;
import techreborn.pda.pages.MultiBlockPage;
import techreborn.pda.pages.TitledPage;
import techreborn.pda.pages.VersionPage;
import techreborn.pda.pages.*;
@SideOnly(Side.CLIENT)
public class GuiManual extends GuiScreen{
protected final PageCollection root;
protected int pageIndex = 0;
protected int xSize = 0;
protected int ySize = 0;
public Container inventorySlots;
protected int guiLeft;
protected int guiTop;
public class GuiManual extends GuiScreen {
public GuiManual() {
this.xSize = 256;
this.ySize = 202;
root = createRoot();
}
protected final PageCollection root;
protected int pageIndex = 0;
protected int xSize = 0;
protected int ySize = 0;
public Container inventorySlots;
protected int guiLeft;
protected int guiTop;
protected PageCollection createRoot() {
pageIndex = 0;
final PageCollection pageCollection = new PageCollection();
pageCollection.addPage(new IndexPage("INDEX", pageCollection));
pageCollection.addPage(new ContentsPage("CONTENTS", pageCollection));
pageCollection.addPage(new ItemsPage("ITEMS", pageCollection, "ITEM_PAGE"));
pageCollection.addPage(new ItemsPage("TOOLS", pageCollection, "TOOLS_PAGE"));
pageCollection.addPage(new ItemsPage("UPGRADES", pageCollection, "UPGRADES_PAGE"));
public GuiManual() {
this.xSize = 256;
this.ySize = 202;
root = createRoot();
}
pageCollection.addPage(new ItemsPage("MACHINES", pageCollection, "MACHINES_PAGE"));
pageCollection.addPage(new ItemsPage("POWER_GENERATION", pageCollection, "POWER_GENERATION_PAGE"));
pageCollection.addPage(new ItemsPage("POWER_STORAGE", pageCollection, "POWER_STORAGE_PAGE"));
pageCollection.addPage(new VersionPage("VERSION", pageCollection, "VERSION PAGE", 777777));
pageCollection.addPage(new MultiBlockPage("MULTIBLOCKS", pageCollection, "MULTIBLOCK_PAGE"));
protected PageCollection createRoot() {
pageIndex = 0;
final PageCollection pageCollection = new PageCollection();
pageCollection.addPage(new IndexPage("INDEX", pageCollection));
pageCollection.addPage(new ContentsPage("CONTENTS", pageCollection));
pageCollection.addPage(new ItemsPage("ITEMS", pageCollection, "ITEM_PAGE"));
pageCollection.addPage(new ItemsPage("TOOLS", pageCollection, "TOOLS_PAGE"));
pageCollection.addPage(new ItemsPage("UPGRADES", pageCollection, "UPGRADES_PAGE"));
pageCollection.addPage(new CraftingInfoPage("POWER_STORAGE_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Aesu), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.AlloyFurnace), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.AlloySmelter), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.BlastFurnace), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.centrifuge), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.chargeBench), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.ChemicalReactor), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.ChunkLoader), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.ComputerCube), ""));
pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.DieselGenerator), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.digitalChest), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Distillationtower), ""));
pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Dragoneggenergysiphoner), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.ElectricCraftingTable), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.FusionCoil), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.FusionControlComputer), ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Gasturbine), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Grinder), ""));
pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.heatGenerator), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.HighAdvancedMachineBlock), ""));
pageCollection.addPage(new CraftingInfoPage("POWER_STORAGE_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Idsu), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.ImplosionCompressor), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.IndustrialElectrolyzer), ""));
pageCollection.addPage(new CraftingInfoPage("POWER_STORAGE_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Lesu), ""));
pageCollection.addPage(new CraftingInfoPage("POWER_STORAGE_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.LesuStorage), ""));
pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.LightningRod), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.machineframe), ""));
pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.MagicalAbsorber), ""));
pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Magicenergeyconverter), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.MatterFabricator), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.PlasmaGenerator), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.quantumChest), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.quantumTank), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.RollingMachine), ""));
pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Semifluidgenerator), ""));
pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.thermalGenerator), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.VacuumFreezer), ""));
pageCollection.addPage(new ItemsPage("MACHINES", pageCollection, "MACHINES_PAGE"));
pageCollection.addPage(new ItemsPage("POWER_GENERATION", pageCollection, "POWER_GENERATION_PAGE"));
pageCollection.addPage(new ItemsPage("POWER_STORAGE", pageCollection, "POWER_STORAGE_PAGE"));
pageCollection.addPage(new VersionPage("VERSION", pageCollection, "VERSION PAGE", 777777));
pageCollection.addPage(new MultiBlockPage("MULTIBLOCKS", pageCollection, "MULTIBLOCK_PAGE"));
pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.advancedDrill), ""));
pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.cloakingDevice), ""));
pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.lapotronicOrb), ""));
pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.lapotronpack), ""));
pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.lithiumBatpack), ""));
pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.omniTool), ""));
pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.rockCutter), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE."+getNextPageIndex(), pageCollection, new ItemStack(ModItems.uuMatter), ""));
return pageCollection;
}
pageCollection.addPage(new CraftingInfoPage("POWER_STORAGE_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Aesu), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.AlloyFurnace), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.AlloySmelter), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.BlastFurnace), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.centrifuge), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.chargeBench), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.ChemicalReactor), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.ChunkLoader), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.ComputerCube), ""));
pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.DieselGenerator), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.digitalChest), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Distillationtower), ""));
pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Dragoneggenergysiphoner), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.ElectricCraftingTable), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.FusionCoil), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.FusionControlComputer), ""));
pageCollection.addPage(new CraftingInfoPage("BLOCK_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Gasturbine), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Grinder), ""));
pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.heatGenerator), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.HighAdvancedMachineBlock), ""));
pageCollection.addPage(new CraftingInfoPage("POWER_STORAGE_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Idsu), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.ImplosionCompressor), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.IndustrialElectrolyzer), ""));
pageCollection.addPage(new CraftingInfoPage("POWER_STORAGE_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Lesu), ""));
pageCollection.addPage(new CraftingInfoPage("POWER_STORAGE_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.LesuStorage), ""));
pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.LightningRod), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.machineframe), ""));
pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.MagicalAbsorber), ""));
pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Magicenergeyconverter), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.MatterFabricator), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.PlasmaGenerator), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.quantumChest), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.quantumTank), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.RollingMachine), ""));
pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.Semifluidgenerator), ""));
pageCollection.addPage(new CraftingInfoPage("POWER_GENERATION_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.thermalGenerator), ""));
pageCollection.addPage(new CraftingInfoPage("MACHINES_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModBlocks.VacuumFreezer), ""));
private int getNextPageIndex(){
int i = pageIndex;
pageIndex++;
return i;
}
pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModItems.advancedDrill), ""));
pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModItems.cloakingDevice), ""));
pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModItems.lapotronicOrb), ""));
pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModItems.lapotronpack), ""));
pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModItems.lithiumBatpack), ""));
pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModItems.omniTool), ""));
pageCollection.addPage(new CraftingInfoPage("TOOLS_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModItems.rockCutter), ""));
pageCollection.addPage(new CraftingInfoPage("ITEM_PAGE." + getNextPageIndex(), pageCollection, new ItemStack(ModItems.uuMatter), ""));
@Override
public void drawScreen(int mouseX, int mouseY, float par3) {
drawGuiBackgroundLayer(par3, mouseX, mouseY);
super.drawScreen(mouseX, mouseY, par3);
return pageCollection;
}
prepareRenderState();
GL11.glPushMatrix();
private int getNextPageIndex() {
int i = pageIndex;
pageIndex++;
return i;
}
root.drawScreen(this.mc, this.guiLeft, this.guiTop, mouseX - this.guiLeft, mouseY - this.guiTop);
@Override
public void drawScreen(int mouseX, int mouseY, float par3) {
drawGuiBackgroundLayer(par3, mouseX, mouseY);
super.drawScreen(mouseX, mouseY, par3);
GL11.glPopMatrix();
restoreRenderState();
}
prepareRenderState();
GL11.glPushMatrix();
protected void prepareRenderState() {
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
}
root.drawScreen(this.mc, this.guiLeft, this.guiTop, mouseX - this.guiLeft, mouseY - this.guiTop);
protected void restoreRenderState() {
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
RenderHelper.enableStandardItemLighting();
}
GL11.glPopMatrix();
restoreRenderState();
}
protected void drawGuiBackgroundLayer(float p_146976_1_, int mouseX, int mouseY) {
GL11.glPushMatrix();
GL11.glTranslated(this.guiLeft, this.guiTop, 0);
root.renderBackgroundLayer(this.mc, 0, 0, mouseX - this.guiLeft, mouseY - this.guiTop);
GL11.glPopMatrix();
}
protected void prepareRenderState() {
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
}
@Override
public void setWorldAndResolution(Minecraft minecraft, int x, int y) {
super.setWorldAndResolution(minecraft, x, y);
root.setWorldAndResolution(minecraft, x, y);
}
protected void restoreRenderState() {
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
RenderHelper.enableStandardItemLighting();
}
@Override
public void actionPerformed(GuiButton button) {
root.actionPerformed(button);
}
protected void drawGuiBackgroundLayer(float p_146976_1_, int mouseX, int mouseY) {
GL11.glPushMatrix();
GL11.glTranslated(this.guiLeft, this.guiTop, 0);
root.renderBackgroundLayer(this.mc, 0, 0, mouseX - this.guiLeft, mouseY - this.guiTop);
GL11.glPopMatrix();
}
@Override
public void mouseMovedOrUp(int par1, int par2, int par3){
root.mouseMovedOrUp(par1, par2, par3);
}
@Override
public void setWorldAndResolution(Minecraft minecraft, int x, int y) {
super.setWorldAndResolution(minecraft, x, y);
root.setWorldAndResolution(minecraft, x, y);
}
@Override
public void mouseClicked(int par1, int par2, int par3){
root.mouseClicked(par1, par2, par3);
}
@Override
public void actionPerformed(GuiButton button) {
root.actionPerformed(button);
}
@Override
public void handleInput() {
super.handleInput();
}
@Override
public void mouseMovedOrUp(int par1, int par2, int par3) {
root.mouseMovedOrUp(par1, par2, par3);
}
@Override
public void initGui() {
super.initGui();
this.guiLeft = (this.width - this.xSize) / 2;
this.guiTop = (this.height - this.ySize) / 2;
}
@Override
public boolean doesGuiPauseGame() {
return false;
}
@Override
public void mouseClicked(int par1, int par2, int par3) {
root.mouseClicked(par1, par2, par3);
}
@Override
public void handleInput() {
super.handleInput();
}
@Override
public void initGui() {
super.initGui();
this.guiLeft = (this.width - this.xSize) / 2;
this.guiTop = (this.height - this.ySize) / 2;
}
@Override
public boolean doesGuiPauseGame() {
return false;
}
}

View file

@ -1,85 +1,84 @@
package techreborn.pda;
import java.util.List;
import com.google.common.collect.Lists;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiButton;
import techreborn.pda.pages.BasePage;
public class PageCollection extends Gui{
public final List<BasePage> pages = Lists.newArrayList();
private String ACTIVE_PAGE = "CONTENTS";
protected int x;
protected int y;
import java.util.List;
public PageCollection() {
this.x = 0;
this.y = 0;
}
public class PageCollection extends Gui {
public void addPage(BasePage page) {
pages.add(page);
}
public final List<BasePage> pages = Lists.newArrayList();
private String ACTIVE_PAGE = "CONTENTS";
protected int x;
protected int y;
public BasePage getPageByName(String name){
for (BasePage component : pages) {
if (component.getReferenceName().equals(ACTIVE_PAGE)) {
return component;
}
}
return null;
}
public PageCollection() {
this.x = 0;
this.y = 0;
}
public BasePage getActivePage(){
for (BasePage component : pages) {
if (component.getReferenceName().equals(ACTIVE_PAGE)) {
return component;
}
}
return null;
}
public void addPage(BasePage page) {
pages.add(page);
}
public final void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
if (getActivePage() == null) return;
getActivePage().drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY);
}
public BasePage getPageByName(String name) {
for (BasePage component : pages) {
if (component.getReferenceName().equals(ACTIVE_PAGE)) {
return component;
}
}
return null;
}
public BasePage getActivePage() {
for (BasePage component : pages) {
if (component.getReferenceName().equals(ACTIVE_PAGE)) {
return component;
}
}
return null;
}
public final void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
if (getActivePage() == null) return;
getActivePage().drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY);
}
public final void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
if (getActivePage() == null) return;
getActivePage().renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
}
public final void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
if (getActivePage() == null) return;
getActivePage().renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
}
public void changeActivePage(String newPage){
ACTIVE_PAGE = newPage;
if (getActivePage() == null) return;
getActivePage().setWorldAndResolution(Minecraft.getMinecraft(), x, y);
}
public void changeActivePage(String newPage) {
ACTIVE_PAGE = newPage;
if (getActivePage() == null) return;
getActivePage().setWorldAndResolution(Minecraft.getMinecraft(), x, y);
}
public void setWorldAndResolution(Minecraft minecraft, int x, int y) {
if (getActivePage() == null) return;
getActivePage().setWorldAndResolution(minecraft, x, y);
this.x = x;
this.y = y;
}
public void setWorldAndResolution(Minecraft minecraft, int x, int y) {
if (getActivePage() == null) return;
getActivePage().setWorldAndResolution(minecraft, x, y);
this.x = x;
this.y = y;
}
protected void actionPerformed(GuiButton button) {
if (getActivePage() == null) return;
getActivePage().actionPerformed(button);
}
protected void actionPerformed(GuiButton button) {
if (getActivePage() == null) return;
getActivePage().actionPerformed(button);
}
protected void mouseMovedOrUp(int par1, int par2, int par3){
if (getActivePage() == null) return;
getActivePage().mouseMovedOrUp(par1, par2, par3);
}
protected void mouseMovedOrUp(int par1, int par2, int par3) {
if (getActivePage() == null) return;
getActivePage().mouseMovedOrUp(par1, par2, par3);
}
protected void mouseClicked(int par1, int par2, int par3){
if (getActivePage() == null) return;
getActivePage().mouseClicked(par1, par2, par3);
}
protected void mouseClicked(int par1, int par2, int par3) {
if (getActivePage() == null) return;
getActivePage().mouseClicked(par1, par2, par3);
}
}

View file

@ -1,103 +1,106 @@
package techreborn.pda.pages;
import java.awt.Button;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import techreborn.client.container.ContainerPda;
import techreborn.cofhLib.gui.GuiBase;
import techreborn.cofhLib.gui.GuiColor;
import techreborn.cofhLib.gui.element.ElementSlider;
import techreborn.pda.PageCollection;
public class BasePage extends GuiScreen {
//Name used to reference the page
private String REFERENCE_NAME;
//Name Displayed in the index page
public String INDEX_NAME;
public boolean hasIndexButton = false;
public static final ResourceLocation PAGE_TEXTURE = new ResourceLocation("techreborn:textures/pda/gui/pda.png");
private final int xSize = 256;
private final int ySize = 202;
protected PageCollection collection;
//Name used to reference the page
private String REFERENCE_NAME;
//Name Displayed in the index page
public String INDEX_NAME;
public boolean hasIndexButton = false;
public static final ResourceLocation PAGE_TEXTURE = new ResourceLocation("techreborn:textures/pda/gui/pda.png");
private final int xSize = 256;
private final int ySize = 202;
protected PageCollection collection;
public BasePage(){}
public BasePage() {
}
public BasePage(String referenceName, PageCollection collection) {
this.REFERENCE_NAME = referenceName;
this.mc = Minecraft.getMinecraft();
this.collection = collection;
initGui();
}
public BasePage(String referenceName, PageCollection collection) {
this.REFERENCE_NAME = referenceName;
this.mc = Minecraft.getMinecraft();
this.collection = collection;
initGui();
}
public BasePage(String referenceName, boolean showInMenue, PageCollection collection) {
this(referenceName, collection);
this.hasIndexButton = showInMenue;
}
public BasePage(String referenceName, boolean showInMenue, PageCollection collection) {
this(referenceName, collection);
this.hasIndexButton = showInMenue;
}
public int getXMin(){
return (this.width - xSize) / 2;
}
public int getXMin() {
return (this.width - xSize) / 2;
}
public int getYMin(){
return (this.height - ySize) / 2;
}
public int getYMin() {
return (this.height - ySize) / 2;
}
public void setXMin(int x){
this.width = x;
}
public void setXMin(int x) {
this.width = x;
}
public void setYMin(int y){
this.height = y;
}
public void setYMin(int y) {
this.height = y;
}
//Unlocalized Index Page Name
public BasePage setIndexName(String unlocalizedName){
this.INDEX_NAME = ttl(unlocalizedName);
return this;
}
//Unlocalized Index Page Name
public BasePage setIndexName(String unlocalizedName) {
this.INDEX_NAME = ttl(unlocalizedName);
return this;
}
@SuppressWarnings("unchecked")
@Override
public void initGui() {
buttonList.clear();
buttonList.add(new GuiButton(0, getXMin()+88, getYMin()+181, 80, 16, ttl("techreborn.pda.backbutton")));
}
@SuppressWarnings("unchecked")
@Override
public void initGui() {
buttonList.clear();
buttonList.add(new GuiButton(0, getXMin() + 88, getYMin() + 181, 80, 16, ttl("techreborn.pda.backbutton")));
}
public void setReferenceName(String name){
REFERENCE_NAME = name;}
public void setReferenceName(String name) {
REFERENCE_NAME = name;
}
public String getReferenceName(){ return REFERENCE_NAME;}
public String getReferenceName() {
return REFERENCE_NAME;
}
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY){
minecraft.renderEngine.bindTexture(PAGE_TEXTURE);
drawTexturedModalRect(offsetX, offsetY, 0, 0, xSize, ySize);
}
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
minecraft.renderEngine.bindTexture(PAGE_TEXTURE);
drawTexturedModalRect(offsetX, offsetY, 0, 0, xSize, ySize);
}
public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY){
}
public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
}
public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.drawScreen(mouseX+offsetX, mouseY+offsetY, 0);
renderOverlayComponents(minecraft, offsetX, offsetY, mouseX, mouseY);
}
public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.drawScreen(mouseX + offsetX, mouseY + offsetY, 0);
renderOverlayComponents(minecraft, offsetX, offsetY, mouseX, mouseY);
}
@Override
public void actionPerformed(GuiButton button) {
if (button.id == 0)collection.changeActivePage("CONTENTS");
}
@Override
public void mouseMovedOrUp(int par1, int par2, int par3){super.mouseMovedOrUp(par1, par2, par3);}
@Override
public void mouseClicked(int par1, int par2, int par3){super.mouseClicked(par1, par2, par3);}
@Override
public void actionPerformed(GuiButton button) {
if (button.id == 0) collection.changeActivePage("CONTENTS");
}
//Translate To Local
public String ttl(String unlocalizedName){return StatCollector.translateToLocal(unlocalizedName);}
@Override
public void mouseMovedOrUp(int par1, int par2, int par3) {
super.mouseMovedOrUp(par1, par2, par3);
}
@Override
public void mouseClicked(int par1, int par2, int par3) {
super.mouseClicked(par1, par2, par3);
}
//Translate To Local
public String ttl(String unlocalizedName) {
return StatCollector.translateToLocal(unlocalizedName);
}
}

View file

@ -1,58 +1,56 @@
package techreborn.pda.pages;
import java.awt.Color;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.item.ItemStack;
import techreborn.config.TechRebornConfigGui;
import techreborn.init.ModBlocks;
import techreborn.init.ModItems;
import techreborn.lib.ModInfo;
import techreborn.pda.PageCollection;
import techreborn.pda.util.GuiButtonCustomTexture;
import techreborn.pda.util.GuiButtonTextOnly;
import java.awt.*;
public class ContentsPage extends TitledPage {
public ContentsPage(String name, PageCollection collection) {
super(name, false, collection, "techreborn.pda.contents", Color.white.getRGB());
}
public ContentsPage(String name, PageCollection collection) {
super(name, false, collection, "techreborn.pda.contents", Color.white.getRGB());
}
@SuppressWarnings("unchecked")
@Override
public void initGui() {
buttonList.clear();
buttonList.add(new GuiButtonCustomTexture(0, getXMin() + 25, getYMin() + 20, 0, 46, 80, 20, new ItemStack(ModBlocks.AlloySmelter), "INDEX", "MACHINES"));
buttonList.add(new GuiButtonCustomTexture(1, getXMin() + 160, getYMin() + 20, 0, 46, 80, 20, new ItemStack(ModItems.uuMatter), "INDEX", "ITEMS"));
buttonList.add(new GuiButtonCustomTexture(2, getXMin() + 25, getYMin() + 40, 0, 46, 80, 20, new ItemStack(ModBlocks.DieselGenerator), "INDEX", "POWER GENERATION"));
buttonList.add(new GuiButtonCustomTexture(3, getXMin() + 160, getYMin() + 40, 0, 46, 80, 20, new ItemStack(ModItems.advancedDrill), "INDEX", "TOOLS"));
buttonList.add(new GuiButtonCustomTexture(4, getXMin() + 25, getYMin() + 60, 0, 46, 80, 20, new ItemStack(ModBlocks.Aesu), "INDEX", "POWER STORAGE"));
buttonList.add(new GuiButtonCustomTexture(5, getXMin() + 25, getYMin() + 80, 0, 46, 80, 20, new ItemStack(ModBlocks.MachineCasing), "INDEX", "MULTIBLOCKS"));
buttonList.add(new GuiButtonCustomTexture(6, getXMin() + 160, getYMin() + 60, 0, 46, 80, 20, new ItemStack(ModItems.upgrades), "INDEX", "UPGRADES"));
buttonList.add(new GuiButtonCustomTexture(7, getXMin() + 160, getYMin() + 180, 0, 46, 80, 20, new ItemStack(ModItems.lapotronicOrb), "INDEX", "Changelog"));
buttonList.add(new GuiButtonCustomTexture(8, getXMin() + 25, getYMin() + 180, 0, 46, 80, 20, new ItemStack(ModItems.lapotronicOrb), "INDEX", "Configs"));
}
@Override
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
}
@SuppressWarnings("unchecked")
@Override
public void initGui() {
buttonList.clear();
buttonList.add(new GuiButtonCustomTexture(0, getXMin() + 25, getYMin() + 20, 0, 46, 80, 20, new ItemStack(ModBlocks.AlloySmelter), "INDEX", "MACHINES"));
buttonList.add(new GuiButtonCustomTexture(1, getXMin() + 160, getYMin() + 20, 0, 46, 80, 20, new ItemStack(ModItems.uuMatter), "INDEX", "ITEMS"));
buttonList.add(new GuiButtonCustomTexture(2, getXMin() + 25, getYMin() + 40, 0, 46, 80, 20, new ItemStack(ModBlocks.DieselGenerator), "INDEX", "POWER GENERATION"));
buttonList.add(new GuiButtonCustomTexture(3, getXMin() + 160, getYMin() + 40, 0, 46, 80, 20, new ItemStack(ModItems.advancedDrill), "INDEX", "TOOLS"));
buttonList.add(new GuiButtonCustomTexture(4, getXMin() + 25, getYMin() + 60, 0, 46, 80, 20, new ItemStack(ModBlocks.Aesu), "INDEX", "POWER STORAGE"));
buttonList.add(new GuiButtonCustomTexture(5, getXMin() + 25, getYMin() + 80, 0, 46, 80, 20, new ItemStack(ModBlocks.MachineCasing), "INDEX", "MULTIBLOCKS"));
buttonList.add(new GuiButtonCustomTexture(6, getXMin() + 160, getYMin() + 60, 0, 46, 80, 20, new ItemStack(ModItems.upgrades), "INDEX", "UPGRADES"));
@Override
public void actionPerformed(GuiButton button) {
if (button.id == 0)collection.changeActivePage("MACHINES");
if (button.id == 1)collection.changeActivePage("ITEMS");
if (button.id == 2)collection.changeActivePage("POWER_GENERATION");
if (button.id == 3)collection.changeActivePage("TOOLS");
if (button.id == 4)collection.changeActivePage("POWER_STORAGE");
if (button.id == 5)collection.changeActivePage("MULTIBLOCKS");
if (button.id == 6)collection.changeActivePage("UPGRADES");
if (button.id == 7)collection.changeActivePage("VERSION");
if (button.id == 8)mc.displayGuiScreen(new TechRebornConfigGui(this));
if (button.id == 9)collection.changeActivePage("CONFIG");
buttonList.add(new GuiButtonCustomTexture(7, getXMin() + 160, getYMin() + 180, 0, 46, 80, 20, new ItemStack(ModItems.lapotronicOrb), "INDEX", "Changelog"));
buttonList.add(new GuiButtonCustomTexture(8, getXMin() + 25, getYMin() + 180, 0, 46, 80, 20, new ItemStack(ModItems.lapotronicOrb), "INDEX", "Configs"));
}
}
@Override
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
}
@Override
public void actionPerformed(GuiButton button) {
if (button.id == 0) collection.changeActivePage("MACHINES");
if (button.id == 1) collection.changeActivePage("ITEMS");
if (button.id == 2) collection.changeActivePage("POWER_GENERATION");
if (button.id == 3) collection.changeActivePage("TOOLS");
if (button.id == 4) collection.changeActivePage("POWER_STORAGE");
if (button.id == 5) collection.changeActivePage("MULTIBLOCKS");
if (button.id == 6) collection.changeActivePage("UPGRADES");
if (button.id == 7) collection.changeActivePage("VERSION");
if (button.id == 8) mc.displayGuiScreen(new TechRebornConfigGui(this));
if (button.id == 9) collection.changeActivePage("CONFIG");
}
}

View file

@ -1,285 +1,277 @@
package techreborn.pda.pages;
import java.awt.Color;
import com.google.common.base.Objects;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.*;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import org.lwjgl.opengl.GL11;
import techreborn.pda.PageCollection;
import java.awt.*;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.lwjgl.opengl.GL11;
public class CraftingInfoPage extends TitledPage {
protected static RenderItem itemRenderer = new RenderItem();
public ItemStack result;
private boolean isSmelting = false;
private ItemStack[] recipe = new ItemStack[9];
private boolean hasRecipe = false;
private String rawDescription;
private List<String> formattedDescription;
private float descriptionScale = 0.66f;
import com.google.common.base.Objects;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
public CraftingInfoPage(String name, PageCollection collection, ItemStack itemStack, String unlocalizedDescription) {
super(name, true, collection, itemStack.getUnlocalizedName() + ".name", Color.white.getRGB());
this.result = itemStack;
this.recipe = getFirstRecipeForItem(itemStack);
for (ItemStack stack : recipe) if (stack != null) hasRecipe = true;
if (unlocalizedDescription == "") rawDescription = ttl(itemStack.getUnlocalizedName() + ".description");
else rawDescription = ttl(unlocalizedDescription);
}
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import techreborn.client.GuiUtil;
import techreborn.pda.PageCollection;
import techreborn.util.LogHelper;
@Override
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
GL11.glPushMatrix();
if (isSmelting) {
drawTexturedModalRect(offsetX + 87, offsetY + 15, 116, 202, 82, 54);
} else {
if (hasRecipe) {
drawTexturedModalRect(offsetX + 70, offsetY + 15, 0, 202, 116, 54);
} else {
drawTexturedModalRect(offsetX + 119, offsetY + 17, 0, 202, 18, 18);
drawString(fontRendererObj, "No Crafting Recipe", offsetX + 145, offsetY + 17, Color.white.getRGB());
}
}
GL11.glPopMatrix();
public class CraftingInfoPage extends TitledPage{
protected static RenderItem itemRenderer = new RenderItem();
public ItemStack result;
private boolean isSmelting = false;
private ItemStack[] recipe = new ItemStack[9];
private boolean hasRecipe = false;
private String rawDescription;
private List<String> formattedDescription;
private float descriptionScale = 0.66f;
}
public CraftingInfoPage(String name, PageCollection collection, ItemStack itemStack, String unlocalizedDescription) {
super(name, true, collection, itemStack.getUnlocalizedName()+".name", Color.white.getRGB());
this.result = itemStack;
this.recipe = getFirstRecipeForItem(itemStack);
for (ItemStack stack : recipe) if (stack != null) hasRecipe = true;
if (unlocalizedDescription == "") rawDescription = ttl(itemStack.getUnlocalizedName()+".description");
else rawDescription = ttl(unlocalizedDescription);
}
public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY);
int relativeMouseX = mouseX + offsetX;
int relativeMouseY = mouseY + offsetY;
int gridOffsetX = isSmelting ? 88 : 71;
int gridOffsetY = 16;
int itemBoxSize = 18;
addDescription(minecraft, offsetX, offsetY);
@Override
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
GL11.glPushMatrix();
if (isSmelting){
drawTexturedModalRect(offsetX + 87, offsetY + 15, 116, 202, 82, 54);
}else {
if (hasRecipe) {
drawTexturedModalRect(offsetX + 70, offsetY + 15, 0, 202, 116, 54);
}
else {
drawTexturedModalRect(offsetX + 119, offsetY + 17, 0, 202, 18, 18);
drawString(fontRendererObj, "No Crafting Recipe", offsetX + 145, offsetY + 17, Color.white.getRGB());
}
}
GL11.glPopMatrix();
ItemStack tooltip = null;
int i = 0;
for (ItemStack input : recipe) {
if (input != null) {
int row = (i % 3);
int column = i / 3;
int itemX = offsetX + gridOffsetX + (row * itemBoxSize);
int itemY = offsetY + gridOffsetY + (column * itemBoxSize);
drawItemStack(input, itemX, itemY, "");
if (relativeMouseX > itemX - 2 && relativeMouseX < itemX - 2 + itemBoxSize &&
relativeMouseY > itemY - 2 && relativeMouseY < itemY - 2 + itemBoxSize) {
tooltip = input;
}
}
i++;
}
int itemX = offsetX + (isSmelting ? 148 : 165);
int itemY = offsetY + 34;
if (!hasRecipe) {
itemX = offsetX + 120;
itemY = offsetY + 18;
}
}
drawItemStack(result, itemX, itemY, "");
if (relativeMouseX > itemX - 2 && relativeMouseX < itemX - 2 + itemBoxSize &&
relativeMouseY > itemY - 2 && relativeMouseY < itemY - 2 + itemBoxSize) {
tooltip = result;
}
if (tooltip != null) {
drawItemStackTooltip(tooltip, relativeMouseX, relativeMouseY);
}
}
public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY);
int relativeMouseX = mouseX + offsetX;
int relativeMouseY = mouseY + offsetY;
int gridOffsetX = isSmelting ? 88 : 71;
int gridOffsetY = 16;
int itemBoxSize = 18;
addDescription(minecraft, offsetX, offsetY);
ItemStack tooltip = null;
int i = 0;
for (ItemStack input : recipe) {
if (input != null) {
int row = (i % 3);
int column = i / 3;
int itemX = offsetX + gridOffsetX + (row * itemBoxSize);
int itemY = offsetY + gridOffsetY + (column * itemBoxSize);
drawItemStack(input, itemX, itemY, "");
if (relativeMouseX > itemX - 2 && relativeMouseX < itemX - 2 + itemBoxSize &&
relativeMouseY > itemY - 2 && relativeMouseY < itemY - 2 + itemBoxSize) {
tooltip = input;
}
}
i++;
}
int itemX = offsetX + (isSmelting ? 148 : 165);
int itemY = offsetY + 34;
if (!hasRecipe){
itemX = offsetX+120;
itemY = offsetY+18;
}
drawItemStack(result, itemX, itemY, "");
if (relativeMouseX > itemX - 2 && relativeMouseX < itemX - 2 + itemBoxSize &&
relativeMouseY > itemY - 2 && relativeMouseY < itemY - 2 + itemBoxSize) {
tooltip = result;
}
if (tooltip != null) {
drawItemStackTooltip(tooltip, relativeMouseX, relativeMouseY);
}
}
public void addDescription(Minecraft minecraft, int offsetX, int offsetY){
GL11.glPushMatrix();
if (hasRecipe) GL11.glTranslated(offsetX+5, offsetY+75, 1);
else GL11.glTranslated(offsetX+5, offsetY+40, 1);
GL11.glScalef(descriptionScale, descriptionScale, descriptionScale);
int offset = 0;
for (String s : getFormattedText(fontRendererObj)) {
if (s == null) break;
if (s.contains("\\%") && s.substring(0,2).equals("\\%")){
s = s.substring(2);
offset += fontRendererObj.FONT_HEIGHT/2;
}
fontRendererObj.drawString(s, 0, offset, Color.white.getRGB());
offset += fontRendererObj.FONT_HEIGHT;
}
GL11.glPopMatrix();
}
public void addDescription(Minecraft minecraft, int offsetX, int offsetY) {
GL11.glPushMatrix();
if (hasRecipe) GL11.glTranslated(offsetX + 5, offsetY + 75, 1);
else GL11.glTranslated(offsetX + 5, offsetY + 40, 1);
GL11.glScalef(descriptionScale, descriptionScale, descriptionScale);
int offset = 0;
for (String s : getFormattedText(fontRendererObj)) {
if (s == null) break;
if (s.contains("\\%") && s.substring(0, 2).equals("\\%")) {
s = s.substring(2);
offset += fontRendererObj.FONT_HEIGHT / 2;
}
fontRendererObj.drawString(s, 0, offset, Color.white.getRGB());
offset += fontRendererObj.FONT_HEIGHT;
}
GL11.glPopMatrix();
}
@SuppressWarnings("unchecked")
public List<String> getFormattedText(FontRenderer fr) {
if (formattedDescription == null) {
formattedDescription = new ArrayList<String>();
@SuppressWarnings("unchecked")
public List<String> getFormattedText(FontRenderer fr) {
if (formattedDescription == null) {
formattedDescription = new ArrayList<String>();
if (Strings.isNullOrEmpty(rawDescription)) {
formattedDescription = ImmutableList.of();
return formattedDescription;
}
if (!rawDescription.contains("\\n")) {
formattedDescription = ImmutableList.copyOf(fr.listFormattedStringToWidth(rawDescription, 370));
return formattedDescription;
}
if (Strings.isNullOrEmpty(rawDescription)) {
formattedDescription = ImmutableList.of();
return formattedDescription;
}
if (!rawDescription.contains("\\n")) {
formattedDescription = ImmutableList.copyOf(fr.listFormattedStringToWidth(rawDescription, 370));
return formattedDescription;
}
List<String> segments = new ArrayList(); //Each separate string that is separated by a \n
String raw = rawDescription;
List<String> segments = new ArrayList(); //Each separate string that is separated by a \n
String raw = rawDescription;
int escape = 0;
while (raw.contains("\\n")) {
segments.add(raw.substring(0, raw.indexOf("\\n")));
raw = raw.substring(raw.indexOf("\\n") + 2);
if (!raw.contains("\\n")) segments.add(raw);
int escape = 0;
while (raw.contains("\\n")) {
segments.add(raw.substring(0, raw.indexOf("\\n")));
raw = raw.substring(raw.indexOf("\\n") + 2);
if (!raw.contains("\\n")) segments.add(raw);
escape++;
if (escape > 100) {
break;
}
}
escape++;
if (escape > 100) {
break;
}
}
for (String s : segments)
formattedDescription.addAll(ImmutableList.copyOf(fr.listFormattedStringToWidth(s, 370)));
}
return formattedDescription;
}
for (String s : segments)
formattedDescription.addAll(ImmutableList.copyOf(fr.listFormattedStringToWidth(s, 370)));
}
return formattedDescription;
}
protected void drawItemStackTooltip(ItemStack stack, int x, int y) {
final Minecraft mc = Minecraft.getMinecraft();
FontRenderer font = Objects.firstNonNull(stack.getItem().getFontRenderer(stack), mc.fontRenderer);
protected void drawItemStackTooltip(ItemStack stack, int x, int y) {
final Minecraft mc = Minecraft.getMinecraft();
FontRenderer font = Objects.firstNonNull(stack.getItem().getFontRenderer(stack), mc.fontRenderer);
@SuppressWarnings("unchecked")
List<String> list = stack.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips);
@SuppressWarnings("unchecked")
List<String> list = stack.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips);
List<String> colored = Lists.newArrayListWithCapacity(list.size());
colored.add(stack.getRarity().rarityColor + list.get(0));
for (String line : list)
colored.add(EnumChatFormatting.GRAY + line);
List<String> colored = Lists.newArrayListWithCapacity(list.size());
colored.add(stack.getRarity().rarityColor + list.get(0));
for (String line : list)
colored.add(EnumChatFormatting.GRAY + line);
if (colored.size() >= 2) colored.remove(1);
drawHoveringText(colored, x, y, font);
}
if (colored.size() >= 2) colored.remove(1);
drawHoveringText(colored, x, y, font);
}
private void drawItemStack(ItemStack par1ItemStack, int par2, int par3, String par4Str) {
GL11.glTranslatef(0.0F, 0.0F, 32.0F);
this.zLevel = 200.0F;
itemRenderer.zLevel = 200.0F;
RenderHelper.enableGUIStandardItemLighting();
GL11.glColor3f(1f, 1f, 1f);
GL11.glEnable(GL11.GL_NORMALIZE);
FontRenderer font = null;
if (par1ItemStack != null) font = par1ItemStack.getItem().getFontRenderer(par1ItemStack);
if (font == null) font = Minecraft.getMinecraft().fontRenderer;
itemRenderer.renderItemAndEffectIntoGUI(font, Minecraft.getMinecraft().getTextureManager(), par1ItemStack, par2, par3);
itemRenderer.renderItemOverlayIntoGUI(font, Minecraft.getMinecraft().getTextureManager(), par1ItemStack, par2, par3, par4Str);
this.zLevel = 0.0F;
itemRenderer.zLevel = 0.0F;
}
private void drawItemStack(ItemStack par1ItemStack, int par2, int par3, String par4Str) {
GL11.glTranslatef(0.0F, 0.0F, 32.0F);
this.zLevel = 200.0F;
itemRenderer.zLevel = 200.0F;
RenderHelper.enableGUIStandardItemLighting();
GL11.glColor3f(1f, 1f, 1f);
GL11.glEnable(GL11.GL_NORMALIZE);
FontRenderer font = null;
if (par1ItemStack != null) font = par1ItemStack.getItem().getFontRenderer(par1ItemStack);
if (font == null) font = Minecraft.getMinecraft().fontRenderer;
itemRenderer.renderItemAndEffectIntoGUI(font, Minecraft.getMinecraft().getTextureManager(), par1ItemStack, par2, par3);
itemRenderer.renderItemOverlayIntoGUI(font, Minecraft.getMinecraft().getTextureManager(), par1ItemStack, par2, par3, par4Str);
this.zLevel = 0.0F;
itemRenderer.zLevel = 0.0F;
}
@SuppressWarnings("unchecked")
private ItemStack[] getFirstRecipeForItem(ItemStack resultingItem) {
ItemStack[] recipeItems = new ItemStack[9];
for (IRecipe recipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
if (recipe == null) continue;
@SuppressWarnings("unchecked")
private ItemStack[] getFirstRecipeForItem(ItemStack resultingItem) {
ItemStack[] recipeItems = new ItemStack[9];
for (IRecipe recipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
if (recipe == null) continue;
ItemStack result = recipe.getRecipeOutput();
if (result == null || !result.isItemEqual(resultingItem)) continue;
ItemStack result = recipe.getRecipeOutput();
if (result == null || !result.isItemEqual(resultingItem)) continue;
Object[] input = getRecipeInput(recipe);
if (input == null) continue;
Object[] input = getRecipeInput(recipe);
if (input == null) continue;
for (int i = 0; i < input.length; i++)
recipeItems[i] = convertToStack(input[i]);
break;
for (int i = 0; i < input.length; i++)
recipeItems[i] = convertToStack(input[i]);
break;
}
}
Iterator iterator = FurnaceRecipes.smelting().getSmeltingList().entrySet().iterator();
Map.Entry entry;
Iterator iterator = FurnaceRecipes.smelting().getSmeltingList().entrySet().iterator();
Map.Entry entry;
while (iterator.hasNext()){
entry = (Map.Entry)iterator.next();
if (entry.getKey() instanceof ItemStack && ((ItemStack)entry.getValue()).isItemEqual(result)){
isSmelting = true;
recipeItems[0] = (ItemStack)entry.getKey();
}
}
while (iterator.hasNext()) {
entry = (Map.Entry) iterator.next();
if (entry.getKey() instanceof ItemStack && ((ItemStack) entry.getValue()).isItemEqual(result)) {
isSmelting = true;
recipeItems[0] = (ItemStack) entry.getKey();
}
}
return recipeItems;
}
return recipeItems;
}
protected ItemStack convertToStack(Object obj) {
ItemStack entry = null;
if (obj instanceof ItemStack) {
entry = (ItemStack)obj;
} else if (obj instanceof List) {
@SuppressWarnings("unchecked")
List<ItemStack> list = (List<ItemStack>)obj;
if (list.size() > 0) entry = list.get(0);
}
protected ItemStack convertToStack(Object obj) {
ItemStack entry = null;
if (obj instanceof ItemStack) {
entry = (ItemStack) obj;
} else if (obj instanceof List) {
@SuppressWarnings("unchecked")
List<ItemStack> list = (List<ItemStack>) obj;
if (list.size() > 0) entry = list.get(0);
}
if (entry == null) return null;
entry = entry.copy();
if (entry.getItemDamage() == OreDictionary.WILDCARD_VALUE) entry.setItemDamage(0);
return entry;
}
if (entry == null) return null;
entry = entry.copy();
if (entry.getItemDamage() == OreDictionary.WILDCARD_VALUE) entry.setItemDamage(0);
return entry;
}
@SuppressWarnings("unchecked")
private Object[] getRecipeInput(IRecipe recipe) {
if (recipe instanceof ShapelessOreRecipe) return ((ShapelessOreRecipe)recipe).getInput().toArray();
else if (recipe instanceof ShapedOreRecipe) return getShapedOreRecipe((ShapedOreRecipe)recipe);
else if (recipe instanceof ShapedRecipes) return ((ShapedRecipes)recipe).recipeItems;
else if (recipe instanceof ShapelessRecipes) return ((ShapelessRecipes)recipe).recipeItems.toArray(new ItemStack[0]);
return null;
}
@SuppressWarnings("unchecked")
private Object[] getRecipeInput(IRecipe recipe) {
if (recipe instanceof ShapelessOreRecipe) return ((ShapelessOreRecipe) recipe).getInput().toArray();
else if (recipe instanceof ShapedOreRecipe) return getShapedOreRecipe((ShapedOreRecipe) recipe);
else if (recipe instanceof ShapedRecipes) return ((ShapedRecipes) recipe).recipeItems;
else if (recipe instanceof ShapelessRecipes)
return ((ShapelessRecipes) recipe).recipeItems.toArray(new ItemStack[0]);
return null;
}
private Object[] getShapedOreRecipe(ShapedOreRecipe recipe) {
try {
Field field = ShapedOreRecipe.class.getDeclaredField("width");
if (field != null) {
field.setAccessible(true);
int width = field.getInt(recipe);
Object[] input = recipe.getInput();
Object[] grid = new Object[9];
for (int i = 0, offset = 0, y = 0; y < 3; y++) {
for (int x = 0; x < 3; x++, i++) {
if (x < width && offset < input.length) {
grid[i] = input[offset];
offset++;
} else {
grid[i] = null;
}
}
}
return grid;
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
private Object[] getShapedOreRecipe(ShapedOreRecipe recipe) {
try {
Field field = ShapedOreRecipe.class.getDeclaredField("width");
if (field != null) {
field.setAccessible(true);
int width = field.getInt(recipe);
Object[] input = recipe.getInput();
Object[] grid = new Object[9];
for (int i = 0, offset = 0, y = 0; y < 3; y++) {
for (int x = 0; x < 3; x++, i++) {
if (x < width && offset < input.length) {
grid[i] = input[offset];
offset++;
} else {
grid[i] = null;
}
}
}
return grid;
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}

View file

@ -3,58 +3,58 @@ package techreborn.pda.pages;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import techreborn.pda.PageCollection;
import techreborn.pda.util.GuiButtonAHeight;
import techreborn.pda.util.GuiButtonTextOnly;
public class IndexPage extends TitledPage{
public IndexPage(String name, PageCollection collection) {
super(name, false, collection, "techreborn.pda.index", 518915);
}
public class IndexPage extends TitledPage {
@SuppressWarnings("unchecked")
@Override
public void initGui() {
buttonList.clear();
int row = 0;
int collum = 0;
for (BasePage page : collection.pages){
if (page.hasIndexButton){
String indexName = page.INDEX_NAME;
if (indexName==null && page instanceof CraftingInfoPage) indexName = ttl(((CraftingInfoPage)page).result.getUnlocalizedName()+".name");
else if (indexName==null) indexName = page.getReferenceName();
int colour = 0000000;
public IndexPage(String name, PageCollection collection) {
super(name, false, collection, "techreborn.pda.index", 518915);
}
buttonList.add(new GuiButtonTextOnly(999, getXMin()+5+collum*81, getYMin()+20+(row*7), 82, 7, indexName, page.getReferenceName(), 6666666));
row++;
if (row > 21){
row = 0;
collum++;
}
}
}
}
@SuppressWarnings("unchecked")
@Override
public void initGui() {
buttonList.clear();
int row = 0;
int collum = 0;
for (BasePage page : collection.pages) {
if (page.hasIndexButton) {
String indexName = page.INDEX_NAME;
if (indexName == null && page instanceof CraftingInfoPage)
indexName = ttl(((CraftingInfoPage) page).result.getUnlocalizedName() + ".name");
else if (indexName == null) indexName = page.getReferenceName();
int colour = 0000000;
@Override
public void actionPerformed(GuiButton button) {
if (button instanceof GuiButtonTextOnly)
collection.changeActivePage(((GuiButtonTextOnly)button).LINKED_PAGE);
if (button.id == 0) collection.changeActivePage("CONTENTS");
}
buttonList.add(new GuiButtonTextOnly(999, getXMin() + 5 + collum * 81, getYMin() + 20 + (row * 7), 82, 7, indexName, page.getReferenceName(), 6666666));
row++;
if (row > 21) {
row = 0;
collum++;
}
}
}
}
@Override
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
}
@Override
public void actionPerformed(GuiButton button) {
if (button instanceof GuiButtonTextOnly)
collection.changeActivePage(((GuiButtonTextOnly) button).LINKED_PAGE);
if (button.id == 0) collection.changeActivePage("CONTENTS");
}
@Override
public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY);
for (int k = 0; k < this.buttonList.size(); ++k){
if (buttonList.get(k) instanceof GuiButtonTextOnly && ((GuiButtonTextOnly) buttonList.get(k)).getIsHovering()) {
((GuiButtonTextOnly) this.buttonList.get(k)).drawButton(this.mc, mouseX + offsetX, mouseY + offsetY);
}
}
buttonList.add(new GuiButton(0, offsetX + 20, offsetY + 180, ttl("techreborn.pda.backbutton")));
}
@Override
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
}
@Override
public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY);
for (int k = 0; k < this.buttonList.size(); ++k) {
if (buttonList.get(k) instanceof GuiButtonTextOnly && ((GuiButtonTextOnly) buttonList.get(k)).getIsHovering()) {
((GuiButtonTextOnly) this.buttonList.get(k)).drawButton(this.mc, mouseX + offsetX, mouseY + offsetY);
}
}
buttonList.add(new GuiButton(0, offsetX + 20, offsetY + 180, ttl("techreborn.pda.backbutton")));
}
}

View file

@ -1,72 +1,65 @@
package techreborn.pda.pages;
import java.awt.Color;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.item.ItemStack;
import techreborn.init.ModItems;
import techreborn.pda.PageCollection;
import techreborn.pda.util.GuiButtonAHeight;
import techreborn.pda.util.GuiButtonCustomTexture;
import techreborn.pda.util.GuiButtonTextOnly;
public class ItemsPage extends TitledPage{
public String PAGE;
public ItemsPage(String name, PageCollection collection, String page) {
super(name, false, collection, page, Color.white.getRGB());
PAGE = page;
}
import java.awt.*;
@SuppressWarnings("unchecked")
@Override
public void initGui() {
buttonList.clear();
int row = 0;
int collum = 0;
for (BasePage page : collection.pages){
if (page.hasIndexButton){
String indexName = page.INDEX_NAME;
if (page.getReferenceName() != null && page.getReferenceName().contains(PAGE)){
if (indexName==null && page instanceof CraftingInfoPage) indexName = ttl(((CraftingInfoPage)page).result.getUnlocalizedName()+".name");
else if (indexName==null) indexName = page.getReferenceName();
int colour = 77777777;
buttonList.add(new GuiButtonTextOnly(999, getXMin()+20+collum*120, getYMin()+20+(row*7), 82, 7, indexName, page.getReferenceName(), 6666666));
row++;
if (row > 21){
row = 0;
collum++;
}
}
}
}
buttonList.add(new GuiButton(1, getXMin() + 20, getYMin() + 180, ttl("techreborn.pda.backbutton")));
}
public class ItemsPage extends TitledPage {
public String PAGE;
@Override
public void actionPerformed(GuiButton button) {
if (button instanceof GuiButtonTextOnly)
collection.changeActivePage(((GuiButtonTextOnly)button).LINKED_PAGE);
if (button.id == 1) collection.changeActivePage("CONTENTS");
}
public ItemsPage(String name, PageCollection collection, String page) {
super(name, false, collection, page, Color.white.getRGB());
PAGE = page;
}
@Override
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
}
@SuppressWarnings("unchecked")
@Override
public void initGui() {
buttonList.clear();
int row = 0;
int collum = 0;
for (BasePage page : collection.pages) {
if (page.hasIndexButton) {
String indexName = page.INDEX_NAME;
if (page.getReferenceName() != null && page.getReferenceName().contains(PAGE)) {
if (indexName == null && page instanceof CraftingInfoPage)
indexName = ttl(((CraftingInfoPage) page).result.getUnlocalizedName() + ".name");
else if (indexName == null) indexName = page.getReferenceName();
int colour = 77777777;
buttonList.add(new GuiButtonTextOnly(999, getXMin() + 20 + collum * 120, getYMin() + 20 + (row * 7), 82, 7, indexName, page.getReferenceName(), 6666666));
row++;
if (row > 21) {
row = 0;
collum++;
}
}
}
}
buttonList.add(new GuiButton(1, getXMin() + 20, getYMin() + 180, ttl("techreborn.pda.backbutton")));
}
@Override
public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY);
for (int k = 0; k < this.buttonList.size(); ++k){
if (buttonList.get(k) instanceof GuiButtonTextOnly && ((GuiButtonTextOnly) buttonList.get(k)).getIsHovering()) {
((GuiButtonTextOnly) this.buttonList.get(k)).drawButton(this.mc, mouseX + offsetX, mouseY + offsetY);
}
}
}
@Override
public void actionPerformed(GuiButton button) {
if (button instanceof GuiButtonTextOnly)
collection.changeActivePage(((GuiButtonTextOnly) button).LINKED_PAGE);
if (button.id == 1) collection.changeActivePage("CONTENTS");
}
@Override
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
}
@Override
public void drawScreen(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.drawScreen(minecraft, offsetX, offsetY, mouseX, mouseY);
for (int k = 0; k < this.buttonList.size(); ++k) {
if (buttonList.get(k) instanceof GuiButtonTextOnly && ((GuiButtonTextOnly) buttonList.get(k)).getIsHovering()) {
((GuiButtonTextOnly) this.buttonList.get(k)).drawButton(this.mc, mouseX + offsetX, mouseY + offsetY);
}
}
}
}

View file

@ -1,103 +1,97 @@
package techreborn.pda.pages;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.init.Blocks;
import java.awt.Color;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.ResourceLocation;
import techreborn.client.multiblock.Multiblock;
import techreborn.client.multiblock.MultiblockSet;
import reborncore.client.multiblock.Multiblock;
import reborncore.client.multiblock.MultiblockSet;
import techreborn.init.ModBlocks;
import techreborn.pda.PageCollection;
import techreborn.proxies.ClientProxy;
public class MultiBlockPage extends TitledPage{
public static ResourceLocation test = new ResourceLocation("techreborn:textures/pda/multiblocks/base.png");
import java.awt.*;
public MultiBlockPage(String name, PageCollection collection, String unlocalizedTitle) {
super(name, false, collection, unlocalizedTitle, Color.white.getRGB());
}
@Override
public void initGui() {
super.initGui();
GuiButton button = new GuiButton(212, getXMin() + 30, getYMin() + 140, "Show multiblock in world");
buttonList.add(button);
if(ClientProxy.multiblockRenderEvent.currentMultiblock != null){
button.displayString = "Hide multiblock in world";
}
}
@Override
public void drawBackground(int p_146278_1_) {
super.drawBackground(p_146278_1_);
}
@Override
public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderOverlayComponents(minecraft, offsetX, offsetY, mouseX, mouseY);
drawCenteredString(fontRendererObj, ttl("techreborn.pda.multiblock.decripion"), offsetX + 128, offsetY + 20, Color.white.getRGB());
}
public class MultiBlockPage extends TitledPage {
@Override
public void actionPerformed(GuiButton button) {
super.actionPerformed(button);
if(button.id == 212){
if(ClientProxy.multiblockRenderEvent.currentMultiblock == null){
{//This code here makes a basic multiblock and then sets to the selected one.
Multiblock multiblock = new Multiblock();
multiblock.addComponent(0, 0, 0, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 0, 0, ModBlocks.MachineCasing, 0);
multiblock.addComponent(0, 0, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(-1, 0, 0, ModBlocks.MachineCasing, 0);
multiblock.addComponent(0, 0, -1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(-1, 0, -1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(-1, 0, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 0, -1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 0, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 1, 0, ModBlocks.MachineCasing, 0);
multiblock.addComponent(0, 1, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(-1, 1, 0, ModBlocks.MachineCasing, 0);
multiblock.addComponent(0, 1, -1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(-1, 1, -1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(-1, 1, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 1, -1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 1, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 2, 0, ModBlocks.MachineCasing, 0);
multiblock.addComponent(0, 2, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(-1, 2, 0, ModBlocks.MachineCasing, 0);
multiblock.addComponent(0, 2, -1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(-1, 2, -1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(-1, 2, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 2, -1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 2, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 3, 0, ModBlocks.MachineCasing, 0);
multiblock.addComponent(0, 3, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(-1, 3, 0, ModBlocks.MachineCasing, 0);
multiblock.addComponent(0, 3, -1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(-1, 3, -1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(-1, 3, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 3, -1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 3, 1, ModBlocks.MachineCasing, 0);
MultiblockSet set = new MultiblockSet(multiblock);
ClientProxy.multiblockRenderEvent.setMultiblock(set);
}
button.displayString = "Hide multiblock in world";
} else {
ClientProxy.multiblockRenderEvent.setMultiblock(null);
button.displayString = "Show multiblock in world";
}
}
}
public static ResourceLocation test = new ResourceLocation("techreborn:textures/pda/multiblocks/base.png");
public MultiBlockPage(String name, PageCollection collection, String unlocalizedTitle) {
super(name, false, collection, unlocalizedTitle, Color.white.getRGB());
}
@Override
public void initGui() {
super.initGui();
GuiButton button = new GuiButton(212, getXMin() + 30, getYMin() + 140, "Show multiblock in world");
buttonList.add(button);
if (ClientProxy.multiblockRenderEvent.currentMultiblock != null) {
button.displayString = "Hide multiblock in world";
}
}
@Override
public void drawBackground(int p_146278_1_) {
super.drawBackground(p_146278_1_);
}
@Override
public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderOverlayComponents(minecraft, offsetX, offsetY, mouseX, mouseY);
drawCenteredString(fontRendererObj, ttl("techreborn.pda.multiblock.decripion"), offsetX + 128, offsetY + 20, Color.white.getRGB());
}
@Override
public void actionPerformed(GuiButton button) {
super.actionPerformed(button);
if (button.id == 212) {
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null) {
{//This code here makes a basic multiblock and then sets to the selected one.
Multiblock multiblock = new Multiblock();
multiblock.addComponent(0, 0, 0, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 0, 0, ModBlocks.MachineCasing, 0);
multiblock.addComponent(0, 0, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(-1, 0, 0, ModBlocks.MachineCasing, 0);
multiblock.addComponent(0, 0, -1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(-1, 0, -1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(-1, 0, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 0, -1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 0, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 1, 0, ModBlocks.MachineCasing, 0);
multiblock.addComponent(0, 1, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(-1, 1, 0, ModBlocks.MachineCasing, 0);
multiblock.addComponent(0, 1, -1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(-1, 1, -1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(-1, 1, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 1, -1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 1, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 2, 0, ModBlocks.MachineCasing, 0);
multiblock.addComponent(0, 2, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(-1, 2, 0, ModBlocks.MachineCasing, 0);
multiblock.addComponent(0, 2, -1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(-1, 2, -1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(-1, 2, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 2, -1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 2, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 3, 0, ModBlocks.MachineCasing, 0);
multiblock.addComponent(0, 3, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(-1, 3, 0, ModBlocks.MachineCasing, 0);
multiblock.addComponent(0, 3, -1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(-1, 3, -1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(-1, 3, 1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 3, -1, ModBlocks.MachineCasing, 0);
multiblock.addComponent(1, 3, 1, ModBlocks.MachineCasing, 0);
MultiblockSet set = new MultiblockSet(multiblock);
ClientProxy.multiblockRenderEvent.setMultiblock(set);
}
button.displayString = "Hide multiblock in world";
} else {
ClientProxy.multiblockRenderEvent.setMultiblock(null);
button.displayString = "Show multiblock in world";
}
}
}
}

View file

@ -3,20 +3,20 @@ package techreborn.pda.pages;
import net.minecraft.client.Minecraft;
import techreborn.pda.PageCollection;
public class TitledPage extends BasePage{
private String title;
public boolean drawTitle = true;
private int colour;
public class TitledPage extends BasePage {
private String title;
public boolean drawTitle = true;
private int colour;
public TitledPage(String name, boolean showInMenue, PageCollection collection, String unlocalizedTitle, int colour) {
super(name, showInMenue, collection);
this.title = unlocalizedTitle;
this.colour = colour;
}
public TitledPage(String name, boolean showInMenue, PageCollection collection, String unlocalizedTitle, int colour) {
super(name, showInMenue, collection);
this.title = unlocalizedTitle;
this.colour = colour;
}
@Override
public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
if (title == null) title = INDEX_NAME;
if (drawTitle)drawCenteredString(minecraft.fontRenderer, ttl(title), offsetX + 128, offsetY + 5, colour);
}
@Override
public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
if (title == null) title = INDEX_NAME;
if (drawTitle) drawCenteredString(minecraft.fontRenderer, ttl(title), offsetX + 128, offsetY + 5, colour);
}
}

View file

@ -1,73 +1,62 @@
package techreborn.pda.pages;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import org.lwjgl.opengl.Drawable;
import org.lwjgl.opengl.GL11;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import cpw.mods.fml.client.GuiModList;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraftforge.client.event.GuiScreenEvent;
import org.lwjgl.opengl.GL11;
import techreborn.Core;
import techreborn.client.GuiUtil;
import techreborn.lib.ModInfo;
import techreborn.pda.PageCollection;
public class VersionPage extends TitledPage{
import java.awt.*;
import java.util.ArrayList;
public VersionPage(String name, PageCollection collection, String unlocalizedTitle, int colour) {
super(name, false, collection, unlocalizedTitle, Color.white.getRGB());
}
@Override
public void initGui() {
super.initGui();
}
@Override
public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderOverlayComponents(minecraft, offsetX, offsetY, mouseX, mouseY);
addDescription(mc, offsetX, offsetY);
addChangelog(mc, offsetX, offsetY);
addChangelog2(mc, offsetX, offsetY);
}
@Override
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
}
public void addDescription(Minecraft minecraft, int offsetX, int offsetY){
GL11.glPushMatrix();
this.drawCenteredString(minecraft.fontRenderer, "INSTALLED VERSION " + ModInfo.MOD_VERSION, offsetX + 120, offsetY + 20, 7777777);
this.drawCenteredString(minecraft.fontRenderer, "LATEST VERSION " + "TODO", offsetX + 120, offsetY + 40, 7777777);
GL11.glPopMatrix();
}
public void addChangelog(Minecraft minecraft, int offsetX, int offsetY){
GL11.glPushMatrix();
this.drawCenteredString(minecraft.fontRenderer, "CHANGELOG", offsetX + 120, getYMin() + 50, 7777777);
GL11.glPopMatrix();
}
public void addChangelog2(Minecraft minecraft, int offsetX, int offsetY){
public class VersionPage extends TitledPage {
public VersionPage(String name, PageCollection collection, String unlocalizedTitle, int colour) {
super(name, false, collection, unlocalizedTitle, Color.white.getRGB());
}
@Override
public void initGui() {
super.initGui();
}
@Override
public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderOverlayComponents(minecraft, offsetX, offsetY, mouseX, mouseY);
addDescription(mc, offsetX, offsetY);
addChangelog(mc, offsetX, offsetY);
addChangelog2(mc, offsetX, offsetY);
}
@Override
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
}
public void addDescription(Minecraft minecraft, int offsetX, int offsetY) {
GL11.glPushMatrix();
this.drawCenteredString(minecraft.fontRenderer, "INSTALLED VERSION " + ModInfo.MOD_VERSION, offsetX + 120, offsetY + 20, 7777777);
this.drawCenteredString(minecraft.fontRenderer, "LATEST VERSION " + "TODO", offsetX + 120, offsetY + 40, 7777777);
GL11.glPopMatrix();
}
public void addChangelog(Minecraft minecraft, int offsetX, int offsetY) {
GL11.glPushMatrix();
this.drawCenteredString(minecraft.fontRenderer, "CHANGELOG", offsetX + 120, getYMin() + 50, 7777777);
GL11.glPopMatrix();
}
public void addChangelog2(Minecraft minecraft, int offsetX, int offsetY) {
ArrayList<String> changeLog = Core.INSTANCE.versionChecker.getChangeLogSinceCurrentVersion();
GL11.glPushMatrix();
GL11.glScalef(0.7F, 0.7F, 0.7F);
GL11.glPushMatrix();
GL11.glScalef(0.7F, 0.7F, 0.7F);
int y = offsetY + 105;
for (String change : changeLog) {
drawCenteredString(minecraft.fontRenderer, change, offsetX + 230, y, Color.white.getRGB());
drawCenteredString(minecraft.fontRenderer, change, offsetX + 230, y, Color.white.getRGB());
y += 10;
}
GL11.glPopMatrix();
}
GL11.glPopMatrix();
}
}

View file

@ -1,51 +1,48 @@
package techreborn.pda.util;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.OpenGlHelper;
import org.lwjgl.opengl.GL11;
public class GuiButtonAHeight extends GuiButton{
public GuiButtonAHeight(int id, int xPos, int yPos, int width, int hight, String displayString) {
super(id, xPos, yPos, width, hight, displayString);
}
public class GuiButtonAHeight extends GuiButton {
@Override
public void drawButton(Minecraft minecraft, int mouseX, int mouseY) {
if (this.visible){
FontRenderer fontrenderer = minecraft.fontRenderer;
minecraft.getTextureManager().bindTexture(buttonTextures);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
int k = this.getHoverState(this.field_146123_n);
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + k * 20, this.width / 2, this.height);
this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2, 46 + k * 20, this.width / 2, this.height);
if (this.height < 20){
this.drawTexturedModalRect(xPosition, yPosition+3, 0, (46 + k * 20)+20-height+3, width / 2, height-3);
this.drawTexturedModalRect(xPosition + width / 2, yPosition+3, 200 - width / 2, (46 + k * 20)+20-height+3, width / 2, height-3);
}
this.mouseDragged(minecraft, mouseX, mouseY);
int l = 14737632;
public GuiButtonAHeight(int id, int xPos, int yPos, int width, int hight, String displayString) {
super(id, xPos, yPos, width, hight, displayString);
}
if (packedFGColour != 0){
l = packedFGColour;
}
else if (!this.enabled){
l = 10526880;
}
else if (this.field_146123_n){
l = 16777120;
}
this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, l);
}
}
@Override
public void drawButton(Minecraft minecraft, int mouseX, int mouseY) {
if (this.visible) {
FontRenderer fontrenderer = minecraft.fontRenderer;
minecraft.getTextureManager().bindTexture(buttonTextures);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
int k = this.getHoverState(this.field_146123_n);
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + k * 20, this.width / 2, this.height);
this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2, 46 + k * 20, this.width / 2, this.height);
if (this.height < 20) {
this.drawTexturedModalRect(xPosition, yPosition + 3, 0, (46 + k * 20) + 20 - height + 3, width / 2, height - 3);
this.drawTexturedModalRect(xPosition + width / 2, yPosition + 3, 200 - width / 2, (46 + k * 20) + 20 - height + 3, width / 2, height - 3);
}
this.mouseDragged(minecraft, mouseX, mouseY);
int l = 14737632;
if (packedFGColour != 0) {
l = packedFGColour;
} else if (!this.enabled) {
l = 10526880;
} else if (this.field_146123_n) {
l = 16777120;
}
this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, l);
}
}
}

View file

@ -1,32 +1,29 @@
package techreborn.pda.util;
import java.awt.Color;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.config.GuiButtonExt;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import java.awt.*;
public class GuiButtonCustomTexture extends GuiButtonExt {
public int textureU;
public int textureV;
public ItemStack itemstack;
public String LINKED_PAGE;
public String NAME;
public String LINKED_PAGE;
public String NAME;
public GuiButtonCustomTexture(int id, int xPos, int yPos, int u, int v, int width, int height, ItemStack stack, String linkedPage, String name) {
super(id, xPos, yPos, width, height, "_");
textureU = u;
textureV = v;
itemstack = stack;
NAME = name;
this.LINKED_PAGE = linkedPage;
this.LINKED_PAGE = linkedPage;
}
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
@ -34,16 +31,16 @@ public class GuiButtonCustomTexture extends GuiButtonExt {
boolean flag = mouseX >= this.xPosition && mouseY >= this.yPosition
&& mouseX < this.xPosition + this.width
&& mouseY < this.yPosition + this.height;
mc.getTextureManager().bindTexture(buttonTextures);
mc.getTextureManager().bindTexture(buttonTextures);
int u = textureU;
int v = textureV;
if (flag) {
u += width;
GL11.glPushMatrix();
GL11.glColor4f(0f, 0f, 0f, 1f);
GL11.glPushMatrix();
GL11.glColor4f(0f, 0f, 0f, 1f);
this.drawTexturedModalRect(this.xPosition, this.yPosition, u, v, width, height);
GL11.glPopMatrix();
GL11.glPopMatrix();
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glEnable(32826);
@ -53,6 +50,9 @@ public class GuiButtonCustomTexture extends GuiButtonExt {
this.drawString(mc.fontRenderer, this.NAME, this.xPosition + 20, this.yPosition + 3, Color.white.getRGB());
}
}
public boolean getIsHovering(){return field_146123_n;}
public boolean getIsHovering() {
return field_146123_n;
}
}

View file

@ -1,62 +1,63 @@
package techreborn.pda.util;
import java.awt.Color;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.util.EnumChatFormatting;
import org.lwjgl.opengl.GL11;
public class GuiButtonTextOnly extends GuiButton{
public String LINKED_PAGE;
public int textColour;
import java.awt.*;
public GuiButtonTextOnly(int id, int xPos, int yPos, int width, int hight, String displayString, String linkedPage, int colour) {
super(id, xPos, yPos, width, hight, displayString);
this.LINKED_PAGE = linkedPage;
this.textColour = colour;
}
public class GuiButtonTextOnly extends GuiButton {
public String LINKED_PAGE;
public int textColour;
@Override
public void drawButton(Minecraft minecraft, int mouseX, int mouseY) {
if (this.visible){
FontRenderer fontrenderer = minecraft.fontRenderer;
minecraft.getTextureManager().bindTexture(buttonTextures);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
public GuiButtonTextOnly(int id, int xPos, int yPos, int width, int hight, String displayString, String linkedPage, int colour) {
super(id, xPos, yPos, width, hight, displayString);
this.LINKED_PAGE = linkedPage;
this.textColour = colour;
}
this.mouseDragged(minecraft, mouseX, mouseY);
@Override
public void drawButton(Minecraft minecraft, int mouseX, int mouseY) {
if (this.visible) {
FontRenderer fontrenderer = minecraft.fontRenderer;
minecraft.getTextureManager().bindTexture(buttonTextures);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
String trimmedDisplayString = displayString;
if (fontrenderer.getStringWidth(displayString) > width+30 && !this.field_146123_n){
int energencyBreak = 0;
while (fontrenderer.getStringWidth(trimmedDisplayString)*0.7 > width-5){
trimmedDisplayString = trimmedDisplayString.substring(0, trimmedDisplayString.length()-1);
energencyBreak++;
if (energencyBreak > 100) break;
}
trimmedDisplayString+="...";
}
this.mouseDragged(minecraft, mouseX, mouseY);
if (this.field_146123_n){
trimmedDisplayString = EnumChatFormatting.BOLD+""+EnumChatFormatting.ITALIC+trimmedDisplayString;
GL11.glPushMatrix();
GL11.glColor4f(0f, 0f, 0f, 1f);
drawTexturedModalRect(xPosition+(int)(xPosition*0.01), yPosition+(int)(yPosition*0.01), 0, 46, (int)(fontrenderer.getStringWidth(trimmedDisplayString)*0.72)+2, 8);
GL11.glPopMatrix();
}
GL11.glPushMatrix();
GL11.glScalef(0.7F, 0.7F, 1);
fontrenderer.drawString(trimmedDisplayString, (int)(xPosition*1.45), (int)((yPosition + (height - 8) / 2)*1.45), Color.WHITE.getRGB());
GL11.glPopMatrix();
}
}
String trimmedDisplayString = displayString;
if (fontrenderer.getStringWidth(displayString) > width + 30 && !this.field_146123_n) {
int energencyBreak = 0;
while (fontrenderer.getStringWidth(trimmedDisplayString) * 0.7 > width - 5) {
trimmedDisplayString = trimmedDisplayString.substring(0, trimmedDisplayString.length() - 1);
energencyBreak++;
if (energencyBreak > 100) break;
}
trimmedDisplayString += "...";
}
public boolean getIsHovering(){return field_146123_n;}
if (this.field_146123_n) {
trimmedDisplayString = EnumChatFormatting.BOLD + "" + EnumChatFormatting.ITALIC + trimmedDisplayString;
GL11.glPushMatrix();
GL11.glColor4f(0f, 0f, 0f, 1f);
drawTexturedModalRect(xPosition + (int) (xPosition * 0.01), yPosition + (int) (yPosition * 0.01), 0, 46, (int) (fontrenderer.getStringWidth(trimmedDisplayString) * 0.72) + 2, 8);
GL11.glPopMatrix();
}
GL11.glPushMatrix();
GL11.glScalef(0.7F, 0.7F, 1);
fontrenderer.drawString(trimmedDisplayString, (int) (xPosition * 1.45), (int) ((yPosition + (height - 8) / 2) * 1.45), Color.WHITE.getRGB());
GL11.glPopMatrix();
}
}
public boolean getIsHovering() {
return field_146123_n;
}
}