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 167787a87..cfd0fa2cb 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 @@ -48,14 +48,12 @@ class SubprojectPlugin: Plugin { } } - @Suppress("UnstableApiUsage") private fun setupLoom(project: Project) { val loom = project.the() loom.silentMojangMappingsLicense() - // FIXME y tho? :( - loom.mixin.useLegacyMixinAp = true - loom.mixin.defaultRefmapName = "flywheel.refmap.json" + //fixme is this still needed? +// loom.mixin.defaultRefmapName = "flywheel.refmap.json" } private fun setupJava(project: Project) { diff --git a/fabric/src/main/java/dev/engine_room/flywheel/impl/mixin/fabric/MinecraftMixin.java b/fabric/src/main/java/dev/engine_room/flywheel/impl/mixin/fabric/MinecraftMixin.java index 894ee66ee..f87736ad1 100644 --- a/fabric/src/main/java/dev/engine_room/flywheel/impl/mixin/fabric/MinecraftMixin.java +++ b/fabric/src/main/java/dev/engine_room/flywheel/impl/mixin/fabric/MinecraftMixin.java @@ -22,8 +22,8 @@ abstract class MinecraftMixin { } } - @Inject(method = "clearClientLevel(Lnet/minecraft/client/gui/screens/Screen;)V", at = @At("HEAD")) - private void flywheel$onClearLevel(CallbackInfo ci) { + @Inject(method = "disconnect(Lnet/minecraft/client/gui/screens/Screen;)V", at = @At("HEAD")) + private void flywheel$onDisconnect(CallbackInfo ci) { if (level != null) { LevelAttached.invalidateLevel(level); } 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 a6a9ed00c..ae4a0077f 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 @@ -1,10 +1,9 @@ package dev.engine_room.flywheel.api.event; -import net.neoforged.bus.api.Event; - import org.jetbrains.annotations.Nullable; import net.minecraft.client.multiplayer.ClientLevel; +import net.neoforged.bus.api.Event; /** * This event is posted to the Forge event bus. diff --git a/forge/src/api/java/dev/engine_room/flywheel/api/event/RenderStageEvent.java b/forge/src/api/java/dev/engine_room/flywheel/api/event/RenderStageEvent.java index d9c27aad7..1062e93e8 100644 --- a/forge/src/api/java/dev/engine_room/flywheel/api/event/RenderStageEvent.java +++ b/forge/src/api/java/dev/engine_room/flywheel/api/event/RenderStageEvent.java @@ -1,7 +1,5 @@ package dev.engine_room.flywheel.api.event; -import net.neoforged.bus.api.Event; - import org.joml.Matrix4f; import com.mojang.blaze3d.vertex.PoseStack; @@ -9,6 +7,7 @@ import net.minecraft.client.Camera; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.renderer.RenderBuffers; +import net.neoforged.bus.api.Event; /** * This event is posted to the Forge event bus. diff --git a/forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/BakedModelBufferer.java b/forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/BakedModelBufferer.java index 4453ec5b8..8709e20a1 100644 --- a/forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/BakedModelBufferer.java +++ b/forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/BakedModelBufferer.java @@ -3,9 +3,6 @@ import java.util.Iterator; import java.util.function.Function; -import net.neoforged.neoforge.client.ChunkRenderTypeSet; -import net.neoforged.neoforge.client.model.data.ModelData; - import org.jetbrains.annotations.Nullable; import com.mojang.blaze3d.vertex.BufferBuilder.RenderedBuffer; @@ -23,6 +20,8 @@ import net.minecraft.world.level.block.RenderShape; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.FluidState; +import net.neoforged.neoforge.client.ChunkRenderTypeSet; +import net.neoforged.neoforge.client.model.data.ModelData; final class BakedModelBufferer { static final RenderType[] CHUNK_LAYERS = RenderType.chunkBufferLayers().toArray(RenderType[]::new); 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/ForgeBakedModelBuilder.java index 3d9cf4885..dccefefec 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/ForgeBakedModelBuilder.java @@ -2,8 +2,6 @@ import java.util.function.BiFunction; -import net.neoforged.neoforge.client.model.data.ModelData; - import org.jetbrains.annotations.Nullable; import com.mojang.blaze3d.vertex.PoseStack; @@ -18,6 +16,7 @@ import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; +import net.neoforged.neoforge.client.model.data.ModelData; public final class ForgeBakedModelBuilder extends BakedModelBuilder { @Nullable 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/ForgeBlockModelBuilder.java index d09730dc7..fabe098f6 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/ForgeBlockModelBuilder.java @@ -2,8 +2,6 @@ import java.util.function.BiFunction; -import net.neoforged.neoforge.client.model.data.ModelData; - import org.jetbrains.annotations.Nullable; import com.mojang.blaze3d.vertex.PoseStack; @@ -16,6 +14,7 @@ import net.minecraft.client.renderer.RenderType; import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.block.state.BlockState; +import net.neoforged.neoforge.client.model.data.ModelData; public final class ForgeBlockModelBuilder extends BlockModelBuilder { @Nullable 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/ForgeMultiBlockModelBuilder.java index 9bbf47079..e8fd93325 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/ForgeMultiBlockModelBuilder.java @@ -3,8 +3,6 @@ import java.util.function.BiFunction; import java.util.function.Function; -import net.neoforged.neoforge.client.model.data.ModelData; - import org.jetbrains.annotations.Nullable; import com.mojang.blaze3d.vertex.PoseStack; @@ -17,6 +15,7 @@ import net.minecraft.client.renderer.RenderType; import net.minecraft.core.BlockPos; import net.minecraft.world.level.BlockAndTintGetter; +import net.neoforged.neoforge.client.model.data.ModelData; public final class ForgeMultiBlockModelBuilder extends MultiBlockModelBuilder { @Nullable diff --git a/forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/PartialModelEventHandler.java b/forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/PartialModelEventHandler.java index f84fc5ff3..0e2189468 100644 --- a/forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/PartialModelEventHandler.java +++ b/forge/src/lib/java/dev/engine_room/flywheel/lib/model/baked/PartialModelEventHandler.java @@ -2,12 +2,11 @@ import java.util.Map; -import net.neoforged.neoforge.client.event.ModelEvent; - import org.jetbrains.annotations.ApiStatus; import net.minecraft.client.resources.model.BakedModel; import net.minecraft.resources.ResourceLocation; +import net.neoforged.neoforge.client.event.ModelEvent; @ApiStatus.Internal public final class PartialModelEventHandler { diff --git a/forge/src/main/java/dev/engine_room/flywheel/impl/FlwCommands.java b/forge/src/main/java/dev/engine_room/flywheel/impl/FlwCommands.java index 830c0fb0f..3ff42e291 100644 --- a/forge/src/main/java/dev/engine_room/flywheel/impl/FlwCommands.java +++ b/forge/src/main/java/dev/engine_room/flywheel/impl/FlwCommands.java @@ -16,7 +16,8 @@ import net.minecraft.network.chat.Component; import net.minecraft.world.entity.Entity; import net.neoforged.neoforge.client.event.RegisterClientCommandsEvent; -import net.neoforged.neoforge.common.ModConfigSpec; +import net.neoforged.neoforge.common.ModConfigSpec.BooleanValue; +import net.neoforged.neoforge.common.ModConfigSpec.ConfigValue; public final class FlwCommands { private FlwCommands() { @@ -25,7 +26,7 @@ private FlwCommands() { public static void registerClientCommands(RegisterClientCommandsEvent event) { LiteralArgumentBuilder command = Commands.literal("flywheel"); - ModConfigSpec.ConfigValue backendValue = ForgeFlwConfig.INSTANCE.client.backend; + ConfigValue backendValue = ForgeFlwConfig.INSTANCE.client.backend; command.then(Commands.literal("backend") .executes(context -> { Backend backend = BackendManager.getBackend(); @@ -55,7 +56,7 @@ public static void registerClientCommands(RegisterClientCommandsEvent event) { return Command.SINGLE_SUCCESS; }))); - ModConfigSpec.BooleanValue limitUpdatesValue = ForgeFlwConfig.INSTANCE.client.limitUpdates; + BooleanValue limitUpdatesValue = ForgeFlwConfig.INSTANCE.client.limitUpdates; command.then(Commands.literal("limitUpdates") .executes(context -> { if (limitUpdatesValue.get()) { 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 cddd85e4e..dcbcce71c 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,7 +1,5 @@ package dev.engine_room.flywheel.impl; -import net.neoforged.neoforge.common.NeoForge; - import org.jetbrains.annotations.Nullable; import dev.engine_room.flywheel.api.event.BeginFrameEvent; @@ -10,6 +8,7 @@ import dev.engine_room.flywheel.api.event.RenderStage; import dev.engine_room.flywheel.api.event.RenderStageEvent; import net.minecraft.client.multiplayer.ClientLevel; +import net.neoforged.neoforge.common.NeoForge; public class FlwImplXplatImpl implements FlwImplXplat { @Override 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 c4bc9ffae..2557efc45 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,9 +2,6 @@ import java.lang.reflect.Field; -import net.neoforged.fml.ModList; -import net.neoforged.fml.util.ObfuscationReflectionHelper; - import org.jetbrains.annotations.Nullable; import dev.engine_room.flywheel.lib.internal.FlwLibXplat; @@ -23,6 +20,8 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.block.state.BlockState; +import net.neoforged.fml.ModList; +import net.neoforged.fml.util.ObfuscationReflectionHelper; public class FlwLibXplatImpl implements FlwLibXplat { @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/FlywheelForge.java index 03a297a67..e921573ac 100644 --- a/forge/src/main/java/dev/engine_room/flywheel/impl/FlywheelForge.java +++ b/forge/src/main/java/dev/engine_room/flywheel/impl/FlywheelForge.java @@ -1,28 +1,5 @@ package dev.engine_room.flywheel.impl; -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.DistExecutor; -import net.neoforged.fml.ModLoadingContext; - -import net.neoforged.fml.common.Mod; - -import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; -import net.neoforged.fml.loading.FMLEnvironment; -import net.neoforged.neoforge.client.event.CustomizeGuiOverlayEvent; -import net.neoforged.neoforge.client.event.RegisterClientReloadListenersEvent; -import net.neoforged.neoforge.common.NeoForge; - -import net.neoforged.neoforge.event.entity.EntityJoinLevelEvent; - -import net.neoforged.neoforge.event.entity.EntityLeaveLevelEvent; - -import net.neoforged.neoforge.event.level.LevelEvent; -import net.neoforged.neoforge.event.tick.LevelTickEvent; -import net.neoforged.neoforge.registries.RegisterEvent; - import org.apache.maven.artifact.versioning.ArtifactVersion; import org.jetbrains.annotations.UnknownNullability; @@ -40,17 +17,35 @@ import dev.engine_room.flywheel.lib.util.LevelAttached; 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.DistExecutor; +import net.neoforged.fml.LogicalSide; +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.FMLEnvironment; +import net.neoforged.neoforge.client.event.CustomizeGuiOverlayEvent; +import net.neoforged.neoforge.client.event.RegisterClientReloadListenersEvent; +import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.neoforge.event.entity.EntityJoinLevelEvent; +import net.neoforged.neoforge.event.entity.EntityLeaveLevelEvent; +import net.neoforged.neoforge.event.level.LevelEvent; +import net.neoforged.neoforge.event.tick.LevelTickEvent; +import net.neoforged.neoforge.registries.RegisterEvent; @Mod(Flywheel.ID) public final class FlywheelForge { @UnknownNullability private static ArtifactVersion version; - public FlywheelForge(IEventBus modEventBus) { + public FlywheelForge(IEventBus modEventBus, ModContainer modContainer) { ModLoadingContext modLoadingContext = ModLoadingContext.get(); - version = modLoadingContext - .getActiveContainer() + version = modContainer .getModInfo() .getVersion(); @@ -96,7 +91,7 @@ private static void registerImplEventListeners(IEventBus forgeEventBus, IEventBu FlwDebugInfo.addDebugInfo(minecraft, e.getRight()); }); - modEventBus.addListener((EndClientResourceReloadEvent e) -> BackendManagerImpl.onEndClientResourceReload(e.error() != null)); + modEventBus.addListener((EndClientResourceReloadEvent e) -> BackendManagerImpl.onEndClientResourceReload(e.error().isPresent())); modEventBus.addListener((FMLCommonSetupEvent e) -> { ArgumentTypeInfos.registerByClass(BackendArgument.class, BackendArgument.INFO); diff --git a/forge/src/main/java/dev/engine_room/flywheel/impl/ForgeFlwConfig.java b/forge/src/main/java/dev/engine_room/flywheel/impl/ForgeFlwConfig.java index 60832455d..9ef397337 100644 --- a/forge/src/main/java/dev/engine_room/flywheel/impl/ForgeFlwConfig.java +++ b/forge/src/main/java/dev/engine_room/flywheel/impl/ForgeFlwConfig.java @@ -1,9 +1,5 @@ package dev.engine_room.flywheel.impl; -import net.neoforged.fml.ModLoadingContext; -import net.neoforged.fml.config.ModConfig; -import net.neoforged.neoforge.common.ModConfigSpec; - import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.Nullable; @@ -11,6 +7,9 @@ import dev.engine_room.flywheel.api.backend.BackendManager; import net.minecraft.ResourceLocationException; import net.minecraft.resources.ResourceLocation; +import net.neoforged.fml.ModLoadingContext; +import net.neoforged.fml.config.ModConfig; +import net.neoforged.neoforge.common.ModConfigSpec; public class ForgeFlwConfig implements FlwConfig { public static final ForgeFlwConfig INSTANCE = new ForgeFlwConfig(); 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 85a5746f6..197ac92a9 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 @@ -4,8 +4,6 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; -import net.neoforged.fml.ModLoader; - import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -15,14 +13,13 @@ import org.spongepowered.asm.mixin.injection.ModifyArg; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import com.mojang.realmsclient.client.RealmsClient; - import dev.engine_room.flywheel.api.event.EndClientResourceReloadEvent; import dev.engine_room.flywheel.impl.FlwImpl; import net.minecraft.client.Minecraft; import net.minecraft.server.packs.resources.ReloadableResourceManager; +import net.neoforged.fml.ModLoader; -@Mixin(value = Minecraft.class, remap = false) +@Mixin(Minecraft.class) abstract class MinecraftMixin { @Shadow @Final @@ -36,12 +33,12 @@ abstract class MinecraftMixin { } @Inject(method = "lambda$new$7", at = @At("HEAD")) - private void flywheel$onEndInitialResourceReload(@Coerce Object minecraft$gameloadcookie, Optional error, CallbackInfo ci) { + private void flywheel$onEndInitialResourceReload(@Coerce Object gameLoadCookie, Optional error, CallbackInfo ci) { ModLoader.postEvent(new EndClientResourceReloadEvent((Minecraft) (Object) this, resourceManager, true, error)); } @Inject(method = "lambda$reloadResourcePacks$39", at = @At("HEAD")) - private void flywheel$onEndManualResourceReload(boolean bl, @Coerce Object minecraft$gameloadcookie, CompletableFuture completablefuture, Optional error, CallbackInfo ci) { + private void flywheel$onEndManualResourceReload(boolean recovery, @Coerce Object gameLoadCookie, CompletableFuture completablefuture, Optional error, CallbackInfo ci) { ModLoader.postEvent(new EndClientResourceReloadEvent((Minecraft) (Object) this, resourceManager, false, error)); } } diff --git a/forge/src/main/java/dev/engine_room/flywheel/impl/mixin/sodium/SodiumMixinPlugin.java b/forge/src/main/java/dev/engine_room/flywheel/impl/mixin/sodium/SodiumMixinPlugin.java index 5ee303ff0..c2fe3df02 100644 --- a/forge/src/main/java/dev/engine_room/flywheel/impl/mixin/sodium/SodiumMixinPlugin.java +++ b/forge/src/main/java/dev/engine_room/flywheel/impl/mixin/sodium/SodiumMixinPlugin.java @@ -4,16 +4,16 @@ import java.util.Set; import java.util.function.Supplier; -import net.neoforged.fml.loading.LoadingModList; - import org.objectweb.asm.tree.ClassNode; import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; import org.spongepowered.asm.mixin.extensibility.IMixinInfo; import com.google.common.base.Suppliers; +import net.neoforged.fml.loading.LoadingModList; + public class SodiumMixinPlugin implements IMixinConfigPlugin { - private static final Supplier IS_SODIUM_LOADED = Suppliers.memoize(() -> LoadingModList.get().getModFileById("rubidium") != null); + private static final Supplier IS_SODIUM_LOADED = Suppliers.memoize(() -> LoadingModList.get().getModFileById("embeddium") != null); @Override public void onLoad(String mixinPackage) { diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index 546372adf..0fe5ee7c5 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -32,11 +32,3 @@ modId = "neoforge" type = "required" versionRange = "${neoforge_version_range}" side = "CLIENT" - -# Breaks dependency -[[dependencies.${mod_id}]] -modId = "rubidium" -type = "incompatible" -reason = "mixin crash with any version of rubidium under 0.7.0" -versionRange = "[0.7.0,)" -side = "CLIENT"