From 72376d48343150478da2841e3e90923e340249c7 Mon Sep 17 00:00:00 2001 From: James Mitchell Date: Mon, 9 Sep 2024 15:06:29 -1000 Subject: [PATCH] Fix JEI plugin failure when no potions are registered to the zeta registry, fix crash from ForgeZGatherHints (#50) --- src/main/java/org/violetmoon/zeta/registry/ZetaRegistry.java | 2 +- .../violetmoon/zetaimplforge/event/load/ForgeZGatherHints.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/violetmoon/zeta/registry/ZetaRegistry.java b/src/main/java/org/violetmoon/zeta/registry/ZetaRegistry.java index 2106b37..a67b0e7 100644 --- a/src/main/java/org/violetmoon/zeta/registry/ZetaRegistry.java +++ b/src/main/java/org/violetmoon/zeta/registry/ZetaRegistry.java @@ -285,6 +285,6 @@ protected void trackRegisteredObject(ResourceKey> keyGeneric, Ho * Gets all the registered objects from this Zeta */ public Collection> getRegisteredObjects(ResourceKey> registry) { - return (Collection>) (Collection) myRegisteredObjects.get((ResourceKey) registry); + return (Collection>) (Collection) myRegisteredObjects.getOrDefault((ResourceKey) registry, List.of()); } } diff --git a/src/main/java/org/violetmoon/zetaimplforge/event/load/ForgeZGatherHints.java b/src/main/java/org/violetmoon/zetaimplforge/event/load/ForgeZGatherHints.java index ae6c311..73487ca 100644 --- a/src/main/java/org/violetmoon/zetaimplforge/event/load/ForgeZGatherHints.java +++ b/src/main/java/org/violetmoon/zetaimplforge/event/load/ForgeZGatherHints.java @@ -4,11 +4,12 @@ import net.minecraft.network.chat.Component; import net.minecraft.world.level.ItemLike; import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.fml.event.IModBusEvent; import org.violetmoon.zeta.config.ConfigFlagManager; import org.violetmoon.zeta.event.load.ZGatherHints; import org.violetmoon.zeta.module.ZetaModule; -public class ForgeZGatherHints extends Event implements ZGatherHints { +public class ForgeZGatherHints extends Event implements ZGatherHints, IModBusEvent { private final ZGatherHints wrapped; public ForgeZGatherHints(ZGatherHints e) {