From 178dd6c44e7af7ec9ec9ab4bf8ff67f56f8da4f3 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Sat, 12 Oct 2024 08:37:52 -0400 Subject: [PATCH] address review --- .../gradle/subproject/SubprojectPlugin.kt | 3 --- .../flywheel/lib/model/part/VertexWriter.java | 1 + .../flywheel/impl/FlwImplXplat.java | 4 ++-- .../flywheel/impl/compat/CompatMods.java | 17 +++++++------- .../flywheel/lib/model/baked/MeshEmitter.java | 7 +++--- .../flywheel/impl/FlwImplXplatImpl.java | 8 +++---- .../api/event/ReloadLevelRendererEvent.java | 2 +- .../flywheel/lib/model/baked/MeshEmitter.java | 7 +++--- ...er.java => NeoForgeBakedModelBuilder.java} | 14 ++++++------ ...er.java => NeoForgeBlockModelBuilder.java} | 12 +++++----- ...va => NeoForgeMultiBlockModelBuilder.java} | 12 +++++----- .../flywheel/impl/FlwImplXplatImpl.java | 10 ++++----- .../flywheel/impl/FlwLibXplatImpl.java | 13 ++++++----- ...ywheelForge.java => FlywheelNeoForge.java} | 22 +++++-------------- .../flywheel/impl/mixin/MinecraftMixin.java | 8 ++----- 15 files changed, 58 insertions(+), 82 deletions(-) rename forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/{ForgeBakedModelBuilder.java => NeoForgeBakedModelBuilder.java} (78%) rename forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/{ForgeBlockModelBuilder.java => NeoForgeBlockModelBuilder.java} (79%) rename forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/{ForgeMultiBlockModelBuilder.java => NeoForgeMultiBlockModelBuilder.java} (77%) rename forge/src/main/java/dev/engine_room/flywheel/impl/{FlywheelForge.java => FlywheelNeoForge.java} (89%) diff --git a/buildSrc/src/main/kotlin/dev/engine_room/gradle/subproject/SubprojectPlugin.kt b/buildSrc/src/main/kotlin/dev/engine_room/gradle/subproject/SubprojectPlugin.kt index df66ef78c..0b4756938 100644 --- a/buildSrc/src/main/kotlin/dev/engine_room/gradle/subproject/SubprojectPlugin.kt +++ b/buildSrc/src/main/kotlin/dev/engine_room/gradle/subproject/SubprojectPlugin.kt @@ -89,9 +89,6 @@ class SubprojectPlugin: Plugin { includeGroup("maven.modrinth") } } - flatDir { - dirs = setOf(project.rootProject.file("libs")) - } } } diff --git a/common/src/lib/java/dev/engine_room/flywheel/lib/model/part/VertexWriter.java b/common/src/lib/java/dev/engine_room/flywheel/lib/model/part/VertexWriter.java index ec85caf3b..0b99a3f18 100644 --- a/common/src/lib/java/dev/engine_room/flywheel/lib/model/part/VertexWriter.java +++ b/common/src/lib/java/dev/engine_room/flywheel/lib/model/part/VertexWriter.java @@ -76,6 +76,7 @@ public VertexConsumer setNormal(float x, float y, float z) { public VertexConsumer endVertexIfNeeded() { if (!filledPosition || !filledTexture || !filledNormal) { + // We do not throw here as that matched what vanilla does return this; } diff --git a/common/src/main/java/dev/engine_room/flywheel/impl/FlwImplXplat.java b/common/src/main/java/dev/engine_room/flywheel/impl/FlwImplXplat.java index c1006ce63..f9f91f56e 100644 --- a/common/src/main/java/dev/engine_room/flywheel/impl/FlwImplXplat.java +++ b/common/src/main/java/dev/engine_room/flywheel/impl/FlwImplXplat.java @@ -1,6 +1,6 @@ package dev.engine_room.flywheel.impl; -import java.util.function.Supplier; +import java.util.function.BooleanSupplier; import dev.engine_room.flywheel.api.internal.DependencyInjection; import net.minecraft.client.multiplayer.ClientLevel; @@ -14,5 +14,5 @@ public interface FlwImplXplat { FlwConfig getConfig(); - Supplier getModLoaded(String modId); + BooleanSupplier getModLoaded(String modId); } diff --git a/common/src/main/java/dev/engine_room/flywheel/impl/compat/CompatMods.java b/common/src/main/java/dev/engine_room/flywheel/impl/compat/CompatMods.java index 2ef7f7d03..46a671ea3 100644 --- a/common/src/main/java/dev/engine_room/flywheel/impl/compat/CompatMods.java +++ b/common/src/main/java/dev/engine_room/flywheel/impl/compat/CompatMods.java @@ -1,22 +1,21 @@ package dev.engine_room.flywheel.impl.compat; -import java.util.Locale; -import java.util.function.Supplier; +import java.util.function.BooleanSupplier; import dev.engine_room.flywheel.impl.FlwImplXplat; public enum CompatMods { - SODIUM, - EMBEDDIUM, - IRIS; + SODIUM("sodium"), + EMBEDDIUM("embeddium"), + IRIS("iris"); - private final Supplier isLoaded; + private final BooleanSupplier isLoaded; - CompatMods() { - isLoaded = FlwImplXplat.INSTANCE.getModLoaded(name().toLowerCase(Locale.ROOT)); + CompatMods(String modid) { + isLoaded = FlwImplXplat.INSTANCE.getModLoaded(modid); } public boolean isLoaded() { - return isLoaded.get(); + return isLoaded.getAsBoolean(); } } diff --git a/fabric/src/lib/java/dev/engine_room/flywheel/lib/model/baked/MeshEmitter.java b/fabric/src/lib/java/dev/engine_room/flywheel/lib/model/baked/MeshEmitter.java index db3eb85ba..dd5094466 100644 --- a/fabric/src/lib/java/dev/engine_room/flywheel/lib/model/baked/MeshEmitter.java +++ b/fabric/src/lib/java/dev/engine_room/flywheel/lib/model/baked/MeshEmitter.java @@ -41,11 +41,10 @@ public BufferBuilder getBuffer(boolean shade) { } void prepareForGeometry(boolean shade) { - if (!((BufferBuilderAccessor) bufferBuilder).flywheel$getBuilding()) { - bufferBuilder = new BufferBuilder(byteBufferBuilder, VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK); - } else if (shade != currentShade) { + bufferBuilder = new BufferBuilder(byteBufferBuilder, VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK); + + if (((BufferBuilderAccessor) bufferBuilder).flywheel$getBuilding() && shade != currentShade) { emit(); - bufferBuilder = new BufferBuilder(byteBufferBuilder, VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK); } currentShade = shade; diff --git a/fabric/src/main/java/dev/engine_room/flywheel/impl/FlwImplXplatImpl.java b/fabric/src/main/java/dev/engine_room/flywheel/impl/FlwImplXplatImpl.java index 56a725969..5a75e971d 100644 --- a/fabric/src/main/java/dev/engine_room/flywheel/impl/FlwImplXplatImpl.java +++ b/fabric/src/main/java/dev/engine_room/flywheel/impl/FlwImplXplatImpl.java @@ -1,8 +1,6 @@ package dev.engine_room.flywheel.impl; -import java.util.function.Supplier; - -import com.google.common.base.Suppliers; +import java.util.function.BooleanSupplier; import dev.engine_room.flywheel.api.event.ReloadLevelRendererCallback; import net.fabricmc.loader.api.FabricLoader; @@ -25,7 +23,7 @@ public FlwConfig getConfig() { } @Override - public Supplier getModLoaded(String modId) { - return Suppliers.memoize(() -> FabricLoader.getInstance().isModLoaded(modId)); + public BooleanSupplier getModLoaded(String modId) { + return () -> FabricLoader.getInstance().isModLoaded(modId); } } diff --git a/forge/src/api/java/dev/engine_room/flywheel/api/event/ReloadLevelRendererEvent.java b/forge/src/api/java/dev/engine_room/flywheel/api/event/ReloadLevelRendererEvent.java index 0289dc124..1af467d83 100644 --- a/forge/src/api/java/dev/engine_room/flywheel/api/event/ReloadLevelRendererEvent.java +++ b/forge/src/api/java/dev/engine_room/flywheel/api/event/ReloadLevelRendererEvent.java @@ -4,7 +4,7 @@ import net.neoforged.bus.api.Event; /** - * This event is posted to the Forge event bus. + * This event is posted to the NeoForge event bus. */ public final class ReloadLevelRendererEvent extends Event { private final ClientLevel level; diff --git a/forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/MeshEmitter.java b/forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/MeshEmitter.java index b45845d6f..3426a4947 100644 --- a/forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/MeshEmitter.java +++ b/forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/MeshEmitter.java @@ -44,11 +44,10 @@ public BufferBuilder unwrap(boolean shade) { } void prepareForGeometry(boolean shade) { - if (!((BufferBuilderAccessor) bufferBuilder).flywheel$getBuilding()) { - bufferBuilder = new BufferBuilder(byteBufferBuilder, VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK); - } else if (shade != currentShade) { + bufferBuilder = new BufferBuilder(byteBufferBuilder, VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK); + + if (((BufferBuilderAccessor) bufferBuilder).flywheel$getBuilding() && shade != currentShade) { emit(); - bufferBuilder = new BufferBuilder(byteBufferBuilder, VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK); } currentShade = shade; diff --git a/forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/ForgeBakedModelBuilder.java b/forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/NeoForgeBakedModelBuilder.java similarity index 78% rename from forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/ForgeBakedModelBuilder.java rename to forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/NeoForgeBakedModelBuilder.java index 55bc7929b..b1fd25507 100644 --- a/forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/ForgeBakedModelBuilder.java +++ b/forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/NeoForgeBakedModelBuilder.java @@ -17,39 +17,39 @@ import net.minecraft.world.level.block.state.BlockState; import net.neoforged.neoforge.client.model.data.ModelData; -public final class ForgeBakedModelBuilder extends BakedModelBuilder { +public final class NeoForgeBakedModelBuilder extends BakedModelBuilder { @Nullable private ModelData modelData; - public ForgeBakedModelBuilder(BakedModel bakedModel) { + public NeoForgeBakedModelBuilder(BakedModel bakedModel) { super(bakedModel); } @Override - public ForgeBakedModelBuilder level(BlockAndTintGetter level) { + public NeoForgeBakedModelBuilder level(BlockAndTintGetter level) { super.level(level); return this; } @Override - public ForgeBakedModelBuilder blockState(BlockState blockState) { + public NeoForgeBakedModelBuilder blockState(BlockState blockState) { super.blockState(blockState); return this; } @Override - public ForgeBakedModelBuilder poseStack(PoseStack poseStack) { + public NeoForgeBakedModelBuilder poseStack(PoseStack poseStack) { super.poseStack(poseStack); return this; } @Override - public ForgeBakedModelBuilder materialFunc(BiFunction materialFunc) { + public NeoForgeBakedModelBuilder materialFunc(BiFunction materialFunc) { super.materialFunc(materialFunc); return this; } - public ForgeBakedModelBuilder modelData(ModelData modelData) { + public NeoForgeBakedModelBuilder modelData(ModelData modelData) { this.modelData = modelData; return this; } diff --git a/forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/ForgeBlockModelBuilder.java b/forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/NeoForgeBlockModelBuilder.java similarity index 79% rename from forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/ForgeBlockModelBuilder.java rename to forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/NeoForgeBlockModelBuilder.java index 5e0666dbf..cd90926b3 100644 --- a/forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/ForgeBlockModelBuilder.java +++ b/forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/NeoForgeBlockModelBuilder.java @@ -16,33 +16,33 @@ import net.minecraft.world.level.block.state.BlockState; import net.neoforged.neoforge.client.model.data.ModelData; -public final class ForgeBlockModelBuilder extends BlockModelBuilder { +public final class NeoForgeBlockModelBuilder extends BlockModelBuilder { @Nullable private ModelData modelData; - public ForgeBlockModelBuilder(BlockState state) { + public NeoForgeBlockModelBuilder(BlockState state) { super(state); } @Override - public ForgeBlockModelBuilder level(BlockAndTintGetter level) { + public NeoForgeBlockModelBuilder level(BlockAndTintGetter level) { super.level(level); return this; } @Override - public ForgeBlockModelBuilder poseStack(PoseStack poseStack) { + public NeoForgeBlockModelBuilder poseStack(PoseStack poseStack) { super.poseStack(poseStack); return this; } @Override - public ForgeBlockModelBuilder materialFunc(BiFunction materialFunc) { + public NeoForgeBlockModelBuilder materialFunc(BiFunction materialFunc) { super.materialFunc(materialFunc); return this; } - public ForgeBlockModelBuilder modelData(ModelData modelData) { + public NeoForgeBlockModelBuilder modelData(ModelData modelData) { this.modelData = modelData; return this; } diff --git a/forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/ForgeMultiBlockModelBuilder.java b/forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/NeoForgeMultiBlockModelBuilder.java similarity index 77% rename from forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/ForgeMultiBlockModelBuilder.java rename to forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/NeoForgeMultiBlockModelBuilder.java index e8fd93325..51abbc425 100644 --- a/forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/ForgeMultiBlockModelBuilder.java +++ b/forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/NeoForgeMultiBlockModelBuilder.java @@ -17,33 +17,33 @@ import net.minecraft.world.level.BlockAndTintGetter; import net.neoforged.neoforge.client.model.data.ModelData; -public final class ForgeMultiBlockModelBuilder extends MultiBlockModelBuilder { +public final class NeoForgeMultiBlockModelBuilder extends MultiBlockModelBuilder { @Nullable private Function modelDataLookup; - public ForgeMultiBlockModelBuilder(BlockAndTintGetter level, Iterable positions) { + public NeoForgeMultiBlockModelBuilder(BlockAndTintGetter level, Iterable positions) { super(level, positions); } @Override - public ForgeMultiBlockModelBuilder poseStack(PoseStack poseStack) { + public NeoForgeMultiBlockModelBuilder poseStack(PoseStack poseStack) { super.poseStack(poseStack); return this; } @Override - public ForgeMultiBlockModelBuilder enableFluidRendering() { + public NeoForgeMultiBlockModelBuilder enableFluidRendering() { super.enableFluidRendering(); return this; } @Override - public ForgeMultiBlockModelBuilder materialFunc(BiFunction materialFunc) { + public NeoForgeMultiBlockModelBuilder materialFunc(BiFunction materialFunc) { super.materialFunc(materialFunc); return this; } - public ForgeMultiBlockModelBuilder modelDataLookup(Function modelDataLookup) { + public NeoForgeMultiBlockModelBuilder modelDataLookup(Function modelDataLookup) { this.modelDataLookup = modelDataLookup; return this; } diff --git a/forge/src/main/java/dev/engine_room/flywheel/impl/FlwImplXplatImpl.java b/forge/src/main/java/dev/engine_room/flywheel/impl/FlwImplXplatImpl.java index 2a70b66a4..219cccaf8 100644 --- a/forge/src/main/java/dev/engine_room/flywheel/impl/FlwImplXplatImpl.java +++ b/forge/src/main/java/dev/engine_room/flywheel/impl/FlwImplXplatImpl.java @@ -1,8 +1,6 @@ package dev.engine_room.flywheel.impl; -import java.util.function.Supplier; - -import com.google.common.base.Suppliers; +import java.util.function.BooleanSupplier; import dev.engine_room.flywheel.api.event.ReloadLevelRendererEvent; import net.minecraft.client.multiplayer.ClientLevel; @@ -17,7 +15,7 @@ public void dispatchReloadLevelRendererEvent(ClientLevel level) { @Override public String getVersionStr() { - return FlywheelForge.version().toString(); + return FlywheelNeoForge.version().toString(); } @Override @@ -26,7 +24,7 @@ public FlwConfig getConfig() { } @Override - public Supplier getModLoaded(String modId) { - return Suppliers.memoize(() -> LoadingModList.get().getModFileById(modId) != null); + public BooleanSupplier getModLoaded(String modId) { + return () -> LoadingModList.get().getModFileById(modId) != null; } } diff --git a/forge/src/main/java/dev/engine_room/flywheel/impl/FlwLibXplatImpl.java b/forge/src/main/java/dev/engine_room/flywheel/impl/FlwLibXplatImpl.java index 098df8131..278094cb4 100644 --- a/forge/src/main/java/dev/engine_room/flywheel/impl/FlwLibXplatImpl.java +++ b/forge/src/main/java/dev/engine_room/flywheel/impl/FlwLibXplatImpl.java @@ -2,6 +2,9 @@ import java.lang.reflect.Field; +import dev.engine_room.flywheel.lib.model.baked.NeoForgeBlockModelBuilder; +import dev.engine_room.flywheel.lib.model.baked.NeoForgeMultiBlockModelBuilder; + import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.UnknownNullability; @@ -9,9 +12,7 @@ import dev.engine_room.flywheel.lib.internal.FlwLibXplat; import dev.engine_room.flywheel.lib.model.baked.BakedModelBuilder; import dev.engine_room.flywheel.lib.model.baked.BlockModelBuilder; -import dev.engine_room.flywheel.lib.model.baked.ForgeBakedModelBuilder; -import dev.engine_room.flywheel.lib.model.baked.ForgeBlockModelBuilder; -import dev.engine_room.flywheel.lib.model.baked.ForgeMultiBlockModelBuilder; +import dev.engine_room.flywheel.lib.model.baked.NeoForgeBakedModelBuilder; import dev.engine_room.flywheel.lib.model.baked.MultiBlockModelBuilder; import dev.engine_room.flywheel.lib.util.ShadersModHandler; import net.irisshaders.iris.api.v0.IrisApi; @@ -53,17 +54,17 @@ public BlockRenderDispatcher createVanillaBlockRenderDispatcher() { @Override public BakedModelBuilder createBakedModelBuilder(BakedModel bakedModel) { - return new ForgeBakedModelBuilder(bakedModel); + return new NeoForgeBakedModelBuilder(bakedModel); } @Override public BlockModelBuilder createBlockModelBuilder(BlockState state) { - return new ForgeBlockModelBuilder(state); + return new NeoForgeBlockModelBuilder(state); } @Override public MultiBlockModelBuilder createMultiBlockModelBuilder(BlockAndTintGetter level, Iterable positions) { - return new ForgeMultiBlockModelBuilder(level, positions); + return new NeoForgeMultiBlockModelBuilder(level, positions); } @Override diff --git a/forge/src/main/java/dev/engine_room/flywheel/impl/FlywheelForge.java b/forge/src/main/java/dev/engine_room/flywheel/impl/FlywheelNeoForge.java similarity index 89% rename from forge/src/main/java/dev/engine_room/flywheel/impl/FlywheelForge.java rename to forge/src/main/java/dev/engine_room/flywheel/impl/FlywheelNeoForge.java index 6625315ea..4c0b69d44 100644 --- a/forge/src/main/java/dev/engine_room/flywheel/impl/FlywheelForge.java +++ b/forge/src/main/java/dev/engine_room/flywheel/impl/FlywheelNeoForge.java @@ -1,7 +1,5 @@ package dev.engine_room.flywheel.impl; -import java.util.function.Supplier; - import org.apache.maven.artifact.versioning.ArtifactVersion; import org.jetbrains.annotations.UnknownNullability; @@ -18,13 +16,12 @@ import net.minecraft.client.Minecraft; import net.minecraft.commands.synchronization.ArgumentTypeInfos; import net.minecraft.core.registries.Registries; +import net.neoforged.api.distmarker.Dist; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.CrashReportCallables; import net.neoforged.fml.ModContainer; -import net.neoforged.fml.ModLoadingContext; import net.neoforged.fml.common.Mod; import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; -import net.neoforged.fml.loading.FMLLoader; import net.neoforged.neoforge.client.event.CustomizeGuiOverlayEvent; import net.neoforged.neoforge.client.event.RegisterClientReloadListenersEvent; import net.neoforged.neoforge.common.NeoForge; @@ -34,14 +31,12 @@ import net.neoforged.neoforge.event.tick.LevelTickEvent; import net.neoforged.neoforge.registries.RegisterEvent; -@Mod(Flywheel.ID) -public final class FlywheelForge { +@Mod(value = Flywheel.ID, dist = Dist.CLIENT) +public final class FlywheelNeoForge { @UnknownNullability private static ArtifactVersion version; - public FlywheelForge(IEventBus modEventBus, ModContainer modContainer) { - ModLoadingContext modLoadingContext = ModLoadingContext.get(); - + public FlywheelNeoForge(IEventBus modEventBus, ModContainer modContainer) { version = modContainer .getModInfo() .getVersion(); @@ -50,13 +45,6 @@ public FlywheelForge(IEventBus modEventBus, ModContainer modContainer) { ForgeFlwConfig.INSTANCE.registerSpecs(modContainer); - if (FMLLoader.getDist().isClient()) { - Supplier toRun = () -> () -> FlywheelForge.clientInit(forgeEventBus, modEventBus); - toRun.get().run(); - } - } - - private static void clientInit(IEventBus forgeEventBus, IEventBus modEventBus) { registerImplEventListeners(forgeEventBus, modEventBus); registerLibEventListeners(forgeEventBus, modEventBus); registerBackendEventListeners(forgeEventBus, modEventBus); @@ -70,7 +58,7 @@ private static void registerImplEventListeners(IEventBus forgeEventBus, IEventBu forgeEventBus.addListener((LevelTickEvent.Post e) -> { // Make sure we don't tick on the server somehow. - if (FMLLoader.getDist().isClient()) { + if (e.getLevel().isClientSide()) { VisualizationEventHandler.onClientTick(Minecraft.getInstance(), e.getLevel()); } }); diff --git a/forge/src/main/java/dev/engine_room/flywheel/impl/mixin/MinecraftMixin.java b/forge/src/main/java/dev/engine_room/flywheel/impl/mixin/MinecraftMixin.java index 5c295a7b1..4115da92d 100644 --- a/forge/src/main/java/dev/engine_room/flywheel/impl/mixin/MinecraftMixin.java +++ b/forge/src/main/java/dev/engine_room/flywheel/impl/mixin/MinecraftMixin.java @@ -2,7 +2,6 @@ import java.util.Optional; import java.util.concurrent.CompletableFuture; -import java.util.concurrent.Executor; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -10,7 +9,6 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Coerce; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.ModifyArg; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import dev.engine_room.flywheel.api.event.EndClientResourceReloadEvent; @@ -25,11 +23,9 @@ abstract class MinecraftMixin { @Final private ReloadableResourceManager resourceManager; - // Inject at invoke cannot be used in constructors in vanilla Mixin, so use ModifyArg instead. - @ModifyArg(method = "", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/packs/resources/ReloadableResourceManager;createReload(Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ljava/util/concurrent/CompletableFuture;Ljava/util/List;)Lnet/minecraft/server/packs/resources/ReloadInstance;"), index = 0) - private Executor flywheel$onBeginInitialResourceReload(Executor arg0) { + @Inject(method = "", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/packs/resources/ReloadableResourceManager;createReload(Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ljava/util/concurrent/CompletableFuture;Ljava/util/List;)Lnet/minecraft/server/packs/resources/ReloadInstance;")) + private void flywheel$onBeginInitialResourceReload(CallbackInfo ci) { FlwImpl.freezeRegistries(); - return arg0; } @Inject(method = "lambda$new$8", at = @At("HEAD"), remap = false)