diff options
| author | Moulberry <james.jenour@student.scotch.wa.edu.au> | 2020-08-29 02:32:19 +1000 |
|---|---|---|
| committer | Moulberry <james.jenour@student.scotch.wa.edu.au> | 2020-08-29 02:32:19 +1000 |
| commit | a5f669c4ec0692efd0e532d23156ea260718c0ee (patch) | |
| tree | a1383731d8f645f90afaf3a413767c0944305909 /src/main/java/io/github/moulberry/notenoughupdates/infopanes/CollectionLogInfoPane.java | |
| parent | 3cb08dc571907bdf216ee628c1f8608067a03441 (diff) | |
| download | notenoughupdates-a5f669c4ec0692efd0e532d23156ea260718c0ee.tar.gz notenoughupdates-a5f669c4ec0692efd0e532d23156ea260718c0ee.tar.bz2 notenoughupdates-a5f669c4ec0692efd0e532d23156ea260718c0ee.zip | |
1.2.3
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/infopanes/CollectionLogInfoPane.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/infopanes/CollectionLogInfoPane.java | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/CollectionLogInfoPane.java b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/CollectionLogInfoPane.java index 2912c6bd..0302d74a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/infopanes/CollectionLogInfoPane.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/infopanes/CollectionLogInfoPane.java @@ -303,7 +303,7 @@ public class CollectionLogInfoPane extends ScrollableInfoPane { itemFramebufferGrayscale.bindFramebufferTexture(); - AtomicReference<JsonObject> tooltipToDisplay = new AtomicReference<>(null); + AtomicReference<ItemStack> tooltipToDisplay = new AtomicReference<>(null); AtomicBoolean isTop = new AtomicBoolean(false); AtomicInteger lowestY = new AtomicInteger(-1); @@ -326,7 +326,7 @@ public class CollectionLogInfoPane extends ScrollableInfoPane { if(mouseX > leftI && mouseX < rightI) { if(mouseY > topI && mouseY < bottomI) { - tooltipToDisplay.set(manager.getItemInformation().get(internalname)); + tooltipToDisplay.set(manager.jsonToStack(manager.getItemInformation().get(internalname), true)); } } @@ -360,16 +360,9 @@ public class CollectionLogInfoPane extends ScrollableInfoPane { itemFramebufferGrayscale.unbindFramebufferTexture(); - JsonObject json = tooltipToDisplay.get(); - if(json != null) { - List<String> text = new ArrayList<>(); - text.add(json.get("displayname").getAsString()); - JsonArray lore = json.get("lore").getAsJsonArray(); - - for(int i=0; i<lore.size(); i++) { - text.add(lore.get(i).getAsString()); - } - + ItemStack displayStack = tooltipToDisplay.get(); + if(displayStack != null) { + List<String> text = displayStack.getTooltip(Minecraft.getMinecraft().thePlayer, true); Utils.drawHoveringText(text, mouseX, mouseY, width, height, -1, Minecraft.getMinecraft().fontRendererObj); } } |
