aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/miscgui/KatSitterOverlay.java
diff options
context:
space:
mode:
authorMoulberry <jjenour@student.unimelb.edu.au>2022-10-15 16:14:46 +0200
committerGitHub <noreply@github.com>2022-10-15 16:14:46 +0200
commit9dff9de9be425a07691951f7f7e6d43ca2c967bf (patch)
tree525c4086b4b8cb9ee2a329dee7a0915ceaaa788a /src/main/java/io/github/moulberry/notenoughupdates/miscgui/KatSitterOverlay.java
parent7c6d37b2eb758a13b342b906f0aef88b940bc52a (diff)
parentdf02addf3404f07f245d6e6da8ce3ee8d72bd235 (diff)
downloadnotenoughupdates-9dff9de9be425a07691951f7f7e6d43ca2c967bf.tar.gz
notenoughupdates-9dff9de9be425a07691951f7f7e6d43ca2c967bf.tar.bz2
notenoughupdates-9dff9de9be425a07691951f7f7e6d43ca2c967bf.zip
Merge pull request #268 from NotEnoughUpdates/master
2.1 Continued
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscgui/KatSitterOverlay.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/KatSitterOverlay.java43
1 files changed, 37 insertions, 6 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/KatSitterOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/KatSitterOverlay.java
index 107d4db2..62aba35b 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/KatSitterOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/KatSitterOverlay.java
@@ -1,9 +1,29 @@
+/*
+ * Copyright (C) 2022 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
package io.github.moulberry.notenoughupdates.miscgui;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.mixins.AccessorGuiContainer;
+import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer;
import io.github.moulberry.notenoughupdates.util.Utils;
-import io.github.moulberry.notenoughupdates.util.XPInformation;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.inventory.GuiChest;
@@ -49,8 +69,8 @@ public class KatSitterOverlay {
boolean nextRarityPresent = katSlot.getStack() != null && katSlot.getStack().getItem() != Item.getItemFromBlock(
Blocks.barrier) && upgradedRarity != null;
renderPetInformation(
- (int) XPInformation.getInstance().getPetLevel(petId, xp, rarity),
- nextRarityPresent ? (int) XPInformation.getInstance().getPetLevel(petId, xp, upgradedRarity) : null,
+ (int) GuiProfileViewer.getPetLevel(petId, rarity, (float) xp).level,
+ nextRarityPresent ? (int) GuiProfileViewer.getPetLevel(petId, upgradedRarity, (float) xp).level : null,
gui
);
}
@@ -61,12 +81,23 @@ public class KatSitterOverlay {
int currentWidth = font.getStringWidth(currentText);
String upgradedText = "Upgraded pet level: " + upgradedLevel;
int upgradedWidth = font.getStringWidth(upgradedText);
- int left = gui.guiLeft - 30 - (upgradedLevel == null ? Math.max(upgradedWidth, currentWidth) : currentWidth);
+ int left = ((AccessorGuiContainer) gui).getGuiLeft() - 30 - (upgradedLevel == null ? Math.max(
+ upgradedWidth,
+ currentWidth
+ ) : currentWidth);
GlStateManager.disableLighting();
GlStateManager.color(1F, 1F, 1F, 1F);
- Utils.drawStringScaled(currentText, font, left, gui.guiTop + 25, false, 0xFFD700, 1F);
+ Utils.drawStringScaled(currentText, font, left, ((AccessorGuiContainer) gui).getGuiTop() + 25, false, 0xFFD700, 1F);
if (upgradedLevel != null)
- Utils.drawStringScaled(upgradedText, font, left, gui.guiTop + 45, false, 0xFFD700, 1F);
+ Utils.drawStringScaled(
+ upgradedText,
+ font,
+ left,
+ ((AccessorGuiContainer) gui).getGuiTop() + 45,
+ false,
+ 0xFFD700,
+ 1F
+ );
}
public String nextRarity(String currentRarity) {