diff --git a/src/main/java/dev/dubhe/anvilcraft/AnvilCraft.java b/src/main/java/dev/dubhe/anvilcraft/AnvilCraft.java index 0157061dd..34d02890b 100644 --- a/src/main/java/dev/dubhe/anvilcraft/AnvilCraft.java +++ b/src/main/java/dev/dubhe/anvilcraft/AnvilCraft.java @@ -21,11 +21,11 @@ import dev.dubhe.anvilcraft.init.ModNetworks; import dev.dubhe.anvilcraft.init.ModRecipeTypes; import dev.dubhe.anvilcraft.init.ModVillagers; -import dev.dubhe.anvilcraft.integration.CompatMods; import dev.dubhe.anvilcraft.integration.top.AnvilCraftTopPlugin; import dev.dubhe.anvilcraft.recipe.anvil.cache.RecipeCaches; import dev.dubhe.anvilcraft.util.ModInteractionMap; +import dev.dubhe.anvilcraft.util.Util; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.PackType; @@ -137,7 +137,7 @@ public static void addReloadListeners(@NotNull AddReloadListenerEvent event) { public static void loadComplete(@NotNull FMLLoadCompleteEvent event) { event.enqueueWork(() -> { ModInteractionMap.initInteractionMap(); - if (CompatMods.THE_ONE_PROBE.isLoaded()) { + if (Util.isLoaded("theoneprobe")) { LOGGER.info("TheOneProbe found. Loading AnvilCraft TheOneProbe plugin..."); AnvilCraftTopPlugin.init(); } diff --git a/src/main/java/dev/dubhe/anvilcraft/client/renderer/RenderState.java b/src/main/java/dev/dubhe/anvilcraft/client/renderer/RenderState.java index 88add2e33..dda03776c 100644 --- a/src/main/java/dev/dubhe/anvilcraft/client/renderer/RenderState.java +++ b/src/main/java/dev/dubhe/anvilcraft/client/renderer/RenderState.java @@ -2,8 +2,8 @@ import com.mojang.logging.LogUtils; import dev.dubhe.anvilcraft.AnvilCraft; -import dev.dubhe.anvilcraft.integration.CompatMods; import dev.dubhe.anvilcraft.integration.iris.IrisState; +import dev.dubhe.anvilcraft.util.Util; import lombok.Getter; import net.minecraft.client.Minecraft; import org.slf4j.Logger; @@ -15,7 +15,7 @@ public class RenderState { private static final Logger logger = LogUtils.getLogger(); static { - IRIS_PRESENT = CompatMods.IRIS.isLoaded(); + IRIS_PRESENT = Util.isLoaded("iris"); } public static boolean isIrisPresent() { diff --git a/src/main/java/dev/dubhe/anvilcraft/init/ModBlockTags.java b/src/main/java/dev/dubhe/anvilcraft/init/ModBlockTags.java index 8e8fd100f..889d74391 100644 --- a/src/main/java/dev/dubhe/anvilcraft/init/ModBlockTags.java +++ b/src/main/java/dev/dubhe/anvilcraft/init/ModBlockTags.java @@ -2,7 +2,6 @@ import dev.dubhe.anvilcraft.AnvilCraft; -import dev.dubhe.anvilcraft.integration.CompatMods; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; @@ -11,6 +10,8 @@ import org.jetbrains.annotations.NotNull; public class ModBlockTags { + + private static final String MEKANISM_MODID = "mekanism"; // mod tags public static final TagKey UNDER_CAULDRON = bind("under_cauldron"); public static final TagKey MAGNET = bind("magnet"); @@ -68,7 +69,7 @@ public class ModBlockTags { } private static @NotNull TagKey bindMekanism(String id){ - return TagKey.create(Registries.BLOCK, CompatMods.MEKANISM.of(id)); + return TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(MEKANISM_MODID, id)); } private static @NotNull TagKey bind(String id) { diff --git a/src/main/java/dev/dubhe/anvilcraft/item/GuideBookItem.java b/src/main/java/dev/dubhe/anvilcraft/item/GuideBookItem.java index fa995b3dc..3ebde0f60 100644 --- a/src/main/java/dev/dubhe/anvilcraft/item/GuideBookItem.java +++ b/src/main/java/dev/dubhe/anvilcraft/item/GuideBookItem.java @@ -1,8 +1,8 @@ package dev.dubhe.anvilcraft.item; -import dev.dubhe.anvilcraft.integration.CompatMods; import dev.dubhe.anvilcraft.integration.patchouli.PatchouliUtil; +import dev.dubhe.anvilcraft.util.Util; import net.minecraft.ChatFormatting; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.network.chat.Component; @@ -27,7 +27,7 @@ public GuideBookItem(Properties properties) { @Override public InteractionResultHolder use(Level level, Player player, InteractionHand usedHand) { if (player instanceof ServerPlayer serverPlayer) { - if (CompatMods.PATCHOULI.isLoaded()) { + if (Util.isLoaded("patchouli")) { PatchouliUtil.openBook(serverPlayer); return new InteractionResultHolder<>(InteractionResult.CONSUME, player.getItemInHand(usedHand)); } else { diff --git a/src/main/java/dev/dubhe/anvilcraft/util/Util.java b/src/main/java/dev/dubhe/anvilcraft/util/Util.java index 959dacf8d..d729d0757 100644 --- a/src/main/java/dev/dubhe/anvilcraft/util/Util.java +++ b/src/main/java/dev/dubhe/anvilcraft/util/Util.java @@ -1,6 +1,5 @@ package dev.dubhe.anvilcraft.util; -import dev.dubhe.anvilcraft.integration.CompatMods; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.InteractionResult; @@ -22,7 +21,7 @@ @NoArgsConstructor(access = AccessLevel.PRIVATE) public class Util { - public static final Lazy jadePresent = new Lazy<>(() -> CompatMods.JADE.isLoaded() || CompatMods.WTHIT.isLoaded()); + public static final Lazy jadePresent = new Lazy<>(() -> isLoaded("jade") || isLoaded("wthit")); private static final StackWalker STACK_WALKER = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE); public static final Direction[] HORIZONTAL_DIRECTIONS = new Direction[] { Direction.SOUTH,