client.gui.lexicon

This commit is contained in:
Vincent Lee committed 2015-11-14 19:48:26 -06:00
1 parent b07cac07a0
commit 88ca096ae0
21 files changed
+69 -62

No files matched your search

@@ -11,6 +11,7 @@
package vazkii.botania.client.gui.lexicon;
import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayDeque;
import java.util.ArrayList;
@@ -294,7 +295,7 @@ public class GuiLexicon extends GuiScreen {
public void drawBookmark(int x, int y, String s, boolean drawLeft, int color) {
// This function is called from the buttons so I can't use fontRendererObj
FontRenderer font = Minecraft.getMinecraft().fontRenderer;
FontRenderer font = Minecraft.getMinecraft().fontRendererObj;
boolean unicode = font.getUnicodeFlag();
font.setUnicodeFlag(true);
int l = font.getStringWidth(s);
@@ -424,7 +425,7 @@ public class GuiLexicon extends GuiScreen {
public int bookmarkWidth(String b) {
if(fontRendererObj == null)
fontRendererObj = Minecraft.getMinecraft().fontRenderer;
fontRendererObj = Minecraft.getMinecraft().fontRendererObj;
boolean unicode = fontRendererObj.getUnicodeFlag();
fontRendererObj.setUnicodeFlag(true);
@@ -557,7 +558,7 @@ public class GuiLexicon extends GuiScreen {
}
@Override
protected void keyTyped(char par1, int par2) {
protected void keyTyped(char par1, int par2) throws IOException {
handleNoteKey(par1, par2);
if(!notesEnabled && closeScreenOnInvKey() && mc.gameSettings.keyBindInventory.getKeyCode() == par2) {
@@ -568,7 +569,7 @@ public class GuiLexicon extends GuiScreen {
if(par2 == KONAMI_CODE[konamiIndex]) {
konamiIndex++;
if(konamiIndex >= KONAMI_CODE.length) {
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147673_a(new ResourceLocation("botania:way")));
mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("botania:way")));
konamiIndex = 0;
}
} else konamiIndex = 0;
@@ -27,6 +27,8 @@ import vazkii.botania.client.core.handler.PersistentVariableHelper;
import vazkii.botania.client.gui.lexicon.button.GuiButtonBack;
import vazkii.botania.common.lexicon.page.PageText;
import java.io.IOException;
public class GuiLexiconChallenge extends GuiLexicon implements IParented {
private static final String TAG_CHALLENGE = "challenge";
@@ -65,7 +67,7 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
RenderHelper.enableGUIStandardItemLighting();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderItem.getInstance().renderItemIntoGUI(fontRendererObj, mc.renderEngine, challenge.icon, left + 18, top + 15);
mc.getRenderItem().renderItemIntoGUI(challenge.icon, left + 18, top + 15);
RenderHelper.disableStandardItemLighting();
GL11.glEnable(GL11.GL_BLEND);
@@ -95,7 +97,7 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
}
@Override
protected void mouseClicked(int par1, int par2, int par3) {
protected void mouseClicked(int par1, int par2, int par3) throws IOException {
super.mouseClicked(par1, par2, par3);
if(par3 == 1)
@@ -124,7 +126,7 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
void back() {
if(backButton.enabled) {
actionPerformed(backButton);
backButton.func_146113_a(mc.getSoundHandler());
backButton.playPressSound(mc.getSoundHandler());
}
}
@@ -10,6 +10,7 @@
*/
package vazkii.botania.client.gui.lexicon;
import java.io.IOException;
import java.util.List;
import net.minecraft.client.gui.GuiButton;
@@ -84,7 +85,7 @@ public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
}
@Override
protected void mouseClicked(int par1, int par2, int par3) {
protected void mouseClicked(int par1, int par2, int par3) throws IOException {
super.mouseClicked(par1, par2, par3);
if(par3 == 1)
@@ -108,7 +109,7 @@ public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
void back() {
if(backButton.enabled) {
actionPerformed(backButton);
backButton.func_146113_a(mc.getSoundHandler());
backButton.playPressSound(mc.getSoundHandler());
}
}
@@ -11,6 +11,7 @@
package vazkii.botania.client.gui.lexicon;
import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.util.List;
@@ -272,7 +273,7 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
}
@Override
protected void mouseClicked(int par1, int par2, int par3) {
protected void mouseClicked(int par1, int par2, int par3) throws IOException {
super.mouseClicked(par1, par2, par3);
fx = par1;
@@ -290,7 +291,7 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
}
@Override
public void handleMouseInput() {
public void handleMouseInput() throws IOException {
super.handleMouseInput();
if(Mouse.getEventButton() == 0)
@@ -328,14 +329,14 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
void back() {
if(backButton.enabled) {
actionPerformed(backButton);
backButton.func_146113_a(mc.getSoundHandler());
backButton.playPressSound(mc.getSoundHandler());
}
}
void nextPage() {
if(rightButton.enabled) {
actionPerformed(rightButton);
rightButton.func_146113_a(mc.getSoundHandler());
rightButton.playPressSound(mc.getSoundHandler());
updateNote();
}
}
@@ -343,7 +344,7 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
void prevPage() {
if(leftButton.enabled) {
actionPerformed(leftButton);
leftButton.func_146113_a(mc.getSoundHandler());
leftButton.playPressSound(mc.getSoundHandler());
updateNote();
}
}
@@ -400,7 +401,7 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
@Override
public GuiLexicon copy() {
GuiLexiconEntry gui = new GuiLexiconEntry(entry, new GuiScreen());
GuiLexiconEntry gui = new GuiLexiconEntry(entry, new GuiScreen() {}); // todo 1.8 check anonymous class
gui.page = page;
gui.setTitle();
return gui;
@@ -10,6 +10,7 @@
*/
package vazkii.botania.client.gui.lexicon;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -107,7 +108,8 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
buttonList.add(leftButton = new GuiButtonPage(13, left, top + guiHeight - 10, false));
buttonList.add(rightButton = new GuiButtonPage(14, left + guiWidth - 18, top + guiHeight - 10, true));
searchField = new GuiTextField(fontRendererObj, left + guiWidth / 2 + 28, top + guiHeight + 6, 200, 10);
// todo 1.8 verify componentID
searchField = new GuiTextField(15, fontRendererObj, left + guiWidth / 2 + 28, top + guiHeight + 6, 200, 10);
searchField.setCanLoseFocus(false);
searchField.setFocused(true);
searchField.setEnableBackgroundDrawing(false);
@@ -214,15 +216,15 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
ItemStack paper = new ItemStack(Items.paper, currentEntry.pages.size());
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, paper, 14, -28);
RenderItem.getInstance().renderItemOverlayIntoGUI(mc.fontRenderer, mc.renderEngine, paper, 14, -28);
mc.getRenderItem().renderItemAndEffectIntoGUI(paper, 14, -28);
mc.getRenderItem().renderItemOverlayIntoGUI(mc.fontRendererObj, paper, 14, -28, ""); // todo 1.8 text
List<ItemStack> stacks = currentEntry.getDisplayedRecipes();
if(stacks.size() > 0) {
int spaceForEach = Math.min(18, (width - 30) / stacks.size());
for(int i = 0; i < stacks.size(); i++) {
ItemStack stack = stacks.get(i);
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, stack, 38 + spaceForEach * i, -28);
mc.getRenderItem().renderItemAndEffectIntoGUI(stack, 38 + spaceForEach * i, -28);
}
}
@@ -330,7 +332,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
}
@Override
protected void mouseClicked(int par1, int par2, int par3) {
protected void mouseClicked(int par1, int par2, int par3) throws IOException {
super.mouseClicked(par1, par2, par3);
searchField.mouseClicked(par1, par2, par3);
@@ -349,7 +351,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
}
@Override
public void handleMouseInput() {
public void handleMouseInput() throws IOException {
super.handleMouseInput();
if(Mouse.getEventButton() == 0)
@@ -394,21 +396,21 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
void back() {
if(backButton.enabled) {
actionPerformed(backButton);
backButton.func_146113_a(mc.getSoundHandler());
backButton.playPressSound(mc.getSoundHandler());
}
}
void nextPage() {
if(rightButton.enabled) {
actionPerformed(rightButton);
rightButton.func_146113_a(mc.getSoundHandler());
rightButton.playPressSound(mc.getSoundHandler());
}
}
void prevPage() {
if(leftButton.enabled) {
actionPerformed(leftButton);
leftButton.func_146113_a(mc.getSoundHandler());
leftButton.playPressSound(mc.getSoundHandler());
}
}
@@ -30,8 +30,8 @@ public class GuiButtonAchievement extends GuiButtonLexicon {
@Override
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(field_146123_n);
hovered = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(hovered);
par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture);
GL11.glColor4f(1F, 1F, 1F, 1F);
@@ -29,8 +29,8 @@ public class GuiButtonBack extends GuiButtonLexicon {
@Override
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(field_146123_n);
hovered = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(hovered);
par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture);
GL11.glColor4f(1F, 1F, 1F, 1F);
@@ -21,8 +21,8 @@ public class GuiButtonBookmark extends GuiButtonLexicon {
@Override
public void drawButton(Minecraft mc, int par2, int par3) {
gui.drawBookmark(xPosition, yPosition, displayString, false);
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(field_146123_n);
hovered = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(hovered);
List<String> tooltip = new ArrayList();
if(displayString.equals("+"))
@@ -35,12 +35,12 @@ public class GuiButtonChallengeIcon extends GuiButtonLexicon {
@Override
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(field_146123_n);
hovered = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(hovered);
RenderHelper.enableGUIStandardItemLighting();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderItem.getInstance().renderItemIntoGUI(par1Minecraft.fontRenderer, par1Minecraft.renderEngine, challenge.icon, xPosition, yPosition);
par1Minecraft.getRenderItem().renderItemIntoGUI(challenge.icon, xPosition, yPosition);
RenderHelper.disableStandardItemLighting();
GL11.glEnable(GL11.GL_BLEND);
@@ -30,8 +30,8 @@ public class GuiButtonChallengeInfo extends GuiButtonLexicon {
@Override
public void drawButton(Minecraft mc, int par2, int par3) {
gui.drawBookmark(xPosition, yPosition, displayString, false);
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(field_146123_n);
hovered = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(hovered);
List<String> tooltip = new ArrayList();
tooltip.add(StatCollector.translateToLocal("botaniamisc.challengeInfo"));
@@ -30,8 +30,8 @@ public class GuiButtonChallenges extends GuiButtonLexicon {
@Override
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(field_146123_n);
hovered = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(hovered);
par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture);
GL11.glColor4f(1F, 1F, 1F, 1F);
@@ -35,13 +35,13 @@ public class GuiButtonDoot extends GuiButtonLexicon {
@Override
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(field_146123_n);
hovered = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(hovered);
par1Minecraft.renderEngine.bindTexture(TextureMap.locationItemsTexture);
par1Minecraft.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
GL11.glColor4f(1F, 1F, 1F, 1F);
RenderItem.getInstance().renderItemIntoGUI(par1Minecraft.fontRenderer, par1Minecraft.renderEngine, new ItemStack(ModItems.cacophonium), xPosition, yPosition);
RenderItem.getInstance().renderItemIntoGUI(par1Minecraft.fontRenderer, par1Minecraft.renderEngine, new ItemStack(Items.fireworks), xPosition + 8, yPosition + 2);
par1Minecraft.getRenderItem().renderItemIntoGUI(new ItemStack(ModItems.cacophonium), xPosition, yPosition);
par1Minecraft.getRenderItem().renderItemIntoGUI(new ItemStack(Items.fireworks), xPosition + 8, yPosition + 2);
GL11.glDisable(GL11.GL_LIGHTING);
@@ -31,8 +31,8 @@ public class GuiButtonHistory extends GuiButtonLexicon {
@Override
public void drawButton(Minecraft mc, int par2, int par3) {
gui.drawBookmark(xPosition, yPosition, displayString, false);
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(field_146123_n);
hovered = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(hovered);
List<String> tooltip = new ArrayList();
tooltip.add(StatCollector.translateToLocal("botaniamisc.historyLong"));
@@ -37,8 +37,8 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
@Override
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(field_146123_n);
hovered = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(hovered);
boolean showStack = displayStack != null && !displayString.isEmpty();
if(!displayString.isEmpty() && k == 2) {
@@ -59,7 +59,7 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
key = format.charAt(1);
for(EnumChatFormatting ecf : EnumChatFormatting.class.getEnumConstants())
if(ecf.getFormattingCode() == key) {
if(ecf.toString().indexOf(ecf.toString().length() - 1) == key) { // todo 1.8 recheck (want last char of code)
if(ecf.ordinal() > 15)
ecf = EnumChatFormatting.BLACK;
color = LibMisc.CONTROL_CODE_COLORS[ecf.ordinal()];
@@ -81,7 +81,7 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
GL11.glScalef(0.5F, 0.5F, 0.5F);
RenderHelper.enableGUIStandardItemLighting();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderItem.getInstance().renderItemIntoGUI(par1Minecraft.fontRenderer, par1Minecraft.renderEngine, displayStack, xPosition * 2 - 6, yPosition * 2 + 4);
par1Minecraft.getRenderItem().renderItemIntoGUI(displayStack, xPosition * 2 - 6, yPosition * 2 + 4);
RenderHelper.disableStandardItemLighting();
GL11.glEnable(GL11.GL_BLEND);
}
@@ -22,8 +22,8 @@ public class GuiButtonLexicon extends GuiButton {
}
@Override
public void func_146113_a(SoundHandler p_146113_1_) {
p_146113_1_.playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("botania:lexiconPage"), 1.0F));
public void playPressSound(SoundHandler p_146113_1_) {
p_146113_1_.playSound(PositionedSoundRecord.create(new ResourceLocation("botania:lexiconPage"), 1.0F));
}
}
@@ -33,8 +33,8 @@ public class GuiButtonNotes extends GuiButtonLexicon {
@Override
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(field_146123_n);
hovered = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(hovered);
par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture);
GL11.glColor4f(1F, 1F, 1F, 1F);
@@ -30,8 +30,8 @@ public class GuiButtonOptions extends GuiButtonLexicon {
@Override
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(field_146123_n);
hovered = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(hovered);
par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture);
GL11.glColor4f(1F, 1F, 1F, 1F);
@@ -32,8 +32,8 @@ public class GuiButtonPage extends GuiButtonLexicon {
@Override
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
if(enabled) {
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(field_146123_n);
hovered = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(hovered);
par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture);
GL11.glColor4f(1F, 1F, 1F, 1F);
@@ -30,8 +30,8 @@ public class GuiButtonShare extends GuiButtonLexicon {
@Override
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(field_146123_n);
hovered = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(hovered);
par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture);
GL11.glColor4f(1F, 1F, 1F, 1F);
@@ -35,8 +35,8 @@ public class GuiButtonUpdateWarning extends GuiButtonLexicon {
if(!visible || !enabled)
return;
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(field_146123_n);
hovered = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(hovered);
boolean red = k == 2 || ClientTickHandler.ticksInGame % 10 < 5;
@@ -30,8 +30,8 @@ public class GuiButtonViewOnline extends GuiButtonLexicon {
@Override
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(field_146123_n);
hovered = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(hovered);
par1Minecraft.renderEngine.bindTexture(GuiLexicon.texture);
GL11.glColor4f(1F, 1F, 1F, 1F);