From fa2864d88f1f6b0b80badfc06c50a6c6e0519830 Mon Sep 17 00:00:00 2001 From: FlorianMichael Date: Sun, 7 Jul 2024 00:22:44 +0200 Subject: [PATCH] Update VV usage --- .../fixes/viaversion/MixinEntityPacketRewriter1_9.java | 2 +- .../mixin/fixes/viaversion/MixinEntityTracker1_9.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinEntityPacketRewriter1_9.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinEntityPacketRewriter1_9.java index 7fe8ff91..d6aae8c9 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinEntityPacketRewriter1_9.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinEntityPacketRewriter1_9.java @@ -31,7 +31,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(value = EntityPacketRewriter1_9.class, remap = false) public abstract class MixinEntityPacketRewriter1_9 { - @Inject(method = "handleMetadata", at = @At(value = "FIELD", target = "Lcom/viaversion/viaversion/api/minecraft/entities/EntityTypes1_9$EntityType;PLAYER:Lcom/viaversion/viaversion/api/minecraft/entities/EntityTypes1_9$EntityType;", ordinal = 0, shift = At.Shift.BEFORE), cancellable = true) + @Inject(method = "handleEntityData", at = @At(value = "FIELD", target = "Lcom/viaversion/viaversion/api/minecraft/entities/EntityTypes1_9$EntityType;PLAYER:Lcom/viaversion/viaversion/api/minecraft/entities/EntityTypes1_9$EntityType;", ordinal = 0, shift = At.Shift.BEFORE), cancellable = true) private void preventMetadataForClientPlayer(EntityDataHandlerEvent event, EntityData metadata, CallbackInfo ci) { if (event.user().getEntityTracker(Protocol1_8To1_9.class).clientEntityId() == event.entityId()) { ci.cancel(); diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinEntityTracker1_9.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinEntityTracker1_9.java index 93a53e76..fca38ffc 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinEntityTracker1_9.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/viaversion/MixinEntityTracker1_9.java @@ -29,17 +29,17 @@ import org.spongepowered.asm.mixin.injection.Slice; @Mixin(value = EntityTracker1_9.class, remap = false) public abstract class MixinEntityTracker1_9 { - @Redirect(method = "handleMetadata", at = @At(value = "INVOKE", target = "Ljava/lang/Math;min(FF)F"), slice = @Slice(from = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/api/configuration/ViaVersionConfig;isBossbarAntiflicker()Z"))) + @Redirect(method = "handleEntityData", at = @At(value = "INVOKE", target = "Ljava/lang/Math;min(FF)F"), slice = @Slice(from = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/api/configuration/ViaVersionConfig;isBossbarAntiflicker()Z"))) private float removeMin(float a, float b) { return a; } - @Redirect(method = "handleMetadata", at = @At(value = "INVOKE", target = "Ljava/lang/Math;max(FF)F"), slice = @Slice(from = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/api/configuration/ViaVersionConfig;isBossbarAntiflicker()Z"))) + @Redirect(method = "handleEntityData", at = @At(value = "INVOKE", target = "Ljava/lang/Math;max(FF)F"), slice = @Slice(from = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/api/configuration/ViaVersionConfig;isBossbarAntiflicker()Z"))) private float removeMax(float a, float b) { return b; } - @Redirect(method = "handleMetadata", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/api/minecraft/entitydata/EntityData;getValue()Ljava/lang/Object;"), slice = @Slice(from = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/api/configuration/ViaVersionConfig;isBossbarAntiflicker()Z"))) + @Redirect(method = "handleEntityData", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/api/minecraft/entitydata/EntityData;getValue()Ljava/lang/Object;"), slice = @Slice(from = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/api/configuration/ViaVersionConfig;isBossbarAntiflicker()Z"))) private Object remapNaNToZero(EntityData instance) { if (instance.getValue() instanceof Float && ((Float) instance.getValue()).isNaN()) { return 0F;