diff --git a/src/main/java/me/tellinq/potioneffects/mixin/MinecraftMixin.java b/src/main/java/me/tellinq/potioneffects/mixin/MinecraftMixin.java new file mode 100644 index 0000000..1fa69ac --- /dev/null +++ b/src/main/java/me/tellinq/potioneffects/mixin/MinecraftMixin.java @@ -0,0 +1,17 @@ +package me.tellinq.potioneffects.mixin; + +import cc.polyfrost.oneconfig.events.EventManager; +import me.tellinq.potioneffects.event.UpdatePotionEffectsEvent; +import net.minecraft.client.Minecraft; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(Minecraft.class) +public class MinecraftMixin { + @Inject(method = "loadWorld(Lnet/minecraft/client/multiplayer/WorldClient;Ljava/lang/String;)V", at = @At(value = "TAIL")) + private void inject$loadWolEnd(CallbackInfo ci) { + EventManager.INSTANCE.post(new UpdatePotionEffectsEvent()); + } +} diff --git a/src/main/resources/mixins.potioneffects.json b/src/main/resources/mixins.potioneffects.json index 71d9927..c22a00a 100644 --- a/src/main/resources/mixins.potioneffects.json +++ b/src/main/resources/mixins.potioneffects.json @@ -7,6 +7,7 @@ "client": [ "EntityLivingBaseMixin", "InventoryEffectRendererMixin", - "GuiAccessor" + "GuiAccessor", + "MinecraftMixin" ] } \ No newline at end of file