diff options
| author | NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> | 2024-07-14 02:37:01 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-13 18:37:01 +0200 |
| commit | 1192fd943f761ad983fc55da51161c4e294076f7 (patch) | |
| tree | d4b6117406e3bf3dabe475ae615501f44ae3e379 | |
| parent | 8c25d6608e5badde10cdf3e70d166c636ad65082 (diff) | |
| download | notenoughupdates-1192fd943f761ad983fc55da51161c4e294076f7.tar.gz notenoughupdates-1192fd943f761ad983fc55da51161c4e294076f7.tar.bz2 notenoughupdates-1192fd943f761ad983fc55da51161c4e294076f7.zip | |
Add option for pet item icon instead of words (#1233)
2 files changed, 117 insertions, 40 deletions
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 9d346638..5e86f2ac 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java @@ -460,7 +460,9 @@ public class PetInfoOverlay extends TextOverlay { if (currentPet.petItem != null) { JsonObject json = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(currentPet.petItem); if (json != null) { - String name = NotEnoughUpdates.INSTANCE.manager.jsonToStack(json).getDisplayName(); + String name; + if (!NotEnoughUpdates.INSTANCE.config.petOverlay.petItemIcon) name = NotEnoughUpdates.INSTANCE.manager.jsonToStack(json).getDisplayName(); + else name = ""; petItemStr = EnumChatFormatting.AQUA + "Held Item: " + name; } } @@ -603,52 +605,28 @@ public class PetInfoOverlay extends TextOverlay { return; } - if (!NotEnoughUpdates.INSTANCE.config.petOverlay.petOverlayIcon) return; - int mythicRarity = currentPet.rarity.petId; - JsonObject petItem = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get( - currentPet.skin != null ? currentPet.skin : (currentPet.petType + ";" + mythicRarity)); - - if (petItem == null && currentPet.rarity.petId == 5) { - petItem = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get( - currentPet.skin != null ? currentPet.skin : (currentPet.petType + ";" + 4)); - } - - if (petItem != null) { - Vector2f position = getPosition(overlayWidth, overlayHeight, true); - int x = (int) position.x; - int y = (int) position.y; - - ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(petItem); - GlStateManager.enableDepth(); - GlStateManager.pushMatrix(); - Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.locationedit.guiScale); + if (NotEnoughUpdates.INSTANCE.config.petOverlay.petOverlayIcon) { + int mythicRarity = currentPet.rarity.petId; + JsonObject petItem = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get( + currentPet.skin != null ? currentPet.skin : (currentPet.petType + ";" + mythicRarity)); - 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); - Utils.pushGuiScale(0); - GlStateManager.popMatrix(); - } + if (petItem == null && currentPet.rarity.petId == 5) { + petItem = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get( + currentPet.skin != null ? currentPet.skin : (currentPet.petType + ";" + 4)); + } - Pet currentPet2 = getCurrentPet2(); - if (currentPet2 != null) { - JsonObject petItem2 = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get( - currentPet2.skin != null ? currentPet2.skin : (currentPet2.petType + ";" + currentPet2.rarity.petId)); - if (petItem2 != null) { + if (petItem != null) { Vector2f position = getPosition(overlayWidth, overlayHeight, true); int x = (int) position.x; - int y = (int) position.y + (overlayStrings.size() - secondPetLines) * 10; + int y = (int) position.y; - ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(petItem2); + ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(petItem); GlStateManager.enableDepth(); GlStateManager.pushMatrix(); Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.locationedit.guiScale); - if (secondPetLines == 1) y -= 9; - if (secondPetLines == 2) y -= 3; + if (firstPetLines == 1) y -= 9; + if (firstPetLines == 2) y -= 3; GlStateManager.translate(x - 2, y - 2, 0); GlStateManager.scale(2, 2, 1); @@ -656,6 +634,97 @@ public class PetInfoOverlay extends TextOverlay { Utils.pushGuiScale(0); GlStateManager.popMatrix(); } + + Pet currentPet2 = getCurrentPet2(); + if (currentPet2 != null) { + JsonObject petItem2 = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get( + currentPet2.skin != null ? currentPet2.skin : (currentPet2.petType + ";" + currentPet2.rarity.petId)); + if (petItem2 != null) { + Vector2f position = getPosition(overlayWidth, overlayHeight, true); + int x = (int) position.x; + 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); + Utils.pushGuiScale(0); + GlStateManager.popMatrix(); + } + } + } + + if (NotEnoughUpdates.INSTANCE.config.petOverlay.petItemIcon) { + int backgroundOffset = (NotEnoughUpdates.INSTANCE.config.petOverlay.petInfoOverlayStyle == 0) ? 0 : 5; + if (currentPet.petItem != null) { + JsonObject petHeldItem = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(currentPet.petItem); + + if (petHeldItem != null) { + Vector2f position = getPosition(overlayWidth, overlayHeight, true); + int x = (int) position.x; + int y = (int) position.y; + + ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(petHeldItem); + GlStateManager.enableDepth(); + GlStateManager.pushMatrix(); + Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.locationedit.guiScale); + + int counter = 0; + for (String line : overlayStrings) { + if (line.contains("Held Item:")) { + break; + } + counter++; + } + if (counter >= overlayStrings.size()) { + return; + } + + GlStateManager.translate(x + 77, y + (10 * counter) + 2 - backgroundOffset, 0); + Utils.drawItemStack(stack, 0, 0); + Utils.pushGuiScale(0); + GlStateManager.popMatrix(); + } + } + + Pet currentPet2 = getCurrentPet2(); + if (currentPet2 != null && currentPet2.petItem != null) { + JsonObject petHeldItem = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(currentPet2.petItem); + + if (petHeldItem != null) { + Vector2f position = getPosition(overlayWidth, overlayHeight, true); + int x = (int) position.x; + int y = (int) position.y + (overlayStrings.size() - secondPetLines) * 10; + + ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(petHeldItem); + GlStateManager.enableDepth(); + GlStateManager.pushMatrix(); + Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.locationedit.guiScale); + + int counter = 0; + for (String line : overlayStrings) { + if (line.contains("Held Item:")) { + break; + } + counter++; + } + if (counter >= overlayStrings.size()) { + return; + } + + GlStateManager.translate(x + 77, y + (10 * counter) + 2 - backgroundOffset, 0); + Utils.drawItemStack(stack, 0, 0); + Utils.pushGuiScale(0); + GlStateManager.popMatrix(); + } + } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/PetOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/PetOverlay.java index 8a0f7884..e015c05d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/PetOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/PetOverlay.java @@ -20,11 +20,11 @@ package io.github.moulberry.notenoughupdates.options.separatesections; import com.google.gson.annotations.Expose; -import io.github.moulberry.notenoughupdates.core.config.Position; import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; import io.github.moulberry.moulconfig.annotations.ConfigEditorDraggableList; import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown; import io.github.moulberry.moulconfig.annotations.ConfigOption; +import io.github.moulberry.notenoughupdates.core.config.Position; import java.util.ArrayList; import java.util.Arrays; @@ -65,13 +65,21 @@ public class PetOverlay { @Expose @ConfigOption( name = "Pet Overlay Icon", - desc = "Show the icon of the pet you have equiped in the overlay" + desc = "Show the icon of the pet you have equipped in the overlay" ) @ConfigEditorBoolean public boolean petOverlayIcon = true; @Expose @ConfigOption( + name = "Pet Item Icon", + desc = "Show the icon of the pet item you have equipped in the overlay" + ) + @ConfigEditorBoolean + public boolean petItemIcon = false; + + @Expose + @ConfigOption( name = "Pet Info Overlay Style", desc = "Change the style of the Pet Info overlay" ) |
