Code formatter take 2
This commit is contained in:
parent
33985f1a31
commit
5eed5b161d
450 changed files with 32768 additions and 26684 deletions
|
@ -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 {
|
||||
public static final ResourceLocation PAGE_TEXTURE = new ResourceLocation(
|
||||
"techreborn:textures/manual/gui/manual.png");
|
||||
private final int xSize = 146;
|
||||
private final int ySize = 180;
|
||||
// Name Displayed in the index page
|
||||
public String INDEX_NAME;
|
||||
public boolean hasIndexButton = false;
|
||||
protected PageCollection collection;
|
||||
// Name used to reference the page
|
||||
private String REFERENCE_NAME;
|
||||
|
||||
//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 void setXMin(int x)
|
||||
{
|
||||
this.width = x;
|
||||
}
|
||||
|
||||
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 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 String getReferenceName()
|
||||
{
|
||||
return REFERENCE_NAME;
|
||||
}
|
||||
|
||||
public void setReferenceName(String name) {
|
||||
REFERENCE_NAME = name;
|
||||
}
|
||||
public void setReferenceName(String name)
|
||||
{
|
||||
REFERENCE_NAME = 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,142 @@ 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.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.ShapedRecipes;
|
||||
import net.minecraft.item.crafting.ShapelessRecipes;
|
||||
import net.minecraft.util.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;
|
||||
public String imageprefix = "techreborn:textures/manual/elements/";
|
||||
public String backpage;
|
||||
private boolean isSmelting = false;
|
||||
private ItemStack[] recipe = new ItemStack[9];
|
||||
private boolean hasRecipe = false;
|
||||
private String rawDescription;
|
||||
private List<String> formattedDescription;
|
||||
private float descriptionScale = 0.66f;
|
||||
|
||||
public CraftingInfoPage(String name, PageCollection collection, ItemStack itemStack, String unlocalizedDescription,
|
||||
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 +151,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,65 @@
|
|||
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;
|
||||
|
||||
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)
|
||||
{
|
||||
private String rawDescription;
|
||||
private List<String> formattedDescription;
|
||||
private float descriptionScale = 0.88f;
|
||||
|
||||
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 +68,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
|
||||
{
|
||||
public boolean drawTitle = true;
|
||||
private String title;
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue