From b26f8950304fdb5da586fc9ec9a34aab17e6ff87 Mon Sep 17 00:00:00 2001 From: Giselle Date: Tue, 7 Jan 2025 11:14:48 +0900 Subject: [PATCH 1/2] Fix #38 again --- .../impl/mixin/ServerPlayNetworkHandlerMixin_Disguiser.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/xyz/nucleoid/disguiselib/impl/mixin/ServerPlayNetworkHandlerMixin_Disguiser.java b/src/main/java/xyz/nucleoid/disguiselib/impl/mixin/ServerPlayNetworkHandlerMixin_Disguiser.java index 94bc962..35cd760 100644 --- a/src/main/java/xyz/nucleoid/disguiselib/impl/mixin/ServerPlayNetworkHandlerMixin_Disguiser.java +++ b/src/main/java/xyz/nucleoid/disguiselib/impl/mixin/ServerPlayNetworkHandlerMixin_Disguiser.java @@ -83,9 +83,9 @@ public ServerPlayNetworkHandlerMixin_Disguiser(MinecraftServer server, ClientCon if(original != null && ((EntityDisguise) original).isDisguised()) { Entity disguised = ((EntityDisguise) original).getDisguiseEntity(); if(disguised != null) { + remove.run(); ((DisguiseUtils) original).updateTrackedData(); - List> trackedValues = disguised.getDataTracker().getChangedEntries(); - ((EntityTrackerUpdateS2CPacketAccessor) packet).setTrackedValues(trackedValues); + add.accept(new EntityTrackerUpdateS2CPacket(entityId, disguised.getDataTracker().getChangedEntries())); } } } From efbe80b407cd03013d6aad4db32f188816317e18 Mon Sep 17 00:00:00 2001 From: Giselle Date: Tue, 7 Jan 2025 15:09:42 +0900 Subject: [PATCH 2/2] Remove unused method --- .../mixin/ServerPlayNetworkHandlerMixin_Disguiser.java | 3 ++- .../accessor/EntityTrackerUpdateS2CPacketAccessor.java | 9 +-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/main/java/xyz/nucleoid/disguiselib/impl/mixin/ServerPlayNetworkHandlerMixin_Disguiser.java b/src/main/java/xyz/nucleoid/disguiselib/impl/mixin/ServerPlayNetworkHandlerMixin_Disguiser.java index 35cd760..25f6af8 100644 --- a/src/main/java/xyz/nucleoid/disguiselib/impl/mixin/ServerPlayNetworkHandlerMixin_Disguiser.java +++ b/src/main/java/xyz/nucleoid/disguiselib/impl/mixin/ServerPlayNetworkHandlerMixin_Disguiser.java @@ -73,7 +73,8 @@ public ServerPlayNetworkHandlerMixin_Disguiser(MinecraftServer server, ClientCon trackedValues.add(fakeInvisibleFlag); } } - ((EntityTrackerUpdateS2CPacketAccessor) packet).setTrackedValues(trackedValues); + remove.run(); + add.accept(new EntityTrackerUpdateS2CPacket(entityId, trackedValues)); } else if(!((EntityDisguise) this.player).hasTrueSight()) { // Fixing "wrong data" client issue (#1) // Just prevents the client from spamming the log diff --git a/src/main/java/xyz/nucleoid/disguiselib/impl/mixin/accessor/EntityTrackerUpdateS2CPacketAccessor.java b/src/main/java/xyz/nucleoid/disguiselib/impl/mixin/accessor/EntityTrackerUpdateS2CPacketAccessor.java index 0244aaa..0dd0610 100644 --- a/src/main/java/xyz/nucleoid/disguiselib/impl/mixin/accessor/EntityTrackerUpdateS2CPacketAccessor.java +++ b/src/main/java/xyz/nucleoid/disguiselib/impl/mixin/accessor/EntityTrackerUpdateS2CPacketAccessor.java @@ -1,19 +1,12 @@ package xyz.nucleoid.disguiselib.impl.mixin.accessor; -import net.minecraft.entity.data.DataTracker; -import net.minecraft.network.packet.s2c.play.EntityTrackerUpdateS2CPacket; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Mutable; import org.spongepowered.asm.mixin.gen.Accessor; -import java.util.List; +import net.minecraft.network.packet.s2c.play.EntityTrackerUpdateS2CPacket; @Mixin(EntityTrackerUpdateS2CPacket.class) public interface EntityTrackerUpdateS2CPacketAccessor { @Accessor("id") int getEntityId(); - - @Mutable - @Accessor("trackedValues") - void setTrackedValues(List> trackedValues); }