From bba168c7955ed1c3f0325672386494c0da72ecb9 Mon Sep 17 00:00:00 2001 From: P3pp3rF1y Date: Wed, 29 Nov 2023 22:18:16 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Fix=20jei=20part=20of=20c?= =?UTF-8?q?hipped=20compat=20to=20not=20crash=20when=20jei=20isn't=20in=20?= =?UTF-8?q?a=20pack?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 2 +- .../compat/chipped/ChippedCompat.java | 23 ++++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/gradle.properties b/gradle.properties index 29fc6368..8402f22d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ org.gradle.daemon=false minecraft_version=1.19.2 forge_version=43.2.13 -mod_version=3.18.67 +mod_version=3.19.1 jei_mc_version=1.19.2-forge jei_version=11.6.0.+ curios_version=1.19.2-5.1.1.+ diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/compat/chipped/ChippedCompat.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/compat/chipped/ChippedCompat.java index 26e5447e..b665f67e 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/compat/chipped/ChippedCompat.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/compat/chipped/ChippedCompat.java @@ -10,6 +10,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.DistExecutor; +import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegisterEvent; @@ -23,12 +24,15 @@ import net.p3pp3rf1y.sophisticatedcore.client.gui.utils.Position; import net.p3pp3rf1y.sophisticatedcore.common.gui.UpgradeContainerRegistry; import net.p3pp3rf1y.sophisticatedcore.common.gui.UpgradeContainerType; +import net.p3pp3rf1y.sophisticatedcore.compat.CompatModIds; import net.p3pp3rf1y.sophisticatedcore.compat.ICompat; import net.p3pp3rf1y.sophisticatedcore.compat.chipped.BlockTransformationUpgradeContainer; import net.p3pp3rf1y.sophisticatedcore.compat.chipped.BlockTransformationUpgradeItem; import net.p3pp3rf1y.sophisticatedcore.compat.chipped.BlockTransformationUpgradeTab; import net.p3pp3rf1y.sophisticatedcore.compat.chipped.BlockTransformationUpgradeWrapper; +import java.util.function.Supplier; + public class ChippedCompat implements ICompat { public static final RegistryObject BOTANIST_WORKBENCH_UPGRADE = ModItems.ITEMS.register("chipped/botanist_workbench_upgrade", @@ -51,14 +55,17 @@ public void init() { IEventBus modBus = FMLJavaModLoadingContext.get().getModEventBus(); modBus.addListener(this::registerContainers); - SBPPlugin.setAdditionalCatalystRegistrar(registration -> { - registration.addRecipeCatalyst(new ItemStack(BOTANIST_WORKBENCH_UPGRADE.get()), ChippedRecipeCategory.BOTANIST_WORKBENCH_RECIPE); - registration.addRecipeCatalyst(new ItemStack(GLASSBLOWER_WORKBENCH_UPGRADE.get()), ChippedRecipeCategory.GLASSBLOWER_RECIPE); - registration.addRecipeCatalyst(new ItemStack(CARPENTER_WORKBENCH_UPGRADE.get()), ChippedRecipeCategory.CARPENTERS_TABLE_RECIPE); - registration.addRecipeCatalyst(new ItemStack(SHEPHERD_WORKBENCH_UPGRADE.get()), ChippedRecipeCategory.LOOM_TABLE_RECIPE); - registration.addRecipeCatalyst(new ItemStack(MASON_WORKBENCH_UPGRADE.get()), ChippedRecipeCategory.MASON_TABLE_RECIPE); - registration.addRecipeCatalyst(new ItemStack(PHILOSOPHER_WORKBENCH_UPGRADE.get()), ChippedRecipeCategory.ALCHEMY_BENCH_RECIPE); - registration.addRecipeCatalyst(new ItemStack(TINKERER_WORKBENCH_UPGRADE.get()), ChippedRecipeCategory.TINKERING_TABLE_RECIPE); }); + if (ModList.get().isLoaded(CompatModIds.JEI)) { + ((Supplier) () -> () -> SBPPlugin.setAdditionalCatalystRegistrar(registration -> { + registration.addRecipeCatalyst(new ItemStack(BOTANIST_WORKBENCH_UPGRADE.get()), ChippedRecipeCategory.BOTANIST_WORKBENCH_RECIPE); + registration.addRecipeCatalyst(new ItemStack(GLASSBLOWER_WORKBENCH_UPGRADE.get()), ChippedRecipeCategory.GLASSBLOWER_RECIPE); + registration.addRecipeCatalyst(new ItemStack(CARPENTER_WORKBENCH_UPGRADE.get()), ChippedRecipeCategory.CARPENTERS_TABLE_RECIPE); + registration.addRecipeCatalyst(new ItemStack(SHEPHERD_WORKBENCH_UPGRADE.get()), ChippedRecipeCategory.LOOM_TABLE_RECIPE); + registration.addRecipeCatalyst(new ItemStack(MASON_WORKBENCH_UPGRADE.get()), ChippedRecipeCategory.MASON_TABLE_RECIPE); + registration.addRecipeCatalyst(new ItemStack(PHILOSOPHER_WORKBENCH_UPGRADE.get()), ChippedRecipeCategory.ALCHEMY_BENCH_RECIPE); + registration.addRecipeCatalyst(new ItemStack(TINKERER_WORKBENCH_UPGRADE.get()), ChippedRecipeCategory.TINKERING_TABLE_RECIPE); + })).get().run(); + } } public void registerContainers(RegisterEvent event) {