aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2023-02-15 19:22:52 +0100
committerGitHub <noreply@github.com>2023-02-15 19:22:52 +0100
commit7c0a3b571109969621641d1790ee2efd72e7edf6 (patch)
treefd5e2a4164ffbb2be5c26e61681cea371fab7965 /src/main/java
parentd3ca199f904cd72e419c6320eda261f023c71937 (diff)
downloadNotEnoughUpdates-7c0a3b571109969621641d1790ee2efd72e7edf6.tar.gz
NotEnoughUpdates-7c0a3b571109969621641d1790ee2efd72e7edf6.tar.bz2
NotEnoughUpdates-7c0a3b571109969621641d1790ee2efd72e7edf6.zip
Pet overlay progress hider, pet icon moved, and neudevtest value (#576)
* Pet overlay progress hider, pet item moved and /neudevtest value <value> * Bingo has already enough to do. * Typo. * Revert "Typo." This reverts commit b4a1c385e0c410b1e111797b8d39e7ff64b09ef5. * Revert "Bingo has already enough to do." This reverts commit 6e004d2d65dff47ea3bee5c5789cb725724df6ed. * Dynamically used best position for the pet icons (yes, both) and the distance between the two pet tests. * I hate debugs. --------- Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.java9
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java61
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/PetOverlay.java9
3 files changed, 63 insertions, 16 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.java
index 8dda864a..1a1400ab 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.java
@@ -96,6 +96,8 @@ public class DevTestCommand extends ClientCommandBase {
};
private int devFailIndex = 0;
+ public static int testValue = 0;
+
public DevTestCommand() {
super("neudevtest");
}
@@ -279,5 +281,12 @@ public class DevTestCommand extends ClientCommandBase {
Utils.addChatMessage("§e[NEU] Changed user agent override to: " + newUserAgent);
NotEnoughUpdates.INSTANCE.config.hidden.customUserAgent = newUserAgent;
}
+ if (args.length == 2 && args[0].equalsIgnoreCase("value")) {
+ try {
+ testValue = Integer.parseInt(args[1]);
+ } catch (NumberFormatException e) {
+ Utils.addChatMessage("NumberFormatException!");
+ }
+ }
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java
index 716fb37d..ceae782b 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java
@@ -473,29 +473,44 @@ public class PetInfoOverlay extends TextOverlay {
}
}
JsonObject pets = Constants.PETS;
- if (pets != null && pets.has("custom_pet_leveling") && pets.get("custom_pet_leveling").getAsJsonObject().has(pet.petType.toUpperCase()) &&
- pets.get("custom_pet_leveling").getAsJsonObject().get(pet.petType.toUpperCase()).getAsJsonObject().has("xp_multiplier")) {
- xp *= pets.get("custom_pet_leveling").getAsJsonObject().get(pet.petType.toUpperCase()).getAsJsonObject().get("xp_multiplier").getAsFloat();
+ if (pets != null && pets.has("custom_pet_leveling") &&
+ pets.get("custom_pet_leveling").getAsJsonObject().has(pet.petType.toUpperCase()) &&
+ pets.get("custom_pet_leveling").getAsJsonObject().get(pet.petType.toUpperCase()).getAsJsonObject().has(
+ "xp_multiplier")) {
+ xp *= pets.get("custom_pet_leveling").getAsJsonObject().get(pet.petType.toUpperCase()).getAsJsonObject().get(
+ "xp_multiplier").getAsFloat();
}
return xp;
}
+ private int firstPetLines = 0;
+ private int secondPetLines = 0;
+
@Override
public void updateFrequent() {
Pet currentPet = getCurrentPet();
if (!NotEnoughUpdates.INSTANCE.config.petOverlay.enablePetInfo || currentPet == null) {
overlayStrings = null;
} else {
+ firstPetLines = 0;
+ secondPetLines = 0;
overlayStrings = new ArrayList<>();
overlayStrings.addAll(createStringsForPet(currentPet, false));
+ firstPetLines = overlayStrings.size();
Pet currentPet2 = getCurrentPet2();
if (currentPet2 != null) {
overlayStrings.add("");
+ if (firstPetLines == 1) {
+ overlayStrings.add("");
+ }
overlayStrings.addAll(createStringsForPet(currentPet2, true));
+ secondPetLines = overlayStrings.size() - firstPetLines - 1;
+ if (firstPetLines == 1) {
+ secondPetLines--;
+ }
}
-
}
}
@@ -519,14 +534,20 @@ public class PetInfoOverlay extends TextOverlay {
currentPet.rarity.chatFormatting +
WordUtils.capitalizeFully(currentPet.petType.replace("_", " "));
- String lvlStringShort = EnumChatFormatting.AQUA + "" + roundFloat(levelXp) + "/" +
- roundFloat(currentPet.petLevel.getExpRequiredForNextLevel())
- + EnumChatFormatting.YELLOW + " (" + getLevelPercent(currentPet) + "%)";
+ float levelPercent = getLevelPercent(currentPet);
+ String lvlStringShort = null;
+ String lvlString = null;
+
+ if (levelPercent != 100 || !NotEnoughUpdates.INSTANCE.config.petOverlay.hidePetLevelProgress) {
+ lvlStringShort = EnumChatFormatting.AQUA + "" + roundFloat(levelXp) + "/" +
+ roundFloat(currentPet.petLevel.getExpRequiredForNextLevel())
+ + EnumChatFormatting.YELLOW + " (" + levelPercent + "%)";
- String lvlString = EnumChatFormatting.AQUA + "" +
- Utils.shortNumberFormat(Math.min(levelXp, currentPet.petLevel.getExpRequiredForNextLevel()), 0) + "/" +
- Utils.shortNumberFormat(currentPet.petLevel.getExpRequiredForNextLevel(), 0)
- + EnumChatFormatting.YELLOW + " (" + getLevelPercent(currentPet) + "%)";
+ lvlString = EnumChatFormatting.AQUA + "" +
+ Utils.shortNumberFormat(Math.min(levelXp, currentPet.petLevel.getExpRequiredForNextLevel()), 0) + "/" +
+ Utils.shortNumberFormat(currentPet.petLevel.getExpRequiredForNextLevel(), 0)
+ + EnumChatFormatting.YELLOW + " (" + levelPercent + "%)";
+ }
float xpGain;
if (!secondPet) {
@@ -593,6 +614,8 @@ public class PetInfoOverlay extends TextOverlay {
String finalEtaMaxStr = etaMaxStr;
String finalXpGainString = xpGainString;
String finalPetItemStr = petItemStr;
+ String finalLvlString = lvlString;
+ String finalLvlStringShort = lvlStringShort;
return new ArrayList<String>() {{
for (int index : NotEnoughUpdates.INSTANCE.config.petOverlay.petOverlayText) {
switch (index) {
@@ -600,10 +623,10 @@ public class PetInfoOverlay extends TextOverlay {
add(petName);
break;
case 1:
- add(lvlStringShort);
+ if (finalLvlStringShort != null) add(finalLvlStringShort);
break;
case 2:
- add(lvlString);
+ if (finalLvlString != null) add(finalLvlString);
break;
case 3:
add(finalXpGainString);
@@ -716,6 +739,10 @@ public class PetInfoOverlay extends TextOverlay {
GlStateManager.enableDepth();
GlStateManager.pushMatrix();
Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.locationedit.guiScale);
+
+ if (firstPetLines == 1) y -= 9;
+ if (firstPetLines == 2) y -= 3;
+
GlStateManager.translate(x - 2, y - 2, 0);
GlStateManager.scale(2, 2, 1);
Utils.drawItemStack(stack, 0, 0);
@@ -730,12 +757,16 @@ public class PetInfoOverlay extends TextOverlay {
if (petItem2 != null) {
Vector2f position = getPosition(overlayWidth, overlayHeight, true);
int x = (int) position.x;
- int y = (int) position.y + NotEnoughUpdates.INSTANCE.config.petOverlay.petOverlayText.size() * 10;
+ int y = (int) position.y + (overlayStrings.size() - secondPetLines) * 10;
ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(petItem2);
GlStateManager.enableDepth();
GlStateManager.pushMatrix();
Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.locationedit.guiScale);
+
+ if (secondPetLines == 1) y -= 9;
+ if (secondPetLines == 2) y -= 3;
+
GlStateManager.translate(x - 2, y - 2, 0);
GlStateManager.scale(2, 2, 1);
Utils.drawItemStack(stack, 0, 0);
@@ -1114,7 +1145,7 @@ public class PetInfoOverlay extends TextOverlay {
PetInfoOverlay.config.selectedPet = -1;
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(
EnumChatFormatting.RED + "[NEU] Can't find pet \u00a7" + petStringMatch +
- EnumChatFormatting.RED + " try revisiting all pages of /pets."));
+ EnumChatFormatting.RED + " try revisiting all pages of /pets."));
}
}
} else if ((chatMessage.toLowerCase().startsWith("you despawned your")) || (chatMessage.toLowerCase().contains(
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/PetOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/PetOverlay.java
index fce1f9af..9d88e8f1 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/PetOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/PetOverlay.java
@@ -22,7 +22,6 @@ package io.github.moulberry.notenoughupdates.options.seperateSections;
import com.google.gson.annotations.Expose;
import io.github.moulberry.notenoughupdates.core.config.Position;
import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorBoolean;
-import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorButton;
import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorDraggableList;
import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorDropdown;
import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption;
@@ -131,4 +130,12 @@ public class PetOverlay {
)
@ConfigEditorBoolean
public boolean showKatSitting = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Hide Pet Level Progress",
+ desc = "Hide the pet level progress information for maxed out pets."
+ )
+ @ConfigEditorBoolean
+ public boolean hidePetLevelProgress = false;
}