diff --git a/src/main/java/vazkii/quark/addons/oddities/block/MatrixEnchantingTableBlock.java b/src/main/java/vazkii/quark/addons/oddities/block/MatrixEnchantingTableBlock.java index 43969faa8e..8358477eeb 100644 --- a/src/main/java/vazkii/quark/addons/oddities/block/MatrixEnchantingTableBlock.java +++ b/src/main/java/vazkii/quark/addons/oddities/block/MatrixEnchantingTableBlock.java @@ -39,7 +39,6 @@ import vazkii.quark.base.Quark; import vazkii.quark.base.block.IQuarkBlock; import vazkii.quark.base.handler.CreativeTabHandler; -import vazkii.quark.base.module.ModuleLoader; import vazkii.zeta.module.ZetaModule; public class MatrixEnchantingTableBlock extends EnchantmentTableBlock implements IQuarkBlock { @@ -100,7 +99,7 @@ public InteractionResult use(@Nonnull BlockState state, Level worldIn, @Nonnull if(!(worldIn.getBlockEntity(pos) instanceof MatrixEnchantingTableBlockEntity)) worldIn.setBlockEntity(newBlockEntity(pos, state)); - if(ModuleLoader.INSTANCE.isModuleEnabled(MatrixEnchantingModule.class)) { + if(Quark.ZETA.modules.isEnabled(MatrixEnchantingModule.class)) { if(player instanceof ServerPlayer serverPlayer) NetworkHooks.openScreen(serverPlayer, (MatrixEnchantingTableBlockEntity) worldIn.getBlockEntity(pos), pos); } else @@ -112,7 +111,7 @@ public InteractionResult use(@Nonnull BlockState state, Level worldIn, @Nonnull @Override @OnlyIn(Dist.CLIENT) public void animateTick(@Nonnull BlockState stateIn, @Nonnull Level worldIn, @Nonnull BlockPos pos, @Nonnull RandomSource rand) { - boolean enabled = ModuleLoader.INSTANCE.isModuleEnabled(MatrixEnchantingModule.class); + boolean enabled = Quark.ZETA.modules.isEnabled(MatrixEnchantingModule.class); boolean showInfluences = enabled && MatrixEnchantingModule.allowInfluencing; boolean allowUnderwater = enabled && MatrixEnchantingModule.allowUnderwaterEnchanting; boolean allowShort = enabled && MatrixEnchantingModule.allowShortBlockEnchanting; diff --git a/src/main/java/vazkii/quark/base/handler/InventoryTransferHandler.java b/src/main/java/vazkii/quark/base/handler/InventoryTransferHandler.java index 461e63863f..3b266f4741 100644 --- a/src/main/java/vazkii/quark/base/handler/InventoryTransferHandler.java +++ b/src/main/java/vazkii/quark/base/handler/InventoryTransferHandler.java @@ -17,7 +17,6 @@ import vazkii.quark.api.ITransferManager; import vazkii.quark.api.QuarkCapabilities; import vazkii.quark.base.Quark; -import vazkii.quark.base.module.ModuleLoader; import vazkii.quark.content.management.module.EasyTransferingModule; import javax.annotation.Nonnull; @@ -28,7 +27,7 @@ public class InventoryTransferHandler { public static void transfer(Player player, boolean isRestock, boolean smart) { - if(!ModuleLoader.INSTANCE.isModuleEnabled(EasyTransferingModule.class) || player.isSpectator() || !accepts(player.containerMenu, player)) + if(!Quark.ZETA.modules.isEnabled(EasyTransferingModule.class) || player.isSpectator() || !accepts(player.containerMenu, player)) return; // if(!useContainer && !player.getEntityWorld().getWorldInfo().getGameRulesInstance().getBoolean(StoreToChests.GAME_RULE)) { diff --git a/src/main/java/vazkii/quark/base/handler/SortingHandler.java b/src/main/java/vazkii/quark/base/handler/SortingHandler.java index a644600d57..a782fa34b8 100644 --- a/src/main/java/vazkii/quark/base/handler/SortingHandler.java +++ b/src/main/java/vazkii/quark/base/handler/SortingHandler.java @@ -26,7 +26,6 @@ import vazkii.quark.api.ISortingLockedSlots; import vazkii.quark.api.QuarkCapabilities; import vazkii.quark.base.Quark; -import vazkii.quark.base.module.ModuleLoader; import vazkii.quark.content.management.module.InventorySortingModule; import java.util.*; @@ -69,7 +68,7 @@ public final class SortingHandler { SortingHandler::potionTypeCompare)); public static void sortInventory(Player player, boolean forcePlayer) { - if (!ModuleLoader.INSTANCE.isModuleEnabled(InventorySortingModule.class)) + if (!Quark.ZETA.modules.isEnabled(InventorySortingModule.class)) return; AbstractContainerMenu c = player.containerMenu; diff --git a/src/main/java/vazkii/quark/base/handler/WoodSetHandler.java b/src/main/java/vazkii/quark/base/handler/WoodSetHandler.java index 868a0955f7..55f92ab147 100644 --- a/src/main/java/vazkii/quark/base/handler/WoodSetHandler.java +++ b/src/main/java/vazkii/quark/base/handler/WoodSetHandler.java @@ -1,6 +1,15 @@ package vazkii.quark.base.handler; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Stream; + import com.google.common.collect.ImmutableSet; + import net.minecraft.client.renderer.Sheets; import net.minecraft.client.renderer.entity.EntityRenderers; import net.minecraft.core.Direction; @@ -10,8 +19,12 @@ import net.minecraft.world.entity.MobCategory; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.Item; -import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.DispenserBlock; import net.minecraft.world.level.block.PressurePlateBlock.Sensitivity; +import net.minecraft.world.level.block.RotatedPillarBlock; +import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockBehaviour.Properties; @@ -20,24 +33,38 @@ import net.minecraft.world.level.material.MaterialColor; import net.minecraftforge.common.ToolActions; import vazkii.quark.base.Quark; -import vazkii.quark.base.block.*; +import vazkii.quark.base.block.IQuarkBlock; +import vazkii.quark.base.block.QuarkBlock; +import vazkii.quark.base.block.QuarkDoorBlock; +import vazkii.quark.base.block.QuarkFenceBlock; +import vazkii.quark.base.block.QuarkFenceGateBlock; +import vazkii.quark.base.block.QuarkPillarBlock; +import vazkii.quark.base.block.QuarkPressurePlateBlock; +import vazkii.quark.base.block.QuarkStandingSignBlock; +import vazkii.quark.base.block.QuarkTrapdoorBlock; +import vazkii.quark.base.block.QuarkWallSignBlock; +import vazkii.quark.base.block.QuarkWoodenButtonBlock; import vazkii.quark.base.client.render.QuarkBoatRenderer; import vazkii.quark.base.item.QuarkSignItem; import vazkii.quark.base.item.boat.QuarkBoat; import vazkii.quark.base.item.boat.QuarkBoatDispenseItemBehavior; import vazkii.quark.base.item.boat.QuarkBoatItem; import vazkii.quark.base.item.boat.QuarkChestBoat; -import vazkii.quark.base.module.ModuleLoader; -import vazkii.zeta.module.ZetaModule; -import vazkii.quark.content.building.block.*; -import vazkii.quark.content.building.module.*; +import vazkii.quark.content.building.block.HollowLogBlock; +import vazkii.quark.content.building.block.VariantBookshelfBlock; +import vazkii.quark.content.building.block.VariantLadderBlock; +import vazkii.quark.content.building.block.WoodPostBlock; +import vazkii.quark.content.building.module.HollowLogsModule; +import vazkii.quark.content.building.module.VariantBookshelvesModule; +import vazkii.quark.content.building.module.VariantChestsModule; +import vazkii.quark.content.building.module.VariantLaddersModule; +import vazkii.quark.content.building.module.VerticalPlanksModule; +import vazkii.quark.content.building.module.WoodenPostsModule; +import vazkii.zeta.client.event.ZClientSetup; import vazkii.zeta.event.ZCommonSetup; import vazkii.zeta.event.ZRegister; import vazkii.zeta.event.bus.LoadEvent; -import vazkii.zeta.client.event.ZClientSetup; - -import java.util.*; -import java.util.stream.Stream; +import vazkii.zeta.module.ZetaModule; public class WoodSetHandler { @@ -109,18 +136,16 @@ public static WoodSet addWoodSet(ZetaModule module, String name, MaterialColor c set.sign = new QuarkStandingSignBlock(name + "_sign", module, type, BlockBehaviour.Properties.of(Material.WOOD, color).noCollission().strength(1.0F).sound(SoundType.WOOD)); set.wallSign = new QuarkWallSignBlock(name + "_wall_sign", module, type, BlockBehaviour.Properties.of(Material.WOOD, color).noCollission().strength(1.0F).sound(SoundType.WOOD).lootFrom(() -> set.sign)); - set.bookshelf = new VariantBookshelfBlock(name, module, true).setCondition(() -> ModuleLoader.INSTANCE.isModuleEnabledOrOverlapping(VariantBookshelvesModule.class)); - set.ladder = new VariantLadderBlock(name, module, true).setCondition(() -> ModuleLoader.INSTANCE.isModuleEnabledOrOverlapping(VariantLaddersModule.class)); + set.bookshelf = new VariantBookshelfBlock(name, module, true).setCondition(() -> Quark.ZETA.modules.isEnabledOrOverlapping(VariantBookshelvesModule.class)); + set.ladder = new VariantLadderBlock(name, module, true).setCondition(() -> Quark.ZETA.modules.isEnabledOrOverlapping(VariantLaddersModule.class)); - set.post = new WoodPostBlock(module, set.fence, "", false).setCondition(() -> ModuleLoader.INSTANCE.isModuleEnabledOrOverlapping(WoodenPostsModule.class)); - set.strippedPost = new WoodPostBlock(module, set.fence, "stripped_", false).setCondition(() -> ModuleLoader.INSTANCE.isModuleEnabledOrOverlapping(WoodenPostsModule.class)); + set.post = new WoodPostBlock(module, set.fence, "", false).setCondition(() -> Quark.ZETA.modules.isEnabledOrOverlapping(WoodenPostsModule.class)); + set.strippedPost = new WoodPostBlock(module, set.fence, "stripped_", false).setCondition(() -> Quark.ZETA.modules.isEnabledOrOverlapping(WoodenPostsModule.class)); - set.verticalPlanks = VerticalPlanksModule.add(name, set.planks, module).setCondition(() -> ModuleLoader.INSTANCE.isModuleEnabledOrOverlapping(VerticalPlanksModule.class)); + set.verticalPlanks = VerticalPlanksModule.add(name, set.planks, module).setCondition(() -> Quark.ZETA.modules.isEnabledOrOverlapping(VerticalPlanksModule.class)); - if(hasLog) { - set.hollowLog = new HollowLogBlock(set.log, module, flammable).setCondition(() -> ModuleLoader.INSTANCE.isModuleEnabledOrOverlapping(HollowLogsModule.class)); -// set.hollowWood = new HollowWoodBlock(set.wood, module, flammable).setCondition(() -> ModuleLoader.INSTANCE.isModuleEnabledOrOverlapping(HollowLogsModule.class)); - } + if(hasLog) + set.hollowLog = new HollowLogBlock(set.log, module, flammable).setCondition(() -> Quark.ZETA.modules.isEnabledOrOverlapping(HollowLogsModule.class)); VariantChestsModule.addChest(name, module, () -> Block.Properties.copy(Blocks.CHEST), true); diff --git a/src/main/java/vazkii/quark/base/module/ModuleLoader.java b/src/main/java/vazkii/quark/base/module/ModuleLoader.java deleted file mode 100644 index b81d621e4f..0000000000 --- a/src/main/java/vazkii/quark/base/module/ModuleLoader.java +++ /dev/null @@ -1,29 +0,0 @@ -package vazkii.quark.base.module; - -import vazkii.quark.base.Quark; -import vazkii.zeta.module.ZetaModule; - -//TODO ZETA: im in the process of stripping this class for parts -@Deprecated -public final class ModuleLoader { - - public static final ModuleLoader INSTANCE = new ModuleLoader(); - - private ModuleLoader() { } - - //tempting to push this method directly through to Quark.ZETA.modules... - //but i think it's more appropriate to have this stored in a configuration class - @Deprecated - public boolean isModuleEnabled(Class moduleClazz) { - ZetaModule module = Quark.ZETA.modules.get(moduleClazz); - return module != null && module.enabled; - } - - //same for this - @Deprecated - public boolean isModuleEnabledOrOverlapping(Class moduleClazz) { - ZetaModule module = Quark.ZETA.modules.get(moduleClazz); - return module != null && (module.enabled || module.disabledByOverlap); - } - -} diff --git a/src/main/java/vazkii/quark/content/automation/module/FeedingTroughModule.java b/src/main/java/vazkii/quark/content/automation/module/FeedingTroughModule.java index a9ed0a13f0..bc37d6a2cb 100644 --- a/src/main/java/vazkii/quark/content/automation/module/FeedingTroughModule.java +++ b/src/main/java/vazkii/quark/content/automation/module/FeedingTroughModule.java @@ -30,7 +30,6 @@ import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.util.FakePlayer; import vazkii.quark.base.Quark; -import vazkii.quark.base.module.ModuleLoader; import vazkii.quark.base.module.config.Config; import vazkii.quark.content.automation.block.FeedingTroughBlock; import vazkii.quark.content.automation.block.be.FeedingTroughBlockEntity; @@ -96,7 +95,7 @@ public void onOrbSpawn(ZEntityJoinLevel event) { } public static Player temptWithTroughs(TemptGoal goal, Player found, ServerLevel level) { - if (!ModuleLoader.INSTANCE.isModuleEnabled(FeedingTroughModule.class) || + if (!Quark.ZETA.modules.isEnabled(FeedingTroughModule.class) || (found != null && (goal.items.test(found.getMainHandItem()) || goal.items.test(found.getOffhandItem())))) return found; diff --git a/src/main/java/vazkii/quark/content/automation/module/PistonsMoveTileEntitiesModule.java b/src/main/java/vazkii/quark/content/automation/module/PistonsMoveTileEntitiesModule.java index 21948e4a99..803b57ccb5 100644 --- a/src/main/java/vazkii/quark/content/automation/module/PistonsMoveTileEntitiesModule.java +++ b/src/main/java/vazkii/quark/content/automation/module/PistonsMoveTileEntitiesModule.java @@ -21,7 +21,6 @@ import vazkii.quark.api.IPistonCallback; import vazkii.quark.api.QuarkCapabilities; import vazkii.quark.base.Quark; -import vazkii.quark.base.module.ModuleLoader; import vazkii.quark.base.module.config.Config; import vazkii.quark.content.building.module.SturdyStoneModule; import vazkii.zeta.api.IIndirectConnector; @@ -91,7 +90,7 @@ public void onWorldTick(ZLevelTick.End event) { public void addAdditionalHints(ZGatherHints consumer) { MutableComponent comp = Component.translatable("quark.jei.hint.piston_te"); - if(ModuleLoader.INSTANCE.isModuleEnabled(SturdyStoneModule.class)) + if(Quark.ZETA.modules.isEnabled(SturdyStoneModule.class)) comp = comp.append(" ").append(Component.translatable("quark.jei.hint.piston_sturdy")); if(ZetaPistonStructureResolver.GlobalSettings.getPushLimit() != 12) @@ -103,7 +102,7 @@ public void addAdditionalHints(ZGatherHints consumer) { // This is called from injected code and subsequently flipped, so to make it move, we return false public static boolean shouldMoveTE(boolean te, BlockState state) { - if (!ModuleLoader.INSTANCE.isModuleEnabled(PistonsMoveTileEntitiesModule.class)) + if (!Quark.ZETA.modules.isEnabled(PistonsMoveTileEntitiesModule.class)) return te; return shouldMoveTE(state); @@ -122,7 +121,7 @@ public static boolean shouldMoveTE(BlockState state) { } public static void detachTileEntities(Level world, PistonStructureResolver helper, Direction facing, boolean extending) { - if (!ModuleLoader.INSTANCE.isModuleEnabled(PistonsMoveTileEntitiesModule.class)) + if (!Quark.ZETA.modules.isEnabled(PistonsMoveTileEntitiesModule.class)) return; if (!extending) @@ -146,7 +145,7 @@ public static void detachTileEntities(Level world, PistonStructureResolver helpe } public static boolean setPistonBlock(Level world, BlockPos pos, BlockState state, int flags) { - if (!ModuleLoader.INSTANCE.isModuleEnabled(PistonsMoveTileEntitiesModule.class)) { + if (!Quark.ZETA.modules.isEnabled(PistonsMoveTileEntitiesModule.class)) { world.setBlock(pos, state, flags); return false; } diff --git a/src/main/java/vazkii/quark/content/building/module/LeafCarpetModule.java b/src/main/java/vazkii/quark/content/building/module/LeafCarpetModule.java index a6ffd69b0b..85bcde2fe5 100644 --- a/src/main/java/vazkii/quark/content/building/module/LeafCarpetModule.java +++ b/src/main/java/vazkii/quark/content/building/module/LeafCarpetModule.java @@ -6,8 +6,8 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.ComposterBlock; +import vazkii.quark.base.Quark; import vazkii.quark.base.block.IQuarkBlock; -import vazkii.quark.base.module.ModuleLoader; import vazkii.zeta.client.AlikeColorHandler; import vazkii.zeta.client.event.ZAddBlockColorHandlers; import vazkii.zeta.client.event.ZAddItemColorHandlers; @@ -41,7 +41,7 @@ public final void register(ZRegister event) { public void postRegister(ZRegister.Post e) { BlossomTreesModule.trees.keySet().stream().map(t -> (BlossomLeavesBlock) t.leaf.getBlock()).forEach(this::blossomCarpet); - carpetBlock(AncientWoodModule.ancient_leaves).setCondition(() -> ModuleLoader.INSTANCE.isModuleEnabled(AncientWoodModule.class)); + carpetBlock(AncientWoodModule.ancient_leaves).setCondition(() -> Quark.ZETA.modules.isEnabled(AncientWoodModule.class)); } @LoadEvent diff --git a/src/main/java/vazkii/quark/content/building/module/MoreBrickTypesModule.java b/src/main/java/vazkii/quark/content/building/module/MoreBrickTypesModule.java index 7235d30a52..439a950db0 100644 --- a/src/main/java/vazkii/quark/content/building/module/MoreBrickTypesModule.java +++ b/src/main/java/vazkii/quark/content/building/module/MoreBrickTypesModule.java @@ -3,9 +3,9 @@ import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; +import vazkii.quark.base.Quark; import vazkii.quark.base.block.QuarkBlock; import vazkii.quark.base.handler.VariantHandler; -import vazkii.quark.base.module.ModuleLoader; import vazkii.quark.base.module.config.Config; import vazkii.zeta.event.ZRegister; import vazkii.zeta.event.bus.LoadEvent; @@ -41,7 +41,7 @@ public final void register(ZRegister event) { add("sandstone", Blocks.SANDSTONE, () -> enableSandstoneBricks); add("red_sandstone", Blocks.RED_SANDSTONE, () -> enableSandstoneBricks); - add("soul_sandstone", Blocks.SANDSTONE, () -> enableSandstoneBricks && ModuleLoader.INSTANCE.isModuleEnabled(SoulSandstoneModule.class)); + add("soul_sandstone", Blocks.SANDSTONE, () -> enableSandstoneBricks && Quark.ZETA.modules.isEnabled(SoulSandstoneModule.class)); add("cobblestone", Blocks.COBBLESTONE, () -> enableCobblestoneBricks); add("mossy_cobblestone", Blocks.MOSSY_COBBLESTONE, () -> enableCobblestoneBricks); diff --git a/src/main/java/vazkii/quark/content/building/module/VariantChestsModule.java b/src/main/java/vazkii/quark/content/building/module/VariantChestsModule.java index 89a4a784bf..64bc8b7919 100644 --- a/src/main/java/vazkii/quark/content/building/module/VariantChestsModule.java +++ b/src/main/java/vazkii/quark/content/building/module/VariantChestsModule.java @@ -28,7 +28,6 @@ import vazkii.quark.base.Quark; import vazkii.quark.base.handler.StructureBlockReplacementHandler; import vazkii.quark.base.handler.StructureBlockReplacementHandler.StructureHolder; -import vazkii.quark.base.module.ModuleLoader; import vazkii.quark.base.module.config.Config; import vazkii.quark.base.util.VanillaWoods; import vazkii.quark.base.util.VanillaWoods.Wood; @@ -197,7 +196,7 @@ public void addChest(String name, Supplier props) { } public static void addChest(String name, ZetaModule module, Supplier props, boolean external) { - BooleanSupplier cond = external ? (() -> ModuleLoader.INSTANCE.isModuleEnabled(VariantChestsModule.class)) : (() -> true); + BooleanSupplier cond = external ? (() -> Quark.ZETA.modules.isEnabled(VariantChestsModule.class)) : (() -> true); chestTypes.add(new ChestInfo(name, module, props, cond, null)); } diff --git a/src/main/java/vazkii/quark/content/building/module/WoodenPostsModule.java b/src/main/java/vazkii/quark/content/building/module/WoodenPostsModule.java index cbe1977734..935feced27 100644 --- a/src/main/java/vazkii/quark/content/building/module/WoodenPostsModule.java +++ b/src/main/java/vazkii/quark/content/building/module/WoodenPostsModule.java @@ -13,7 +13,6 @@ import net.minecraftforge.common.ToolActions; import vazkii.quark.base.Quark; import vazkii.quark.base.handler.ToolInteractionHandler; -import vazkii.quark.base.module.ModuleLoader; import vazkii.quark.base.util.VanillaWoods; import vazkii.quark.base.util.VanillaWoods.Wood; import vazkii.quark.content.building.block.WoodPostBlock; @@ -48,7 +47,7 @@ public final void setup(ZCommonSetup event) { public static boolean canLanternConnect(BlockState state, LevelReader worldIn, BlockPos pos, boolean prev) { return prev || - (ModuleLoader.INSTANCE.isModuleEnabled(WoodenPostsModule.class) + (Quark.ZETA.modules.isEnabled(WoodenPostsModule.class) && state.getValue(LanternBlock.HANGING) && worldIn.getBlockState(pos.above()).getBlock() instanceof WoodPostBlock); } diff --git a/src/main/java/vazkii/quark/content/management/module/AutomaticToolRestockModule.java b/src/main/java/vazkii/quark/content/management/module/AutomaticToolRestockModule.java index e4f72b5a23..ac68595212 100644 --- a/src/main/java/vazkii/quark/content/management/module/AutomaticToolRestockModule.java +++ b/src/main/java/vazkii/quark/content/management/module/AutomaticToolRestockModule.java @@ -17,7 +17,7 @@ import net.minecraftforge.items.wrapper.PlayerInvWrapper; import vazkii.quark.addons.oddities.module.BackpackModule; import vazkii.quark.api.event.GatherToolClassesEvent; -import vazkii.quark.base.module.ModuleLoader; +import vazkii.quark.base.Quark; import vazkii.quark.base.module.config.Config; import vazkii.quark.base.module.sync.SyncedFlagHandler; import vazkii.quark.base.util.InventoryIIH; @@ -127,7 +127,7 @@ public void onToolBreak(ZPlayerDestroyItem event) { int upper = player.getInventory().items.size(); boolean foundInInv = crawlInventory(new PlayerInvWrapper(player.getInventory()), lower, upper, ctx); - if (!foundInInv && ModuleLoader.INSTANCE.isModuleEnabled(BackpackModule.class)) { + if (!foundInInv && Quark.ZETA.modules.isEnabled(BackpackModule.class)) { ItemStack backpack = player.getInventory().armor.get(2); if (backpack.getItem() == BackpackModule.backpack) { diff --git a/src/main/java/vazkii/quark/content/management/module/ItemSharingModule.java b/src/main/java/vazkii/quark/content/management/module/ItemSharingModule.java index f67e846410..8ae4dd353b 100755 --- a/src/main/java/vazkii/quark/content/management/module/ItemSharingModule.java +++ b/src/main/java/vazkii/quark/content/management/module/ItemSharingModule.java @@ -29,7 +29,8 @@ import net.minecraft.world.level.block.Blocks; import net.minecraftforge.client.ForgeHooksClient; import org.lwjgl.glfw.GLFW; -import vazkii.quark.base.module.ModuleLoader; + +import vazkii.quark.base.Quark; import vazkii.quark.base.module.config.Config; import vazkii.quark.base.network.QuarkNetwork; import vazkii.quark.base.network.message.ShareItemMessage; @@ -103,7 +104,7 @@ public boolean click() { } public static void shareItem(ServerPlayer player, String message, ItemStack stack, Instant timeStamp, long salt, MessageSignature signature, boolean signedPreview, LastSeenMessages.Update lastSeenMessages) { - if (!ModuleLoader.INSTANCE.isModuleEnabled(ItemSharingModule.class)) + if (!Quark.ZETA.modules.isEnabled(ItemSharingModule.class)) return; Component itemComp = stack.getDisplayName(); @@ -114,7 +115,7 @@ public static void shareItem(ServerPlayer player, String message, ItemStack stac } public static MutableComponent createStackComponent(ItemStack stack, MutableComponent component) { - if (!ModuleLoader.INSTANCE.isModuleEnabled(ItemSharingModule.class) || !renderItemsInChat) + if (!Quark.ZETA.modules.isEnabled(ItemSharingModule.class) || !renderItemsInChat) return component; Style style = component.getStyle(); @@ -133,7 +134,7 @@ public static MutableComponent createStackComponent(ItemStack stack, MutableComp @ZetaLoadModule(clientReplacement = true) public static class Client extends ItemSharingModule { public static void renderItemForMessage(PoseStack poseStack, FormattedCharSequence sequence, float x, float y, int color) { - if (!ModuleLoader.INSTANCE.isModuleEnabled(ItemSharingModule.class) || !renderItemsInChat) + if (!Quark.ZETA.modules.isEnabled(ItemSharingModule.class) || !renderItemsInChat) return; Minecraft mc = Minecraft.getInstance(); diff --git a/src/main/java/vazkii/quark/content/mobs/entity/Forgotten.java b/src/main/java/vazkii/quark/content/mobs/entity/Forgotten.java index 8ba101ab93..576d27e055 100644 --- a/src/main/java/vazkii/quark/content/mobs/entity/Forgotten.java +++ b/src/main/java/vazkii/quark/content/mobs/entity/Forgotten.java @@ -48,8 +48,8 @@ import net.minecraft.world.level.ServerLevelAccessor; import net.minecraftforge.network.NetworkHooks; import vazkii.zeta.util.ItemNBTHelper; +import vazkii.quark.base.Quark; import vazkii.quark.base.handler.MiscUtil; -import vazkii.quark.base.module.ModuleLoader; import vazkii.quark.content.mobs.module.ForgottenModule; import vazkii.quark.content.tools.module.ColorRunesModule; @@ -175,7 +175,7 @@ public void prepareEquipment() { EnchantmentHelper.enchantItem(random, bow, 20, false); EnchantmentHelper.enchantItem(random, sheathed, 20, false); - if(ModuleLoader.INSTANCE.isModuleEnabled(ColorRunesModule.class) && random.nextBoolean()) { + if(Quark.ZETA.modules.isEnabled(ColorRunesModule.class) && random.nextBoolean()) { List items = MiscUtil.getTagValues(level.registryAccess(), ColorRunesModule.runesLootableTag); if (!items.isEmpty()) { ItemStack item = new ItemStack(items.get(random.nextInt(items.size()))); diff --git a/src/main/java/vazkii/quark/content/mobs/entity/Stoneling.java b/src/main/java/vazkii/quark/content/mobs/entity/Stoneling.java index ba4dfadee1..de5d4229e3 100755 --- a/src/main/java/vazkii/quark/content/mobs/entity/Stoneling.java +++ b/src/main/java/vazkii/quark/content/mobs/entity/Stoneling.java @@ -71,7 +71,6 @@ import vazkii.quark.base.Quark; import vazkii.quark.base.handler.MiscUtil; import vazkii.quark.base.handler.QuarkSounds; -import vazkii.quark.base.module.ModuleLoader; import vazkii.quark.base.util.IfFlagGoal; import vazkii.quark.content.mobs.ai.ActWaryGoal; import vazkii.quark.content.mobs.ai.FavorBlockGoal; @@ -126,7 +125,7 @@ protected void registerGoals() { } private TagKey temptTag() { - return ModuleLoader.INSTANCE.isModuleEnabled(GlimmeringWealdModule.class) ? GlimmeringWealdModule.glowShroomFeedablesTag : Tags.Items.GEMS_DIAMOND; + return Quark.ZETA.modules.isEnabled(GlimmeringWealdModule.class) ? GlimmeringWealdModule.glowShroomFeedablesTag : Tags.Items.GEMS_DIAMOND; } public static AttributeSupplier.Builder prepareAttributes() { diff --git a/src/main/java/vazkii/quark/content/tools/item/PathfindersQuillItem.java b/src/main/java/vazkii/quark/content/tools/item/PathfindersQuillItem.java index d6d9732ad8..279f04cf05 100644 --- a/src/main/java/vazkii/quark/content/tools/item/PathfindersQuillItem.java +++ b/src/main/java/vazkii/quark/content/tools/item/PathfindersQuillItem.java @@ -26,10 +26,10 @@ import net.minecraft.world.phys.Vec3; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import vazkii.quark.base.Quark; import vazkii.quark.base.QuarkClient; import vazkii.zeta.util.ItemNBTHelper; import vazkii.quark.base.item.QuarkItem; -import vazkii.quark.base.module.ModuleLoader; import vazkii.zeta.module.ZetaModule; import vazkii.quark.content.mobs.module.StonelingsModule; import vazkii.quark.content.tools.module.PathfinderMapsModule; @@ -383,8 +383,8 @@ public void fillItemCategory(CreativeModeTab group, NonNullList items items.add(forBiome(trade.biome.toString(), trade.color)); } if (!generatedWeald && - ModuleLoader.INSTANCE.isModuleEnabled(StonelingsModule.class) && - ModuleLoader.INSTANCE.isModuleEnabled(GlimmeringWealdModule.class) && + Quark.ZETA.modules.isEnabled(StonelingsModule.class) && + Quark.ZETA.modules.isEnabled(GlimmeringWealdModule.class) && StonelingsModule.wealdPathfinderMaps) { items.add(forBiome(GlimmeringWealdModule.BIOME_NAME.toString(), 0x317546)); } diff --git a/src/main/java/vazkii/quark/content/tools/item/SeedPouchItem.java b/src/main/java/vazkii/quark/content/tools/item/SeedPouchItem.java index 136219e6bd..a3a79c5dbe 100644 --- a/src/main/java/vazkii/quark/content/tools/item/SeedPouchItem.java +++ b/src/main/java/vazkii/quark/content/tools/item/SeedPouchItem.java @@ -31,7 +31,6 @@ import vazkii.quark.api.IUsageTickerOverride; import vazkii.quark.base.handler.MiscUtil; import vazkii.quark.base.item.QuarkItem; -import vazkii.quark.base.module.ModuleLoader; import vazkii.zeta.module.ZetaModule; import vazkii.quark.content.tools.module.SeedPouchModule; diff --git a/src/main/java/vazkii/quark/content/tools/module/AncientTomesModule.java b/src/main/java/vazkii/quark/content/tools/module/AncientTomesModule.java index 5b8ec3d4b2..a5a2638cba 100644 --- a/src/main/java/vazkii/quark/content/tools/module/AncientTomesModule.java +++ b/src/main/java/vazkii/quark/content/tools/module/AncientTomesModule.java @@ -42,7 +42,6 @@ import vazkii.quark.base.handler.MiscUtil; import vazkii.quark.base.handler.advancement.QuarkAdvancementHandler; import vazkii.quark.base.handler.advancement.QuarkGenericTrigger; -import vazkii.quark.base.module.ModuleLoader; import vazkii.quark.base.module.config.Config; import vazkii.quark.content.tools.item.AncientTomeItem; import vazkii.quark.content.tools.loot.EnchantTome; @@ -361,7 +360,7 @@ public void attachRuneCapability(ZAttachCapabilities.ItemStackCaps event) { } public static Rarity shiftRarity(ItemStack itemStack, Rarity returnValue) { - return ModuleLoader.INSTANCE.isModuleEnabled(AncientTomesModule.class) && overleveledBooksGlowRainbow && + return Quark.ZETA.modules.isEnabled(AncientTomesModule.class) && overleveledBooksGlowRainbow && itemStack.getItem() == Items.ENCHANTED_BOOK && isOverlevel(itemStack) ? Rarity.EPIC : returnValue; } diff --git a/src/main/java/vazkii/quark/content/tools/module/BeaconRedirectionModule.java b/src/main/java/vazkii/quark/content/tools/module/BeaconRedirectionModule.java index 39c3a5c6a1..27221369a6 100644 --- a/src/main/java/vazkii/quark/content/tools/module/BeaconRedirectionModule.java +++ b/src/main/java/vazkii/quark/content/tools/module/BeaconRedirectionModule.java @@ -19,9 +19,9 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.phys.AABB; +import vazkii.quark.base.Quark; import vazkii.quark.base.handler.advancement.QuarkAdvancementHandler; import vazkii.quark.base.handler.advancement.QuarkGenericTrigger; -import vazkii.quark.base.module.ModuleLoader; import vazkii.quark.base.module.config.Config; import vazkii.quark.content.world.block.CorundumClusterBlock; import vazkii.quark.content.world.module.CorundumModule; @@ -70,7 +70,7 @@ public void addAdditionalHints(ZGatherHints consumer) { final String redirectHint = "beacon_redirect_item"; String type = "amethyst"; - if(!ModuleLoader.INSTANCE.isModuleEnabled(CorundumModule.class)) + if(!Quark.ZETA.modules.isEnabled(CorundumModule.class)) consumer.hintItem(Items.AMETHYST_CLUSTER, redirectHint); else type = "corundum"; diff --git a/src/main/java/vazkii/quark/content/tweaks/module/HoeHarvestingModule.java b/src/main/java/vazkii/quark/content/tweaks/module/HoeHarvestingModule.java index 8430d785b2..edc3b3fc09 100644 --- a/src/main/java/vazkii/quark/content/tweaks/module/HoeHarvestingModule.java +++ b/src/main/java/vazkii/quark/content/tweaks/module/HoeHarvestingModule.java @@ -26,7 +26,6 @@ import net.minecraftforge.common.ToolActions; import vazkii.quark.base.Quark; import vazkii.quark.base.handler.MiscUtil; -import vazkii.quark.base.module.ModuleLoader; import vazkii.quark.base.module.config.Config; import vazkii.zeta.event.ZBlock; import vazkii.zeta.event.ZCommonSetup; @@ -56,7 +55,7 @@ public class HoeHarvestingModule extends ZetaModule { public static TagKey bigHarvestingHoesTag; public static int getRange(ItemStack hoe) { - if(!ModuleLoader.INSTANCE.isModuleEnabled(HoeHarvestingModule.class)) + if(!Quark.ZETA.modules.isEnabled(HoeHarvestingModule.class)) return 1; if(!isHoe(hoe)) diff --git a/src/main/java/vazkii/quark/content/tweaks/module/LockRotationModule.java b/src/main/java/vazkii/quark/content/tweaks/module/LockRotationModule.java index 7f8359936d..82f1bb0d01 100644 --- a/src/main/java/vazkii/quark/content/tweaks/module/LockRotationModule.java +++ b/src/main/java/vazkii/quark/content/tweaks/module/LockRotationModule.java @@ -30,9 +30,9 @@ import net.minecraft.world.phys.Vec3; import org.lwjgl.opengl.GL11; import vazkii.quark.api.IRotationLockable; +import vazkii.quark.base.Quark; import vazkii.quark.base.QuarkClient; import vazkii.quark.base.handler.MiscUtil; -import vazkii.quark.base.module.ModuleLoader; import vazkii.quark.base.network.QuarkNetwork; import vazkii.quark.base.network.message.SetLockProfileMessage; import vazkii.quark.content.building.block.QuarkVerticalSlabBlock; @@ -65,7 +65,7 @@ public final void configChanged(ZConfigChanged event) { } public static BlockState fixBlockRotation(BlockState state, BlockPlaceContext ctx) { - if(state == null || ctx.getPlayer() == null || !ModuleLoader.INSTANCE.isModuleEnabled(LockRotationModule.class)) + if(state == null || ctx.getPlayer() == null || !Quark.ZETA.modules.isEnabled(LockRotationModule.class)) return state; UUID uuid = ctx.getPlayer().getUUID(); diff --git a/src/main/java/vazkii/quark/content/tweaks/module/PigLittersModule.java b/src/main/java/vazkii/quark/content/tweaks/module/PigLittersModule.java index e3c1a1d2c9..430273e2f1 100644 --- a/src/main/java/vazkii/quark/content/tweaks/module/PigLittersModule.java +++ b/src/main/java/vazkii/quark/content/tweaks/module/PigLittersModule.java @@ -17,8 +17,8 @@ import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.Level; +import vazkii.quark.base.Quark; import vazkii.quark.base.handler.MiscUtil; -import vazkii.quark.base.module.ModuleLoader; import vazkii.quark.base.module.config.Config; import vazkii.zeta.event.ZBabyEntitySpawn; import vazkii.zeta.event.ZEntityJoinLevel; @@ -50,7 +50,7 @@ public class PigLittersModule extends ZetaModule { public static int maxGoldenCarrotBoost = 2; public static boolean canEat(ItemStack stack) { - return ModuleLoader.INSTANCE.isModuleEnabled(PigLittersModule.class) && pigsEatGoldenCarrots && stack.is(Items.GOLDEN_CARROT); + return Quark.ZETA.modules.isEnabled(PigLittersModule.class) && pigsEatGoldenCarrots && stack.is(Items.GOLDEN_CARROT); } public static void onEat(Animal animal, ItemStack stack) { diff --git a/src/main/java/vazkii/quark/content/tweaks/module/SpongesBetterModule.java b/src/main/java/vazkii/quark/content/tweaks/module/SpongesBetterModule.java index 0366215608..d3edcaaf87 100644 --- a/src/main/java/vazkii/quark/content/tweaks/module/SpongesBetterModule.java +++ b/src/main/java/vazkii/quark/content/tweaks/module/SpongesBetterModule.java @@ -1,6 +1,6 @@ package vazkii.quark.content.tweaks.module; -import vazkii.quark.base.module.ModuleLoader; +import vazkii.quark.base.Quark; import vazkii.zeta.module.ZetaLoadModule; import vazkii.zeta.module.ZetaModule; import vazkii.quark.base.module.config.Config; @@ -17,7 +17,7 @@ public class SpongesBetterModule extends ZetaModule { public static int maximumCrawlDistance = 10; public static int drainLimit(int previous) { - if (ModuleLoader.INSTANCE.isModuleEnabled(SpongesBetterModule.class)) { + if (Quark.ZETA.modules.isEnabled(SpongesBetterModule.class)) { // Additive to not directly conflict with other mods return maximumWaterDrain - 64 + previous; } @@ -25,7 +25,7 @@ public static int drainLimit(int previous) { } public static int crawlLimit(int previous) { - if (ModuleLoader.INSTANCE.isModuleEnabled(SpongesBetterModule.class)) { + if (Quark.ZETA.modules.isEnabled(SpongesBetterModule.class)) { // Additive to not directly conflict with other mods return maximumCrawlDistance - 6 + previous; } diff --git a/src/main/java/vazkii/quark/content/world/block/CorundumBlock.java b/src/main/java/vazkii/quark/content/world/block/CorundumBlock.java index 45ec48c7d0..80acbb0660 100644 --- a/src/main/java/vazkii/quark/content/world/block/CorundumBlock.java +++ b/src/main/java/vazkii/quark/content/world/block/CorundumBlock.java @@ -19,8 +19,8 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.MaterialColor; +import vazkii.quark.base.Quark; import vazkii.quark.base.block.QuarkGlassBlock; -import vazkii.quark.base.module.ModuleLoader; import vazkii.zeta.module.ZetaModule; import vazkii.quark.content.world.module.CorundumModule; import vazkii.quark.content.world.module.SpiralSpiresModule; @@ -70,7 +70,7 @@ public void tick(@Nonnull BlockState state, @Nonnull ServerLevel worldIn, @Nonnu BlockPos up = pos.above(); worldIn.setBlockAndUpdate(up, state); - if(down.getBlock() == SpiralSpiresModule.myalite_crystal && ModuleLoader.INSTANCE.isModuleEnabled(SpiralSpiresModule.class) && SpiralSpiresModule.renewableMyalite) + if(down.getBlock() == SpiralSpiresModule.myalite_crystal && Quark.ZETA.modules.isEnabled(SpiralSpiresModule.class) && SpiralSpiresModule.renewableMyalite) worldIn.setBlockAndUpdate(pos, SpiralSpiresModule.myalite_crystal.defaultBlockState()); else for(Direction d : Direction.values()) { BlockPos offPos = up.relative(d); diff --git a/src/main/java/vazkii/quark/content/world/gen/ObsidianSpikeGenerator.java b/src/main/java/vazkii/quark/content/world/gen/ObsidianSpikeGenerator.java index f69d9a61d7..3875437125 100644 --- a/src/main/java/vazkii/quark/content/world/gen/ObsidianSpikeGenerator.java +++ b/src/main/java/vazkii/quark/content/world/gen/ObsidianSpikeGenerator.java @@ -13,8 +13,8 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.material.Material; +import vazkii.quark.base.Quark; import vazkii.quark.base.handler.MiscUtil; -import vazkii.quark.base.module.ModuleLoader; import vazkii.quark.base.module.config.type.DimensionConfig; import vazkii.quark.base.world.generator.Generator; import vazkii.quark.content.building.module.CompressedBlocksModule; @@ -91,7 +91,7 @@ public static void placeSpikeAt(LevelAccessor world, BlockPos pos, RandomSource world.setBlock(placePos, obsidian, 0); if(addSpawner && i == 0) { - boolean useBlazeLantern = ModuleLoader.INSTANCE.isModuleEnabled(CompressedBlocksModule.class) && CompressedBlocksModule.enableBlazeLantern; + boolean useBlazeLantern = Quark.ZETA.modules.isEnabled(CompressedBlocksModule.class) && CompressedBlocksModule.enableBlazeLantern; world.setBlock(placePos, useBlazeLantern ? CompressedBlocksModule.blaze_lantern.defaultBlockState() : Blocks.GLOWSTONE.defaultBlockState(), 0); placePos = placePos.below(); diff --git a/src/main/java/vazkii/quark/content/world/module/CorundumModule.java b/src/main/java/vazkii/quark/content/world/module/CorundumModule.java index 69313cc2e1..576bb41e09 100644 --- a/src/main/java/vazkii/quark/content/world/module/CorundumModule.java +++ b/src/main/java/vazkii/quark/content/world/module/CorundumModule.java @@ -16,7 +16,6 @@ import vazkii.quark.base.Quark; import vazkii.quark.base.block.QuarkInheritedPaneBlock; import vazkii.quark.base.handler.ToolInteractionHandler; -import vazkii.quark.base.module.ModuleLoader; import vazkii.quark.base.module.config.Config; import vazkii.quark.base.util.CorundumColor; import vazkii.quark.content.tools.module.BeaconRedirectionModule; @@ -94,7 +93,7 @@ public final void mySetup(ZCommonSetup event) { public void addAdditionalHints(ZGatherHints consumer) { MutableComponent comp = Component.translatable("quark.jei.hint.corundum_cluster_grow"); - if(ModuleLoader.INSTANCE.isModuleEnabled(BeaconRedirectionModule.class)) + if(Quark.ZETA.modules.isEnabled(BeaconRedirectionModule.class)) comp = comp.append(" ").append(Component.translatable("quark.jei.hint.corundum_cluster_redirect")); for(Block block : clusters) diff --git a/src/main/java/vazkii/quark/content/world/module/GlimmeringWealdModule.java b/src/main/java/vazkii/quark/content/world/module/GlimmeringWealdModule.java index b57dfc0412..f5febd2622 100644 --- a/src/main/java/vazkii/quark/content/world/module/GlimmeringWealdModule.java +++ b/src/main/java/vazkii/quark/content/world/module/GlimmeringWealdModule.java @@ -38,7 +38,6 @@ import vazkii.quark.base.handler.VariantHandler; import vazkii.quark.base.handler.advancement.QuarkAdvancementHandler; import vazkii.quark.base.handler.advancement.mod.AdventuringTimeModifier; -import vazkii.quark.base.module.ModuleLoader; import vazkii.quark.base.module.config.Config; import vazkii.quark.content.mobs.module.StonelingsModule; import vazkii.quark.content.world.block.GlowLichenGrowthBlock; @@ -149,7 +148,7 @@ private static Biome makeBiome() { MobSpawnSettings.Builder mobs = new MobSpawnSettings.Builder(); BiomeDefaultFeatures.commonSpawns(mobs); - if(ModuleLoader.INSTANCE.isModuleEnabled(StonelingsModule.class)) + if(Quark.ZETA.modules.isEnabled(StonelingsModule.class)) mobs.addSpawn(MobCategory.CREATURE, new MobSpawnSettings.SpawnerData(StonelingsModule.stonelingType, 200, 1, 4)); mobs.addSpawn(MobCategory.UNDERGROUND_WATER_CREATURE, new MobSpawnSettings.SpawnerData(EntityType.GLOW_SQUID, 20, 4, 6)); diff --git a/src/main/java/vazkii/quark/content/world/module/NewStoneTypesModule.java b/src/main/java/vazkii/quark/content/world/module/NewStoneTypesModule.java index 05c402b6a7..1b559cfc38 100644 --- a/src/main/java/vazkii/quark/content/world/module/NewStoneTypesModule.java +++ b/src/main/java/vazkii/quark/content/world/module/NewStoneTypesModule.java @@ -21,11 +21,11 @@ import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; +import vazkii.quark.base.Quark; import vazkii.quark.base.block.IQuarkBlock; import vazkii.quark.base.block.QuarkBlock; import vazkii.quark.base.block.QuarkBlockWrapper; import vazkii.quark.base.handler.VariantHandler; -import vazkii.quark.base.module.ModuleLoader; import vazkii.quark.content.world.block.MyaliteColorLogic; import vazkii.zeta.client.event.ZAddBlockColorHandlers; import vazkii.zeta.client.event.ZAddItemColorHandlers; @@ -82,7 +82,7 @@ public static Block makeStone(ZetaModule module, String name, StoneTypeConfig co } public static Block makeStone(ZetaModule module, final Block raw, String name, StoneTypeConfig config, BigStoneClusterConfig bigConfig, BooleanSupplier enabledCond, MaterialColor color, QuarkBlock.Constructor constr) { - BooleanSupplier trueEnabledCond = () -> (bigConfig == null || !bigConfig.enabled || !ModuleLoader.INSTANCE.isModuleEnabled(BigStoneClustersModule.class)) && enabledCond.getAsBoolean(); + BooleanSupplier trueEnabledCond = () -> (bigConfig == null || !bigConfig.enabled || !Quark.ZETA.modules.isEnabled(BigStoneClustersModule.class)) && enabledCond.getAsBoolean(); Block.Properties props; if(raw != null) diff --git a/src/main/java/vazkii/quark/content/world/module/SpiralSpiresModule.java b/src/main/java/vazkii/quark/content/world/module/SpiralSpiresModule.java index e5d545ced2..517b682d0a 100644 --- a/src/main/java/vazkii/quark/content/world/module/SpiralSpiresModule.java +++ b/src/main/java/vazkii/quark/content/world/module/SpiralSpiresModule.java @@ -16,10 +16,10 @@ import net.minecraft.world.level.levelgen.GenerationStep.Decoration; import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.MaterialColor; +import vazkii.quark.base.Quark; import vazkii.quark.base.block.QuarkBlock; import vazkii.quark.base.handler.advancement.QuarkAdvancementHandler; import vazkii.quark.base.handler.advancement.QuarkGenericTrigger; -import vazkii.quark.base.module.ModuleLoader; import vazkii.quark.base.module.config.Config; import vazkii.quark.base.module.config.Config.Max; import vazkii.quark.base.module.config.Config.Min; @@ -93,7 +93,7 @@ public void addAdditionalHints(ZGatherHints consumer) { if(enableMyaliteViaducts) comp = comp.append(" ").append(Component.translatable("quark.jei.hint.myalite_crystal_viaduct")); - if(renewableMyalite && ModuleLoader.INSTANCE.isModuleEnabled(CorundumModule.class)) + if(renewableMyalite && Quark.ZETA.modules.isEnabled(CorundumModule.class)) comp = comp.append(" ").append(Component.translatable("quark.jei.hint.myalite_crystal_grow")); consumer.accept(myalite_crystal.asItem(), comp); diff --git a/src/main/java/vazkii/quark/integration/jei/QuarkJeiPlugin.java b/src/main/java/vazkii/quark/integration/jei/QuarkJeiPlugin.java index 2f167eef25..85329391ed 100644 --- a/src/main/java/vazkii/quark/integration/jei/QuarkJeiPlugin.java +++ b/src/main/java/vazkii/quark/integration/jei/QuarkJeiPlugin.java @@ -1,6 +1,17 @@ package vazkii.quark.integration.jei; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import javax.annotation.Nonnull; + import com.google.common.collect.Sets; + import mezz.jei.api.IModPlugin; import mezz.jei.api.JeiPlugin; import mezz.jei.api.constants.RecipeTypes; @@ -10,7 +21,13 @@ import mezz.jei.api.recipe.RecipeType; import mezz.jei.api.recipe.vanilla.IJeiAnvilRecipe; import mezz.jei.api.recipe.vanilla.IVanillaRecipeFactory; -import mezz.jei.api.registration.*; +import mezz.jei.api.registration.IGuiHandlerRegistration; +import mezz.jei.api.registration.IRecipeCatalystRegistration; +import mezz.jei.api.registration.IRecipeCategoryRegistration; +import mezz.jei.api.registration.IRecipeRegistration; +import mezz.jei.api.registration.IRecipeTransferRegistration; +import mezz.jei.api.registration.ISubtypeRegistration; +import mezz.jei.api.registration.IVanillaCategoryExtensionRegistration; import mezz.jei.api.runtime.IJeiRuntime; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.Rect2i; @@ -21,7 +38,14 @@ import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.RandomSource; -import net.minecraft.world.item.*; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.item.EnchantedBookItem; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.PotionItem; +import net.minecraft.world.item.TippedArrowItem; import net.minecraft.world.item.alchemy.Potion; import net.minecraft.world.item.alchemy.PotionUtils; import net.minecraft.world.item.enchantment.Enchantment; @@ -30,9 +54,6 @@ import net.minecraft.world.item.enchantment.Enchantments; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; -import vazkii.zeta.event.ZGatherHints; -import vazkii.zeta.module.IDisableable; -import vazkii.zeta.util.ItemNBTHelper; import vazkii.quark.addons.oddities.block.be.MatrixEnchantingTableBlockEntity; import vazkii.quark.addons.oddities.client.screen.BackpackInventoryScreen; import vazkii.quark.addons.oddities.client.screen.CrateScreen; @@ -43,7 +64,6 @@ import vazkii.quark.base.handler.GeneralConfig; import vazkii.quark.base.handler.MiscUtil; import vazkii.quark.base.item.QuarkItem; -import vazkii.quark.base.module.ModuleLoader; import vazkii.quark.content.building.module.VariantFurnacesModule; import vazkii.quark.content.client.module.ImprovedTooltipsModule; import vazkii.quark.content.client.tooltip.EnchantedBookTooltips; @@ -54,13 +74,11 @@ import vazkii.quark.content.tweaks.module.DiamondRepairModule; import vazkii.quark.content.tweaks.recipe.ElytraDuplicationRecipe; import vazkii.quark.content.tweaks.recipe.SlabToBlockRecipe; +import vazkii.zeta.event.ZGatherHints; +import vazkii.zeta.module.IDisableable; +import vazkii.zeta.util.ItemNBTHelper; import vazkii.zeta.util.RegistryUtil; -import javax.annotation.Nonnull; -import java.util.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; - @JeiPlugin public class QuarkJeiPlugin implements IModPlugin { private static final ResourceLocation UID = new ResourceLocation(Quark.MOD_ID, Quark.MOD_ID); @@ -86,7 +104,7 @@ public void onRuntimeAvailable(@Nonnull final IJeiRuntime jeiRuntime) { jeiRuntime.getIngredientManager().removeIngredientsAtRuntime(VanillaTypes.ITEM_STACK, disabledItems); Quark.ZETA.configManager.setJeiReloadListener(configInternals -> { - if(ModuleLoader.INSTANCE.isModuleEnabled(DiamondRepairModule.class)) + if(Quark.ZETA.modules.isEnabled(DiamondRepairModule.class)) Minecraft.getInstance().submitAsync(() -> hideAnvilRepairRecipes(jeiRuntime.getRecipeManager())); if(!GeneralConfig.hideDisabledContent) @@ -128,7 +146,7 @@ public void registerVanillaCategoryExtensions(@Nonnull IVanillaCategoryExtension } private boolean matrix() { - return ModuleLoader.INSTANCE.isModuleEnabled(MatrixEnchantingModule.class) && MatrixEnchantingModule.allowInfluencing && !MatrixEnchantingModule.candleInfluencingFailed; + return Quark.ZETA.modules.isEnabled(MatrixEnchantingModule.class) && MatrixEnchantingModule.allowInfluencing && !MatrixEnchantingModule.candleInfluencingFailed; } @Override @@ -141,21 +159,21 @@ public void registerCategories(@Nonnull IRecipeCategoryRegistration registration public void registerRecipes(@Nonnull IRecipeRegistration registration) { IVanillaRecipeFactory factory = registration.getVanillaRecipeFactory(); - if (ModuleLoader.INSTANCE.isModuleEnabled(AncientTomesModule.class)) + if (Quark.ZETA.modules.isEnabled(AncientTomesModule.class)) registerAncientTomeAnvilRecipes(registration, factory); - if (ModuleLoader.INSTANCE.isModuleEnabled(PickarangModule.class)) { + if (Quark.ZETA.modules.isEnabled(PickarangModule.class)) { registerPickarangAnvilRepairs(PickarangModule.pickarang, Items.DIAMOND, registration, factory); registerPickarangAnvilRepairs(PickarangModule.flamerang, Items.NETHERITE_INGOT, registration, factory); } - if (ModuleLoader.INSTANCE.isModuleEnabled(ColorRunesModule.class)) + if (Quark.ZETA.modules.isEnabled(ColorRunesModule.class)) registerRuneAnvilRecipes(registration, factory); if (matrix()) registerInfluenceRecipes(registration); - if(ModuleLoader.INSTANCE.isModuleEnabled(DiamondRepairModule.class)) + if(Quark.ZETA.modules.isEnabled(DiamondRepairModule.class)) registerCustomAnvilRecipes(registration, factory); if(GeneralConfig.enableJeiItemInfo) { @@ -180,7 +198,7 @@ public void registerRecipes(@Nonnull IRecipeRegistration registration) { @Override public void registerRecipeCatalysts(@Nonnull IRecipeCatalystRegistration registration) { - if(ModuleLoader.INSTANCE.isModuleEnabled(VariantFurnacesModule.class)) { + if(Quark.ZETA.modules.isEnabled(VariantFurnacesModule.class)) { registration.addRecipeCatalyst(new ItemStack(VariantFurnacesModule.deepslateFurnace), RecipeTypes.FUELING, RecipeTypes.SMELTING); registration.addRecipeCatalyst(new ItemStack(VariantFurnacesModule.blackstoneFurnace), RecipeTypes.FUELING, RecipeTypes.SMELTING); } @@ -218,7 +236,7 @@ private void registerAncientTomeAnvilRecipes(@Nonnull IRecipeRegistration regist private void registerRuneAnvilRecipes(@Nonnull IRecipeRegistration registration, @Nonnull IVanillaRecipeFactory factory) { RandomSource random = RandomSource.create(); Stream displayItems; - if (ModuleLoader.INSTANCE.isModuleEnabled(ImprovedTooltipsModule.class) && ImprovedTooltipsModule.enchantingTooltips) { + if (Quark.ZETA.modules.isEnabled(ImprovedTooltipsModule.class) && ImprovedTooltipsModule.enchantingTooltips) { displayItems = EnchantedBookTooltips.getTestItems().stream(); } else { displayItems = Stream.of(Items.DIAMOND_SWORD, Items.DIAMOND_PICKAXE, Items.DIAMOND_AXE, diff --git a/src/main/java/vazkii/zeta/module/ZetaModuleManager.java b/src/main/java/vazkii/zeta/module/ZetaModuleManager.java index a14743cbe9..f6650ff49b 100644 --- a/src/main/java/vazkii/zeta/module/ZetaModuleManager.java +++ b/src/main/java/vazkii/zeta/module/ZetaModuleManager.java @@ -11,8 +11,9 @@ import java.util.Map; import java.util.Optional; -import net.minecraftforge.fml.loading.FMLEnvironment; import org.jetbrains.annotations.Nullable; + +import net.minecraftforge.fml.loading.FMLEnvironment; import vazkii.quark.base.module.LoadModule; import vazkii.zeta.Zeta; import vazkii.zeta.event.ZModulesReady; @@ -54,6 +55,11 @@ public Optional getOptional(Class keyClass) { public boolean isEnabled(Class keyClass) { return get(keyClass).enabled; } + + public boolean isEnabledOrOverlapping(Class keyClass) { + ZetaModule module = get(keyClass); + return module.enabled || module.disabledByOverlap; + } // Categories //