diff options
| author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2023-02-22 18:30:38 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-22 18:30:38 +0100 |
| commit | 30bd46e46aab73e2927fa5631c49ace84708e590 (patch) | |
| tree | 2ad5f73d914dc12541cb45470b26f4b43de28a57 /src/main/java/io/github/moulberry/notenoughupdates/recipes/ForgeRecipe.java | |
| parent | 0d281d483909d71272783033b2aba8f33dcbce36 (diff) | |
| download | notenoughupdates-30bd46e46aab73e2927fa5631c49ace84708e590.tar.gz notenoughupdates-30bd46e46aab73e2927fa5631c49ace84708e590.tar.bz2 notenoughupdates-30bd46e46aab73e2927fa5631c49ace84708e590.zip | |
HotmInformation rework (#611)
* Rename .java to .kt
* hotm rework.
* Moved class to kotlin directory.
* Removed debug.
* Support for maxed out levels.
* Fun fact of the day: Developer waste more time on the name of a variable than actual coding.
* default is 0
---------
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/recipes/ForgeRecipe.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/recipes/ForgeRecipe.java | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/recipes/ForgeRecipe.java b/src/main/java/io/github/moulberry/notenoughupdates/recipes/ForgeRecipe.java index 47eb0d11..73b4f32d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/recipes/ForgeRecipe.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/recipes/ForgeRecipe.java @@ -25,7 +25,9 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; import io.github.moulberry.notenoughupdates.NEUManager; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.miscgui.GuiItemRecipe; +import io.github.moulberry.notenoughupdates.options.NEUConfig; import io.github.moulberry.notenoughupdates.util.HotmInformation; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; @@ -35,7 +37,6 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Set; @@ -88,10 +89,6 @@ public class ForgeRecipe implements NeuRecipe { return output; } - public int getHotmLevel() { - return hotmLevel; - } - public int getTimeInSeconds() { return timeInSeconds; } @@ -166,30 +163,28 @@ public class ForgeRecipe implements NeuRecipe { @Override public void drawHoverInformation(GuiItemRecipe gui, int mouseX, int mouseY) { - manager.hotm.getInformationOnCurrentProfile().ifPresent(hotmTree -> { - if (timeInSeconds > 0 && gui.isWithinRect( - mouseX, mouseY, - gui.guiLeft + EXTRA_INFO_X - EXTRA_INFO_MAX_WIDTH / 2, - gui.guiTop + EXTRA_INFO_Y - 8, - EXTRA_INFO_MAX_WIDTH, 16 - )) { - int qf = hotmTree.getLevel("forge_time"); - int reducedTime = getReducedTime(qf); - if (qf > 0) { + NEUConfig.HiddenProfileSpecific profileSpecific = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); + if (profileSpecific == null) return; + + if (timeInSeconds <= 0 || !gui.isWithinRect( + mouseX, mouseY, + gui.guiLeft + EXTRA_INFO_X - EXTRA_INFO_MAX_WIDTH / 2, + gui.guiTop + EXTRA_INFO_Y - 8, + EXTRA_INFO_MAX_WIDTH, 16 + )) return; - Utils.drawHoveringText( - Arrays.asList( - EnumChatFormatting.YELLOW + formatDuration(reducedTime) + " with Quick Forge (Level " + qf + ")"), - mouseX, - mouseY, - gui.width, - gui.height, - 500, - Minecraft.getMinecraft().fontRendererObj - ); - } - } - }); + int level = profileSpecific.hotmTree.getOrDefault("Quick Forge", 0); + if (level == 0) return; + int reducedTime = getReducedTime(level); + + Utils.drawHoveringText( + Collections.singletonList( + EnumChatFormatting.YELLOW + formatDuration(reducedTime) + " with Quick Forge (Level " + level + ")"), + mouseX, mouseY, + gui.width, gui.height, + 500, + Minecraft.getMinecraft().fontRendererObj + ); } public int getReducedTime(int quickForgeUpgradeLevel) { |
