diff --git a/CHANGELOG.md b/CHANGELOG.md index 85a5d7de..a1f2dace 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +craftedcore 4.3.1 +================ + +- fix mixins on forge not working properly anymore + craftedcore 4.3 ================ diff --git a/common/build.gradle b/common/build.gradle index a2f8697e..4bbee929 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -6,5 +6,5 @@ loom { dependencies { // mixin extras - implementation(annotationProcessor("io.github.llamalad7:mixinextras-common:0.3.6")) + implementation(annotationProcessor("io.github.llamalad7:mixinextras-common:${rootProject.mixinextras_version}")) } \ No newline at end of file diff --git a/common/src/main/java/tocraft/craftedcore/mixin/CrashReportCategoryMixin.java b/common/src/main/java/tocraft/craftedcore/mixin/CrashReportCategoryMixin.java index c237a812..4394107c 100644 --- a/common/src/main/java/tocraft/craftedcore/mixin/CrashReportCategoryMixin.java +++ b/common/src/main/java/tocraft/craftedcore/mixin/CrashReportCategoryMixin.java @@ -6,7 +6,6 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import tocraft.craftedcore.platform.PlatformData; import tocraft.craftedcore.util.TraceUtils; // based on code by comp500 (licensed as MIT, take a look https://github.com/comp500/mixintrace for details) @@ -17,8 +16,6 @@ public abstract class CrashReportCategoryMixin { @Inject(method = "getDetails", at = @At("TAIL")) private void onGetDetails(StringBuilder crashReportBuilder, CallbackInfo ci) { - if (!PlatformData.isModLoaded("mixintrace")) { - TraceUtils.printMixinTrace(stackTrace, crashReportBuilder); - } + TraceUtils.printMixinTrace(stackTrace, crashReportBuilder); } } diff --git a/common/src/main/java/tocraft/craftedcore/mixin/CrashReportMixin.java b/common/src/main/java/tocraft/craftedcore/mixin/CrashReportMixin.java index 1cbf8704..e9091f0c 100644 --- a/common/src/main/java/tocraft/craftedcore/mixin/CrashReportMixin.java +++ b/common/src/main/java/tocraft/craftedcore/mixin/CrashReportMixin.java @@ -6,10 +6,8 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import tocraft.craftedcore.platform.PlatformData; import tocraft.craftedcore.util.TraceUtils; -// based on code by comp500 (licensed as MIT, take a look https://github.com/comp500/mixintrace for details) @Mixin(CrashReport.class) public abstract class CrashReportMixin { @Shadow @@ -18,19 +16,17 @@ public abstract class CrashReportMixin { @Inject(method = "getDetails(Ljava/lang/StringBuilder;)V", at = @At(value = "FIELD", target = "Lnet/minecraft/CrashReport;details:Ljava/util/List;")) private void onGetDetails(StringBuilder crashReportBuilder, CallbackInfo ci) { - if (!PlatformData.isModLoaded("mixintrace")) { - int trailingNewlineCount = 0; - // Remove trailing \n - if (crashReportBuilder.charAt(crashReportBuilder.length() - 1) == '\n') { - crashReportBuilder.deleteCharAt(crashReportBuilder.length() - 1); - trailingNewlineCount++; - } - if (crashReportBuilder.charAt(crashReportBuilder.length() - 1) == '\n') { - crashReportBuilder.deleteCharAt(crashReportBuilder.length() - 1); - trailingNewlineCount++; - } - TraceUtils.printMixinTrace(uncategorizedStackTrace, crashReportBuilder); - crashReportBuilder.append("\n".repeat(trailingNewlineCount)); + int trailingNewlineCount = 0; + // Remove trailing \n + if (crashReportBuilder.charAt(crashReportBuilder.length() - 1) == '\n') { + crashReportBuilder.deleteCharAt(crashReportBuilder.length() - 1); + trailingNewlineCount++; } + if (crashReportBuilder.charAt(crashReportBuilder.length() - 1) == '\n') { + crashReportBuilder.deleteCharAt(crashReportBuilder.length() - 1); + trailingNewlineCount++; + } + TraceUtils.printMixinTrace(uncategorizedStackTrace, crashReportBuilder); + crashReportBuilder.append("\n".repeat(trailingNewlineCount)); } } \ No newline at end of file diff --git a/common/src/main/java/tocraft/craftedcore/mixin/MinecraftServerMixin.java b/common/src/main/java/tocraft/craftedcore/mixin/MinecraftServerMixin.java index 764c8442..5c5099a6 100644 --- a/common/src/main/java/tocraft/craftedcore/mixin/MinecraftServerMixin.java +++ b/common/src/main/java/tocraft/craftedcore/mixin/MinecraftServerMixin.java @@ -6,7 +6,6 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import tocraft.craftedcore.platform.PlatformData; import tocraft.craftedcore.util.TraceUtils; // based on code by comp500 @@ -14,11 +13,9 @@ public abstract class MinecraftServerMixin { @Inject(method = "onServerCrash", at = @At("HEAD")) private void onOnServerCrash(CrashReport report, CallbackInfo ci) { - if (!PlatformData.isModLoaded("mixintrace")) { - StringBuilder crashReportBuilder = new StringBuilder(); - TraceUtils.printMixinTrace(report.getException().getStackTrace(), crashReportBuilder); - System.out.println(crashReportBuilder); - } + StringBuilder crashReportBuilder = new StringBuilder(); + TraceUtils.printMixinTrace(report.getException().getStackTrace(), crashReportBuilder); + System.out.println(crashReportBuilder); } } diff --git a/common/src/main/java/tocraft/craftedcore/mixin/client/MinecraftMixin.java b/common/src/main/java/tocraft/craftedcore/mixin/client/MinecraftMixin.java index beb6864f..84e557e1 100644 --- a/common/src/main/java/tocraft/craftedcore/mixin/client/MinecraftMixin.java +++ b/common/src/main/java/tocraft/craftedcore/mixin/client/MinecraftMixin.java @@ -8,7 +8,6 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import tocraft.craftedcore.platform.PlatformData; import tocraft.craftedcore.util.TraceUtils; import java.io.File; @@ -19,10 +18,8 @@ public abstract class MinecraftMixin { @Inject(method = "crash", at = @At("HEAD")) private static void onCrash(Minecraft minecraft, File gameDirectory, CrashReport report, CallbackInfo ci) { - if (!PlatformData.isModLoaded("mixintrace")) { - StringBuilder crashReportBuilder = new StringBuilder(); - TraceUtils.printMixinTrace(report.getException().getStackTrace(), crashReportBuilder); - System.out.println(crashReportBuilder); - } + StringBuilder crashReportBuilder = new StringBuilder(); + TraceUtils.printMixinTrace(report.getException().getStackTrace(), crashReportBuilder); + System.out.println(crashReportBuilder); } } diff --git a/fabric/build.gradle b/fabric/build.gradle index 1b9aca99..9999db12 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -6,5 +6,5 @@ loom { dependencies { // mixin extras - include(implementation(annotationProcessor("io.github.llamalad7:mixinextras-fabric:0.3.6"))) + include(implementation(annotationProcessor("io.github.llamalad7:mixinextras-fabric:${rootProject.mixinextras_version}"))) } \ No newline at end of file diff --git a/forge/build.gradle b/forge/build.gradle index 5bf4353d..025f551b 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -13,6 +13,6 @@ loom { dependencies { // mixin extras - compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:0.3.6")) - implementation(include("io.github.llamalad7:mixinextras-forge:0.3.6")) + compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:${rootProject.mixinextras_version}")) + implementation(include("io.github.llamalad7:mixinextras-forge:${rootProject.mixinextras_version}")) } \ No newline at end of file diff --git a/forge/src/main/java/tocraft/craftedcore/forge/client/CraftedCoreForgeEventHandlerClient.java b/forge/src/main/java/tocraft/craftedcore/forge/client/CraftedCoreForgeEventHandlerClient.java index bdc5cfac..2bb5b03d 100644 --- a/forge/src/main/java/tocraft/craftedcore/forge/client/CraftedCoreForgeEventHandlerClient.java +++ b/forge/src/main/java/tocraft/craftedcore/forge/client/CraftedCoreForgeEventHandlerClient.java @@ -1,25 +1,21 @@ package tocraft.craftedcore.forge.client; -import net.minecraft.client.KeyMapping; import net.minecraft.client.Minecraft; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.event.ClientPlayerNetworkEvent; import net.minecraftforge.client.event.CustomizeGuiOverlayEvent; -import net.minecraftforge.client.event.RegisterKeyMappingsEvent; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import tocraft.craftedcore.event.client.ClientPlayerEvents; import tocraft.craftedcore.event.client.ClientTickEvents; import tocraft.craftedcore.event.client.RenderEvents; -import tocraft.craftedcore.registration.forge.KeyBindingRegistryImpl; @SuppressWarnings("unused") @OnlyIn(Dist.CLIENT) public class CraftedCoreForgeEventHandlerClient { - // FIXME: Where is RenderGuiEvent.Post ??? @SubscribeEvent - public void eventRenderGameOverlayEvent(CustomizeGuiOverlayEvent event) { + public void event(CustomizeGuiOverlayEvent event) { RenderEvents.HUD_RENDERING.invoke().render(event.getGuiGraphics(), event.getPartialTick()); } diff --git a/forge/src/main/java/tocraft/craftedcore/network/forge/ModernNetworkingImpl.java b/forge/src/main/java/tocraft/craftedcore/network/forge/ModernNetworkingImpl.java index 0b9152bb..3bd2aae4 100644 --- a/forge/src/main/java/tocraft/craftedcore/network/forge/ModernNetworkingImpl.java +++ b/forge/src/main/java/tocraft/craftedcore/network/forge/ModernNetworkingImpl.java @@ -11,7 +11,6 @@ import net.minecraft.world.entity.player.Player; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.fml.LogicalSide; import net.minecraftforge.fml.loading.FMLLoader; import net.minecraftforge.network.ChannelBuilder; import net.minecraftforge.network.EventNetworkChannel; @@ -43,7 +42,7 @@ public Player getPlayer() { @Override public ModernNetworking.Env getEnv() { - return event.getSource().getDirection().getReceptionSide() == LogicalSide.CLIENT ? ModernNetworking.Env.CLIENT : ModernNetworking.Env.SERVER; + return event.getSource().isClientSide() ? ModernNetworking.Env.CLIENT : ModernNetworking.Env.SERVER; } @Override diff --git a/forge/src/main/java/tocraft/craftedcore/registration/forge/KeyBindingRegistryImpl.java b/forge/src/main/java/tocraft/craftedcore/registration/forge/KeyBindingRegistryImpl.java index c5a48a0c..feec5e2b 100644 --- a/forge/src/main/java/tocraft/craftedcore/registration/forge/KeyBindingRegistryImpl.java +++ b/forge/src/main/java/tocraft/craftedcore/registration/forge/KeyBindingRegistryImpl.java @@ -1,17 +1,12 @@ package tocraft.craftedcore.registration.forge; -import com.mojang.logging.LogUtils; -import net.minecraft.client.KeyMapping; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraft.client.KeyMapping; import net.minecraft.client.Minecraft; import net.minecraft.client.Options; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import org.apache.commons.lang3.ArrayUtils; -import java.util.ArrayList; -import java.util.List; - @SuppressWarnings("unused") @OnlyIn(Dist.CLIENT) public final class KeyBindingRegistryImpl { diff --git a/forge/src/main/resources/craftedcore-forge.mixins.json b/forge/src/main/resources/craftedcore-forge.mixins.json deleted file mode 100644 index abd0db87..00000000 --- a/forge/src/main/resources/craftedcore-forge.mixins.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "required": true, - "minVersion": "0.8", - "package": "tocraft.craftedcore.forge.mixin", - "compatibilityLevel": "JAVA_17", - "mixins": [ - ], - "client": [ - "client.GuiMixin" - ], - "injectors": { - "defaultRequire": 1 - } -} diff --git a/gradle.properties b/gradle.properties index a507db2c..9b116b4c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx4G minecraft_version=1.20.6 supported_versions=1.20.6 archives_base_name=craftedcore -mod_version=4.3 +mod_version=4.3.1 artifact_type=release maven_group=dev.tocraft # Loader Versions @@ -18,6 +18,7 @@ modrinth_id=Dg7PHdkJ required_dependencies= optional_dependencies= # Platforms +mixinextras_version=0.4.0-beta.2 enabled_platforms=fabric,neoforge java_version=21 # Discord Webhook diff --git a/neoforge/build.gradle b/neoforge/build.gradle index 0bce207e..bf92b75e 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -6,6 +6,6 @@ loom { dependencies { // mixin extras - compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:0.3.6")) - implementation(include("io.github.llamalad7:mixinextras-neoforge:0.3.6")) + compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:${rootProject.mixinextras_version}")) + implementation(include("io.github.llamalad7:mixinextras-neoforge:${rootProject.mixinextras_version}")) } \ No newline at end of file