mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-21 04:32:23 +00:00
Minor cleanup in lexicon
This commit is contained in:
1 parent
f3dcb4f68f
commit
34005c4a62
6 files changed
+48
-60
No files matched your search
@@ -137,13 +137,12 @@ public class GuiLexicon extends GuiScreen {
|
||||
}
|
||||
|
||||
public void onInitGui() {
|
||||
ScaledResolution res = new ScaledResolution(mc);
|
||||
int guiScale = mc.gameSettings.guiScale;
|
||||
int persistentScale = Math.min(PersistentVariableHelper.lexiconGuiScale, getMaxAllowedScale());
|
||||
|
||||
if(persistentScale > 0 && persistentScale != guiScale) {
|
||||
mc.gameSettings.guiScale = persistentScale;
|
||||
res = new ScaledResolution(mc);
|
||||
ScaledResolution res = new ScaledResolution(mc);
|
||||
width = res.getScaledWidth();
|
||||
height = res.getScaledHeight();
|
||||
mc.gameSettings.guiScale = guiScale;
|
||||
@@ -218,7 +217,7 @@ public class GuiLexicon extends GuiScreen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void drawScreen(int par1, int par2, float par3) {
|
||||
public final void drawScreen(int x, int y, float partialTicks) {
|
||||
ScaledResolution res = new ScaledResolution(mc);
|
||||
int guiScale = mc.gameSettings.guiScale;
|
||||
|
||||
@@ -234,11 +233,11 @@ public class GuiLexicon extends GuiScreen {
|
||||
res = new ScaledResolution(mc);
|
||||
int sw = res.getScaledWidth();
|
||||
int sh = res.getScaledHeight();
|
||||
par1 = Mouse.getX() * sw / mc.displayWidth;
|
||||
par2 = sh - Mouse.getY() * sh / mc.displayHeight - 1;
|
||||
x = Mouse.getX() * sw / mc.displayWidth;
|
||||
y = sh - Mouse.getY() * sh / mc.displayHeight - 1;
|
||||
}
|
||||
|
||||
drawScreenAfterScale(par1, par2, par3);
|
||||
drawScreenAfterScale(x, y, partialTicks);
|
||||
|
||||
mc.gameSettings.guiScale = guiScale;
|
||||
GlStateManager.popMatrix();
|
||||
@@ -249,7 +248,7 @@ public class GuiLexicon extends GuiScreen {
|
||||
int fullWidth = fontRenderer.getStringWidth(meme);
|
||||
int left = width;
|
||||
double widthPerTick = (fullWidth + width) / 240;
|
||||
double currWidth = left - widthPerTick * (240 - (konamiTime - par3)) * 3.2;
|
||||
double currWidth = left - widthPerTick * (240 - (konamiTime - partialTicks)) * 3.2;
|
||||
|
||||
GlStateManager.translate(currWidth, height / 2 - 10, 0);
|
||||
GlStateManager.scale(4, 4, 4);
|
||||
|
||||
@@ -29,13 +29,9 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
|
||||
|
||||
private static final String TAG_CHALLENGE = "challenge";
|
||||
|
||||
Challenge challenge;
|
||||
GuiLexicon parent;
|
||||
GuiButton backButton, completeButton;
|
||||
|
||||
public GuiLexiconChallenge() {
|
||||
parent = new GuiLexiconChallengesList();
|
||||
}
|
||||
private Challenge challenge;
|
||||
private GuiLexicon parent;
|
||||
private GuiButton backButton, completeButton;
|
||||
|
||||
public GuiLexiconChallenge(GuiLexicon parent, Challenge challenge) {
|
||||
this.parent = parent;
|
||||
@@ -43,7 +39,7 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
|
||||
setTitle();
|
||||
}
|
||||
|
||||
public void setTitle() {
|
||||
private void setTitle() {
|
||||
title = challenge == null ? "(null)" : I18n.format(challenge.unlocalizedName);
|
||||
}
|
||||
|
||||
@@ -115,11 +111,11 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
|
||||
notesEnabled = !notesEnabled;
|
||||
}
|
||||
|
||||
void setCompleteButtonTitle() {
|
||||
private void setCompleteButtonTitle() {
|
||||
completeButton.displayString = I18n.format(challenge.complete ? "botaniamisc.markNotCompleted" : "botaniamisc.markCompleted");
|
||||
}
|
||||
|
||||
void back() {
|
||||
private void back() {
|
||||
if(backButton.enabled) {
|
||||
actionPerformed(backButton);
|
||||
backButton.playPressSound(mc.getSoundHandler());
|
||||
@@ -166,8 +162,7 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
|
||||
public void load(NBTTagCompound cmp) {
|
||||
super.load(cmp);
|
||||
String challengeName = cmp.getString(TAG_CHALLENGE);
|
||||
Challenge c = ModChallenges.challengeLookup.get(challengeName);
|
||||
challenge = c;
|
||||
challenge = ModChallenges.challengeLookup.get(challengeName);
|
||||
setTitle();
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ import java.util.List;
|
||||
|
||||
public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
|
||||
|
||||
GuiLexicon parent;
|
||||
GuiButton backButton;
|
||||
private GuiLexicon parent;
|
||||
private GuiButton backButton;
|
||||
|
||||
public GuiLexiconChallengesList() {
|
||||
parent = new GuiLexicon();
|
||||
@@ -106,7 +106,7 @@ public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
|
||||
notesEnabled = !notesEnabled;
|
||||
}
|
||||
|
||||
void back() {
|
||||
private void back() {
|
||||
if(backButton.enabled) {
|
||||
actionPerformed(backButton);
|
||||
backButton.playPressSound(mc.getSoundHandler());
|
||||
|
||||
@@ -41,13 +41,13 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
private static final String TAG_PAGE = "page";
|
||||
|
||||
public int page = 0;
|
||||
public boolean firstEntry = false;
|
||||
private boolean firstEntry = false;
|
||||
LexiconEntry entry;
|
||||
GuiScreen parent;
|
||||
String title;
|
||||
String subtitle;
|
||||
private GuiScreen parent;
|
||||
private String title;
|
||||
private String subtitle;
|
||||
|
||||
GuiButton leftButton, rightButton, backButton;
|
||||
private GuiButton leftButton, rightButton, backButton;
|
||||
|
||||
public GuiLexiconEntry() {
|
||||
parent = new GuiLexicon();
|
||||
@@ -60,7 +60,7 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
setTitle();
|
||||
}
|
||||
|
||||
public void setTitle() {
|
||||
private void setTitle() {
|
||||
if(entry == null) {
|
||||
title = "(null)";
|
||||
return;
|
||||
@@ -261,8 +261,8 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
parent = gui;
|
||||
}
|
||||
|
||||
int fx = 0;
|
||||
boolean swiped = false;
|
||||
private int fx = 0;
|
||||
private boolean swiped = false;
|
||||
|
||||
@Override
|
||||
protected void mouseClickMove(int x, int y, int button, long time) {
|
||||
@@ -332,14 +332,14 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
}
|
||||
}
|
||||
|
||||
void back() {
|
||||
private void back() {
|
||||
if(backButton.enabled) {
|
||||
actionPerformed(backButton);
|
||||
backButton.playPressSound(mc.getSoundHandler());
|
||||
}
|
||||
}
|
||||
|
||||
void nextPage() {
|
||||
private void nextPage() {
|
||||
if(rightButton.enabled) {
|
||||
actionPerformed(rightButton);
|
||||
rightButton.playPressSound(mc.getSoundHandler());
|
||||
@@ -347,7 +347,7 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
}
|
||||
}
|
||||
|
||||
void prevPage() {
|
||||
private void prevPage() {
|
||||
if(leftButton.enabled) {
|
||||
actionPerformed(leftButton);
|
||||
leftButton.playPressSound(mc.getSoundHandler());
|
||||
@@ -355,11 +355,9 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
}
|
||||
}
|
||||
|
||||
void updateNote() {
|
||||
private void updateNote() {
|
||||
String key = getNotesKey();
|
||||
if(!notes.containsKey(key))
|
||||
note = "";
|
||||
else note = notes.get(key);
|
||||
note = notes.getOrDefault(key, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -39,8 +39,7 @@ public class GuiLexiconHistory extends GuiLexiconIndex {
|
||||
}
|
||||
|
||||
public static void visit(LexiconEntry entry) {
|
||||
if(history.contains(entry))
|
||||
history.remove(entry);
|
||||
history.remove(entry);
|
||||
history.add(entry);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.client.gui.lexicon.button.GuiButtonBack;
|
||||
import vazkii.botania.client.gui.lexicon.button.GuiButtonInvisible;
|
||||
import vazkii.botania.client.gui.lexicon.button.GuiButtonPage;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.lexicon.DogLexiconEntry;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -42,31 +43,27 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
|
||||
LexiconCategory category;
|
||||
String title;
|
||||
int page = 0;
|
||||
private int page = 0;
|
||||
|
||||
int tutPage = -1;
|
||||
private int tutPage = -1;
|
||||
|
||||
GuiButton leftButton, rightButton, backButton;
|
||||
GuiLexicon parent;
|
||||
private GuiButton leftButton, rightButton, backButton;
|
||||
private GuiLexicon parent;
|
||||
GuiTextField searchField;
|
||||
|
||||
GuiButton currentButton;
|
||||
LexiconEntry currentEntry;
|
||||
float infoTime;
|
||||
private GuiButton currentButton;
|
||||
private LexiconEntry currentEntry;
|
||||
private float infoTime;
|
||||
|
||||
final List<LexiconEntry> entriesToDisplay = new ArrayList<>();
|
||||
|
||||
public GuiLexiconIndex() {
|
||||
parent = new GuiLexicon();
|
||||
}
|
||||
|
||||
public GuiLexiconIndex(LexiconCategory category) {
|
||||
this.category = category;
|
||||
parent = new GuiLexicon();
|
||||
setTitle();
|
||||
}
|
||||
|
||||
public void setTitle() {
|
||||
private void setTitle() {
|
||||
title = I18n.format(category == null ? "botaniamisc.lexiconIndex" : category.getUnlocalizedName());
|
||||
}
|
||||
|
||||
@@ -113,7 +110,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
updateAll();
|
||||
}
|
||||
|
||||
void updateAll() {
|
||||
private void updateAll() {
|
||||
buildEntries();
|
||||
updatePageButtons();
|
||||
populateIndex();
|
||||
@@ -129,7 +126,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
Collections.sort(entriesToDisplay);
|
||||
}
|
||||
|
||||
boolean matchesSearch(LexiconEntry e) {
|
||||
private boolean matchesSearch(LexiconEntry e) {
|
||||
String search = searchField.getText().trim();
|
||||
if(search.isEmpty())
|
||||
return true;
|
||||
@@ -324,7 +321,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
}
|
||||
}
|
||||
|
||||
void openEntry(int index) {
|
||||
private void openEntry(int index) {
|
||||
if(index >= entriesToDisplay.size())
|
||||
return;
|
||||
|
||||
@@ -333,7 +330,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
ClientTickHandler.notifyPageChange();
|
||||
}
|
||||
|
||||
public void updatePageButtons() {
|
||||
private void updatePageButtons() {
|
||||
leftButton.enabled = page != 0;
|
||||
rightButton.enabled = page < (entriesToDisplay.size() - 1) / 12;
|
||||
putTutorialArrow();
|
||||
@@ -344,8 +341,8 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
parent = gui;
|
||||
}
|
||||
|
||||
int fx = 0;
|
||||
boolean swiped = false;
|
||||
private int fx = 0;
|
||||
private boolean swiped = false;
|
||||
|
||||
@Override
|
||||
protected void mouseClickMove(int x, int y, int button, long time) {
|
||||
@@ -423,21 +420,21 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
super.keyTyped(par1, par2);
|
||||
}
|
||||
|
||||
void back() {
|
||||
private void back() {
|
||||
if(backButton.enabled) {
|
||||
actionPerformed(backButton);
|
||||
backButton.playPressSound(mc.getSoundHandler());
|
||||
}
|
||||
}
|
||||
|
||||
void nextPage() {
|
||||
private void nextPage() {
|
||||
if(rightButton.enabled) {
|
||||
actionPerformed(rightButton);
|
||||
rightButton.playPressSound(mc.getSoundHandler());
|
||||
}
|
||||
}
|
||||
|
||||
void prevPage() {
|
||||
private void prevPage() {
|
||||
if(leftButton.enabled) {
|
||||
actionPerformed(leftButton);
|
||||
leftButton.playPressSound(mc.getSoundHandler());
|
||||
|
||||
Reference in new issue
Block a user