diff options
author | Lorenz <lo.scherf@gmail.com> | 2022-09-04 10:40:24 +0200 |
---|---|---|
committer | Lorenz <lo.scherf@gmail.com> | 2022-09-04 10:40:24 +0200 |
commit | 8821010142db46a6b5983738d814d5942e28104b (patch) | |
tree | 76f287791cac2839a64b678b54f5d658c006a6b8 /src/main/java | |
parent | faef964ca44bfec28817f32c2a09370d91313a19 (diff) | |
download | NotEnoughUpdates-8821010142db46a6b5983738d814d5942e28104b.tar.gz NotEnoughUpdates-8821010142db46a6b5983738d814d5942e28104b.tar.bz2 NotEnoughUpdates-8821010142db46a6b5983738d814d5942e28104b.zip |
additional code cleanup
Diffstat (limited to 'src/main/java')
4 files changed, 9 insertions, 11 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperManager.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperManager.java index 7d0227fe..67b974a5 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/MinionHelperManager.java @@ -52,8 +52,6 @@ public class MinionHelperManager { private final MinionHelperApiLoader api = new MinionHelperApiLoader(this); private final MinionHelperRepoLoader repo = new MinionHelperRepoLoader(this); private final MinionHelperOverlay overlay = new MinionHelperOverlay(this); - private final MinionHelperTooltips tooltips = new MinionHelperTooltips(this); - private final MinionHelperChatLoader chatLoader = new MinionHelperChatLoader(this); private final MinionHelperInventoryLoader inventoryLoader = new MinionHelperInventoryLoader(this); public static MinionHelperManager getInstance() { @@ -68,8 +66,8 @@ public class MinionHelperManager { MinecraftForge.EVENT_BUS.register(api); MinecraftForge.EVENT_BUS.register(repo); MinecraftForge.EVENT_BUS.register(overlay); - MinecraftForge.EVENT_BUS.register(tooltips); - MinecraftForge.EVENT_BUS.register(chatLoader); + MinecraftForge.EVENT_BUS.register(new MinionHelperTooltips(this)); + MinecraftForge.EVENT_BUS.register(new MinionHelperChatLoader(this)); MinecraftForge.EVENT_BUS.register(inventoryLoader); } @@ -86,8 +84,8 @@ public class MinionHelperManager { return name.equalsIgnoreCase("Crafted Minions"); } - public boolean isReadyToUse() { - return repo.isRepoReadyToUse() && api.isApiReadyToUse(); + public boolean notReady() { + return !repo.isRepoReadyToUse() || !api.isApiReadyToUse(); } public Minion getMinionById(String internalName) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperInventoryLoader.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperInventoryLoader.java index 1e682618..f23db532 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperInventoryLoader.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperInventoryLoader.java @@ -58,7 +58,7 @@ public class MinionHelperInventoryLoader { public void onTick(TickEvent.ClientTickEvent event) { if (!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return; if (!NotEnoughUpdates.INSTANCE.config.minionHelper.gui) return; - if (!manager.isReadyToUse()) return; + if (manager.notReady()) return; ticks++; if (ticks % 5 != 0) return; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlay.java index ff9b4ac7..36113418 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperOverlay.java @@ -87,7 +87,7 @@ public class MinionHelperOverlay { public void onDrawBackground(GuiScreenEvent.BackgroundDrawnEvent event) { if (!manager.inCraftedMinionsInventory()) return; if (!NotEnoughUpdates.INSTANCE.config.minionHelper.gui) return; - if (!manager.isReadyToUse()) { + if (manager.notReady()) { LinkedHashMap<String, OverviewLine> map = new LinkedHashMap<>(); map.put("§cLoading...", new OverviewText(Collections.emptyList(), () -> {})); render(map); @@ -127,7 +127,7 @@ public class MinionHelperOverlay { public void onMouseClick(GuiScreenEvent.MouseInputEvent.Pre event) { if (!manager.inCraftedMinionsInventory()) return; if (!NotEnoughUpdates.INSTANCE.config.minionHelper.gui) return; - if (!manager.isReadyToUse()) return; + if (manager.notReady()) return; if (!Mouse.getEventButtonState()) return; OverviewLine overviewLine = getObjectOverMouse(getRenderMap()); @@ -177,7 +177,7 @@ public class MinionHelperOverlay { public void onMouseClick(GuiScreenEvent.KeyboardInputEvent.Pre event) { if (!manager.inCraftedMinionsInventory()) return; if (!NotEnoughUpdates.INSTANCE.config.minionHelper.gui) return; - if (!manager.isReadyToUse()) return; + if (manager.notReady()) return; int totalPages = getTotalPages(); if (ArrowPagesUtils.onPageSwitchKey(currentPage, totalPages, pageChange -> { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperTooltips.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperTooltips.java index c6405c98..ef243a6f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperTooltips.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/render/MinionHelperTooltips.java @@ -46,7 +46,7 @@ public class MinionHelperTooltips { public void onItemTooltip(ItemTooltipEvent event) { if (!manager.inCraftedMinionsInventory()) return; if (!NotEnoughUpdates.INSTANCE.config.minionHelper.tooltip) return; - if (!manager.isReadyToUse()) return; + if (manager.notReady()) return; boolean shift = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT); if (!pressedShiftLast && shift) { |