Added code formatter
This commit is contained in:
parent
710f9c04e7
commit
b9448d5d90
444 changed files with 32383 additions and 26254 deletions
|
@ -1,5 +1,7 @@
|
|||
package techreborn.manual;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
@ -8,170 +10,203 @@ import net.minecraft.inventory.Container;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import techreborn.init.ModBlocks;
|
||||
import techreborn.init.ModItems;
|
||||
import techreborn.items.ItemParts;
|
||||
import techreborn.items.ItemPlates;
|
||||
import techreborn.manual.pages.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import techreborn.manual.pages.AdvancedMachines;
|
||||
import techreborn.manual.pages.BasicMachinesPage;
|
||||
import techreborn.manual.pages.ContentsPage;
|
||||
import techreborn.manual.pages.CraftingInfoPage;
|
||||
import techreborn.manual.pages.DescriptionPage;
|
||||
import techreborn.manual.pages.GeneratingPowerPage;
|
||||
import techreborn.manual.pages.GettingStartedPage;
|
||||
import techreborn.manual.pages.ToolsPage;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiManual extends GuiScreen
|
||||
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;
|
||||
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 GuiManual()
|
||||
{
|
||||
this.xSize = 146;
|
||||
this.ySize = 180;
|
||||
root = createRoot();
|
||||
}
|
||||
public GuiManual()
|
||||
{
|
||||
this.xSize = 146;
|
||||
this.ySize = 180;
|
||||
root = createRoot();
|
||||
}
|
||||
|
||||
protected PageCollection createRoot()
|
||||
{
|
||||
pageIndex = 0;
|
||||
final PageCollection pageCollection = new PageCollection();
|
||||
pageCollection.addPage(new ContentsPage(Reference.pageNames.CONTENTS_PAGE, pageCollection));
|
||||
|
||||
//GETTING STARTED
|
||||
pageCollection.addPage(new GettingStartedPage(Reference.pageNames.GETTINGSTARTED_PAGE, pageCollection));
|
||||
protected PageCollection createRoot()
|
||||
{
|
||||
pageIndex = 0;
|
||||
final PageCollection pageCollection = new PageCollection();
|
||||
pageCollection.addPage(new ContentsPage(Reference.pageNames.CONTENTS_PAGE, pageCollection));
|
||||
|
||||
pageCollection.addPage(new DescriptionPage(Reference.pageNames.GETTINGRUBBER_PAGE, pageCollection, true, Reference.pageNames.GETTINGRUBBER2_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(Reference.pageNames.GETTINGRUBBER2_PAGE, pageCollection, ItemParts.getPartByName("rubber"), "", Reference.pageNames.GETTINGRUBBER_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(Reference.pageNames.CRAFTINGPLATES_PAGE, pageCollection, ItemPlates.getPlateByName("iron"), "", Reference.pageNames.GETTINGSTARTED_PAGE));
|
||||
|
||||
//POWER GENERATION
|
||||
pageCollection.addPage(new GeneratingPowerPage(Reference.pageNames.GENERATINGPOWER_PAGE, pageCollection));
|
||||
// GETTING STARTED
|
||||
pageCollection.addPage(new GettingStartedPage(Reference.pageNames.GETTINGSTARTED_PAGE, pageCollection));
|
||||
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.Generator.getLocalizedName(), pageCollection, new ItemStack(ModBlocks.Generator), "", Reference.pageNames.GENERATINGPOWER_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.thermalGenerator.getLocalizedName(), pageCollection, new ItemStack(ModBlocks.thermalGenerator), "", Reference.pageNames.GENERATINGPOWER_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.solarPanel.getLocalizedName(), pageCollection, new ItemStack(ModBlocks.solarPanel), "", Reference.pageNames.GENERATINGPOWER_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.heatGenerator.getLocalizedName(), pageCollection, new ItemStack(ModBlocks.heatGenerator), "", Reference.pageNames.GENERATINGPOWER_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.LightningRod.getLocalizedName(), pageCollection, new ItemStack(ModBlocks.LightningRod), "", Reference.pageNames.GENERATINGPOWER_PAGE));
|
||||
|
||||
//BASIC MACHINES
|
||||
pageCollection.addPage(new BasicMachinesPage(Reference.pageNames.BASICMACHINES_PAGE, pageCollection));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.Grinder.getLocalizedName(), pageCollection, new ItemStack(ModBlocks.Grinder), "", Reference.pageNames.BASICMACHINES_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.ElectricFurnace.getLocalizedName(), pageCollection, new ItemStack(ModBlocks.ElectricFurnace), "", Reference.pageNames.BASICMACHINES_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.AlloySmelter.getLocalizedName(), pageCollection, new ItemStack(ModBlocks.AlloySmelter), "", Reference.pageNames.BASICMACHINES_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.Extractor.getLocalizedName(), pageCollection, new ItemStack(ModBlocks.Extractor), "", Reference.pageNames.BASICMACHINES_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.Compressor.getLocalizedName(), pageCollection, new ItemStack(ModBlocks.Compressor), "", Reference.pageNames.BASICMACHINES_PAGE));
|
||||
|
||||
//ADVANCED MACHINES
|
||||
pageCollection.addPage(new AdvancedMachines(Reference.pageNames.ADVANCEDMACHINES_PAGE, pageCollection));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.BlastFurnace.getLocalizedName(), pageCollection, new ItemStack(ModBlocks.BlastFurnace), "", Reference.pageNames.ADVANCEDMACHINES_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.industrialSawmill.getLocalizedName(), pageCollection, new ItemStack(ModBlocks.industrialSawmill), "", Reference.pageNames.ADVANCEDMACHINES_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.IndustrialElectrolyzer.getLocalizedName(), pageCollection, new ItemStack(ModBlocks.IndustrialElectrolyzer), "", Reference.pageNames.ADVANCEDMACHINES_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.IndustrialGrinder.getLocalizedName(), pageCollection, new ItemStack(ModBlocks.IndustrialGrinder), "", Reference.pageNames.ADVANCEDMACHINES_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.ImplosionCompressor.getLocalizedName(), pageCollection, new ItemStack(ModBlocks.ImplosionCompressor), "", Reference.pageNames.ADVANCEDMACHINES_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.centrifuge.getLocalizedName(), pageCollection, new ItemStack(ModBlocks.centrifuge), "", Reference.pageNames.ADVANCEDMACHINES_PAGE));
|
||||
pageCollection.addPage(new DescriptionPage(Reference.pageNames.GETTINGRUBBER_PAGE, pageCollection, true,
|
||||
Reference.pageNames.GETTINGRUBBER2_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(Reference.pageNames.GETTINGRUBBER2_PAGE, pageCollection,
|
||||
ItemParts.getPartByName("rubber"), "", Reference.pageNames.GETTINGRUBBER_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(Reference.pageNames.CRAFTINGPLATES_PAGE, pageCollection,
|
||||
ItemPlates.getPlateByName("iron"), "", Reference.pageNames.GETTINGSTARTED_PAGE));
|
||||
|
||||
//TOOLS
|
||||
pageCollection.addPage(new ToolsPage(Reference.pageNames.TOOLS_PAGE, pageCollection));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModItems.ironDrill.getUnlocalizedName() + ".name", pageCollection, new ItemStack(ModItems.ironDrill), "", Reference.pageNames.TOOLS_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModItems.diamondDrill.getUnlocalizedName() + ".name", pageCollection, new ItemStack(ModItems.diamondDrill), "", Reference.pageNames.TOOLS_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModItems.advancedDrill.getUnlocalizedName() + ".name", pageCollection, new ItemStack(ModItems.advancedDrill), "", Reference.pageNames.TOOLS_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModItems.ironChainsaw.getUnlocalizedName() + ".name", pageCollection, new ItemStack(ModItems.ironChainsaw), "", Reference.pageNames.TOOLS_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModItems.diamondChainsaw.getUnlocalizedName() + ".name", pageCollection, new ItemStack(ModItems.diamondChainsaw), "", Reference.pageNames.TOOLS_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModItems.advancedChainsaw.getUnlocalizedName() + ".name", pageCollection, new ItemStack(ModItems.advancedChainsaw), "", Reference.pageNames.TOOLS_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModItems.omniTool.getUnlocalizedName() + ".name", pageCollection, new ItemStack(ModItems.omniTool), "", Reference.pageNames.TOOLS_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModItems.treeTap.getUnlocalizedName() + ".name", pageCollection, new ItemStack(ModItems.treeTap), "", Reference.pageNames.TOOLS_PAGE));
|
||||
// POWER GENERATION
|
||||
pageCollection.addPage(new GeneratingPowerPage(Reference.pageNames.GENERATINGPOWER_PAGE, pageCollection));
|
||||
|
||||
return pageCollection;
|
||||
}
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.Generator.getLocalizedName(), pageCollection,
|
||||
new ItemStack(ModBlocks.Generator), "", Reference.pageNames.GENERATINGPOWER_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.thermalGenerator.getLocalizedName(), pageCollection,
|
||||
new ItemStack(ModBlocks.thermalGenerator), "", Reference.pageNames.GENERATINGPOWER_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.solarPanel.getLocalizedName(), pageCollection,
|
||||
new ItemStack(ModBlocks.solarPanel), "", Reference.pageNames.GENERATINGPOWER_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.heatGenerator.getLocalizedName(), pageCollection,
|
||||
new ItemStack(ModBlocks.heatGenerator), "", Reference.pageNames.GENERATINGPOWER_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.LightningRod.getLocalizedName(), pageCollection,
|
||||
new ItemStack(ModBlocks.LightningRod), "", Reference.pageNames.GENERATINGPOWER_PAGE));
|
||||
|
||||
private int getNextPageIndex()
|
||||
{
|
||||
int i = pageIndex;
|
||||
pageIndex++;
|
||||
return i;
|
||||
}
|
||||
// BASIC MACHINES
|
||||
pageCollection.addPage(new BasicMachinesPage(Reference.pageNames.BASICMACHINES_PAGE, pageCollection));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.Grinder.getLocalizedName(), pageCollection,
|
||||
new ItemStack(ModBlocks.Grinder), "", Reference.pageNames.BASICMACHINES_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.ElectricFurnace.getLocalizedName(), pageCollection,
|
||||
new ItemStack(ModBlocks.ElectricFurnace), "", Reference.pageNames.BASICMACHINES_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.AlloySmelter.getLocalizedName(), pageCollection,
|
||||
new ItemStack(ModBlocks.AlloySmelter), "", Reference.pageNames.BASICMACHINES_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.Extractor.getLocalizedName(), pageCollection,
|
||||
new ItemStack(ModBlocks.Extractor), "", Reference.pageNames.BASICMACHINES_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.Compressor.getLocalizedName(), pageCollection,
|
||||
new ItemStack(ModBlocks.Compressor), "", Reference.pageNames.BASICMACHINES_PAGE));
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float par3)
|
||||
{
|
||||
drawGuiBackgroundLayer(par3, mouseX, mouseY);
|
||||
super.drawScreen(mouseX, mouseY, par3);
|
||||
// ADVANCED MACHINES
|
||||
pageCollection.addPage(new AdvancedMachines(Reference.pageNames.ADVANCEDMACHINES_PAGE, pageCollection));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.BlastFurnace.getLocalizedName(), pageCollection,
|
||||
new ItemStack(ModBlocks.BlastFurnace), "", Reference.pageNames.ADVANCEDMACHINES_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.industrialSawmill.getLocalizedName(), pageCollection,
|
||||
new ItemStack(ModBlocks.industrialSawmill), "", Reference.pageNames.ADVANCEDMACHINES_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.IndustrialElectrolyzer.getLocalizedName(), pageCollection,
|
||||
new ItemStack(ModBlocks.IndustrialElectrolyzer), "", Reference.pageNames.ADVANCEDMACHINES_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.IndustrialGrinder.getLocalizedName(), pageCollection,
|
||||
new ItemStack(ModBlocks.IndustrialGrinder), "", Reference.pageNames.ADVANCEDMACHINES_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.ImplosionCompressor.getLocalizedName(), pageCollection,
|
||||
new ItemStack(ModBlocks.ImplosionCompressor), "", Reference.pageNames.ADVANCEDMACHINES_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModBlocks.centrifuge.getLocalizedName(), pageCollection,
|
||||
new ItemStack(ModBlocks.centrifuge), "", Reference.pageNames.ADVANCEDMACHINES_PAGE));
|
||||
|
||||
prepareRenderState();
|
||||
GL11.glPushMatrix();
|
||||
// TOOLS
|
||||
pageCollection.addPage(new ToolsPage(Reference.pageNames.TOOLS_PAGE, pageCollection));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModItems.ironDrill.getUnlocalizedName() + ".name", pageCollection,
|
||||
new ItemStack(ModItems.ironDrill), "", Reference.pageNames.TOOLS_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModItems.diamondDrill.getUnlocalizedName() + ".name",
|
||||
pageCollection, new ItemStack(ModItems.diamondDrill), "", Reference.pageNames.TOOLS_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModItems.advancedDrill.getUnlocalizedName() + ".name",
|
||||
pageCollection, new ItemStack(ModItems.advancedDrill), "", Reference.pageNames.TOOLS_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModItems.ironChainsaw.getUnlocalizedName() + ".name",
|
||||
pageCollection, new ItemStack(ModItems.ironChainsaw), "", Reference.pageNames.TOOLS_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModItems.diamondChainsaw.getUnlocalizedName() + ".name",
|
||||
pageCollection, new ItemStack(ModItems.diamondChainsaw), "", Reference.pageNames.TOOLS_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModItems.advancedChainsaw.getUnlocalizedName() + ".name",
|
||||
pageCollection, new ItemStack(ModItems.advancedChainsaw), "", Reference.pageNames.TOOLS_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModItems.omniTool.getUnlocalizedName() + ".name", pageCollection,
|
||||
new ItemStack(ModItems.omniTool), "", Reference.pageNames.TOOLS_PAGE));
|
||||
pageCollection.addPage(new CraftingInfoPage(ModItems.treeTap.getUnlocalizedName() + ".name", pageCollection,
|
||||
new ItemStack(ModItems.treeTap), "", Reference.pageNames.TOOLS_PAGE));
|
||||
|
||||
root.drawScreen(this.mc, this.guiLeft, this.guiTop, mouseX - this.guiLeft, mouseY - this.guiTop);
|
||||
return pageCollection;
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
restoreRenderState();
|
||||
}
|
||||
private int getNextPageIndex()
|
||||
{
|
||||
int i = pageIndex;
|
||||
pageIndex++;
|
||||
return i;
|
||||
}
|
||||
|
||||
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 drawScreen(int mouseX, int mouseY, float par3)
|
||||
{
|
||||
drawGuiBackgroundLayer(par3, mouseX, mouseY);
|
||||
super.drawScreen(mouseX, mouseY, par3);
|
||||
|
||||
protected void restoreRenderState()
|
||||
{
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
}
|
||||
prepareRenderState();
|
||||
GL11.glPushMatrix();
|
||||
|
||||
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();
|
||||
}
|
||||
root.drawScreen(this.mc, this.guiLeft, this.guiTop, mouseX - this.guiLeft, mouseY - this.guiTop);
|
||||
|
||||
@Override
|
||||
public void setWorldAndResolution(Minecraft minecraft, int x, int y)
|
||||
{
|
||||
super.setWorldAndResolution(minecraft, x, y);
|
||||
root.setWorldAndResolution(minecraft, x, y);
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
restoreRenderState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button)
|
||||
{
|
||||
root.actionPerformed(button);
|
||||
}
|
||||
protected void prepareRenderState()
|
||||
{
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
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 mouseClicked(int par1, int par2, int par3) throws IOException
|
||||
{
|
||||
root.mouseClicked(par1, par2, par3);
|
||||
}
|
||||
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 handleInput() throws IOException
|
||||
{
|
||||
super.handleInput();
|
||||
}
|
||||
@Override
|
||||
public void setWorldAndResolution(Minecraft minecraft, int x, int y)
|
||||
{
|
||||
super.setWorldAndResolution(minecraft, x, y);
|
||||
root.setWorldAndResolution(minecraft, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
this.guiLeft = (this.width - this.xSize) / 2;
|
||||
this.guiTop = (this.height - this.ySize) / 2;
|
||||
}
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button)
|
||||
{
|
||||
root.actionPerformed(button);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesGuiPauseGame()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public void mouseClicked(int par1, int par2, int par3) throws IOException
|
||||
{
|
||||
root.mouseClicked(par1, par2, par3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleInput() throws IOException
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,85 +1,106 @@
|
|||
package techreborn.manual;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import techreborn.manual.pages.BasePage;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
public class PageCollection extends Gui {
|
||||
public class PageCollection extends Gui
|
||||
{
|
||||
|
||||
public final List<BasePage> pages = Lists.newArrayList();
|
||||
private String ACTIVE_PAGE = Reference.pageNames.CONTENTS_PAGE;
|
||||
protected int x;
|
||||
protected int y;
|
||||
public final List<BasePage> pages = Lists.newArrayList();
|
||||
private String ACTIVE_PAGE = Reference.pageNames.CONTENTS_PAGE;
|
||||
protected int x;
|
||||
protected int y;
|
||||
|
||||
public PageCollection() {
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
}
|
||||
public PageCollection()
|
||||
{
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
}
|
||||
|
||||
public void addPage(BasePage page) {
|
||||
pages.add(page);
|
||||
}
|
||||
public void addPage(BasePage page)
|
||||
{
|
||||
pages.add(page);
|
||||
}
|
||||
|
||||
public BasePage getPageByName(String name) {
|
||||
for (BasePage component : pages) {
|
||||
if (component.getReferenceName().equals(ACTIVE_PAGE)) {
|
||||
return component;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
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 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 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().mo(par1, par2, par3);
|
||||
// }
|
||||
|
||||
// protected void mouseMovedOrUp(int par1, int par2, int par3) {
|
||||
// if (getActivePage() == null) return;
|
||||
// getActivePage().mo(par1, par2, par3);
|
||||
// }
|
||||
|
||||
protected void mouseClicked(int par1, int par2, int par3) throws IOException {
|
||||
if (getActivePage() == null) return;
|
||||
getActivePage().mouseClicked(par1, par2, par3);
|
||||
}
|
||||
protected void mouseClicked(int par1, int par2, int par3) throws IOException
|
||||
{
|
||||
if (getActivePage() == null)
|
||||
return;
|
||||
getActivePage().mouseClicked(par1, par2, par3);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package techreborn.manual;
|
||||
|
||||
public class Reference
|
||||
public class Reference
|
||||
{
|
||||
public static final String CONTENTS_KEY = "techreborn.manual.contents";
|
||||
public static final String CONTENTS_KEY = "techreborn.manual.contents";
|
||||
public static final String GETTINGSTARTED_KEY = "techreborn.manual.gettingstarted";
|
||||
public static final String GENERATINGPOWER_KEY = "techreborn.manual.generatingpower";
|
||||
public static final String BASICMACHINES_KEY = "techreborn.manual.basicmachines";
|
||||
|
@ -12,7 +12,6 @@ public class Reference
|
|||
public static final String GETTINGRUBBER_KEY = "techreborn.manual.gettingrubber";
|
||||
public static final String CRAFTINGPLATES_KEY = "techreborn.manual.gettingplates";
|
||||
|
||||
|
||||
public class pageNames
|
||||
{
|
||||
public static final String CONTENTS_PAGE = "contents";
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package techreborn.manual.pages;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
@ -8,43 +10,54 @@ import techreborn.manual.Reference;
|
|||
import techreborn.manual.util.ButtonUtil;
|
||||
import techreborn.manual.util.GuiButtonItemTexture;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class AdvancedMachines extends TitledPage
|
||||
{
|
||||
public AdvancedMachines(String name, PageCollection collection)
|
||||
{
|
||||
super(name, false, collection, Reference.ADVANCEDMACHINES_KEY, Color.white.getRGB());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
buttonList.clear();
|
||||
ButtonUtil.addBackButton(0, width / 2 - 60, height / 2 + 64, buttonList);
|
||||
buttonList.add(new GuiButtonItemTexture(1, getXMin() + 10, getYMin() + 20, 0, 46, 100, 20, new ItemStack(ModBlocks.BlastFurnace),
|
||||
ModBlocks.BlastFurnace.getUnlocalizedName(), ttl(ModBlocks.BlastFurnace.getLocalizedName())));
|
||||
buttonList.add(new GuiButtonItemTexture(2, getXMin() + 10, getYMin() + 40, 0, 46, 100, 20, new ItemStack(ModBlocks.industrialSawmill),
|
||||
ModBlocks.industrialSawmill.getUnlocalizedName(), ttl(ModBlocks.industrialSawmill.getLocalizedName())));
|
||||
buttonList.add(new GuiButtonItemTexture(3, getXMin() + 10, getYMin() + 60, 0, 46, 100, 20, new ItemStack(ModBlocks.IndustrialElectrolyzer),
|
||||
ModBlocks.IndustrialElectrolyzer.getUnlocalizedName(), ttl(ModBlocks.IndustrialElectrolyzer.getLocalizedName())));
|
||||
buttonList.add(new GuiButtonItemTexture(4, getXMin() + 10, getYMin() + 80, 0, 46, 100, 20, new ItemStack(ModBlocks.IndustrialGrinder),
|
||||
ModBlocks.IndustrialGrinder.getUnlocalizedName(), ttl(ModBlocks.IndustrialGrinder.getLocalizedName())));
|
||||
buttonList.add(new GuiButtonItemTexture(5, getXMin() + 10, getYMin() + 100, 0, 46, 100, 20, new ItemStack(ModBlocks.ImplosionCompressor),
|
||||
ModBlocks.ImplosionCompressor.getUnlocalizedName(), ttl(ModBlocks.ImplosionCompressor.getLocalizedName())));
|
||||
buttonList.add(new GuiButtonItemTexture(6, getXMin() + 10, getYMin() + 120, 0, 46, 100, 20, new ItemStack(ModBlocks.centrifuge),
|
||||
ModBlocks.centrifuge.getUnlocalizedName(), ttl(ModBlocks.centrifuge.getLocalizedName())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button)
|
||||
{
|
||||
if (button.id == 0) collection.changeActivePage(Reference.pageNames.CONTENTS_PAGE);
|
||||
if (button.id == 1) collection.changeActivePage(ModBlocks.BlastFurnace.getLocalizedName());
|
||||
if (button.id == 2) collection.changeActivePage(ModBlocks.industrialSawmill.getLocalizedName());
|
||||
if (button.id == 3) collection.changeActivePage(ModBlocks.IndustrialElectrolyzer.getLocalizedName());
|
||||
if (button.id == 4) collection.changeActivePage(ModBlocks.IndustrialGrinder.getLocalizedName());
|
||||
if (button.id == 5) collection.changeActivePage(ModBlocks.ImplosionCompressor.getLocalizedName());
|
||||
if (button.id == 6) collection.changeActivePage(ModBlocks.centrifuge.getLocalizedName());
|
||||
}
|
||||
public AdvancedMachines(String name, PageCollection collection)
|
||||
{
|
||||
super(name, false, collection, Reference.ADVANCEDMACHINES_KEY, Color.white.getRGB());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
buttonList.clear();
|
||||
ButtonUtil.addBackButton(0, width / 2 - 60, height / 2 + 64, buttonList);
|
||||
buttonList.add(new GuiButtonItemTexture(1, getXMin() + 10, getYMin() + 20, 0, 46, 100, 20,
|
||||
new ItemStack(ModBlocks.BlastFurnace), ModBlocks.BlastFurnace.getUnlocalizedName(),
|
||||
ttl(ModBlocks.BlastFurnace.getLocalizedName())));
|
||||
buttonList.add(new GuiButtonItemTexture(2, getXMin() + 10, getYMin() + 40, 0, 46, 100, 20,
|
||||
new ItemStack(ModBlocks.industrialSawmill), ModBlocks.industrialSawmill.getUnlocalizedName(),
|
||||
ttl(ModBlocks.industrialSawmill.getLocalizedName())));
|
||||
buttonList.add(new GuiButtonItemTexture(3, getXMin() + 10, getYMin() + 60, 0, 46, 100, 20,
|
||||
new ItemStack(ModBlocks.IndustrialElectrolyzer), ModBlocks.IndustrialElectrolyzer.getUnlocalizedName(),
|
||||
ttl(ModBlocks.IndustrialElectrolyzer.getLocalizedName())));
|
||||
buttonList.add(new GuiButtonItemTexture(4, getXMin() + 10, getYMin() + 80, 0, 46, 100, 20,
|
||||
new ItemStack(ModBlocks.IndustrialGrinder), ModBlocks.IndustrialGrinder.getUnlocalizedName(),
|
||||
ttl(ModBlocks.IndustrialGrinder.getLocalizedName())));
|
||||
buttonList.add(new GuiButtonItemTexture(5, getXMin() + 10, getYMin() + 100, 0, 46, 100, 20,
|
||||
new ItemStack(ModBlocks.ImplosionCompressor), ModBlocks.ImplosionCompressor.getUnlocalizedName(),
|
||||
ttl(ModBlocks.ImplosionCompressor.getLocalizedName())));
|
||||
buttonList.add(new GuiButtonItemTexture(6, getXMin() + 10, getYMin() + 120, 0, 46, 100, 20,
|
||||
new ItemStack(ModBlocks.centrifuge), ModBlocks.centrifuge.getUnlocalizedName(),
|
||||
ttl(ModBlocks.centrifuge.getLocalizedName())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button)
|
||||
{
|
||||
if (button.id == 0)
|
||||
collection.changeActivePage(Reference.pageNames.CONTENTS_PAGE);
|
||||
if (button.id == 1)
|
||||
collection.changeActivePage(ModBlocks.BlastFurnace.getLocalizedName());
|
||||
if (button.id == 2)
|
||||
collection.changeActivePage(ModBlocks.industrialSawmill.getLocalizedName());
|
||||
if (button.id == 3)
|
||||
collection.changeActivePage(ModBlocks.IndustrialElectrolyzer.getLocalizedName());
|
||||
if (button.id == 4)
|
||||
collection.changeActivePage(ModBlocks.IndustrialGrinder.getLocalizedName());
|
||||
if (button.id == 5)
|
||||
collection.changeActivePage(ModBlocks.ImplosionCompressor.getLocalizedName());
|
||||
if (button.id == 6)
|
||||
collection.changeActivePage(ModBlocks.centrifuge.getLocalizedName());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package techreborn.manual.pages;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
@ -8,90 +10,107 @@ import net.minecraft.util.text.translation.I18n;
|
|||
import techreborn.manual.PageCollection;
|
||||
import techreborn.manual.Reference;
|
||||
|
||||
import java.io.IOException;
|
||||
public class BasePage extends GuiScreen
|
||||
{
|
||||
|
||||
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/manual/gui/manual.png");
|
||||
private final int xSize = 146;
|
||||
private final int ySize = 180;
|
||||
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/manual/gui/manual.png");
|
||||
private final int xSize = 146;
|
||||
private final int ySize = 180;
|
||||
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;
|
||||
}
|
||||
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(Reference.pageNames.CONTENTS_PAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button) {
|
||||
if (button.id == 0) collection.changeActivePage(Reference.pageNames.CONTENTS_PAGE);
|
||||
}
|
||||
@Override
|
||||
public void mouseClicked(int par1, int par2, int par3) throws IOException
|
||||
{
|
||||
super.mouseClicked(par1, par2, par3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int par1, int par2, int par3) throws IOException {
|
||||
super.mouseClicked(par1, par2, par3);
|
||||
}
|
||||
|
||||
//Translate To Local
|
||||
public String ttl(String unlocalizedName) {
|
||||
return I18n.translateToLocal(unlocalizedName);
|
||||
}
|
||||
// Translate To Local
|
||||
public String ttl(String unlocalizedName)
|
||||
{
|
||||
return I18n.translateToLocal(unlocalizedName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package techreborn.manual.pages;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
@ -8,40 +10,49 @@ import techreborn.manual.Reference;
|
|||
import techreborn.manual.util.ButtonUtil;
|
||||
import techreborn.manual.util.GuiButtonItemTexture;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class BasicMachinesPage extends TitledPage
|
||||
{
|
||||
public BasicMachinesPage(String name, PageCollection collection)
|
||||
{
|
||||
super(name, false, collection, Reference.BASICMACHINES_KEY, Color.white.getRGB());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
buttonList.clear();
|
||||
ButtonUtil.addBackButton(0, width / 2 - 60, height / 2 + 64, buttonList);
|
||||
buttonList.add(new GuiButtonItemTexture(1, getXMin() + 20, getYMin() + 20, 0, 46, 100, 20, new ItemStack(ModBlocks.Grinder),
|
||||
ModBlocks.Grinder.getUnlocalizedName(), ttl(ModBlocks.Grinder.getLocalizedName())));
|
||||
buttonList.add(new GuiButtonItemTexture(2, getXMin() + 20, getYMin() + 40, 0, 46, 100, 20, new ItemStack(ModBlocks.ElectricFurnace),
|
||||
ModBlocks.ElectricFurnace.getUnlocalizedName(), ttl(ModBlocks.ElectricFurnace.getLocalizedName())));
|
||||
buttonList.add(new GuiButtonItemTexture(3, getXMin() + 20, getYMin() + 60, 0, 46, 100, 20, new ItemStack(ModBlocks.AlloySmelter),
|
||||
ModBlocks.AlloySmelter.getUnlocalizedName(), ttl(ModBlocks.AlloySmelter.getLocalizedName())));
|
||||
buttonList.add(new GuiButtonItemTexture(4, getXMin() + 20, getYMin() + 80, 0, 46, 100, 20, new ItemStack(ModBlocks.Extractor),
|
||||
ModBlocks.Extractor.getUnlocalizedName(), ttl(ModBlocks.Extractor.getLocalizedName())));
|
||||
buttonList.add(new GuiButtonItemTexture(5, getXMin() + 20, getYMin() + 100, 0, 46, 100, 20, new ItemStack(ModBlocks.Compressor),
|
||||
ModBlocks.Compressor.getUnlocalizedName(), ttl(ModBlocks.Compressor.getLocalizedName())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button)
|
||||
{
|
||||
if (button.id == 0) collection.changeActivePage(Reference.pageNames.CONTENTS_PAGE);
|
||||
if (button.id == 1) collection.changeActivePage(ModBlocks.Grinder.getLocalizedName());
|
||||
if (button.id == 2) collection.changeActivePage(ModBlocks.ElectricFurnace.getLocalizedName());
|
||||
if (button.id == 3) collection.changeActivePage(ModBlocks.AlloySmelter.getLocalizedName());
|
||||
if (button.id == 4) collection.changeActivePage(ModBlocks.Extractor.getLocalizedName());
|
||||
if (button.id == 5) collection.changeActivePage(ModBlocks.Compressor.getLocalizedName());
|
||||
}
|
||||
public BasicMachinesPage(String name, PageCollection collection)
|
||||
{
|
||||
super(name, false, collection, Reference.BASICMACHINES_KEY, Color.white.getRGB());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
buttonList.clear();
|
||||
ButtonUtil.addBackButton(0, width / 2 - 60, height / 2 + 64, buttonList);
|
||||
buttonList.add(new GuiButtonItemTexture(1, getXMin() + 20, getYMin() + 20, 0, 46, 100, 20,
|
||||
new ItemStack(ModBlocks.Grinder), ModBlocks.Grinder.getUnlocalizedName(),
|
||||
ttl(ModBlocks.Grinder.getLocalizedName())));
|
||||
buttonList.add(new GuiButtonItemTexture(2, getXMin() + 20, getYMin() + 40, 0, 46, 100, 20,
|
||||
new ItemStack(ModBlocks.ElectricFurnace), ModBlocks.ElectricFurnace.getUnlocalizedName(),
|
||||
ttl(ModBlocks.ElectricFurnace.getLocalizedName())));
|
||||
buttonList.add(new GuiButtonItemTexture(3, getXMin() + 20, getYMin() + 60, 0, 46, 100, 20,
|
||||
new ItemStack(ModBlocks.AlloySmelter), ModBlocks.AlloySmelter.getUnlocalizedName(),
|
||||
ttl(ModBlocks.AlloySmelter.getLocalizedName())));
|
||||
buttonList.add(new GuiButtonItemTexture(4, getXMin() + 20, getYMin() + 80, 0, 46, 100, 20,
|
||||
new ItemStack(ModBlocks.Extractor), ModBlocks.Extractor.getUnlocalizedName(),
|
||||
ttl(ModBlocks.Extractor.getLocalizedName())));
|
||||
buttonList.add(new GuiButtonItemTexture(5, getXMin() + 20, getYMin() + 100, 0, 46, 100, 20,
|
||||
new ItemStack(ModBlocks.Compressor), ModBlocks.Compressor.getUnlocalizedName(),
|
||||
ttl(ModBlocks.Compressor.getLocalizedName())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button)
|
||||
{
|
||||
if (button.id == 0)
|
||||
collection.changeActivePage(Reference.pageNames.CONTENTS_PAGE);
|
||||
if (button.id == 1)
|
||||
collection.changeActivePage(ModBlocks.Grinder.getLocalizedName());
|
||||
if (button.id == 2)
|
||||
collection.changeActivePage(ModBlocks.ElectricFurnace.getLocalizedName());
|
||||
if (button.id == 3)
|
||||
collection.changeActivePage(ModBlocks.AlloySmelter.getLocalizedName());
|
||||
if (button.id == 4)
|
||||
collection.changeActivePage(ModBlocks.Extractor.getLocalizedName());
|
||||
if (button.id == 5)
|
||||
collection.changeActivePage(ModBlocks.Compressor.getLocalizedName());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package techreborn.manual.pages;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -10,45 +12,52 @@ import techreborn.manual.PageCollection;
|
|||
import techreborn.manual.Reference;
|
||||
import techreborn.manual.util.GuiButtonItemTexture;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class ContentsPage extends TitledPage
|
||||
public class ContentsPage extends TitledPage
|
||||
{
|
||||
public ContentsPage(String name, PageCollection collection)
|
||||
{
|
||||
super(name, false, collection, Reference.CONTENTS_KEY, Color.white.getRGB());
|
||||
}
|
||||
public ContentsPage(String name, PageCollection collection)
|
||||
{
|
||||
super(name, false, collection, Reference.CONTENTS_KEY, Color.white.getRGB());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
buttonList.clear();
|
||||
buttonList.add(new GuiButtonItemTexture(0, getXMin() + 20, getYMin() + 20, 0, 46, 100, 20, ItemPlates.getPlateByName("iron"),
|
||||
Reference.pageNames.GETTINGSTARTED_PAGE, ttl(Reference.GETTINGSTARTED_KEY)));
|
||||
buttonList.add(new GuiButtonItemTexture(1, getXMin() + 20, getYMin() + 40, 0, 46, 100, 20, new ItemStack(ModBlocks.Generator),
|
||||
Reference.pageNames.GENERATINGPOWER_PAGE, ttl(Reference.GENERATINGPOWER_KEY)));
|
||||
buttonList.add(new GuiButtonItemTexture(2, getXMin() + 20, getYMin() + 60, 0, 46, 100, 20, new ItemStack(ModBlocks.ElectricFurnace),
|
||||
Reference.pageNames.BASICMACHINES_PAGE, ttl(Reference.BASICMACHINES_KEY)));
|
||||
buttonList.add(new GuiButtonItemTexture(3, getXMin() + 20, getYMin() + 80, 0, 46, 100, 20, new ItemStack(ModBlocks.BlastFurnace),
|
||||
Reference.pageNames.ADVANCEDMACHINES_PAGE, ttl(Reference.ADVANCEDMACHINES_KEY)));
|
||||
buttonList.add(new GuiButtonItemTexture(4, getXMin() + 20, getYMin() + 100, 0, 46, 100, 20, new ItemStack(ModItems.ironDrill),
|
||||
Reference.pageNames.TOOLS_PAGE, ttl(Reference.TOOLS_KEY)));
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
buttonList.clear();
|
||||
buttonList.add(new GuiButtonItemTexture(0, getXMin() + 20, getYMin() + 20, 0, 46, 100, 20,
|
||||
ItemPlates.getPlateByName("iron"), Reference.pageNames.GETTINGSTARTED_PAGE,
|
||||
ttl(Reference.GETTINGSTARTED_KEY)));
|
||||
buttonList.add(new GuiButtonItemTexture(1, getXMin() + 20, getYMin() + 40, 0, 46, 100, 20,
|
||||
new ItemStack(ModBlocks.Generator), Reference.pageNames.GENERATINGPOWER_PAGE,
|
||||
ttl(Reference.GENERATINGPOWER_KEY)));
|
||||
buttonList.add(new GuiButtonItemTexture(2, getXMin() + 20, getYMin() + 60, 0, 46, 100, 20,
|
||||
new ItemStack(ModBlocks.ElectricFurnace), Reference.pageNames.BASICMACHINES_PAGE,
|
||||
ttl(Reference.BASICMACHINES_KEY)));
|
||||
buttonList.add(new GuiButtonItemTexture(3, getXMin() + 20, getYMin() + 80, 0, 46, 100, 20,
|
||||
new ItemStack(ModBlocks.BlastFurnace), Reference.pageNames.ADVANCEDMACHINES_PAGE,
|
||||
ttl(Reference.ADVANCEDMACHINES_KEY)));
|
||||
buttonList.add(new GuiButtonItemTexture(4, getXMin() + 20, getYMin() + 100, 0, 46, 100, 20,
|
||||
new ItemStack(ModItems.ironDrill), Reference.pageNames.TOOLS_PAGE, ttl(Reference.TOOLS_KEY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackgroundLayer(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
super.renderBackgroundLayer(minecraft, offsetX, offsetY, mouseX, mouseY);
|
||||
}
|
||||
@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(Reference.pageNames.GETTINGSTARTED_PAGE);
|
||||
if (button.id == 1) collection.changeActivePage(Reference.pageNames.GENERATINGPOWER_PAGE);
|
||||
if (button.id == 2) collection.changeActivePage(Reference.pageNames.BASICMACHINES_PAGE);
|
||||
if (button.id == 3) collection.changeActivePage(Reference.pageNames.ADVANCEDMACHINES_PAGE);
|
||||
if (button.id == 4) collection.changeActivePage(Reference.pageNames.TOOLS_PAGE);
|
||||
}
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button)
|
||||
{
|
||||
if (button.id == 0)
|
||||
collection.changeActivePage(Reference.pageNames.GETTINGSTARTED_PAGE);
|
||||
if (button.id == 1)
|
||||
collection.changeActivePage(Reference.pageNames.GENERATINGPOWER_PAGE);
|
||||
if (button.id == 2)
|
||||
collection.changeActivePage(Reference.pageNames.BASICMACHINES_PAGE);
|
||||
if (button.id == 3)
|
||||
collection.changeActivePage(Reference.pageNames.ADVANCEDMACHINES_PAGE);
|
||||
if (button.id == 4)
|
||||
collection.changeActivePage(Reference.pageNames.TOOLS_PAGE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +1,5 @@
|
|||
package techreborn.manual.pages;
|
||||
|
||||
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.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.*;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import techreborn.manual.PageCollection;
|
||||
import techreborn.manual.util.ButtonUtil;
|
||||
|
||||
import java.awt.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
|
@ -28,106 +7,137 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class CraftingInfoPage extends TitledPage
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import techreborn.manual.PageCollection;
|
||||
import techreborn.manual.util.ButtonUtil;
|
||||
|
||||
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 class CraftingInfoPage extends TitledPage
|
||||
{
|
||||
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 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 String imageprefix = "techreborn:textures/manual/elements/";
|
||||
public String backpage;
|
||||
|
||||
public CraftingInfoPage(String name, PageCollection collection, ItemStack itemStack, String unlocalizedDescription,
|
||||
String backPage)
|
||||
{
|
||||
super(name, true, collection, itemStack.getUnlocalizedName() + ".name", Color.white.getRGB());
|
||||
this.result = itemStack;
|
||||
this.recipe = getFirstRecipeForItem(itemStack);
|
||||
this.backpage = backPage;
|
||||
for (ItemStack stack : recipe)
|
||||
if (stack != null)
|
||||
hasRecipe = true;
|
||||
if (unlocalizedDescription == "")
|
||||
rawDescription = ttl(itemStack.getUnlocalizedName() + ".description");
|
||||
else
|
||||
rawDescription = ttl(unlocalizedDescription);
|
||||
}
|
||||
|
||||
public CraftingInfoPage(String name, PageCollection collection, ItemStack itemStack, String unlocalizedDescription, String backPage)
|
||||
{
|
||||
super(name, true, collection, itemStack.getUnlocalizedName() + ".name", Color.white.getRGB());
|
||||
this.result = itemStack;
|
||||
this.recipe = getFirstRecipeForItem(itemStack);
|
||||
this.backpage = backPage;
|
||||
for (ItemStack stack : recipe) if (stack != null) hasRecipe = true;
|
||||
if (unlocalizedDescription == "") rawDescription = ttl(itemStack.getUnlocalizedName() + ".description");
|
||||
else rawDescription = ttl(unlocalizedDescription);
|
||||
}
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
buttonList.clear();
|
||||
ButtonUtil.addBackButton(0, width / 2 - 60, height / 2 + 64, buttonList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
buttonList.clear();
|
||||
ButtonUtil.addBackButton(0, width / 2 - 60, height / 2 + 64, buttonList);
|
||||
}
|
||||
|
||||
@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)
|
||||
{
|
||||
renderImage(offsetX + 15, offsetY + 10, "furnacerecipe");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hasRecipe)
|
||||
{
|
||||
renderImage(offsetX, offsetY + 10, "craftingtable");
|
||||
}
|
||||
else
|
||||
{
|
||||
drawString(fontRendererObj, "No Crafting Recipe", offsetX + 40, offsetY + 22, Color.black.getRGB());
|
||||
}
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
@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)
|
||||
{
|
||||
renderImage(offsetX + 15, offsetY + 10, "furnacerecipe");
|
||||
} else
|
||||
{
|
||||
if (hasRecipe)
|
||||
{
|
||||
renderImage(offsetX, offsetY + 10, "craftingtable");
|
||||
} else
|
||||
{
|
||||
drawString(fontRendererObj, "No Crafting Recipe", offsetX + 40, offsetY + 22, Color.black.getRGB());
|
||||
}
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
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 ? 85 : 71;
|
||||
int gridOffsetY = 18;
|
||||
int itemBoxSize = 18;
|
||||
addDescription(minecraft, offsetX + 8, offsetY);
|
||||
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 ? 85 : 71;
|
||||
int gridOffsetY = 18;
|
||||
int itemBoxSize = 18;
|
||||
addDescription(minecraft, offsetX + 8, 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) - 54;
|
||||
int itemY = offsetY + gridOffsetY + (column * itemBoxSize) + 2;
|
||||
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 ? 92 : 112);
|
||||
int itemY = offsetY + (isSmelting ? 40 : 38);
|
||||
if (!hasRecipe) {
|
||||
itemX = offsetX + 20;
|
||||
itemY = offsetY + 18;
|
||||
}
|
||||
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) - 54;
|
||||
int itemY = offsetY + gridOffsetY + (column * itemBoxSize) + 2;
|
||||
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 ? 92 : 112);
|
||||
int itemY = offsetY + (isSmelting ? 40 : 38);
|
||||
if (!hasRecipe)
|
||||
{
|
||||
itemX = offsetX + 20;
|
||||
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 renderImage(int offsetX, int offsetY, String imagename)
|
||||
{
|
||||
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 renderImage(int offsetX, int offsetY, String imagename)
|
||||
{
|
||||
TextureManager render = Minecraft.getMinecraft().renderEngine;
|
||||
render.bindTexture(new ResourceLocation(imageprefix + imagename + ".png"));
|
||||
|
||||
|
@ -136,210 +146,236 @@ public class CraftingInfoPage extends TitledPage
|
|||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(offsetX, offsetY - 14, 0, 0, 140, this.height);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
}
|
||||
|
||||
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.black.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.black.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();
|
||||
String raw = rawDescription;
|
||||
|
||||
List<String> segments = new ArrayList();
|
||||
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);
|
||||
|
||||
escape++;
|
||||
if (escape > 100)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
for (String s : segments)
|
||||
formattedDescription.addAll(ImmutableList.copyOf(fr.listFormattedStringToWidth(s, 370)));
|
||||
}
|
||||
return formattedDescription;
|
||||
}
|
||||
|
||||
escape++;
|
||||
if (escape > 100) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
protected void drawItemStackTooltip(ItemStack stack, int x, int y)
|
||||
{
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
FontRenderer font = Objects.firstNonNull(stack.getItem().getFontRenderer(stack), mc.fontRendererObj);
|
||||
|
||||
for (String s : segments)
|
||||
formattedDescription.addAll(ImmutableList.copyOf(fr.listFormattedStringToWidth(s, 370)));
|
||||
}
|
||||
return formattedDescription;
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> list = stack.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips);
|
||||
|
||||
protected void drawItemStackTooltip(ItemStack stack, int x, int y)
|
||||
{
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
FontRenderer font = Objects.firstNonNull(stack.getItem().getFontRenderer(stack), mc.fontRendererObj);
|
||||
List<String> colored = Lists.newArrayListWithCapacity(list.size());
|
||||
colored.add(stack.getRarity().rarityColor + list.get(0));
|
||||
for (String line : list)
|
||||
colored.add(TextFormatting.GRAY + line);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> list = stack.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips);
|
||||
if (colored.size() >= 2)
|
||||
colored.remove(1);
|
||||
drawHoveringText(colored, x, y, font);
|
||||
}
|
||||
|
||||
List<String> colored = Lists.newArrayListWithCapacity(list.size());
|
||||
colored.add(stack.getRarity().rarityColor + list.get(0));
|
||||
for (String line : list)
|
||||
colored.add(TextFormatting.GRAY + line);
|
||||
private void drawItemStack(ItemStack par1ItemStack, int par2, int par3, String par4Str)
|
||||
{
|
||||
GL11.glTranslatef(0.0F, 0.0F, 32.0F);
|
||||
this.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().fontRendererObj;
|
||||
renderItemStack(par1ItemStack, par2, par3);
|
||||
this.zLevel = 0.0F;
|
||||
}
|
||||
|
||||
if (colored.size() >= 2) colored.remove(1);
|
||||
drawHoveringText(colored, x, y, font);
|
||||
}
|
||||
public void renderItemStack(ItemStack stack, int x, int y)
|
||||
{
|
||||
if (stack != null)
|
||||
{
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
|
||||
private void drawItemStack(ItemStack par1ItemStack, int par2, int par3, String par4Str)
|
||||
{
|
||||
GL11.glTranslatef(0.0F, 0.0F, 32.0F);
|
||||
this.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().fontRendererObj;
|
||||
renderItemStack(par1ItemStack, par2, par3);
|
||||
this.zLevel = 0.0F;
|
||||
}
|
||||
RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem();
|
||||
itemRenderer.renderItemAndEffectIntoGUI(stack, x, y);
|
||||
|
||||
public void renderItemStack(ItemStack stack, int x, int y)
|
||||
{
|
||||
if (stack != null)
|
||||
{
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
}
|
||||
}
|
||||
|
||||
RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem();
|
||||
itemRenderer.renderItemAndEffectIntoGUI(stack, x, y);
|
||||
@SuppressWarnings("unchecked")
|
||||
private ItemStack[] getFirstRecipeForItem(ItemStack resultingItem)
|
||||
{
|
||||
ItemStack[] recipeItems = new ItemStack[9];
|
||||
for (IRecipe recipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList())
|
||||
{
|
||||
if (recipe == null)
|
||||
continue;
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
}
|
||||
}
|
||||
ItemStack result = recipe.getRecipeOutput();
|
||||
if (result == null || !result.isItemEqual(resultingItem))
|
||||
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;
|
||||
Object[] input = getRecipeInput(recipe);
|
||||
if (input == null)
|
||||
continue;
|
||||
|
||||
ItemStack result = recipe.getRecipeOutput();
|
||||
if (result == null || !result.isItemEqual(resultingItem)) continue;
|
||||
for (int i = 0; i < input.length; i++)
|
||||
recipeItems[i] = convertToStack(input[i]);
|
||||
break;
|
||||
|
||||
Object[] input = getRecipeInput(recipe);
|
||||
if (input == null) continue;
|
||||
}
|
||||
|
||||
for (int i = 0; i < input.length; i++)
|
||||
recipeItems[i] = convertToStack(input[i]);
|
||||
break;
|
||||
Iterator iterator = FurnaceRecipes.instance().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();
|
||||
}
|
||||
}
|
||||
|
||||
Iterator iterator = FurnaceRecipes.instance().getSmeltingList().entrySet().iterator();
|
||||
Map.Entry entry;
|
||||
return recipeItems;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
return recipeItems;
|
||||
}
|
||||
if (entry == null)
|
||||
return null;
|
||||
entry = entry.copy();
|
||||
if (entry.getItemDamage() == OreDictionary.WILDCARD_VALUE)
|
||||
entry.setItemDamage(0);
|
||||
return entry;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
@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;
|
||||
}
|
||||
|
||||
if (entry == null) return null;
|
||||
entry = entry.copy();
|
||||
if (entry.getItemDamage() == OreDictionary.WILDCARD_VALUE) entry.setItemDamage(0);
|
||||
return entry;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button)
|
||||
{
|
||||
if (button.id == 0) collection.changeActivePage(backpage);
|
||||
}
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button)
|
||||
{
|
||||
if (button.id == 0)
|
||||
collection.changeActivePage(backpage);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,64 +1,66 @@
|
|||
package techreborn.manual.pages;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import techreborn.manual.PageCollection;
|
||||
import techreborn.manual.Reference;
|
||||
import techreborn.manual.util.ButtonUtil;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import techreborn.manual.PageCollection;
|
||||
import techreborn.manual.Reference;
|
||||
import techreborn.manual.util.ButtonUtil;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
public class DescriptionPage extends TitledPage
|
||||
{
|
||||
public boolean hasImage;
|
||||
public String secondpage;
|
||||
private String rawDescription;
|
||||
private List<String> formattedDescription;
|
||||
private float descriptionScale = 0.88f;
|
||||
|
||||
private String rawDescription;
|
||||
private List<String> formattedDescription;
|
||||
private float descriptionScale = 0.88f;
|
||||
|
||||
public String imageprefix = "techreborn:textures/manual/screenshots/";
|
||||
|
||||
public DescriptionPage(String name, PageCollection collection, boolean hasImage, String secondPage)
|
||||
{
|
||||
super(name, false, collection, Reference.GETTINGSTARTED_KEY, Color.white.getRGB());
|
||||
this.hasImage = hasImage;
|
||||
this.rawDescription = "techreborn.manual." + this.getReferenceName() + ".description";
|
||||
this.secondpage = secondPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
if(hasImage)
|
||||
{
|
||||
renderImage(offsetX, offsetY);
|
||||
addDescription(mc, offsetX, offsetY + 60);
|
||||
}
|
||||
else
|
||||
addDescription(mc, offsetX, offsetY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
buttonList.clear();
|
||||
ButtonUtil.addBackButton(0, width / 2 - 60, height / 2 + 64, buttonList);
|
||||
if(secondpage != null)
|
||||
{
|
||||
ButtonUtil.addNextButton(1, width / 2 + 40, height / 2 + 64, buttonList);
|
||||
}
|
||||
}
|
||||
|
||||
public void renderImage(int offsetX, int offsetY)
|
||||
{
|
||||
|
||||
public DescriptionPage(String name, PageCollection collection, boolean hasImage, String secondPage)
|
||||
{
|
||||
super(name, false, collection, Reference.GETTINGSTARTED_KEY, Color.white.getRGB());
|
||||
this.hasImage = hasImage;
|
||||
this.rawDescription = "techreborn.manual." + this.getReferenceName() + ".description";
|
||||
this.secondpage = secondPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
if (hasImage)
|
||||
{
|
||||
renderImage(offsetX, offsetY);
|
||||
addDescription(mc, offsetX, offsetY + 60);
|
||||
} else
|
||||
addDescription(mc, offsetX, offsetY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
buttonList.clear();
|
||||
ButtonUtil.addBackButton(0, width / 2 - 60, height / 2 + 64, buttonList);
|
||||
if (secondpage != null)
|
||||
{
|
||||
ButtonUtil.addNextButton(1, width / 2 + 40, height / 2 + 64, buttonList);
|
||||
}
|
||||
}
|
||||
|
||||
public void renderImage(int offsetX, int offsetY)
|
||||
{
|
||||
TextureManager render = Minecraft.getMinecraft().renderEngine;
|
||||
render.bindTexture(new ResourceLocation(imageprefix + this.getReferenceName() + ".png"));
|
||||
|
||||
|
@ -67,63 +69,66 @@ public class DescriptionPage extends TitledPage
|
|||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(offsetX, offsetY - 14, 0, 0, 120, this.height);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
public void addDescription(Minecraft minecraft, int offsetX, int offsetY)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(offsetX + 15, 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.black.getRGB());
|
||||
offset += fontRendererObj.FONT_HEIGHT;
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@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, 130));
|
||||
return formattedDescription;
|
||||
}
|
||||
public void addDescription(Minecraft minecraft, int offsetX, int offsetY)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(offsetX + 15, 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.black.getRGB());
|
||||
offset += fontRendererObj.FONT_HEIGHT;
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
List<String> segments = new ArrayList();
|
||||
String raw = rawDescription;
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<String> getFormattedText(FontRenderer fr)
|
||||
{
|
||||
if (formattedDescription == null)
|
||||
{
|
||||
formattedDescription = new ArrayList<String>();
|
||||
|
||||
for (String s : segments)
|
||||
formattedDescription.addAll(ImmutableList.copyOf(fr.listFormattedStringToWidth(s, 370)));
|
||||
}
|
||||
return formattedDescription;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button)
|
||||
{
|
||||
if (button.id == 0) collection.changeActivePage(Reference.pageNames.GETTINGSTARTED_PAGE);
|
||||
if (Strings.isNullOrEmpty(rawDescription))
|
||||
{
|
||||
formattedDescription = ImmutableList.of();
|
||||
return formattedDescription;
|
||||
}
|
||||
if (!rawDescription.contains("\\n"))
|
||||
{
|
||||
formattedDescription = ImmutableList.copyOf(fr.listFormattedStringToWidth(rawDescription, 130));
|
||||
return formattedDescription;
|
||||
}
|
||||
|
||||
if(secondpage != null)
|
||||
{
|
||||
if (button.id == 1) collection.changeActivePage(secondpage);
|
||||
}
|
||||
}
|
||||
List<String> segments = new ArrayList();
|
||||
String raw = rawDescription;
|
||||
|
||||
for (String s : segments)
|
||||
formattedDescription.addAll(ImmutableList.copyOf(fr.listFormattedStringToWidth(s, 370)));
|
||||
}
|
||||
return formattedDescription;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button)
|
||||
{
|
||||
if (button.id == 0)
|
||||
collection.changeActivePage(Reference.pageNames.GETTINGSTARTED_PAGE);
|
||||
|
||||
if (secondpage != null)
|
||||
{
|
||||
if (button.id == 1)
|
||||
collection.changeActivePage(secondpage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package techreborn.manual.pages;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.init.ModBlocks;
|
||||
|
@ -8,40 +10,49 @@ import techreborn.manual.Reference;
|
|||
import techreborn.manual.util.ButtonUtil;
|
||||
import techreborn.manual.util.GuiButtonItemTexture;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class GeneratingPowerPage extends TitledPage
|
||||
{
|
||||
public GeneratingPowerPage(String name, PageCollection collection)
|
||||
{
|
||||
super(name, false, collection, Reference.GENERATINGPOWER_KEY, Color.white.getRGB());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
buttonList.clear();
|
||||
ButtonUtil.addBackButton(0, width / 2 - 60, height / 2 + 64, buttonList);
|
||||
buttonList.add(new GuiButtonItemTexture(1, getXMin() + 20, getYMin() + 20, 0, 46, 100, 20, new ItemStack(ModBlocks.Generator),
|
||||
ModBlocks.Generator.getUnlocalizedName(), ttl(ModBlocks.Generator.getLocalizedName())));
|
||||
buttonList.add(new GuiButtonItemTexture(2, getXMin() + 20, getYMin() + 40, 0, 46, 100, 20, new ItemStack(ModBlocks.thermalGenerator),
|
||||
ModBlocks.thermalGenerator.getUnlocalizedName(), ttl(ModBlocks.thermalGenerator.getLocalizedName())));
|
||||
buttonList.add(new GuiButtonItemTexture(3, getXMin() + 20, getYMin() + 60, 0, 46, 100, 20, new ItemStack(ModBlocks.solarPanel),
|
||||
ModBlocks.solarPanel.getUnlocalizedName(), ttl(ModBlocks.solarPanel.getLocalizedName())));
|
||||
buttonList.add(new GuiButtonItemTexture(4, getXMin() + 20, getYMin() + 80, 0, 46, 100, 20, new ItemStack(ModBlocks.heatGenerator),
|
||||
ModBlocks.heatGenerator.getUnlocalizedName(), ttl(ModBlocks.heatGenerator.getLocalizedName())));
|
||||
buttonList.add(new GuiButtonItemTexture(5, getXMin() + 20, getYMin() + 100, 0, 46, 100, 20, new ItemStack(ModBlocks.LightningRod),
|
||||
ModBlocks.LightningRod.getUnlocalizedName(), ttl(ModBlocks.LightningRod.getLocalizedName())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button)
|
||||
{
|
||||
if (button.id == 0) collection.changeActivePage(Reference.pageNames.CONTENTS_PAGE);
|
||||
if (button.id == 1) collection.changeActivePage(ModBlocks.Generator.getLocalizedName());
|
||||
if (button.id == 2) collection.changeActivePage(ModBlocks.thermalGenerator.getLocalizedName());
|
||||
if (button.id == 3) collection.changeActivePage(ModBlocks.solarPanel.getLocalizedName());
|
||||
if (button.id == 4) collection.changeActivePage(ModBlocks.heatGenerator.getLocalizedName());
|
||||
if (button.id == 5) collection.changeActivePage(ModBlocks.LightningRod.getLocalizedName());
|
||||
}
|
||||
public GeneratingPowerPage(String name, PageCollection collection)
|
||||
{
|
||||
super(name, false, collection, Reference.GENERATINGPOWER_KEY, Color.white.getRGB());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
buttonList.clear();
|
||||
ButtonUtil.addBackButton(0, width / 2 - 60, height / 2 + 64, buttonList);
|
||||
buttonList.add(new GuiButtonItemTexture(1, getXMin() + 20, getYMin() + 20, 0, 46, 100, 20,
|
||||
new ItemStack(ModBlocks.Generator), ModBlocks.Generator.getUnlocalizedName(),
|
||||
ttl(ModBlocks.Generator.getLocalizedName())));
|
||||
buttonList.add(new GuiButtonItemTexture(2, getXMin() + 20, getYMin() + 40, 0, 46, 100, 20,
|
||||
new ItemStack(ModBlocks.thermalGenerator), ModBlocks.thermalGenerator.getUnlocalizedName(),
|
||||
ttl(ModBlocks.thermalGenerator.getLocalizedName())));
|
||||
buttonList.add(new GuiButtonItemTexture(3, getXMin() + 20, getYMin() + 60, 0, 46, 100, 20,
|
||||
new ItemStack(ModBlocks.solarPanel), ModBlocks.solarPanel.getUnlocalizedName(),
|
||||
ttl(ModBlocks.solarPanel.getLocalizedName())));
|
||||
buttonList.add(new GuiButtonItemTexture(4, getXMin() + 20, getYMin() + 80, 0, 46, 100, 20,
|
||||
new ItemStack(ModBlocks.heatGenerator), ModBlocks.heatGenerator.getUnlocalizedName(),
|
||||
ttl(ModBlocks.heatGenerator.getLocalizedName())));
|
||||
buttonList.add(new GuiButtonItemTexture(5, getXMin() + 20, getYMin() + 100, 0, 46, 100, 20,
|
||||
new ItemStack(ModBlocks.LightningRod), ModBlocks.LightningRod.getUnlocalizedName(),
|
||||
ttl(ModBlocks.LightningRod.getLocalizedName())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button)
|
||||
{
|
||||
if (button.id == 0)
|
||||
collection.changeActivePage(Reference.pageNames.CONTENTS_PAGE);
|
||||
if (button.id == 1)
|
||||
collection.changeActivePage(ModBlocks.Generator.getLocalizedName());
|
||||
if (button.id == 2)
|
||||
collection.changeActivePage(ModBlocks.thermalGenerator.getLocalizedName());
|
||||
if (button.id == 3)
|
||||
collection.changeActivePage(ModBlocks.solarPanel.getLocalizedName());
|
||||
if (button.id == 4)
|
||||
collection.changeActivePage(ModBlocks.heatGenerator.getLocalizedName());
|
||||
if (button.id == 5)
|
||||
collection.changeActivePage(ModBlocks.LightningRod.getLocalizedName());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package techreborn.manual.pages;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import techreborn.items.ItemParts;
|
||||
import techreborn.items.ItemPlates;
|
||||
|
@ -8,32 +10,35 @@ import techreborn.manual.Reference;
|
|||
import techreborn.manual.util.ButtonUtil;
|
||||
import techreborn.manual.util.GuiButtonItemTexture;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class GettingStartedPage extends TitledPage
|
||||
{
|
||||
public GettingStartedPage(String name, PageCollection collection)
|
||||
{
|
||||
super(name, false, collection, Reference.GETTINGSTARTED_KEY, Color.white.getRGB());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
buttonList.clear();
|
||||
ButtonUtil.addBackButton(0, width / 2 - 60, height / 2 + 64, buttonList);
|
||||
buttonList.add(new GuiButtonItemTexture(1, getXMin() + 20, getYMin() + 20, 0, 46, 100, 20, ItemParts.getPartByName("rubberSap"),
|
||||
Reference.pageNames.GETTINGRUBBER_PAGE, ttl(Reference.GETTINGRUBBER_KEY)));
|
||||
buttonList.add(new GuiButtonItemTexture(2, getXMin() + 20, getYMin() + 40, 0, 46, 100, 20, ItemPlates.getPlateByName("iron"),
|
||||
Reference.pageNames.CRAFTINGPLATES_PAGE, ttl(Reference.CRAFTINGPLATES_KEY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button)
|
||||
{
|
||||
if (button.id == 0) collection.changeActivePage(Reference.pageNames.CONTENTS_PAGE);
|
||||
if (button.id == 1) collection.changeActivePage(Reference.pageNames.GETTINGRUBBER_PAGE);
|
||||
if (button.id == 2) collection.changeActivePage(Reference.pageNames.CRAFTINGPLATES_PAGE);
|
||||
public GettingStartedPage(String name, PageCollection collection)
|
||||
{
|
||||
super(name, false, collection, Reference.GETTINGSTARTED_KEY, Color.white.getRGB());
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
buttonList.clear();
|
||||
ButtonUtil.addBackButton(0, width / 2 - 60, height / 2 + 64, buttonList);
|
||||
buttonList.add(new GuiButtonItemTexture(1, getXMin() + 20, getYMin() + 20, 0, 46, 100, 20,
|
||||
ItemParts.getPartByName("rubberSap"), Reference.pageNames.GETTINGRUBBER_PAGE,
|
||||
ttl(Reference.GETTINGRUBBER_KEY)));
|
||||
buttonList.add(new GuiButtonItemTexture(2, getXMin() + 20, getYMin() + 40, 0, 46, 100, 20,
|
||||
ItemPlates.getPlateByName("iron"), Reference.pageNames.CRAFTINGPLATES_PAGE,
|
||||
ttl(Reference.CRAFTINGPLATES_KEY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button)
|
||||
{
|
||||
if (button.id == 0)
|
||||
collection.changeActivePage(Reference.pageNames.CONTENTS_PAGE);
|
||||
if (button.id == 1)
|
||||
collection.changeActivePage(Reference.pageNames.GETTINGRUBBER_PAGE);
|
||||
if (button.id == 2)
|
||||
collection.changeActivePage(Reference.pageNames.CRAFTINGPLATES_PAGE);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,20 +3,25 @@ package techreborn.manual.pages;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import techreborn.manual.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.fontRendererObj, ttl(title), offsetX + 70, offsetY + 10, 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.fontRendererObj, ttl(title), offsetX + 70, offsetY + 10, colour);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package techreborn.manual.pages;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.init.ModItems;
|
||||
|
@ -8,55 +10,70 @@ import techreborn.manual.Reference;
|
|||
import techreborn.manual.util.ButtonUtil;
|
||||
import techreborn.manual.util.GuiButtonItemTexture;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class ToolsPage extends TitledPage
|
||||
{
|
||||
public ToolsPage(String name, PageCollection collection)
|
||||
{
|
||||
super(name, false, collection, Reference.TOOLS_KEY, Color.white.getRGB());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
buttonList.clear();
|
||||
ButtonUtil.addBackButton(0, width / 2 - 60, height / 2 + 64, buttonList);
|
||||
ButtonUtil.addNextButton(1, width / 2 + 40, height / 2 + 64, buttonList);
|
||||
buttonList.add(new GuiButtonItemTexture(2, getXMin() + 20, getYMin() + 20, 0, 46, 100, 20, new ItemStack(ModItems.ironDrill),
|
||||
ModItems.ironDrill.getUnlocalizedName(), ttl(ModItems.ironDrill.getUnlocalizedName() + ".name")));
|
||||
buttonList.add(new GuiButtonItemTexture(3, getXMin() + 20, getYMin() + 40, 0, 46, 100, 20, new ItemStack(ModItems.diamondDrill),
|
||||
ModItems.diamondDrill.getUnlocalizedName(), ttl(ModItems.diamondDrill.getUnlocalizedName() + ".name")));
|
||||
buttonList.add(new GuiButtonItemTexture(4, getXMin() + 20, getYMin() + 60, 0, 46, 100, 20, new ItemStack(ModItems.advancedDrill),
|
||||
ModItems.advancedDrill.getUnlocalizedName(), ttl(ModItems.advancedDrill.getUnlocalizedName() + ".name")));
|
||||
buttonList.add(new GuiButtonItemTexture(5, getXMin() + 20, getYMin() + 80, 0, 46, 100, 20, new ItemStack(ModItems.ironChainsaw),
|
||||
ModItems.ironChainsaw.getUnlocalizedName(), ttl(ModItems.ironChainsaw.getUnlocalizedName() + ".name")));
|
||||
buttonList.add(new GuiButtonItemTexture(6, getXMin() + 20, getYMin() + 100, 0, 46, 100, 20, new ItemStack(ModItems.diamondChainsaw),
|
||||
ModItems.diamondChainsaw.getUnlocalizedName(), ttl(ModItems.diamondChainsaw.getUnlocalizedName() + ".name")));
|
||||
buttonList.add(new GuiButtonItemTexture(7, getXMin() + 20, getYMin() + 120, 0, 46, 100, 20, new ItemStack(ModItems.advancedChainsaw),
|
||||
ModItems.advancedChainsaw.getUnlocalizedName(), ttl(ModItems.advancedChainsaw.getUnlocalizedName() + ".name")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button)
|
||||
{
|
||||
if (button.id == 0) collection.changeActivePage(Reference.pageNames.CONTENTS_PAGE);
|
||||
if (button.id == 1)
|
||||
{
|
||||
buttonList.clear();
|
||||
ButtonUtil.addBackButton(0, width / 2 - 60, height / 2 + 64, buttonList);
|
||||
buttonList.add(new GuiButtonItemTexture(8, getXMin() + 20, getYMin() + 20, 0, 46, 100, 20, new ItemStack(ModItems.omniTool),
|
||||
ModItems.omniTool.getUnlocalizedName(), ttl(ModItems.omniTool.getUnlocalizedName() + ".name")));
|
||||
buttonList.add(new GuiButtonItemTexture(9, getXMin() + 20, getYMin() + 40, 0, 46, 100, 20, new ItemStack(ModItems.treeTap),
|
||||
ModItems.treeTap.getUnlocalizedName(), ttl(ModItems.treeTap.getUnlocalizedName() + ".name")));
|
||||
}
|
||||
if (button.id == 2) collection.changeActivePage(ModItems.ironDrill.getUnlocalizedName() + ".name");
|
||||
if (button.id == 3) collection.changeActivePage(ModItems.diamondDrill.getUnlocalizedName() + ".name");
|
||||
if (button.id == 4) collection.changeActivePage(ModItems.advancedDrill.getUnlocalizedName() + ".name");
|
||||
if (button.id == 5) collection.changeActivePage(ModItems.ironChainsaw.getUnlocalizedName() + ".name");
|
||||
if (button.id == 6) collection.changeActivePage(ModItems.diamondChainsaw.getUnlocalizedName() + ".name");
|
||||
if (button.id == 7) collection.changeActivePage(ModItems.advancedChainsaw.getUnlocalizedName() + ".name");
|
||||
if (button.id == 8) collection.changeActivePage(ModItems.omniTool.getUnlocalizedName() + ".name");
|
||||
if (button.id == 9) collection.changeActivePage(ModItems.treeTap.getUnlocalizedName() + ".name");
|
||||
}
|
||||
{
|
||||
public ToolsPage(String name, PageCollection collection)
|
||||
{
|
||||
super(name, false, collection, Reference.TOOLS_KEY, Color.white.getRGB());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
buttonList.clear();
|
||||
ButtonUtil.addBackButton(0, width / 2 - 60, height / 2 + 64, buttonList);
|
||||
ButtonUtil.addNextButton(1, width / 2 + 40, height / 2 + 64, buttonList);
|
||||
buttonList.add(new GuiButtonItemTexture(2, getXMin() + 20, getYMin() + 20, 0, 46, 100, 20,
|
||||
new ItemStack(ModItems.ironDrill), ModItems.ironDrill.getUnlocalizedName(),
|
||||
ttl(ModItems.ironDrill.getUnlocalizedName() + ".name")));
|
||||
buttonList.add(new GuiButtonItemTexture(3, getXMin() + 20, getYMin() + 40, 0, 46, 100, 20,
|
||||
new ItemStack(ModItems.diamondDrill), ModItems.diamondDrill.getUnlocalizedName(),
|
||||
ttl(ModItems.diamondDrill.getUnlocalizedName() + ".name")));
|
||||
buttonList.add(new GuiButtonItemTexture(4, getXMin() + 20, getYMin() + 60, 0, 46, 100, 20,
|
||||
new ItemStack(ModItems.advancedDrill), ModItems.advancedDrill.getUnlocalizedName(),
|
||||
ttl(ModItems.advancedDrill.getUnlocalizedName() + ".name")));
|
||||
buttonList.add(new GuiButtonItemTexture(5, getXMin() + 20, getYMin() + 80, 0, 46, 100, 20,
|
||||
new ItemStack(ModItems.ironChainsaw), ModItems.ironChainsaw.getUnlocalizedName(),
|
||||
ttl(ModItems.ironChainsaw.getUnlocalizedName() + ".name")));
|
||||
buttonList.add(new GuiButtonItemTexture(6, getXMin() + 20, getYMin() + 100, 0, 46, 100, 20,
|
||||
new ItemStack(ModItems.diamondChainsaw), ModItems.diamondChainsaw.getUnlocalizedName(),
|
||||
ttl(ModItems.diamondChainsaw.getUnlocalizedName() + ".name")));
|
||||
buttonList.add(new GuiButtonItemTexture(7, getXMin() + 20, getYMin() + 120, 0, 46, 100, 20,
|
||||
new ItemStack(ModItems.advancedChainsaw), ModItems.advancedChainsaw.getUnlocalizedName(),
|
||||
ttl(ModItems.advancedChainsaw.getUnlocalizedName() + ".name")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button)
|
||||
{
|
||||
if (button.id == 0)
|
||||
collection.changeActivePage(Reference.pageNames.CONTENTS_PAGE);
|
||||
if (button.id == 1)
|
||||
{
|
||||
buttonList.clear();
|
||||
ButtonUtil.addBackButton(0, width / 2 - 60, height / 2 + 64, buttonList);
|
||||
buttonList.add(new GuiButtonItemTexture(8, getXMin() + 20, getYMin() + 20, 0, 46, 100, 20,
|
||||
new ItemStack(ModItems.omniTool), ModItems.omniTool.getUnlocalizedName(),
|
||||
ttl(ModItems.omniTool.getUnlocalizedName() + ".name")));
|
||||
buttonList.add(new GuiButtonItemTexture(9, getXMin() + 20, getYMin() + 40, 0, 46, 100, 20,
|
||||
new ItemStack(ModItems.treeTap), ModItems.treeTap.getUnlocalizedName(),
|
||||
ttl(ModItems.treeTap.getUnlocalizedName() + ".name")));
|
||||
}
|
||||
if (button.id == 2)
|
||||
collection.changeActivePage(ModItems.ironDrill.getUnlocalizedName() + ".name");
|
||||
if (button.id == 3)
|
||||
collection.changeActivePage(ModItems.diamondDrill.getUnlocalizedName() + ".name");
|
||||
if (button.id == 4)
|
||||
collection.changeActivePage(ModItems.advancedDrill.getUnlocalizedName() + ".name");
|
||||
if (button.id == 5)
|
||||
collection.changeActivePage(ModItems.ironChainsaw.getUnlocalizedName() + ".name");
|
||||
if (button.id == 6)
|
||||
collection.changeActivePage(ModItems.diamondChainsaw.getUnlocalizedName() + ".name");
|
||||
if (button.id == 7)
|
||||
collection.changeActivePage(ModItems.advancedChainsaw.getUnlocalizedName() + ".name");
|
||||
if (button.id == 8)
|
||||
collection.changeActivePage(ModItems.omniTool.getUnlocalizedName() + ".name");
|
||||
if (button.id == 9)
|
||||
collection.changeActivePage(ModItems.treeTap.getUnlocalizedName() + ".name");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
package techreborn.manual.util;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ButtonUtil
|
||||
public class ButtonUtil
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void addBackButton(int ID, int X, int Y, List buttonList)
|
||||
{
|
||||
buttonList.add(new GuiButtonCustomTexture(ID, X, Y, 50, 60, 17, 12, "button", "", "", 0, 11, 10, 16));
|
||||
buttonList.add(new GuiButtonCustomTexture(ID, X, Y, 50, 60, 17, 12, "button", "", "", 0, 11, 10, 16));
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void addNextButton(int ID, int X, int Y, List buttonList)
|
||||
{
|
||||
buttonList.add(new GuiButtonCustomTexture(ID, X, Y, 50, 60, 17, 12, "button", "", "", 0, 1, 10, 17));
|
||||
buttonList.add(new GuiButtonCustomTexture(ID, X, Y, 50, 60, 17, 12, "button", "", "", 0, 1, 10, 17));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,45 +4,59 @@ 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 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 GuiButtonAHeight(int id, int xPos, int yPos, int width, int hight, String displayString)
|
||||
{
|
||||
super(id, xPos, yPos, width, hight, displayString);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft minecraft, int mouseX, int mouseY) {
|
||||
if (this.visible) {
|
||||
FontRenderer fontrenderer = minecraft.fontRendererObj;
|
||||
minecraft.getTextureManager().bindTexture(buttonTextures);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
|
||||
int k = this.getHoverState(this.hovered);
|
||||
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);
|
||||
@Override
|
||||
public void drawButton(Minecraft minecraft, int mouseX, int mouseY)
|
||||
{
|
||||
if (this.visible)
|
||||
{
|
||||
FontRenderer fontrenderer = minecraft.fontRendererObj;
|
||||
minecraft.getTextureManager().bindTexture(buttonTextures);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width
|
||||
&& mouseY < this.yPosition + this.height;
|
||||
int k = this.getHoverState(this.hovered);
|
||||
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);
|
||||
}
|
||||
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;
|
||||
this.mouseDragged(minecraft, mouseX, mouseY);
|
||||
int l = 14737632;
|
||||
|
||||
if (packedFGColour != 0) {
|
||||
l = packedFGColour;
|
||||
} else if (!this.enabled) {
|
||||
l = 10526880;
|
||||
} else if (this.hovered) {
|
||||
l = 16777120;
|
||||
}
|
||||
this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, l);
|
||||
}
|
||||
}
|
||||
if (packedFGColour != 0)
|
||||
{
|
||||
l = packedFGColour;
|
||||
} else if (!this.enabled)
|
||||
{
|
||||
l = 10526880;
|
||||
} else if (this.hovered)
|
||||
{
|
||||
l = 16777120;
|
||||
}
|
||||
this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2,
|
||||
this.yPosition + (this.height - 8) / 2, l);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
package techreborn.manual.util;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.client.config.GuiButtonExt;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.awt.*;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiButtonCustomTexture extends GuiButtonExt
|
||||
{
|
||||
public int textureU;
|
||||
public int textureV;
|
||||
public String texturename;
|
||||
public String LINKED_PAGE;
|
||||
public String NAME;
|
||||
public int textureU;
|
||||
public int textureV;
|
||||
public String texturename;
|
||||
public String LINKED_PAGE;
|
||||
public String NAME;
|
||||
public String imageprefix = "techreborn:textures/manual/elements/";
|
||||
public int buttonHeight;
|
||||
public int buttonWidth;
|
||||
|
@ -24,52 +25,53 @@ public class GuiButtonCustomTexture extends GuiButtonExt
|
|||
public int textureH;
|
||||
public int textureW;
|
||||
|
||||
public GuiButtonCustomTexture(int id, int xPos, int yPos, int u, int v, int buttonWidth, int buttonHeight, String texturename, String linkedPage, String name, int buttonU, int buttonV, int textureH, int textureW)
|
||||
{
|
||||
super(id, xPos, yPos, buttonWidth, buttonHeight, "_");
|
||||
this.textureU = u;
|
||||
this.textureV = v;
|
||||
this.texturename = texturename;
|
||||
this.NAME = name;
|
||||
this.LINKED_PAGE = linkedPage;
|
||||
this.buttonHeight = height;
|
||||
this.buttonWidth = width;
|
||||
this.buttonU = buttonU;
|
||||
this.buttonV = buttonV;
|
||||
this.textureH = textureH;
|
||||
this.textureW = textureW;
|
||||
}
|
||||
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY)
|
||||
{
|
||||
if (this.visible)
|
||||
{
|
||||
boolean flag = mouseX >= this.xPosition && mouseY >= this.yPosition
|
||||
&& mouseX < this.xPosition + this.width
|
||||
&& mouseY < this.yPosition + this.height;
|
||||
mc.getTextureManager().bindTexture(buttonTextures);
|
||||
int u = textureU;
|
||||
int v = textureV;
|
||||
public GuiButtonCustomTexture(int id, int xPos, int yPos, int u, int v, int buttonWidth, int buttonHeight,
|
||||
String texturename, String linkedPage, String name, int buttonU, int buttonV, int textureH, int textureW)
|
||||
{
|
||||
super(id, xPos, yPos, buttonWidth, buttonHeight, "_");
|
||||
this.textureU = u;
|
||||
this.textureV = v;
|
||||
this.texturename = texturename;
|
||||
this.NAME = name;
|
||||
this.LINKED_PAGE = linkedPage;
|
||||
this.buttonHeight = height;
|
||||
this.buttonWidth = width;
|
||||
this.buttonU = buttonU;
|
||||
this.buttonV = buttonV;
|
||||
this.textureH = textureH;
|
||||
this.textureW = textureW;
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
u += width;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glColor4f(0f, 0f, 0f, 1f);
|
||||
this.drawTexturedModalRect(this.xPosition, this.yPosition, u, v, width, height);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glEnable(32826);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
renderImage(this.xPosition, this.yPosition);
|
||||
this.drawString(mc.fontRendererObj, this.NAME, this.xPosition + 20, this.yPosition + 3, Color.white.getRGB());
|
||||
}
|
||||
}
|
||||
|
||||
public void renderImage(int offsetX, int offsetY)
|
||||
{
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY)
|
||||
{
|
||||
if (this.visible)
|
||||
{
|
||||
boolean flag = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width
|
||||
&& mouseY < this.yPosition + this.height;
|
||||
mc.getTextureManager().bindTexture(buttonTextures);
|
||||
int u = textureU;
|
||||
int v = textureV;
|
||||
|
||||
if (flag)
|
||||
{
|
||||
u += width;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glColor4f(0f, 0f, 0f, 1f);
|
||||
this.drawTexturedModalRect(this.xPosition, this.yPosition, u, v, width, height);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glEnable(32826);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
renderImage(this.xPosition, this.yPosition);
|
||||
this.drawString(mc.fontRendererObj, this.NAME, this.xPosition + 20, this.yPosition + 3,
|
||||
Color.white.getRGB());
|
||||
}
|
||||
}
|
||||
|
||||
public void renderImage(int offsetX, int offsetY)
|
||||
{
|
||||
TextureManager render = Minecraft.getMinecraft().renderEngine;
|
||||
render.bindTexture(new ResourceLocation(imageprefix + this.texturename + ".png"));
|
||||
|
||||
|
@ -78,10 +80,10 @@ public class GuiButtonCustomTexture extends GuiButtonExt
|
|||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(offsetX, offsetY, this.buttonU, this.buttonV, this.textureW, this.textureH);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getIsHovering()
|
||||
{
|
||||
return hovered;
|
||||
}
|
||||
public boolean getIsHovering()
|
||||
{
|
||||
return hovered;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,59 +1,67 @@
|
|||
package techreborn.manual.util;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.RenderItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.client.config.GuiButtonExt;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.awt.*;
|
||||
public class GuiButtonItemTexture extends GuiButtonExt
|
||||
{
|
||||
|
||||
public class GuiButtonItemTexture extends GuiButtonExt {
|
||||
public int textureU;
|
||||
public int textureV;
|
||||
public ItemStack itemstack;
|
||||
public String LINKED_PAGE;
|
||||
public String NAME;
|
||||
|
||||
public int textureU;
|
||||
public int textureV;
|
||||
public ItemStack itemstack;
|
||||
public String LINKED_PAGE;
|
||||
public String NAME;
|
||||
public GuiButtonItemTexture(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;
|
||||
}
|
||||
|
||||
public GuiButtonItemTexture(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;
|
||||
}
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY)
|
||||
{
|
||||
if (this.visible)
|
||||
{
|
||||
boolean flag = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width
|
||||
&& mouseY < this.yPosition + this.height;
|
||||
mc.getTextureManager().bindTexture(buttonTextures);
|
||||
int u = textureU;
|
||||
int v = textureV;
|
||||
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
if (this.visible) {
|
||||
boolean flag = mouseX >= this.xPosition && mouseY >= this.yPosition
|
||||
&& mouseX < this.xPosition + this.width
|
||||
&& mouseY < this.yPosition + this.height;
|
||||
mc.getTextureManager().bindTexture(buttonTextures);
|
||||
int u = textureU;
|
||||
int v = textureV;
|
||||
|
||||
if (flag) {
|
||||
u += width;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glColor4f(0f, 0f, 0f, 1f);
|
||||
this.drawTexturedModalRect(this.xPosition, this.yPosition, u, v, width, height);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glEnable(32826);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
if (flag)
|
||||
{
|
||||
u += width;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glColor4f(0f, 0f, 0f, 1f);
|
||||
this.drawTexturedModalRect(this.xPosition, this.yPosition, u, v, width, height);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glEnable(32826);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem();
|
||||
itemRenderer.renderItemIntoGUI(itemstack, this.xPosition, this.yPosition);
|
||||
this.drawString(mc.fontRendererObj, this.NAME, this.xPosition + 20, this.yPosition + 3, Color.white.getRGB());
|
||||
}
|
||||
}
|
||||
this.drawString(mc.fontRendererObj, this.NAME, this.xPosition + 20, this.yPosition + 3,
|
||||
Color.white.getRGB());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getIsHovering() {
|
||||
return hovered;
|
||||
}
|
||||
public boolean getIsHovering()
|
||||
{
|
||||
return hovered;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,63 +1,77 @@
|
|||
package techreborn.manual.util;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
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.text.TextFormatting;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.awt.*;
|
||||
public class GuiButtonTextOnly extends GuiButton
|
||||
{
|
||||
public String LINKED_PAGE;
|
||||
public int textColour;
|
||||
|
||||
public class GuiButtonTextOnly extends GuiButton {
|
||||
public String LINKED_PAGE;
|
||||
public int textColour;
|
||||
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 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;
|
||||
}
|
||||
@Override
|
||||
public void drawButton(Minecraft minecraft, int mouseX, int mouseY)
|
||||
{
|
||||
if (this.visible)
|
||||
{
|
||||
FontRenderer fontrenderer = minecraft.fontRendererObj;
|
||||
minecraft.getTextureManager().bindTexture(buttonTextures);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.hovered = 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);
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft minecraft, int mouseX, int mouseY) {
|
||||
if (this.visible) {
|
||||
FontRenderer fontrenderer = minecraft.fontRendererObj;
|
||||
minecraft.getTextureManager().bindTexture(buttonTextures);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.hovered = 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);
|
||||
this.mouseDragged(minecraft, mouseX, mouseY);
|
||||
|
||||
this.mouseDragged(minecraft, mouseX, mouseY);
|
||||
String trimmedDisplayString = displayString;
|
||||
if (fontrenderer.getStringWidth(displayString) > width + 30 && !this.hovered)
|
||||
{
|
||||
int energencyBreak = 0;
|
||||
while (fontrenderer.getStringWidth(trimmedDisplayString) * 0.7 > width - 5)
|
||||
{
|
||||
trimmedDisplayString = trimmedDisplayString.substring(0, trimmedDisplayString.length() - 1);
|
||||
energencyBreak++;
|
||||
if (energencyBreak > 100)
|
||||
break;
|
||||
}
|
||||
trimmedDisplayString += "...";
|
||||
}
|
||||
|
||||
String trimmedDisplayString = displayString;
|
||||
if (fontrenderer.getStringWidth(displayString) > width + 30 && !this.hovered) {
|
||||
int energencyBreak = 0;
|
||||
while (fontrenderer.getStringWidth(trimmedDisplayString) * 0.7 > width - 5) {
|
||||
trimmedDisplayString = trimmedDisplayString.substring(0, trimmedDisplayString.length() - 1);
|
||||
energencyBreak++;
|
||||
if (energencyBreak > 100) break;
|
||||
}
|
||||
trimmedDisplayString += "...";
|
||||
}
|
||||
if (this.hovered)
|
||||
{
|
||||
trimmedDisplayString = TextFormatting.BOLD + "" + TextFormatting.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();
|
||||
}
|
||||
}
|
||||
|
||||
if (this.hovered) {
|
||||
trimmedDisplayString = TextFormatting.BOLD + "" + TextFormatting.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 hovered;
|
||||
}
|
||||
public boolean getIsHovering()
|
||||
{
|
||||
return hovered;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue