mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-27 23:45:57 +00:00
Cleanup
This commit is contained in:
1 parent
73377e311d
commit
a6729c088b
53 files changed
+259
-289
No files matched your search
@@ -82,7 +82,6 @@ public class GuiLexicon extends GuiScreen {
|
||||
|
||||
public static Queue<LexiconEntry> tutorial = new ArrayDeque();
|
||||
|
||||
private static boolean checkedDoot = false;
|
||||
public static final ResourceLocation texture = new ResourceLocation(LibResources.GUI_LEXICON);
|
||||
public static final ResourceLocation textureToff = new ResourceLocation(LibResources.GUI_TOFF);
|
||||
|
||||
@@ -112,7 +111,7 @@ public class GuiLexicon extends GuiScreen {
|
||||
@Override
|
||||
public final void initGui() {
|
||||
super.initGui();
|
||||
|
||||
|
||||
if(PersistentVariableHelper.firstLoad) {
|
||||
PersistentVariableHelper.firstLoad = false;
|
||||
PersistentVariableHelper.saveSafe();
|
||||
@@ -169,7 +168,7 @@ public class GuiLexicon extends GuiScreen {
|
||||
|
||||
GuiButtonUpdateWarning button = new GuiButtonUpdateWarning(-4, left - 6, top + guiHeight - 70);
|
||||
buttonList.add(button);
|
||||
|
||||
|
||||
if(PersistentVariableHelper.lastBotaniaVersion.equals(LibMisc.VERSION)) {
|
||||
button.enabled = false;
|
||||
button.visible = false;
|
||||
@@ -292,7 +291,7 @@ public class GuiLexicon extends GuiScreen {
|
||||
public void drawBookmark(int x, int y, String s, boolean drawLeft) {
|
||||
drawBookmark(x, y, s, drawLeft, 0x111111);
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
@@ -324,19 +323,19 @@ public class GuiLexicon extends GuiScreen {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
drawTexturedModalRect(left - 8, top + 9, 0, 224, 140, 31);
|
||||
|
||||
|
||||
int color = 0xffd200;
|
||||
boolean unicode = fontRendererObj.getUnicodeFlag();
|
||||
fontRendererObj.drawString(title, left + 18, top + 13, color);
|
||||
fontRendererObj.setUnicodeFlag(true);
|
||||
fontRendererObj.drawString(String.format(StatCollector.translateToLocal("botaniamisc.edition"), ItemLexicon.getEdition()), left + 24, top + 22, color);
|
||||
|
||||
|
||||
String s = EnumChatFormatting.BOLD + categoryHighlight;
|
||||
fontRendererObj.drawString(s, left + guiWidth / 2 - fontRendererObj.getStringWidth(s) / 2, top + 36, 0);
|
||||
|
||||
fontRendererObj.setUnicodeFlag(unicode);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
|
||||
categoryHighlight = "";
|
||||
}
|
||||
|
||||
|
||||
@@ -51,11 +51,11 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
GuiButton leftButton, rightButton, backButton;
|
||||
GuiLexicon parent;
|
||||
GuiTextField searchField;
|
||||
|
||||
|
||||
GuiButton currentButton;
|
||||
LexiconEntry currentEntry;
|
||||
float infoTime;
|
||||
|
||||
|
||||
List<LexiconEntry> entriesToDisplay = new ArrayList();
|
||||
|
||||
public GuiLexiconIndex() {
|
||||
@@ -146,7 +146,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
} else button.displayString = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setHoveredButton(GuiButtonInvisible b) {
|
||||
if(b == null)
|
||||
currentEntry = null;
|
||||
@@ -170,38 +170,38 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
mc.fontRenderer.drawString(s, left + 120 - mc.fontRenderer.getStringWidth(s), top + guiHeight - 18, 0x666666);
|
||||
mc.fontRenderer.setUnicodeFlag(unicode);
|
||||
}
|
||||
|
||||
|
||||
float animationTime = 4F;
|
||||
if(isShiftKeyDown()) {
|
||||
if(currentButton != null)
|
||||
infoTime = Math.min(animationTime, infoTime + timeDelta);
|
||||
} else {
|
||||
infoTime = Math.max(0, infoTime - timeDelta);
|
||||
|
||||
|
||||
if(currentButton != null && infoTime == 0) {
|
||||
int x = par1 + 10;
|
||||
int y = par2;
|
||||
|
||||
|
||||
x = currentButton.xPosition - 20;
|
||||
y = currentButton.yPosition;
|
||||
|
||||
|
||||
mc.fontRenderer.drawStringWithShadow("?", x, y, 0xFFFFFF);
|
||||
GL11.glScalef(0.5F, 0.5F, 1F);
|
||||
mc.fontRenderer.drawStringWithShadow(EnumChatFormatting.BOLD + "Shift", x * 2 - 6, y * 2 + 20, 0xFFFFFF);
|
||||
GL11.glScalef(2F, 2F, 1F);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(currentButton != null && infoTime > 0) {
|
||||
float fract = infoTime / animationTime;
|
||||
|
||||
|
||||
int x = currentButton.xPosition;
|
||||
int y = currentButton.yPosition;
|
||||
String s = StatCollector.translateToLocal(currentEntry.getTagline());
|
||||
boolean unicode = mc.fontRenderer.getUnicodeFlag();
|
||||
mc.fontRenderer.setUnicodeFlag(true);
|
||||
int width = mc.fontRenderer.getStringWidth(s);
|
||||
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(x, y, 0);
|
||||
GL11.glScalef(fract, 1F, 1F);
|
||||
@@ -209,15 +209,15 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
Gui.drawRect(10, -32, width + 22, -2, 0x44000000);
|
||||
drawBookmark(width / 2 + 16, -8, s, true, 0xFFFFFF);
|
||||
mc.fontRenderer.setUnicodeFlag(unicode);
|
||||
|
||||
|
||||
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
|
||||
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);
|
||||
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++) {
|
||||
@@ -225,12 +225,12 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, stack, 38 + spaceForEach * i, -28);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
|
||||
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
setHoveredButton(null);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,27 +10,18 @@
|
||||
*/
|
||||
package vazkii.botania.client.gui.lexicon.button;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.ITextureObject;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
||||
import org.lwjgl.opengl.ARBMultitexture;
|
||||
import org.lwjgl.opengl.ARBShaderObjects;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL13;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
|
||||
import com.sun.prism.ps.Shader;
|
||||
|
||||
import vazkii.botania.api.internal.ShaderCallback;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
import vazkii.botania.client.gui.lexicon.GuiLexicon;
|
||||
@@ -96,8 +87,6 @@ public class GuiButtonCategory extends GuiButtonLexicon {
|
||||
|
||||
float s = 1F / 32F;
|
||||
float defAlpha = 0F;
|
||||
float alpha = ticksHovered / time * (1F - defAlpha) + defAlpha;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
@@ -40,8 +40,8 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
|
||||
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
|
||||
int k = getHoverState(field_146123_n);
|
||||
boolean showStack = displayStack != null && !displayString.isEmpty();
|
||||
|
||||
if(!displayString.isEmpty() && k == 2) {
|
||||
|
||||
if(!displayString.isEmpty() && k == 2) {
|
||||
timeHover = Math.min(5, timeHover + gui.timeDelta);
|
||||
gui.setHoveredButton(this);
|
||||
} else timeHover = Math.max(0, timeHover - gui.timeDelta);
|
||||
|
||||
Reference in new issue
Block a user