From 0de012634c456d7a1306aba5f8e5ccdb0dfe8b71 Mon Sep 17 00:00:00 2001 From: fretuks Date: Sat, 28 Mar 2026 17:59:23 +0100 Subject: [PATCH] try to fix crash on server load --- build.gradle | 4 ++-- gradle.properties | 4 ++-- .../java/net/fretux/mindmotion/AscendMindMotion.java | 9 ++++++--- .../mindmotion/network/VentClientEffectPacket.java | 12 ++++++------ 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index 7630d2c..b151d83 100644 --- a/build.gradle +++ b/build.gradle @@ -88,8 +88,8 @@ repositories { dependencies { minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" - compileOnly fg.deobf("net.fretux.ascend:Ascend:2.1.1") - runtimeOnly fg.deobf("net.fretux.ascend:Ascend:2.1.1") + compileOnly fg.deobf("net.fretux.ascend:Ascend:2.2.1") + runtimeOnly fg.deobf("net.fretux.ascend:Ascend:2.2.1") // Iron's Spellbooks compileOnly fg.deobf("io.redspace.ironsspellbooks:irons_spellbooks:${irons_spells_version}:api") diff --git a/gradle.properties b/gradle.properties index 26ec4f4..af30c00 100644 --- a/gradle.properties +++ b/gradle.properties @@ -52,7 +52,7 @@ mod_name=Mind & Motion # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=All Rights Reserved # The mod version. See https://semver.org/ -mod_version=1.3.0 +mod_version=1.3.1 # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. # See https://maven.apache.org/guides/mini/guide-naming-conventions.html @@ -60,4 +60,4 @@ mod_group_id=net.fretux.mindmotion # The authors of the mod. This is a simple text string that is used for display purposes in the mod list. mod_authors=Fretux # The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list. -mod_description=A mod adding sanity, insanity and adrenaline to minecraft. \ No newline at end of file +mod_description=A mod adding sanity, insanity and adrenaline to minecraft. diff --git a/src/main/java/net/fretux/mindmotion/AscendMindMotion.java b/src/main/java/net/fretux/mindmotion/AscendMindMotion.java index 3984c8c..11523b3 100644 --- a/src/main/java/net/fretux/mindmotion/AscendMindMotion.java +++ b/src/main/java/net/fretux/mindmotion/AscendMindMotion.java @@ -1,13 +1,14 @@ package net.fretux.mindmotion; import com.mojang.logging.LogUtils; -import net.fretux.mindmotion.client.Keybinds; import net.fretux.mindmotion.command.SanityCommand; import net.fretux.mindmotion.event.CombatEvents; import net.fretux.mindmotion.event.PlayerTickHandler; import net.fretux.mindmotion.network.ModMessages; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.config.ModConfig; @@ -23,7 +24,9 @@ public class AscendMindMotion { public AscendMindMotion() { IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); modEventBus.addListener(this::commonSetup); - modEventBus.addListener(Keybinds::register); + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> + net.fretux.mindmotion.client.ClientBootstrap.init(modEventBus) + ); MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(PlayerTickHandler.class); MinecraftForge.EVENT_BUS.register(CombatEvents.class); @@ -36,4 +39,4 @@ public class AscendMindMotion { private void commonSetup(final FMLCommonSetupEvent event) { ModMessages.register(); } -} \ No newline at end of file +} diff --git a/src/main/java/net/fretux/mindmotion/network/VentClientEffectPacket.java b/src/main/java/net/fretux/mindmotion/network/VentClientEffectPacket.java index d94c02f..cc64605 100644 --- a/src/main/java/net/fretux/mindmotion/network/VentClientEffectPacket.java +++ b/src/main/java/net/fretux/mindmotion/network/VentClientEffectPacket.java @@ -1,7 +1,7 @@ package net.fretux.mindmotion.network; -import net.fretux.mindmotion.client.shader.VentShaderHandler; -import net.minecraft.client.Minecraft; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.fml.DistExecutor; import net.minecraft.network.FriendlyByteBuf; import net.minecraftforge.network.NetworkEvent; @@ -16,10 +16,10 @@ public class VentClientEffectPacket { public void handle(Supplier ctx) { ctx.get().enqueueWork(() -> { - Minecraft mc = Minecraft.getInstance(); - if (mc.player == null) return; - mc.player.swingTime = 10; - VentShaderHandler.triggerVentShockwave(); + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> + net.fretux.mindmotion.client.ClientPacketHandlers.handleVentEffect() + ); }); + ctx.get().setPacketHandled(true); } }