bunch of gui stuff

This commit is contained in:
Vincent Lee committed 2019-03-08 15:14:30 -06:00
1 parent 324369c7a6
commit bc2e44ae9a
26 files changed
+247 -328

No files matched your search

@@ -20,7 +20,6 @@ import vazkii.botania.client.model.FloatingFlowerModel;
import vazkii.botania.client.model.GunModel;
import vazkii.botania.client.model.LexiconModel;
import vazkii.botania.client.model.PlatformModel;
import vazkii.botania.common.integration.buildcraft.TriggerManaLevel;
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
import vazkii.botania.common.item.relic.ItemKingKey;
@@ -53,7 +52,7 @@ public class MiscellaneousIcons {
public TextureAtlasSprite[] sparkUpgradeIcons;
public TextureAtlasSprite[] kingKeyWeaponIcons;
public final Map<TriggerManaLevel.State, TextureAtlasSprite> manaLevelTriggerIcons = new EnumMap<>(TriggerManaLevel.State.class);
// public final Map<TriggerManaLevel.State, TextureAtlasSprite> manaLevelTriggerIcons = new EnumMap<>(TriggerManaLevel.State.class);
public TextureAtlasSprite[] tiaraWingIcons;
public TextureAtlasSprite[] thirdEyeLayers;
@@ -151,9 +150,11 @@ public class MiscellaneousIcons {
manaDetectorIcon = IconHelper.forName(evt.getMap(), "triggers/manaDetector", "items");
runeAltarTriggerIcon = IconHelper.forName(evt.getMap(), "triggers/runeAltarCanCraft", "items");
/*
for (TriggerManaLevel.State s : TriggerManaLevel.State.values()) {
manaLevelTriggerIcons.put(s, IconHelper.forName(evt.getMap(), "triggers/mana" + WordUtils.capitalizeFully(s.name()), "items"));
}
*/
tiaraWingIcons = new TextureAtlasSprite[ItemFlightTiara.WING_TYPES];
for (int i = 0; i < tiaraWingIcons.length; i++) {
@@ -12,6 +12,7 @@ package vazkii.botania.client.gui.lexicon;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.audio.SimpleSound;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
@@ -19,12 +20,14 @@ import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.gui.advancements.GuiScreenAdvancements;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.InputMappings;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChatAllowedCharacters;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.common.MinecraftForge;
import org.lwjgl.glfw.GLFW;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
@@ -142,10 +145,11 @@ public class GuiLexicon extends GuiScreen {
if(persistentScale > 0 && persistentScale != guiScale) {
mc.gameSettings.guiScale = persistentScale;
ScaledResolution res = new ScaledResolution(mc);
width = res.getScaledWidth();
height = res.getScaledHeight();
mc.mainWindow.updateSize();
width = mc.mainWindow.getScaledWidth();
height = mc.mainWindow.getScaledHeight();
mc.gameSettings.guiScale = guiScale;
mc.mainWindow.updateSize();
}
allCategories = new ArrayList<>(BotaniaAPI.getAllCategories());
@@ -159,12 +163,12 @@ public class GuiLexicon extends GuiScreen {
left = width / 2 - guiWidth / 2;
top = height / 2 - guiHeight / 2;
buttonList.clear();
buttons.clear();
if(isIndex()) {
int x = 18;
for(int i = 0; i < 12; i++) {
int y = 16 + i * 12;
buttonList.add(new GuiButtonInvisible((GuiLexiconIndex) this, i, left + x, top + y, 110, 10, ""));
buttons.add(new GuiButtonInvisible((GuiLexiconIndex) this, i, left + x, top + y, 110, 10, ""));
}
populateIndex();
} else if(isCategoryIndex()) {
@@ -178,18 +182,18 @@ public class GuiLexicon extends GuiScreen {
int size = 22;
GuiButtonCategory button = new GuiButtonCategory(i, left + 18 + x * size, top + 50 + y * size, this, category);
buttonList.add(button);
buttons.add(button);
}
}
populateBookmarks();
if(isMainPage()) {
buttonList.add(new GuiButtonOptions(-1, left + 20, top + guiHeight - 25));
buttonList.add(new GuiButtonAchievement(-2, left + 33, top + guiHeight - 25));
buttonList.add(new GuiButtonChallenges(-3, left + 45, top + guiHeight - 25));
buttonList.add(new GuiButtonScaleChange(-4, left + 57, top + guiHeight - 25));
buttons.add(new GuiButtonOptions(-1, left + 20, top + guiHeight - 25));
buttons.add(new GuiButtonAchievement(-2, left + 33, top + guiHeight - 25));
buttons.add(new GuiButtonChallenges(-3, left + 45, top + guiHeight - 25));
buttons.add(new GuiButtonScaleChange(-4, left + 57, top + guiHeight - 25));
GuiButtonUpdateWarning button = new GuiButtonUpdateWarning(-98, left - 6, top + guiHeight - 70);
buttonList.add(button);
buttons.add(button);
if(PersistentVariableHelper.lastBotaniaVersion.equals(LibMisc.VERSION)) {
button.enabled = false;
@@ -199,14 +203,14 @@ public class GuiLexicon extends GuiScreen {
LocalDateTime now = LocalDateTime.now();
if(now.getMonth() == Month.NOVEMBER && now.getDayOfMonth() == 22)
buttonList.add(new GuiButtonDoot(-99, left + 100, top + 12));
buttons.add(new GuiButtonDoot(-99, left + 100, top + 12));
}
buttonList.add(new GuiButtonNotes(this, NOTES_BUTTON_ID, left - 4, top - 4));
buttons.add(new GuiButtonNotes(this, NOTES_BUTTON_ID, left - 4, top - 4));
}
@Override
public void updateScreen() {
public void tick() {
if(notesEnabled && notesMoveTime < NOTE_TWEEN_TIME)
notesMoveTime++;
else if(!notesEnabled && notesMoveTime > 0)
@@ -217,8 +221,7 @@ public class GuiLexicon extends GuiScreen {
}
@Override
public final void drawScreen(int x, int y, float partialTicks) {
ScaledResolution res = new ScaledResolution(mc);
public final void render(int x, int y, float partialTicks) {
int guiScale = mc.gameSettings.guiScale;
GlStateManager.pushMatrix();
@@ -226,15 +229,14 @@ public class GuiLexicon extends GuiScreen {
if(persistentScale > 0 && persistentScale != guiScale) {
mc.gameSettings.guiScale = persistentScale;
float s = (float) persistentScale / (float) res.getScaleFactor();
float s = (float) persistentScale / (float) mc.mainWindow.getGuiScaleFactor();
GlStateManager.scale(s, s, s);
GlStateManager.scalef(s, s, s);
res = new ScaledResolution(mc);
int sw = res.getScaledWidth();
int sh = res.getScaledHeight();
x = Mouse.getX() * sw / mc.displayWidth;
y = sh - Mouse.getY() * sh / mc.displayHeight - 1;
int sw = mc.mainWindow.getScaledWidth();
int sh = mc.mainWindow.getScaledHeight();
x = (int) (mc.mouseHelper.getMouseX() * sw / mc.mainWindow.getWidth());
y = (int) (sh - mc.mouseHelper.getMouseY() * sh / mc.mainWindow.getHeight() - 1);
}
drawScreenAfterScale(x, y, partialTicks);
@@ -250,8 +252,8 @@ public class GuiLexicon extends GuiScreen {
double widthPerTick = (fullWidth + width) / 240;
double currWidth = left - widthPerTick * (240 - (konamiTime - partialTicks)) * 3.2;
GlStateManager.translate(currWidth, height / 2 - 10, 0);
GlStateManager.scale(4, 4, 4);
GlStateManager.translated(currWidth, height / 2 - 10, 0);
GlStateManager.scalef(4, 4, 4);
mc.fontRenderer.drawStringWithShadow(meme, 0, 0, 0xFFFFFF);
GlStateManager.popMatrix();
}
@@ -263,11 +265,11 @@ public class GuiLexicon extends GuiScreen {
lastTime = time;
partialTicks = newPartialTicks;
GlStateManager.color(1F, 1F, 1F, 1F);
GlStateManager.color4f(1F, 1F, 1F, 1F);
mc.textureManager.bindTexture(texture);
drawNotes(newPartialTicks);
GlStateManager.color(1F, 1F, 1F, 1F);
GlStateManager.color4f(1F, 1F, 1F, 1F);
mc.textureManager.bindTexture(texture);
drawTexturedModalRect(left, top, 0, 0, guiWidth, guiHeight);
@@ -288,17 +290,17 @@ public class GuiLexicon extends GuiScreen {
bookmarksNeedPopulation = false;
}
if(mc.player.getName().equals("haighyorkie")) {
GlStateManager.color(1F, 1F, 1F, 1F);
if(mc.player.getGameProfile().getName().equals("haighyorkie")) {
GlStateManager.color4f(1F, 1F, 1F, 1F);
mc.textureManager.bindTexture(texture);
drawTexturedModalRect(left - 19, top + 42, 67, 180, 19, 26);
if(xCoord >= left - 19 && xCoord < left && yCoord >= top + 62 && yCoord < top + 88) {
mc.textureManager.bindTexture(textureToff);
GlStateManager.pushMatrix();
GlStateManager.scale(0.5F, 0.5F, 0.5F);
GlStateManager.scalef(0.5F, 0.5F, 0.5F);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.translate(0F, 0F, 2F);
GlStateManager.translatef(0F, 0F, 2F);
int w = 256;
int h = 152;
@@ -313,19 +315,19 @@ public class GuiLexicon extends GuiScreen {
}
}
super.drawScreen(xCoord, yCoord, newPartialTicks);
super.render(xCoord, yCoord, newPartialTicks);
if(hasTutorialArrow) {
mc.textureManager.bindTexture(texture);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.color(1F, 1F, 1F, 0.7F + (float) (Math.sin((ClientTickHandler.ticksInGame + newPartialTicks) * 0.3F) + 1) * 0.15F);
GlStateManager.color4f(1F, 1F, 1F, 0.7F + (float) (Math.sin((ClientTickHandler.ticksInGame + newPartialTicks) * 0.3F) + 1) * 0.15F);
drawTexturedModalRect(tutorialArrowX, tutorialArrowY, 20, 200, TUTORIAL_ARROW_WIDTH, TUTORIAL_ARROW_HEIGHT);
GlStateManager.disableBlend();
}
}
public void drawNotes(float part) {
private void drawNotes(float part) {
int size = 105;
float time = notesMoveTime;
@@ -345,27 +347,20 @@ public class GuiLexicon extends GuiScreen {
noteDisplay += "&r_";
fontRenderer.drawString(I18n.format("botaniamisc.notes"), x + 5, y - 7, 0x666666);
boolean unicode = fontRenderer.getUnicodeFlag();
fontRenderer.setUnicodeFlag(true);
PageText.renderText(x + 5, y - 3, 92, 120, 0, true, 0, TextFormatting.RESET + noteDisplay);
fontRenderer.setUnicodeFlag(unicode);
}
public void drawBookmark(int x, int y, String s, boolean drawLeft) {
drawBookmark(x, y, s, drawLeft, 180);
}
public void drawBookmark(int x, int y, String s, boolean drawLeft, int v) {
private void drawBookmark(int x, int y, String s, boolean drawLeft, int v) {
drawBookmark(x, y, s, drawLeft, 0x111111, v);
}
public void drawBookmark(int x, int y, String s, boolean drawLeft, int color, int v) {
// This function is called from the buttons so I can't use fontRenderer
FontRenderer font = Minecraft.getInstance().fontRenderer;
boolean unicode = font.getUnicodeFlag();
font.setUnicodeFlag(true);
int l = font.getStringWidth(s);
int fontOff = 0;
@@ -376,7 +371,7 @@ public class GuiLexicon extends GuiScreen {
Minecraft.getInstance().textureManager.bindTexture(texture);
GlStateManager.color(1F, 1F, 1F, 1F);
GlStateManager.color4f(1F, 1F, 1F, 1F);
drawTexturedModalRect(x + l / 2 + 3, y - 1, 54, v, 6, 11);
if(drawLeft)
@@ -384,26 +379,22 @@ public class GuiLexicon extends GuiScreen {
for(int i = 0; i < l + 6; i++)
drawTexturedModalRect(x - l / 2 - 3 + i, y - 1, 60, v, 1, 11);
font.drawString(s, x - l / 2 + fontOff, y, color, false);
font.setUnicodeFlag(unicode);
font.drawString(s, x - l / 2 + fontOff, y, color);
}
void drawHeader() {
private void drawHeader() {
GlStateManager.pushMatrix();
GlStateManager.color(1F, 1F, 1F, 1F);
GlStateManager.color4f(1F, 1F, 1F, 1F);
Minecraft.getInstance().textureManager.bindTexture(texture);
drawTexturedModalRect(left - 8, top + 9, 0, 224, 140, 31);
int color = 0xffd200;
boolean unicode = fontRenderer.getUnicodeFlag();
fontRenderer.drawString(title, left + 18, top + 13, color);
fontRenderer.setUnicodeFlag(true);
fontRenderer.drawString(I18n.format("botaniamisc.edition", ItemLexicon.getEdition()), left + 24, top + 22, color);
String s = TextFormatting.BOLD + categoryHighlight;
fontRenderer.drawString(s, left + guiWidth / 2 - fontRenderer.getStringWidth(s) / 2, top + 36, 0);
fontRenderer.setUnicodeFlag(unicode);
GlStateManager.popMatrix();
categoryHighlight = "";
@@ -514,11 +505,7 @@ public class GuiLexicon extends GuiScreen {
if(fontRenderer == null)
fontRenderer = Minecraft.getInstance().fontRenderer;
boolean unicode = fontRenderer.getUnicodeFlag();
fontRenderer.setUnicodeFlag(true);
int width = fontRenderer.getStringWidth(b) + 15;
fontRenderer.setUnicodeFlag(unicode);
return width;
return fontRenderer.getStringWidth(b) + 15;
}
String getTitle() {
@@ -545,14 +532,9 @@ public class GuiLexicon extends GuiScreen {
return true;
}
public static int getMaxAllowedScale() {
private static int getMaxAllowedScale() {
Minecraft mc = Minecraft.getInstance();
int scale = mc.gameSettings.guiScale;
mc.gameSettings.guiScale = 0;
ScaledResolution res = new ScaledResolution(mc);
mc.gameSettings.guiScale = scale;
return res.getScaleFactor();
return mc.mainWindow.getScaleFactor(0);
}
void populateIndex() {
@@ -560,7 +542,7 @@ public class GuiLexicon extends GuiScreen {
int shift = 2;
for(int i = shift; i < 12; i++) {
int i_ = i - shift;
GuiButtonInvisible button = (GuiButtonInvisible) buttonList.get(i);
GuiButtonInvisible button = (GuiButtonInvisible) buttons.get(i);
LexiconCategory category = i_ >= categoryList.size() ? null : categoryList.get(i_);
if(category != null)
button.displayString = I18n.format(category.getUnlocalizedName());
@@ -571,13 +553,8 @@ public class GuiLexicon extends GuiScreen {
}
}
void populateBookmarks() {
List<GuiButton> remove = new ArrayList<>();
List<GuiButton> buttons = buttonList;
for(GuiButton button : buttons)
if(button.id >= BOOKMARK_START)
remove.add(button);
buttonList.removeAll(remove);
private void populateBookmarks() {
buttons.removeIf(b -> b.id >= BOOKMARK_START);
int len = bookmarks.size();
boolean thisExists = false;
@@ -589,13 +566,13 @@ public class GuiLexicon extends GuiScreen {
for(int i = 0; i < len + (addEnabled ? 1 : 0); i++) {
boolean isAdd = i == bookmarks.size();
GuiLexicon gui = isAdd ? null : bookmarks.get(i);
buttonList.add(new GuiButtonBookmark(BOOKMARK_START + i, left + 138, top + 18 + 14 * i, gui == null ? this : gui, gui == null ? "+" : gui.getTitle()));
buttons.add(new GuiButtonBookmark(BOOKMARK_START + i, left + 138, top + 18 + 14 * i, gui == null ? this : gui, gui == null ? "+" : gui.getTitle()));
}
if(isMainPage())
buttonList.add(new GuiButtonHistory(BOOKMARK_START + MAX_BOOKMARK_COUNT, left + 138, top + guiHeight - 24, I18n.format("botaniamisc.history"), this));
buttons.add(new GuiButtonHistory(BOOKMARK_START + MAX_BOOKMARK_COUNT, left + 138, top + guiHeight - 24, I18n.format("botaniamisc.history"), this));
else if(isChallenge())
buttonList.add(new GuiButtonChallengeInfo(BOOKMARK_START + MAX_BOOKMARK_COUNT, left + 138, top + guiHeight - 24, I18n.format("botaniamisc.info"), this));
buttons.add(new GuiButtonChallengeInfo(BOOKMARK_START + MAX_BOOKMARK_COUNT, left + 138, top + guiHeight - 24, I18n.format("botaniamisc.info"), this));
}
public static void startTutorial() {
@@ -629,7 +606,6 @@ public class GuiLexicon extends GuiScreen {
LexiconEntry entry = tutorial.peek();
LexiconCategory category = entry.category;
List<GuiButton> buttons = buttonList;
for(GuiButton button : buttons)
if(button instanceof GuiButtonCategory) {
GuiButtonCategory catButton = (GuiButtonCategory) button;
@@ -650,18 +626,18 @@ public class GuiLexicon extends GuiScreen {
}
@Override
protected void keyTyped(char par1, int par2) throws IOException {
protected void keyPressed(int keyCode, int scanCode, int mods) {
handleNoteKey(par1, par2);
if(!notesEnabled && closeScreenOnInvKey() && mc.gameSettings.keyBindInventory.getKeyCode() == par2) {
if(!notesEnabled && closeScreenOnInvKey() && mc.gameSettings.keyBindInventory.isActiveAndMatches(InputMappings.getInputByCode(keyCode, scanCode))) {
mc.displayGuiScreen(null);
mc.setIngameFocus();
mc.mouseHelper.grabMouse();
}
if(konamiTime == 0 && par2 == KONAMI_CODE[konamiIndex]) {
konamiIndex++;
if(konamiIndex >= KONAMI_CODE.length) {
mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(ModSounds.way, 1.0F));
mc.getSoundHandler().play(SimpleSound.master(ModSounds.way, 1.0F));
konamiIndex = 0;
konamiTime = 240;
}
@@ -714,7 +690,7 @@ public class GuiLexicon extends GuiScreen {
}
public void serialize(NBTTagCompound cmp) {
cmp.setString(TAG_TYPE, getClass().getName());
cmp.putString(TAG_TYPE, getClass().getName());
}
public String getNotesKey() {
@@ -50,8 +50,8 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
super.onInitGui();
setTitle();
buttonList.add(backButton = new GuiButtonBack(12, left + guiWidth / 2 - 8, top + guiHeight + 2));
buttonList.add(completeButton = new GuiButton(13, left + 20, top + guiHeight - 35, guiWidth - 40, 20, ""));
buttons.add(backButton = new GuiButtonBack(12, left + guiWidth / 2 - 8, top + guiHeight + 2));
buttons.add(completeButton = new GuiButton(13, left + 20, top + guiHeight - 35, guiWidth - 40, 20, ""));
setCompleteButtonTitle();
}
@@ -65,8 +65,6 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
RenderHelper.disableStandardItemLighting();
GlStateManager.enableBlend();
boolean unicode = fontRenderer.getUnicodeFlag();
fontRenderer.setUnicodeFlag(true);
fontRenderer.drawString(TextFormatting.BOLD + I18n.format(challenge.unlocalizedName), left + 38, top + 13, 0);
fontRenderer.drawString(I18n.format(challenge.level.getName()) + ((challenge.icon.getItem() instanceof ItemRune) ? "+" : "") + " / " + (challenge.complete ? TextFormatting.DARK_GREEN : TextFormatting.DARK_RED) + I18n.format(challenge.complete ? "botaniamisc.completed" : "botaniamisc.notCompleted"), left + 38, top + 23, 0);
@@ -75,7 +73,6 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
int y = top + 28;
PageText.renderText(x, y, width, guiHeight, challenge.unlocalizedName + ".desc");
fontRenderer.setUnicodeFlag(unicode);
}
@Override
@@ -91,11 +88,12 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
}
@Override
protected void mouseClicked(int par1, int par2, int par3) throws IOException {
super.mouseClicked(par1, par2, par3);
if(par3 == 1)
public boolean mouseClicked(double mouseX, double mouseY, int button) {
if(button == 1) {
back();
return false;
}
return super.mouseClicked(mouseX, mouseY, button);
}
@Override
@@ -157,7 +155,7 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
@Override
public void serialize(NBTTagCompound cmp) {
super.serialize(cmp);
cmp.setString(TAG_CHALLENGE, challenge.unlocalizedName);
cmp.putString(TAG_CHALLENGE, challenge.unlocalizedName);
}
@Override
@@ -18,7 +18,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.text.Style;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.TextFormatting;
import org.lwjgl.input.Mouse;
import org.lwjgl.glfw.GLFW;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.internal.IGuiLexiconEntry;
import vazkii.botania.api.lexicon.IAddonEntry;
@@ -76,12 +76,12 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
public void onInitGui() {
super.onInitGui();
buttonList.add(backButton = new GuiButtonBackWithShift(0, left + guiWidth / 2 - 8, top + guiHeight + 2));
buttonList.add(leftButton = new GuiButtonPage(1, left, top + guiHeight - 10, false));
buttonList.add(rightButton = new GuiButtonPage(2, left + guiWidth - 18, top + guiHeight - 10, true));
buttonList.add(new GuiButtonShare(3, left + guiWidth - 6, top - 2));
buttons.add(backButton = new GuiButtonBackWithShift(0, left + guiWidth / 2 - 8, top + guiHeight + 2));
buttons.add(leftButton = new GuiButtonPage(1, left, top + guiHeight - 10, false));
buttons.add(rightButton = new GuiButtonPage(2, left + guiWidth - 18, top + guiHeight - 10, true));
buttons.add(new GuiButtonShare(3, left + guiWidth - 6, top - 2));
if(entry.getWebLink() != null)
buttonList.add(new GuiButtonViewOnline(4, left - 8, top + 12));
buttons.add(new GuiButtonViewOnline(4, left - 8, top + 12));
if(!GuiLexicon.isValidLexiconGui(this)) {
currentOpenLexicon = new GuiLexicon();
@@ -200,8 +200,8 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
}
@Override
public void updateScreen() {
super.updateScreen();
public void tick() {
super.tick();
LexiconPage page = entry.pages.get(this.page);
page.updateScreen(this);
@@ -261,53 +261,51 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
parent = gui;
}
private int fx = 0;
private boolean swiped = false;
@Override
protected void mouseClickMove(int x, int y, int button, long time) {
if(button == 0 && Math.abs(x - fx) > 100 && mc.gameSettings.touchscreen && !swiped) {
double swipe = (x - fx) / Math.max(1, (double) time);
if(swipe < 0.5) {
public boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) {
if(button == GLFW.GLFW_MOUSE_BUTTON_LEFT && dragX > 100 && mc.gameSettings.touchscreen && !swiped) {
// todo 1.13 correct these constants
if(dragX < 0.5) {
nextPage();
swiped = true;
} else if(swipe > 0.5) {
} else if(dragX > 0.5) {
prevPage();
swiped = true;
}
return true;
}
return false;
}
@Override
protected void mouseClicked(int par1, int par2, int par3) throws IOException {
super.mouseClicked(par1, par2, par3);
public boolean mouseClicked(double mouseX, double mouseY, int button) {
if(button == GLFW.GLFW_MOUSE_BUTTON_LEFT) {
swiped = false;
}
fx = par1;
switch(par3) {
switch(button) {
case 1:
back();
break;
return true;
case 3:
nextPage();
break;
return true;
case 4:
prevPage();
break;
return true;
default: return super.mouseClicked(mouseX, mouseY, button);
}
}
@Override
public void handleMouseInput() throws IOException {
super.handleMouseInput();
if(Mouse.getEventButton() == 0)
swiped = false;
int w = Mouse.getEventDWheel();
public boolean mouseScrolled(double w) {
if(w < 0)
nextPage();
else if(w > 0)
prevPage();
return true;
}
@Override
@@ -319,7 +317,7 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
if(par2 == 1) {
mc.displayGuiScreen(null);
mc.setIngameFocus();
mc.mouseHelper.grabMouse();
} else if(par2 == 203 || par2 == 200 || par2 == 201) // Left, Up, Page Up
prevPage();
else if(par2 == 205 || par2 == 208 || par2 == 209) // Right, Down Page Down
@@ -362,7 +360,7 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
@Override
public List<GuiButton> getButtonList() {
return buttonList;
return buttons;
}
@Override
@@ -383,8 +381,8 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
@Override
public void serialize(NBTTagCompound cmp) {
super.serialize(cmp);
cmp.setString(TAG_ENTRY, entry.getUnlocalizedName());
cmp.setInteger(TAG_PAGE, page);
cmp.putString(TAG_ENTRY, entry.getUnlocalizedName());
cmp.putInt(TAG_PAGE, page);
}
@Override
@@ -398,7 +396,7 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
break;
}
page = cmp.getInteger(TAG_PAGE);
page = cmp.getInt(TAG_PAGE);
setTitle();
}
@@ -19,7 +19,6 @@ import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.text.TextFormatting;
import org.lwjgl.input.Mouse;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.ILexicon;
import vazkii.botania.api.lexicon.LexiconCategory;
@@ -97,9 +96,9 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
return;
}
buttonList.add(backButton = new GuiButtonBack(12, left + guiWidth / 2 - 8, top + guiHeight + 2));
buttonList.add(leftButton = new GuiButtonPage(13, left, top + guiHeight - 10, false));
buttonList.add(rightButton = new GuiButtonPage(14, left + guiWidth - 18, top + guiHeight - 10, true));
buttons.add(backButton = new GuiButtonBack(12, left + guiWidth / 2 - 8, top + guiHeight + 2));
buttons.add(leftButton = new GuiButtonPage(13, left, top + guiHeight - 10, false));
buttons.add(rightButton = new GuiButtonPage(14, left + guiWidth - 18, top + guiHeight - 10, true));
searchField = new GuiTextField(15, fontRenderer, left + guiWidth / 2 + 28, top + guiHeight + 6, 200, 10);
searchField.setCanLoseFocus(false);
@@ -145,10 +144,10 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
@Override
void populateIndex() {
LexiconEntry tutEntry = tutorial != null && !tutorial.isEmpty() ? tutorial.peek() : null;
LexiconEntry tutEntry = !tutorial.isEmpty() ? tutorial.peek() : null;
for(int i = page * 12; i < (page + 1) * 12; i++) {
GuiButtonInvisible button = (GuiButtonInvisible) buttonList.get(i - page * 12);
GuiButtonInvisible button = (GuiButtonInvisible) buttons.get(i - page * 12);
LexiconEntry entry = i >= entriesToDisplay.size() ? null : entriesToDisplay.get(i);
if(entry != null) {
button.displayString = entry.getKnowledgeType().color + "" + (entry.isPriority() ? TextFormatting.ITALIC : "") + I18n.format(entry.getUnlocalizedName());
@@ -176,7 +175,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
if(!searchField.getText().isEmpty()) {
drawBookmark(left + 138, top + guiHeight - 24, " " + searchField.getText(), false);
mc.textureManager.bindTexture(texture);
GlStateManager.color(1F, 1F, 1F, 1F);
GlStateManager.color4f(1F, 1F, 1F, 1F);
drawTexturedModalRect(left + 134, top + guiHeight - 26, 86, 180, 12, 12);
if(entriesToDisplay.size() == 1) {
@@ -209,9 +208,9 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
y = currentButton.y;
mc.fontRenderer.drawStringWithShadow("?", x, y, 0xFFFFFF);
GlStateManager.scale(0.5F, 0.5F, 1F);
GlStateManager.scalef(0.5F, 0.5F, 1F);
mc.fontRenderer.drawStringWithShadow(TextFormatting.BOLD + "Shift", x * 2 - 6, y * 2 + 20, 0xFFFFFF);
GlStateManager.scale(2F, 2F, 1F);
GlStateManager.scalef(2F, 2F, 1F);
}
}
@@ -226,8 +225,8 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
int width = mc.fontRenderer.getStringWidth(s);
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, 0);
GlStateManager.scale(fract, 1F, 1F);
GlStateManager.translatef(x, y, 0);
GlStateManager.scalef(fract, 1F, 1F);
Gui.drawRect(12, -30, width + 20, -2, 0x44000000);
Gui.drawRect(10, -32, width + 22, -2, 0x44000000);
@@ -28,12 +28,12 @@ public class GuiButtonAchievement extends GuiButtonLexicon {
}
@Override
public void drawButton(@Nonnull Minecraft par1Minecraft, int par2, int par3, float partialTicks) {
hovered = par2 >= x && par3 >= y && par2 < x + width && par3 < y + height;
public void render(int mouseX, int mouseY, float partialTicks) {
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
int k = getHoverState(hovered);
par1Minecraft.textureManager.bindTexture(GuiLexicon.texture);
GlStateManager.color(1F, 1F, 1F, 1F);
Minecraft.getInstance().textureManager.bindTexture(GuiLexicon.texture);
GlStateManager.color4f(1F, 1F, 1F, 1F);
drawTexturedModalRect(x, y, k == 2 ? 109 : 98, 191, 11, 11);
List<String> tooltip = new ArrayList<>();
@@ -41,7 +41,7 @@ public class GuiButtonAchievement extends GuiButtonLexicon {
int tooltipY = (tooltip.size() - 1) * 10;
if(k == 2)
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
RenderHelper.renderTooltip(mouseX, mouseY + tooltipY, tooltip);
}
}
@@ -27,19 +27,19 @@ public class GuiButtonBack extends GuiButtonLexicon {
}
@Override
public void drawButton(@Nonnull Minecraft par1Minecraft, int par2, int par3, float partialTicks) {
public void render(int mouseX, int mouseY, float partialTicks) {
if(enabled) {
hovered = par2 >= x && par3 >= y && par2 < x + width && par3 < y + height;
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
int k = getHoverState(hovered);
par1Minecraft.textureManager.bindTexture(GuiLexicon.texture);
GlStateManager.color(1F, 1F, 1F, 1F);
Minecraft.getInstance().textureManager.bindTexture(GuiLexicon.texture);
GlStateManager.color4f(1F, 1F, 1F, 1F);
drawTexturedModalRect(x, y, 36, k == 2 ? 180 : 189, 18, 9);
List<String> tooltip = getTooltip();
int tooltipY = (tooltip.size() - 1) * 10;
if(k == 2)
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
RenderHelper.renderTooltip(mouseX, mouseY + tooltipY, tooltip);
}
}
@@ -20,9 +20,9 @@ public class GuiButtonBookmark extends GuiButtonLexicon {
}
@Override
public void drawButton(@Nonnull Minecraft mc, int par2, int par3, float partialTicks) {
public void render(int mouseX, int mouseY, float partialTicks) {
gui.drawBookmark(x, y, displayString, false);
hovered = par2 >= x && par3 >= y && par2 < x + width && par3 < y + height;
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
int k = getHoverState(hovered);
List<String> tooltip = new ArrayList<>();
@@ -36,7 +36,7 @@ public class GuiButtonBookmark extends GuiButtonLexicon {
int tooltipY = (tooltip.size() + 1) * 5;
if(k == 2)
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
RenderHelper.renderTooltip(mouseX, mouseY + tooltipY, tooltip);
}
}
@@ -49,11 +49,11 @@ public class GuiButtonCategory extends GuiButtonLexicon {
int maskUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "mask");
float heightMatch = ticksHovered / time;
OpenGlHelper.setActiveTexture(ARBMultitexture.GL_TEXTURE0_ARB);
OpenGlHelper.glActiveTexture(ARBMultitexture.GL_TEXTURE0_ARB);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, r.getTexture(resource).getGlTextureId());
ARBShaderObjects.glUniform1iARB(imageUniform, 0);
OpenGlHelper.setActiveTexture(ARBMultitexture.GL_TEXTURE0_ARB + ConfigHandler.glSecondaryTextureUnit);
OpenGlHelper.glActiveTexture(ARBMultitexture.GL_TEXTURE0_ARB + ConfigHandler.glSecondaryTextureUnit);
GlStateManager.enableTexture2D();
GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
@@ -73,7 +73,7 @@ public class GuiButtonCategory extends GuiButtonLexicon {
}
@Override
public void drawButton(@Nonnull Minecraft mc, int mx, int my, float partialTicks) {
public void render(int mx, int my, float partialTicks) {
boolean inside = mx >= x && my >= y && mx < x + width && my < y + height;
if(inside)
ticksHovered = Math.min(time, ticksHovered + gui.timeDelta);
@@ -92,20 +92,20 @@ public class GuiButtonCategory extends GuiButtonLexicon {
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.scale(0.5F, 0.5F, 0.5F);
GlStateManager.color(1F, 1F, 1F, 1F);
GlStateManager.scalef(0.5F, 0.5F, 0.5F);
GlStateManager.color4f(1F, 1F, 1F, 1F);
if(!boundStencil) { // Allow for the texture manager to take care of the ResourceLocation before we use it directly with gl
mc.textureManager.bindTexture(stencilResource);
Minecraft.getInstance().textureManager.bindTexture(stencilResource);
boundStencil = true;
}
mc.textureManager.bindTexture(resource);
Minecraft.getInstance().textureManager.bindTexture(resource);
int texture = 0;
boolean shaders = ShaderHelper.useShaders();
if(shaders) {
OpenGlHelper.setActiveTexture(ARBMultitexture.GL_TEXTURE0_ARB + ConfigHandler.glSecondaryTextureUnit);
OpenGlHelper.glActiveTexture(ARBMultitexture.GL_TEXTURE0_ARB + ConfigHandler.glSecondaryTextureUnit);
texture = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
}
@@ -114,9 +114,9 @@ public class GuiButtonCategory extends GuiButtonLexicon {
ShaderHelper.releaseShader();
if(shaders) {
OpenGlHelper.setActiveTexture(ARBMultitexture.GL_TEXTURE0_ARB + ConfigHandler.glSecondaryTextureUnit);
OpenGlHelper.glActiveTexture(ARBMultitexture.GL_TEXTURE0_ARB + ConfigHandler.glSecondaryTextureUnit);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
OpenGlHelper.setActiveTexture(ARBMultitexture.GL_TEXTURE0_ARB);
OpenGlHelper.glActiveTexture(ARBMultitexture.GL_TEXTURE0_ARB);
}
GlStateManager.popMatrix();
@@ -31,21 +31,21 @@ public class GuiButtonChallengeIcon extends GuiButtonLexicon {
}
@Override
public void drawButton(@Nonnull Minecraft par1Minecraft, int par2, int par3, float partialTicks) {
hovered = par2 >= x && par3 >= y && par2 < x + width && par3 < y + height;
public void render(int mouseX, int mouseY, float partialTicks) {
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
int k = getHoverState(hovered);
RenderHelper.enableGUIStandardItemLighting();
GlStateManager.enableRescaleNormal();
par1Minecraft.getItemRenderer().renderItemIntoGUI(challenge.icon, x, y);
Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(challenge.icon, x, y);
RenderHelper.disableStandardItemLighting();
GlStateManager.enableBlend();
if(challenge.complete) {
GlStateManager.disableDepth();
par1Minecraft.fontRenderer.drawStringWithShadow("\u2714", x + 10, y + 9, 0x004C00);
par1Minecraft.fontRenderer.drawStringWithShadow("\u2714", x + 10, y + 8, 0x0BD20D);
GlStateManager.enableDepth();
GlStateManager.disableDepthTest();
Minecraft.getInstance().fontRenderer.drawStringWithShadow("\u2714", x + 10, y + 9, 0x004C00);
Minecraft.getInstance().fontRenderer.drawStringWithShadow("\u2714", x + 10, y + 8, 0x0BD20D);
GlStateManager.enableDepthTest();
}
@@ -54,7 +54,7 @@ public class GuiButtonChallengeIcon extends GuiButtonLexicon {
int tooltipY = (tooltip.size() - 1) * 10;
if(k == 2)
vazkii.botania.client.core.helper.RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
vazkii.botania.client.core.helper.RenderHelper.renderTooltip(mouseX, mouseY + tooltipY, tooltip);
}
}
@@ -29,9 +29,9 @@ public class GuiButtonChallengeInfo extends GuiButtonLexicon {
}
@Override
public void drawButton(@Nonnull Minecraft mc, int par2, int par3, float partialTicks) {
public void render(int mouseX, int mouseY, float partialTicks) {
gui.drawBookmark(x, y, displayString, false);
hovered = par2 >= x && par3 >= y && par2 < x + width && par3 < y + height;
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
int k = getHoverState(hovered);
List<String> tooltip = new ArrayList<>();
@@ -39,7 +39,7 @@ public class GuiButtonChallengeInfo extends GuiButtonLexicon {
int tooltipY = (tooltip.size() + 1) * 5;
if(k == 2)
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
RenderHelper.renderTooltip(mouseX, mouseY + tooltipY, tooltip);
}
}
@@ -28,20 +28,20 @@ public class GuiButtonChallenges extends GuiButtonLexicon {
}
@Override
public void drawButton(@Nonnull Minecraft par1Minecraft, int par2, int par3, float partialTicks) {
hovered = par2 >= x && par3 >= y && par2 < x + width && par3 < y + height;
public void render(int mouseX, int mouseY, float partialTicks) {
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
int k = getHoverState(hovered);
par1Minecraft.textureManager.bindTexture(GuiLexicon.texture);
GlStateManager.color(1F, 1F, 1F, 1F);
Minecraft.getInstance().textureManager.bindTexture(GuiLexicon.texture);
GlStateManager.color4f(1F, 1F, 1F, 1F);
drawTexturedModalRect(x, y, k == 2 ? 131 : 120, 180, 11, 11);
List<String> tooltip = new ArrayList();
List<String> tooltip = new ArrayList<>();
tooltip.add(TextFormatting.GREEN + I18n.format("botaniamisc.challenges"));
int tooltipY = (tooltip.size() - 1) * 10;
if(k == 2)
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
RenderHelper.renderTooltip(mouseX, mouseY + tooltipY, tooltip);
}
}
@@ -32,14 +32,14 @@ public class GuiButtonDoot extends GuiButtonLexicon {
}
@Override
public void drawButton(@Nonnull Minecraft par1Minecraft, int par2, int par3, float partialTicks) {
hovered = par2 >= x && par3 >= y && par2 < x + width && par3 < y + height;
public void render(int mouseX, int mouseY, float partialTicks) {
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
int k = getHoverState(hovered);
par1Minecraft.textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
GlStateManager.color(1F, 1F, 1F, 1F);
par1Minecraft.getItemRenderer().renderItemIntoGUI(new ItemStack(ModItems.cacophonium), x, y);
par1Minecraft.getItemRenderer().renderItemIntoGUI(new ItemStack(Items.FIREWORKS), x + 8, y + 2);
Minecraft.getInstance().textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
GlStateManager.color4f(1F, 1F, 1F, 1F);
Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(new ItemStack(ModItems.cacophonium), x, y);
Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(new ItemStack(Items.FIREWORK_ROCKET), x + 8, y + 2);
GlStateManager.disableLighting();
@@ -50,7 +50,7 @@ public class GuiButtonDoot extends GuiButtonLexicon {
if(k == 2)
RenderHelper.renderTooltip(x - 100, y + 36, tooltip);
GlStateManager.enableAlpha();
GlStateManager.enableAlphaTest();
}
}
@@ -30,9 +30,9 @@ public class GuiButtonHistory extends GuiButtonLexicon {
}
@Override
public void drawButton(@Nonnull Minecraft mc, int par2, int par3, float partialTicks) {
public void render(int mouseX, int mouseY, float partialTicks) {
gui.drawBookmark(x, y, displayString, false);
hovered = par2 >= x && par3 >= y && par2 < x + width && par3 < y + height;
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
int k = getHoverState(hovered);
List<String> tooltip = new ArrayList<>();
@@ -41,7 +41,7 @@ public class GuiButtonHistory extends GuiButtonLexicon {
int tooltipY = (tooltip.size() + 1) * 5;
if(k == 2)
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
RenderHelper.renderTooltip(mouseX, mouseY + tooltipY, tooltip);
}
}
@@ -33,10 +33,10 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
final GuiLexiconIndex gui;
public ItemStack displayStack = ItemStack.EMPTY;
public boolean dog = false;
float timeHover = 0;
private float timeHover = 0;
boolean enableDog = false;
double dogPos = 0;
private boolean enableDog = false;
private double dogPos = 0;
public GuiButtonInvisible(GuiLexiconIndex gui, int par1, int par2, int par3, int par4, int par5, String par6Str) {
super(par1, par2, par3, par4, par5, par6Str);
@@ -50,21 +50,21 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
}
@Override
public void drawButton(@Nonnull Minecraft par1Minecraft, int par2, int par3, float partialTicks) {
public void render(int mouseX, int mouseY, float partialTicks) {
if(enableDog) {
dogPos += ClientTickHandler.delta * 10;
par1Minecraft.textureManager.bindTexture(dogResource);
Minecraft.getInstance().textureManager.bindTexture(dogResource);
float f = 1F / 64F;
GlStateManager.translate(dogPos, 0, 0);
GlStateManager.color(1F, 1F, 1F, 1F);
GlStateManager.translated(dogPos, 0, 0);
GlStateManager.color4f(1F, 1F, 1F, 1F);
vazkii.botania.client.core.helper.RenderHelper.drawTexturedModalRect(0, y, zLevel + 10, dogPos % 100 < 50 ? 23 : 0, 0, 23, 19, f, f);
x = (int) Math.max(x, dogPos + 10);
GlStateManager.translate(-dogPos, 0, 0);
GlStateManager.translated(-dogPos, 0, 0);
}
hovered = par2 >= x && par3 >= y && par2 < x + width && par3 < y + height;
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
int k = getHoverState(hovered);
boolean showStack = !displayStack.isEmpty() && !displayString.isEmpty();
@@ -77,7 +77,7 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.disableAlpha();
GlStateManager.disableAlphaTest();
int color = 0;
String format = FontHelper.getFormatFromString(displayString);
if(format.length() > 1) {
@@ -97,18 +97,15 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
int maxalpha = 0x22;
int alpha = Math.min(maxalpha, (int) (timeHover / 4 * maxalpha));
drawRect(x - 5, y, (int) (x - 5 + timeHover * 24), y + height, alpha << 24 | color);
GlStateManager.enableAlpha();
GlStateManager.enableAlphaTest();
boolean unicode = par1Minecraft.fontRenderer.getUnicodeFlag();
par1Minecraft.fontRenderer.setUnicodeFlag(true);
par1Minecraft.fontRenderer.drawString(displayString, x + (showStack ? 7 : 0), y + (height - 8) / 2, 0);
par1Minecraft.fontRenderer.setUnicodeFlag(unicode);
Minecraft.getInstance().fontRenderer.drawString(displayString, x + (showStack ? 7 : 0), y + (height - 8) / 2, 0);
if(showStack) {
GlStateManager.scale(0.5F, 0.5F, 0.5F);
GlStateManager.scalef(0.5F, 0.5F, 0.5F);
RenderHelper.enableGUIStandardItemLighting();
GlStateManager.enableRescaleNormal();
par1Minecraft.getItemRenderer().renderItemIntoGUI(displayStack, x * 2 - 6, y * 2 + 4);
Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(displayStack, x * 2 - 6, y * 2 + 4);
RenderHelper.disableStandardItemLighting();
GlStateManager.enableBlend();
}
@@ -23,7 +23,7 @@ import java.util.List;
public class GuiButtonNotes extends GuiButtonLexicon {
final GuiLexicon parent;
private final GuiLexicon parent;
public GuiButtonNotes(GuiLexicon parent, int id, int x, int y) {
super(id, x, y, 11, 11, "");
@@ -31,12 +31,12 @@ public class GuiButtonNotes extends GuiButtonLexicon {
}
@Override
public void drawButton(@Nonnull Minecraft par1Minecraft, int par2, int par3, float partialTicks) {
hovered = par2 >= x && par3 >= y && par2 < x + width && par3 < y + height;
public void render(int x, int y, float partialTicks) {
hovered = x >= this.x && y >= this.y && x < this.x + width && y < this.y + height;
int k = getHoverState(hovered);
par1Minecraft.textureManager.bindTexture(GuiLexicon.texture);
GlStateManager.color(1F, 1F, 1F, 1F);
Minecraft.getInstance().textureManager.bindTexture(GuiLexicon.texture);
GlStateManager.color4f(1F, 1F, 1F, 1F);
drawTexturedModalRect(x, y, k == 2 ? 130 : 120, 191, 10, 11);
List<String> tooltip = new ArrayList<>();
@@ -50,7 +50,7 @@ public class GuiButtonNotes extends GuiButtonLexicon {
int tooltipY = (tooltip.size() - 1) * 10;
if(k == 2)
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
RenderHelper.renderTooltip(x, y + tooltipY, tooltip);
}
}
@@ -28,12 +28,12 @@ public class GuiButtonOptions extends GuiButtonLexicon {
}
@Override
public void drawButton(@Nonnull Minecraft par1Minecraft, int par2, int par3, float partialTicks) {
hovered = par2 >= x && par3 >= y && par2 < x + width && par3 < y + height;
public void render(int mouseX, int mouseY, float partialTicks) {
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
int k = getHoverState(hovered);
par1Minecraft.textureManager.bindTexture(GuiLexicon.texture);
GlStateManager.color(1F, 1F, 1F, 1F);
Minecraft.getInstance().textureManager.bindTexture(GuiLexicon.texture);
GlStateManager.color4f(1F, 1F, 1F, 1F);
drawTexturedModalRect(x, y, k == 2 ? 109 : 98, 180, 11, 11);
List<String> tooltip = new ArrayList<>();
@@ -41,7 +41,7 @@ public class GuiButtonOptions extends GuiButtonLexicon {
tooltip.add((i == 0 ? TextFormatting.GREEN : TextFormatting.GRAY) + I18n.format("botaniamisc.lexiconOptions" + i));
if(k == 2)
RenderHelper.renderTooltip(par2, par3, tooltip);
RenderHelper.renderTooltip(mouseX, mouseY, tooltip);
}
}
@@ -21,7 +21,7 @@ import java.util.Collections;
public class GuiButtonPage extends GuiButtonLexicon {
final boolean right;
private final boolean right;
public GuiButtonPage(int par1, int par2, int par3, boolean right) {
super(par1, par2, par3, 18, 10, "");
@@ -29,17 +29,17 @@ public class GuiButtonPage extends GuiButtonLexicon {
}
@Override
public void drawButton(@Nonnull Minecraft par1Minecraft, int par2, int par3, float partialTicks) {
public void render(int mouseX, int mouseY, float partialTicks) {
if(enabled) {
hovered = par2 >= x && par3 >= y && par2 < x + width && par3 < y + height;
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
int k = getHoverState(hovered);
par1Minecraft.textureManager.bindTexture(GuiLexicon.texture);
GlStateManager.color(1F, 1F, 1F, 1F);
Minecraft.getInstance().textureManager.bindTexture(GuiLexicon.texture);
GlStateManager.color4f(1F, 1F, 1F, 1F);
drawTexturedModalRect(x, y, k == 2 ? 18 : 0, right ? 180 : 190, 18, 10);
if(k == 2)
RenderHelper.renderTooltip(par2, par3, Collections.singletonList(I18n.format(right ? "botaniamisc.nextPage" : "botaniamisc.prevPage")));
RenderHelper.renderTooltip(mouseX, mouseY, Collections.singletonList(I18n.format(right ? "botaniamisc.nextPage" : "botaniamisc.prevPage")));
}
}
@@ -28,12 +28,12 @@ public class GuiButtonScaleChange extends GuiButtonLexicon {
}
@Override
public void drawButton(@Nonnull Minecraft par1Minecraft, int par2, int par3, float partialTicks) {
hovered = par2 >= x && par3 >= y && par2 < x + width && par3 < y + height;
public void render(int mouseX, int mouseY, float partialTicks) {
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
int k = getHoverState(hovered);
par1Minecraft.textureManager.bindTexture(GuiLexicon.texture);
GlStateManager.color(1F, 1F, 1F, 1F);
Minecraft.getInstance().textureManager.bindTexture(GuiLexicon.texture);
GlStateManager.color4f(1F, 1F, 1F, 1F);
drawTexturedModalRect(x, y, k == 2 ? 152 : 141, 191, 11, 11);
List<String> tooltip = new ArrayList<>();
@@ -41,7 +41,7 @@ public class GuiButtonScaleChange extends GuiButtonLexicon {
int tooltipY = (tooltip.size() - 1) * 10;
if(k == 2)
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
RenderHelper.renderTooltip(mouseX, mouseY + tooltipY, tooltip);
}
}
@@ -28,18 +28,18 @@ public class GuiButtonShare extends GuiButtonLexicon {
}
@Override
public void drawButton(@Nonnull Minecraft par1Minecraft, int par2, int par3, float partialTicks) {
hovered = par2 >= x && par3 >= y && par2 < x + width && par3 < y + height;
public void render(int mouseX, int mouseY, float partialTicks) {
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
int k = getHoverState(hovered);
par1Minecraft.textureManager.bindTexture(GuiLexicon.texture);
GlStateManager.color(1F, 1F, 1F, 1F);
Minecraft.getInstance().textureManager.bindTexture(GuiLexicon.texture);
GlStateManager.color4f(1F, 1F, 1F, 1F);
drawTexturedModalRect(x, y, k == 2 ? 10 : 0 , 200, 10, 12);
List<String> tooltip = getTooltip();
int tooltipY = (tooltip.size() - 1) * 10;
if(k == 2)
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
RenderHelper.renderTooltip(mouseX, mouseY + tooltipY, tooltip);
}
public List<String> getTooltip() {
@@ -30,17 +30,17 @@ public class GuiButtonUpdateWarning extends GuiButtonLexicon {
}
@Override
public void drawButton(@Nonnull Minecraft par1Minecraft, int par2, int par3, float partialTicks) {
public void render(int mouseX, int mouseY, float partialTicks) {
if(!visible || !enabled)
return;
hovered = par2 >= x && par3 >= y && par2 < x + width && par3 < y + height;
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
int k = getHoverState(hovered);
boolean red = k == 2 || ClientTickHandler.ticksInGame % 10 < 5;
par1Minecraft.textureManager.bindTexture(GuiLexicon.texture);
GlStateManager.color(1F, 1F, 1F, 1F);
Minecraft.getInstance().textureManager.bindTexture(GuiLexicon.texture);
GlStateManager.color4f(1F, 1F, 1F, 1F);
drawTexturedModalRect(x, y, red ? 153 : 142, 180, 11, 11);
List<String> tooltip = new ArrayList<>();
@@ -53,7 +53,7 @@ public class GuiButtonUpdateWarning extends GuiButtonLexicon {
int tooltipY = (tooltip.size() - 1) * 10 - 25;
if(k == 2)
RenderHelper.renderTooltip(par2 - 125, par3 + tooltipY, tooltip);
RenderHelper.renderTooltip(mouseX - 125, mouseY + tooltipY, tooltip);
}
}
@@ -28,18 +28,18 @@ public class GuiButtonViewOnline extends GuiButtonLexicon {
}
@Override
public void drawButton(@Nonnull Minecraft par1Minecraft, int par2, int par3, float partialTicks) {
hovered = par2 >= x && par3 >= y && par2 < x + width && par3 < y + height;
public void render(int mouseX, int mouseY, float partialTicks) {
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
int k = getHoverState(hovered);
par1Minecraft.textureManager.bindTexture(GuiLexicon.texture);
GlStateManager.color(1F, 1F, 1F, 1F);
Minecraft.getInstance().textureManager.bindTexture(GuiLexicon.texture);
GlStateManager.color4f(1F, 1F, 1F, 1F);
drawTexturedModalRect(x, y, k == 2 ? 41 : 30, 200, 11, 11);
List<String> tooltip = Collections.singletonList(TextFormatting.AQUA + I18n.format("botaniamisc.viewOnline"));
int tooltipY = (tooltip.size() - 1) * 10;
if(k == 2)
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
RenderHelper.renderTooltip(mouseX, mouseY + tooltipY, tooltip);
}
}
@@ -12,17 +12,14 @@ package vazkii.botania.common.block;
import net.minecraft.block.BlockFlower;
import net.minecraft.block.SoundType;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.block.statemap.StateMap;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.fluid.IFluidState;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
@@ -32,12 +29,13 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.ChunkCache;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.api.distmarker.Dist;
@@ -65,7 +63,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, IWandable, ILexiconable, IWandHUD, IModelRegister {
public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, IWandable, ILexiconable, IWandHUD {
static {
BotaniaAPI.subtilesForCreativeMenu.addAll(Arrays.asList(
@@ -117,28 +115,17 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
LibBlockNames.SUBTILE_BERGAMUTE));
}
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.3, 0, 0.3, 0.8, 1, 0.8);
private static final VoxelShape SHAPE = makeCuboidShape(4.8, 0, 4.8, 12.8, 16, 12.8);
protected BlockSpecialFlower() {
setDefaultState(blockState.getBaseState().with(BotaniaStateProps.COLOR, EnumDyeColor.WHITE).with(type, EnumFlowerType.POPPY));
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.SPECIAL_FLOWER));
setTranslationKey(LibBlockNames.SPECIAL_FLOWER);
setHardness(0.1F);
setSoundType(SoundType.PLANT);
setTickRandomly(false);
setCreativeTab(BotaniaCreativeTab.INSTANCE);
protected BlockSpecialFlower(Properties props) {
super(props);
}
@Nonnull
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, @Nonnull IBlockReader world, @Nonnull BlockPos pos) {
return AABB.offset(state.getOffset(world, pos));
}
@Nonnull
@Override
public BlockStateContainer createBlockState() {
return new ExtendedBlockState(this, new IProperty[] { getTypeProperty(), BotaniaStateProps.COLOR }, new IUnlistedProperty[] { BotaniaStateProps.SUBTILE_ID } );
public VoxelShape getShape(IBlockState state, @Nonnull IBlockReader world, @Nonnull BlockPos pos) {
Vec3d shift = state.getOffset(world, pos);
return SHAPE.withOffset(shift.x, shift.y, shift.z);
}
@Nonnull
@@ -155,21 +142,7 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
}
@Override
public int getMetaFromState(IBlockState state) {
return state.get(BotaniaStateProps.COLOR).getMetadata();
}
@Nonnull
@Override
public IBlockState getStateFromMeta(int meta) {
if (meta > 15) {
meta = 0;
}
return getDefaultState().with(BotaniaStateProps.COLOR, EnumDyeColor.byMetadata(meta));
}
@Override
public int getLightValue(@Nonnull IBlockState state, IBlockReader world, @Nonnull BlockPos pos) {
public int getLightValue(@Nonnull IBlockState state, IWorldReader world, @Nonnull BlockPos pos) {
if(world.getBlockState(pos).getBlock() != this)
return world.getBlockState(pos).getLightValue(world, pos);
@@ -202,7 +175,7 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
}
@Override
public void getSubBlocks(CreativeTabs tab, @Nonnull NonNullList<ItemStack> stacks) {
public void fillItemGroup(ItemGroup tab, @Nonnull NonNullList<ItemStack> stacks) {
for(ResourceLocation s : BotaniaAPI.subtilesForCreativeMenu) {
stacks.add(ItemBlockSpecialFlower.ofType(s));
if(BotaniaAPI.miniFlowers.containsKey(s))
@@ -212,29 +185,16 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
@Nonnull
@Override
public EnumFlowerColor getBlockType() {
return EnumFlowerColor.RED;
}
@Nonnull
@Override
public ItemStack getPickBlock(@Nonnull IBlockState state, RayTraceResult target, @Nonnull World world, @Nonnull BlockPos pos, EntityPlayer player) {
public ItemStack getPickBlock(@Nonnull IBlockState state, RayTraceResult target, @Nonnull IBlockReader world, @Nonnull BlockPos pos, EntityPlayer player) {
ResourceLocation name = ((TileSpecialFlower) world.getTileEntity(pos)).subTileName;
return ItemBlockSpecialFlower.ofType(name);
}
@Override
public boolean canPlaceBlockAt(World world, BlockPos pos) {
return world.getBlockState(pos.down()).getBlock() == ModBlocks.redStringRelay
|| world.getBlockState(pos.down()).getBlock() == Blocks.MYCELIUM
|| super.canPlaceBlockAt(world, pos);
}
@Override
protected boolean canSustainBush(IBlockState state) {
protected boolean isValidGround(IBlockState state, IBlockReader worldIn, BlockPos pos) {
return state.getBlock() == ModBlocks.redStringRelay
|| state.getBlock() == Blocks.MYCELIUM
|| super.canSustainBush(state);
|| super.isValidGround(state, worldIn, pos);
}
@Override
@@ -243,14 +203,14 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
}
@Override
public boolean removedByPlayer(@Nonnull IBlockState state, World world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player, boolean willHarvest) {
public boolean removedByPlayer(@Nonnull IBlockState state, World world, @Nonnull BlockPos pos, @Nonnull EntityPlayer player, boolean willHarvest, IFluidState fluidState) {
if (willHarvest) {
// Copy of super.removedByPlayer but don't set to air yet
// This is so getDrops below will have a TE to work with
onBlockHarvested(world, pos, state, player);
return true;
} else {
return super.removedByPlayer(state, world, pos, player, willHarvest);
return super.removedByPlayer(state, world, pos, player, willHarvest, fluidState);
}
}
@@ -258,11 +218,11 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
public void harvestBlock(@Nonnull World world, EntityPlayer player, @Nonnull BlockPos pos, @Nonnull IBlockState state, TileEntity te, ItemStack stack) {
super.harvestBlock(world, player, pos, state, te, stack);
// Now delete the block and TE
world.setBlockToAir(pos);
world.removeBlock(pos);
}
@Override
public void getDrops(NonNullList<ItemStack> list, IBlockReader world, BlockPos pos, @Nonnull IBlockState state, int fortune) {
public void getDrops(@Nonnull IBlockState state, NonNullList<ItemStack> list, World world, BlockPos pos, int fortune) {
TileEntity tile = world.getTileEntity(pos);
if(tile != null) {
@@ -286,7 +246,7 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
@Nonnull
@Override
public TileEntity createTileEntity(@Nonnull World world, @Nonnull IBlockState state) {
public TileEntity createTileEntity(@Nonnull IBlockState state, @Nonnull IBlockReader world) {
return new TileSpecialFlower();
}
@@ -306,12 +266,12 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
}
@Override
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
public void onBlockAdded(IBlockState state, World world, BlockPos pos, IBlockState oldState) {
((TileSpecialFlower) world.getTileEntity(pos)).onBlockAdded(world, pos, state);
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
public boolean onBlockActivated(IBlockState state, World world, BlockPos pos, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
ItemStack stack = player.getHeldItem(hand);
if(!stack.isEmpty() && stack.getItem() instanceof ItemDye) {
EnumDyeColor newColor = ((ItemDye) stack.getItem()).color;
@@ -326,15 +286,7 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
@OnlyIn(Dist.CLIENT)
@Override
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos) {
((TileSpecialFlower) world.getTileEntity(pos)).renderHUD(mc, res);
}
@OnlyIn(Dist.CLIENT)
@Override
public void registerModels() {
// Let custom loader work
ModelLoader.setCustomStateMapper(this, new StateMap.Builder().ignore(BotaniaStateProps.COLOR).ignore(getTypeProperty()).build());
ModelHandler.registerBlockToState(this, 0, getDefaultState());
public void renderHUD(Minecraft mc, World world, BlockPos pos) {
((TileSpecialFlower) world.getTileEntity(pos)).renderHUD(mc);
}
}
@@ -166,7 +166,7 @@ public final class ModBlocks {
@ObjectHolder(LibBlockNames.LIVING_WOOD_PATTERN_FRAMED) public static Block livingwoodPatternFramed;
@ObjectHolder(LibBlockNames.LIVING_WOOD_GLIMMERING) public static Block livingwoodGlimmering;
public static final Block specialFlower = new BlockSpecialFlower();
@ObjectHolder(LibBlockNames.SPECIAL_FLOWER) public static Block specialFlower;
@ObjectHolder(LibBlockNames.SPREADER) public static Block manaSpreader;
@ObjectHolder(LibBlockNames.SPREADER_REDSTONE) public static Block redstoneSpreader;
@ObjectHolder(LibBlockNames.SPREADER_ELVEN) public static Block elvenSpreader;
@@ -401,8 +401,7 @@ public final class ModBlocks {
register(r, new BlockModLexiconable(builder, decorative), LibBlockNames.LIVING_WOOD_FRAMED);
register(r, new BlockModLexiconable(builder, decorative), LibBlockNames.LIVING_WOOD_PATTERN_FRAMED);
register(r, new BlockModLexiconable(builder.lightValue(12), decorative), LibBlockNames.LIVING_WOOD_GLIMMERING);
r.register(specialFlower);
register(r, new BlockSpecialFlower(Block.Properties.from(Blocks.POPPY)), LibBlockNames.SPECIAL_FLOWER);
builder = Block.Properties.create(Material.WOOD).hardnessAndResistance(2).sound(SoundType.WOOD);
register(r, new BlockSpreader(BlockSpreader.Variant.MANA, builder), LibBlockNames.SPREADER);
@@ -13,7 +13,6 @@ package vazkii.botania.common.block.tile;
import com.google.common.base.Predicates;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentData;
import net.minecraft.enchantment.EnchantmentHelper;
@@ -117,10 +116,10 @@ public class TileEnchanter extends TileMod implements ISparkAttachable, ITickabl
mb.addComponent(o.up(), Blocks.OBSIDIAN.getDefaultState());
for(BlockPos p : PYLON_LOCATIONS.get(EnumFacing.Axis.X)) {
mb.addComponent(p.up(), ModBlocks.manaPylon.getDefaultState());
mb.addComponent(new FlowerComponent(p, ModBlocks.flower));
mb.addComponent(new FlowerComponent(p, ModBlocks.whiteFlower));
}
for(BlockPos f : FLOWER_LOCATIONS)
mb.addComponent(new FlowerComponent(f.up(), ModBlocks.flower));
mb.addComponent(new FlowerComponent(f.up(), ModBlocks.whiteFlower));
mb.addComponent(BlockPos.ORIGIN.up(), Blocks.LAPIS_BLOCK.getDefaultState());
@@ -16,7 +16,6 @@ import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemStack;
@@ -27,7 +26,7 @@ import net.minecraftforge.client.event.RenderTooltipEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.lwjgl.input.Mouse;
import org.lwjgl.glfw.GLFW;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.internal.IGuiLexiconEntry;
import vazkii.botania.api.lexicon.ILexicon;
@@ -77,10 +76,11 @@ public class PageRecipe extends LexiconPage {
List<String> parsedTooltip = new ArrayList<>();
boolean first = true;
for(String s : tooltipData) {
String s_ = s;
if(!first)
s_ = TextFormatting.GRAY + s;
for(ITextComponent s : tooltipData) {
String s_ = s.getFormattedText();
if(!first) {
s_ = s.applyTextStyle(TextFormatting.GRAY).getFormattedText();
}
parsedTooltip.add(s_);
first = false;
}
@@ -105,13 +105,13 @@ public class PageRecipe extends LexiconPage {
}
if(!tooltipContainerStack.isEmpty())
vazkii.botania.client.core.helper.RenderHelper.renderTooltipGreen(mx, my + tooltipY, Arrays.asList(TextFormatting.AQUA + I18n.format("botaniamisc.craftingContainer"), tooltipContainerStack.getDisplayName()));
vazkii.botania.client.core.helper.RenderHelper.renderTooltipGreen(mx, my + tooltipY, Arrays.asList(TextFormatting.AQUA + I18n.format("botaniamisc.craftingContainer"), tooltipContainerStack.getDisplayName().getFormattedText()));
}
tooltipStack = tooltipContainerStack = ItemStack.EMPTY;
tooltipEntry = false;
GlStateManager.disableBlend();
mouseDownLastTick = Mouse.isButtonDown(0);
mouseDownLastTick = GLFW.glfwGetMouseButton(Minecraft.getInstance().mainWindow.getHandle(), GLFW.GLFW_MOUSE_BUTTON_LEFT) == GLFW.GLFW_PRESS;
}
@OnlyIn(Dist.CLIENT)
@@ -144,7 +144,7 @@ public class PageRecipe extends LexiconPage {
@OnlyIn(Dist.CLIENT)
public void renderItem(IGuiLexiconEntry gui, double xPos, double yPos, ItemStack stack, boolean accountForContainer) {
ItemRenderer render = Minecraft.getInstance().getItemRenderer();
boolean mouseDown = Mouse.isButtonDown(0);
boolean mouseDown = GLFW.glfwGetMouseButton(Minecraft.getInstance().mainWindow.getHandle(), GLFW.GLFW_MOUSE_BUTTON_LEFT) == GLFW.GLFW_PRESS;
GlStateManager.pushMatrix();
GlStateManager.enableBlend();