3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-25 15:50:10 +01:00

Don't send pose to the client entity

Dieser Commit ist enthalten in:
creeper123123321 2019-04-27 17:39:45 -03:00
Ursprung 61b5c90aa7
Commit 6d8a763f4c
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 0AC57D54786721D1
4 geänderte Dateien mit 24 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -54,15 +54,17 @@ public class MetadataRewriter {
}
if (type.isOrHasParent(Entity1_14Types.EntityType.PLAYER)) {
if (metadata.getId() == 0) {
byte flags = ((Number) metadata.getValue()).byteValue();
// Mojang overrides the client-side pose updater, see OtherPlayerEntity#updateSize
tracker.setEntityFlags(entityId, flags);
} else if (metadata.getId() == 7) {
tracker.setRiptide(entityId, (((Number) metadata.getValue()).byteValue() & 0x4) != 0);
}
if (metadata.getId() == 0 || metadata.getId() == 7) {
metadatas.add(new Metadata(6, MetaType1_14.Pose, recalculatePlayerPose(entityId, tracker)));
if (entityId != tracker.getClientEntityId()) {
if (metadata.getId() == 0) {
byte flags = ((Number) metadata.getValue()).byteValue();
// Mojang overrides the client-side pose updater, see OtherPlayerEntity#updateSize
tracker.setEntityFlags(entityId, flags);
} else if (metadata.getId() == 7) {
tracker.setRiptide(entityId, (((Number) metadata.getValue()).byteValue() & 0x4) != 0);
}
if (metadata.getId() == 0 || metadata.getId() == 7) {
metadatas.add(new Metadata(6, MetaType1_14.Pose, recalculatePlayerPose(entityId, tracker)));
}
}
} else if (type.isOrHasParent(Entity1_14Types.EntityType.ZOMBIE)) {
if (metadata.getId() == 16) {

Datei anzeigen

@ -202,7 +202,9 @@ public class EntityPackets {
PacketWrapper metadataPacket = wrapper.create(0x43);
metadataPacket.write(Type.VAR_INT, entityId);
List<Metadata> metadataList = new LinkedList<>();
metadataList.add(new Metadata(6, MetaType1_14.Pose, MetadataRewriter.recalculatePlayerPose(entityId, tracker)));
if (tracker.getClientEntityId() != entityId) {
metadataList.add(new Metadata(6, MetaType1_14.Pose, MetadataRewriter.recalculatePlayerPose(entityId, tracker)));
}
metadataList.add(new Metadata(12, MetaType1_14.OptPosition, null));
metadataPacket.write(Types1_14.METADATA_LIST, metadataList);
metadataPacket.send(Protocol1_14To1_13_2.class);
@ -227,7 +229,9 @@ public class EntityPackets {
Position position = wrapper.read(Type.POSITION);
List<Metadata> metadataList = new LinkedList<>();
metadataList.add(new Metadata(12, MetaType1_14.OptPosition, position));
metadataList.add(new Metadata(6, MetaType1_14.Pose, MetadataRewriter.recalculatePlayerPose(entityId, tracker)));
if (tracker.getClientEntityId() != entityId) {
metadataList.add(new Metadata(6, MetaType1_14.Pose, MetadataRewriter.recalculatePlayerPose(entityId, tracker)));
}
wrapper.write(Types1_14.METADATA_LIST, metadataList);
}
});

Datei anzeigen

@ -302,7 +302,9 @@ public class WorldPackets {
Entity1_14Types.EntityType entType = Entity1_14Types.EntityType.PLAYER;
// Register Type ID
wrapper.user().get(EntityTracker.class).addEntity(entityId, entType);
EntityTracker tracker = wrapper.user().get(EntityTracker.class);
tracker.addEntity(entityId, entType);
tracker.setClientEntityId(entityId);
}
});

Datei anzeigen

@ -22,6 +22,9 @@ public class EntityTracker extends StoredObject implements ExternalJoinGameListe
private int latestTradeWindowId;
@Getter
@Setter
private int clientEntityId;
@Getter
@Setter
private boolean forceSendCenterChunk = true;
@Getter
@Setter
@ -92,6 +95,7 @@ public class EntityTracker extends StoredObject implements ExternalJoinGameListe
@Override
public void onExternalJoinGame(int playerEntityId) {
clientEntityId = playerEntityId;
clientEntityTypes.put(playerEntityId, Entity1_14Types.EntityType.PLAYER);
}