From e56b1e31d2b16d1868cdda3b6eb8726644d699b7 Mon Sep 17 00:00:00 2001 From: xypercode Date: Fri, 29 Sep 2023 09:00:50 +0200 Subject: [PATCH] Fixed a crash and bug --- .../bubbles/render/gui/screen/LoadScreen.java | 16 ++++++++++------ .../bubbles/render/gui/widget/ObjectList.java | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/com/ultreon/bubbles/render/gui/screen/LoadScreen.java b/core/src/main/java/com/ultreon/bubbles/render/gui/screen/LoadScreen.java index 8a62b86a..1d8588f2 100644 --- a/core/src/main/java/com/ultreon/bubbles/render/gui/screen/LoadScreen.java +++ b/core/src/main/java/com/ultreon/bubbles/render/gui/screen/LoadScreen.java @@ -30,6 +30,7 @@ import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.ModContainer; import net.fabricmc.loader.api.metadata.ModMetadata; +import net.fabricmc.loader.api.metadata.ModOrigin; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -170,12 +171,15 @@ public void run() { this.progressAlt = new ProgressMessenger(msgAlt, allMods.size()); for (ModContainer container : allMods) { progressAlt.sendNext(container.getMetadata().getName()); - List paths = container.getOrigin().getPaths(); - for (Path path : paths) { - try { - game().getResourceManager().importPackage(path); - } catch (IOException e) { - throw new RuntimeException(e); + ModOrigin origin = container.getOrigin(); + if (origin.getKind() == ModOrigin.Kind.PATH) { + List paths = origin.getPaths(); + for (Path path : paths) { + try { + game().getResourceManager().importPackage(path); + } catch (IOException e) { + throw new RuntimeException(e); + } } } } diff --git a/core/src/main/java/com/ultreon/bubbles/render/gui/widget/ObjectList.java b/core/src/main/java/com/ultreon/bubbles/render/gui/widget/ObjectList.java index da53e80b..ca2d0f5e 100644 --- a/core/src/main/java/com/ultreon/bubbles/render/gui/widget/ObjectList.java +++ b/core/src/main/java/com/ultreon/bubbles/render/gui/widget/ObjectList.java @@ -188,7 +188,7 @@ public ListEntry(ObjectList list, C value, int x, int y, int width, int heigh } public void render(Renderer renderer1, int mouseX, int mouseY, float deltaTime) { - this.list.entryRenderer.render(renderer1, list.width - SCROLLBAR_WIDTH, list.entryHeight, this.list.getViewport().yScroll + (list.entryHeight + list.gap) * index, value, list.selected == this && list.selectable, isHovered()); + this.list.entryRenderer.render(renderer1, list.width - SCROLLBAR_WIDTH, list.entryHeight, -this.list.getViewport().yScroll + (list.entryHeight + list.gap) * index, value, list.selected == this && list.selectable, isHovered()); } public void setIndex(int index) {