Skip to content

Commit

Permalink
Make potion effects update on world load
Browse files Browse the repository at this point in the history
  • Loading branch information
Tellinq committed Aug 24, 2023
1 parent b58d765 commit ff15179
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
17 changes: 17 additions & 0 deletions src/main/java/me/tellinq/potioneffects/mixin/MinecraftMixin.java
Original file line number Diff line number Diff line change
@@ -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());
}
}
3 changes: 2 additions & 1 deletion src/main/resources/mixins.potioneffects.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"client": [
"EntityLivingBaseMixin",
"InventoryEffectRendererMixin",
"GuiAccessor"
"GuiAccessor",
"MinecraftMixin"
]
}

0 comments on commit ff15179

Please sign in to comment.