diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-08-02 11:08:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-02 11:08:16 +0200 |
commit | 7a6c175ead0be52201f62d116dba953e5e112fa8 (patch) | |
tree | f984bdb70cafcec2b1ef1787e7ebee084ef98001 /src/main/java/at/hannibal2/skyhanni/mixins | |
parent | 32e7a457983a0a6050d7db8bd99dec52a5164979 (diff) | |
download | skyhanni-7a6c175ead0be52201f62d116dba953e5e112fa8.tar.gz skyhanni-7a6c175ead0be52201f62d116dba953e5e112fa8.tar.bz2 skyhanni-7a6c175ead0be52201f62d116dba953e5e112fa8.zip |
Fix: Contributor nametag flicker Patcher (#2296)
Co-authored-by: nea <nea@nea.moe>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/mixins')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntity.java | 14 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntityPlayer.java | 13 |
2 files changed, 16 insertions, 11 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntity.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntity.java index 951e65e27..12f1cdc61 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntity.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntity.java @@ -2,17 +2,19 @@ package at.hannibal2.skyhanni.mixins.transformers; import at.hannibal2.skyhanni.data.EntityData; import net.minecraft.entity.Entity; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.ChatComponentText; 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.CallbackInfoReturnable; +import org.spongepowered.asm.mixin.injection.ModifyVariable; @Mixin(Entity.class) public abstract class MixinEntity { - @Inject(method = "getDisplayName", at = @At("RETURN"), cancellable = true) - public void getDisplayName(CallbackInfoReturnable<IChatComponent> ci) { - EntityData.getDisplayName((Entity) (Object) this, ci); + @ModifyVariable( + method = "getDisplayName", + at = @At(value = "INVOKE", target = "Lnet/minecraft/util/ChatStyle;setInsertion(Ljava/lang/String;)Lnet/minecraft/util/ChatStyle;", shift = At.Shift.AFTER) + ) + public ChatComponentText getDisplayName(ChatComponentText value) { + return EntityData.getDisplayName((Entity) (Object) this, value); } } diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntityPlayer.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntityPlayer.java index 4a0d4d4a3..876ea1c8b 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntityPlayer.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntityPlayer.java @@ -2,17 +2,20 @@ package at.hannibal2.skyhanni.mixins.transformers; import at.hannibal2.skyhanni.data.EntityData; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ChatComponentText; import net.minecraft.util.IChatComponent; 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.CallbackInfoReturnable; +import org.spongepowered.asm.mixin.injection.ModifyVariable; @Mixin(EntityPlayer.class) public class MixinEntityPlayer { - @Inject(method = "getDisplayName", at = @At("RETURN"), cancellable = true) - public void getDisplayName(CallbackInfoReturnable<IChatComponent> ci) { - EntityData.getDisplayName((EntityPlayer) (Object) this, ci); + @ModifyVariable( + method = "getDisplayName", + at = @At(value = "INVOKE", target = "Lnet/minecraft/util/ChatStyle;setInsertion(Ljava/lang/String;)Lnet/minecraft/util/ChatStyle;", shift = At.Shift.AFTER) + ) + public IChatComponent getDisplayName(IChatComponent value) { + return EntityData.getDisplayName((EntityPlayer) (Object) this, (ChatComponentText) value); } } |