Skip to content

Commit

Permalink
Quark ModuleLoader is kil
Browse files Browse the repository at this point in the history
  • Loading branch information
Vazkii committed Nov 8, 2023
1 parent 581fd28 commit 6b0f890
Show file tree
Hide file tree
Showing 31 changed files with 137 additions and 129 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)) {
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/vazkii/quark/base/handler/SortingHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand Down Expand Up @@ -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;
Expand Down
63 changes: 44 additions & 19 deletions src/main/java/vazkii/quark/base/handler/WoodSetHandler.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand All @@ -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 {

Expand Down Expand Up @@ -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);

Expand Down
29 changes: 0 additions & 29 deletions src/main/java/vazkii/quark/base/module/ModuleLoader.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand All @@ -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);
Expand All @@ -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)
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -197,7 +196,7 @@ public void addChest(String name, Supplier<Block.Properties> props) {
}

public static void addChest(String name, ZetaModule module, Supplier<Block.Properties> 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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand Down
Loading

0 comments on commit 6b0f890

Please sign in to comment.