Only play totem animation for dying player in 1.11->1.10 (#860)

This commit is contained in:
EnZaXD 2024-08-14 09:38:27 +02:00 committed by GitHub
parent b03be8ecfe
commit 9c3255d5a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 3 deletions

View File

@ -83,7 +83,10 @@ public abstract class LegacyEntityRewriter<C extends ClientboundPacketType, T ex
handler(wrapper -> {
ClientWorld clientChunks = wrapper.user().get(ClientWorld.class);
clientChunks.setEnvironment(wrapper.get(Types.INT, 1));
addTrackedEntity(wrapper, wrapper.get(Types.INT, 0), playerType);
final int entityId = wrapper.get(Types.INT, 0);
addTrackedEntity(wrapper, entityId, playerType);
tracker(wrapper.user()).setClientEntityId(entityId);
});
}
});

View File

@ -159,9 +159,15 @@ public class EntityPacketRewriter1_11 extends LegacyEntityRewriter<ClientboundPa
map(Types.BYTE); // 1 - Entity Status
handler(wrapper -> {
byte b = wrapper.get(Types.BYTE, 0);
final int entityId = wrapper.get(Types.INT, 0);
if (entityId != tracker(wrapper.user()).clientEntityId()) {
// Entity events are sent for all players, but we only want to apply this for the self player
return;
}
if (b == 35) {
final byte entityStatus = wrapper.get(Types.BYTE, 0);
if (entityStatus == 35) {
// TODO spawn particles?
wrapper.clearPacket();
wrapper.setPacketType(ClientboundPackets1_9_3.GAME_EVENT);
wrapper.write(Types.UNSIGNED_BYTE, (short) 10); // Play Elder Guardian animation