Skip to content

Commit

Permalink
Only play totem animation for dying player in 1.11->1.10
Browse files Browse the repository at this point in the history
The animation should only be played for the player dying which currently is not the case because the packet is sent to all players and is then mapped to a game event, without this fix the totem animation is played for all nearby players.
  • Loading branch information
FlorianMichael committed Aug 8, 2024
1 parent 4c56605 commit 2ed8c87
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ public void register() {
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);
});
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,15 @@ public void register() {
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
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
projectVersion=5.0.3
projectVersion=5.0.4-SNAPSHOT

# Smile emoji
mcVersions=1.21,1.20.6,1.20.5,1.20.4, 1.20.3, 1.20.2, 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18, 1.17.1, 1.17, 1.16.5, 1.16.4, 1.16.3, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.4, 1.14.3, 1.14.2, 1.14.1, 1.14, 1.13.2, 1.13.1, 1.13, 1.12.2, 1.12.1, 1.12, 1.11.2, 1.11.1, 1.11, 1.10.2, 1.10.1, 1.10
Expand Down

0 comments on commit 2ed8c87

Please sign in to comment.