3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-08 17:20:24 +01:00

Merge pull request #1479 from KennyTV/dev

Fix an error in the player spawn packet
Dieser Commit ist enthalten in:
Myles 2019-10-04 13:40:24 +01:00 committet von GitHub
Commit 232f2494e3
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -60,27 +60,28 @@ public class EntityPackets {
protocol.registerOutgoing(State.PLAY, 0x03, 0x03, new PacketRemapper() { protocol.registerOutgoing(State.PLAY, 0x03, 0x03, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
map(Type.UUID); // 1 - Entity UUID
map(Type.VAR_INT); // 2 - Entity Type
map(Type.DOUBLE); // 3 - X
map(Type.DOUBLE); // 4 - Y
map(Type.DOUBLE); // 5 - Z
map(Type.BYTE); // 6 - Yaw
map(Type.BYTE); // 7 - Pitch
map(Type.BYTE); // 8 - Head Pitch
map(Type.SHORT); // 9 - Velocity X
map(Type.SHORT); // 10 - Velocity Y
map(Type.SHORT); // 11 - Velocity Z
map(Types1_14.METADATA_LIST, Type.NOTHING); // removed - probably sent in an update packet?
handler(new PacketHandler() { handler(new PacketHandler() {
@Override @Override
public void handle(PacketWrapper wrapper) throws Exception { public void handle(PacketWrapper wrapper) throws Exception {
int entityId = wrapper.passthrough(Type.VAR_INT); int entityId = wrapper.get(Type.VAR_INT, 0);
wrapper.passthrough(Type.UUID); int typeId = wrapper.get(Type.VAR_INT, 1);
int typeId = wrapper.read(Type.VAR_INT);
Entity1_15Types.EntityType entityType = Entity1_15Types.getTypeFromId(getNewEntityId(typeId)); Entity1_15Types.EntityType entityType = Entity1_15Types.getTypeFromId(getNewEntityId(typeId));
wrapper.user().get(EntityTracker.class).addEntity(entityId, entityType); wrapper.user().get(EntityTracker.class).addEntity(entityId, entityType);
wrapper.write(Type.VAR_INT, entityType.getId()); wrapper.set(Type.VAR_INT, 1, entityType.getId());
wrapper.passthrough(Type.DOUBLE);
wrapper.passthrough(Type.DOUBLE);
wrapper.passthrough(Type.DOUBLE);
wrapper.passthrough(Type.BYTE);
wrapper.passthrough(Type.BYTE);
wrapper.passthrough(Type.BYTE);
wrapper.passthrough(Type.SHORT);
wrapper.passthrough(Type.SHORT);
wrapper.passthrough(Type.SHORT);
wrapper.read(Types1_14.METADATA_LIST); // removed - probably sent in an update packet?
} }
}); });
} }
@ -90,23 +91,22 @@ public class EntityPackets {
protocol.registerOutgoing(State.PLAY, 0x05, 0x05, new PacketRemapper() { protocol.registerOutgoing(State.PLAY, 0x05, 0x05, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
map(Type.UUID); // 1 - Player UUID
map(Type.DOUBLE); // 2 - X
map(Type.DOUBLE); // 3 - Y
map(Type.DOUBLE); // 4 - Z
map(Type.BYTE); // 5 - Yaw
map(Type.BYTE); // 6 - Pitch
map(Types1_14.METADATA_LIST, Type.NOTHING); // removed - probably sent in an update packet?
handler(new PacketHandler() { handler(new PacketHandler() {
@Override @Override
public void handle(PacketWrapper wrapper) throws Exception { public void handle(PacketWrapper wrapper) throws Exception {
int entityId = wrapper.passthrough(Type.VAR_INT); int entityId = wrapper.get(Type.VAR_INT, 0);
wrapper.passthrough(Type.UUID);
int typeId = wrapper.read(Type.VAR_INT); Entity1_15Types.EntityType entityType = Entity1_15Types.EntityType.PLAYER;
Entity1_15Types.EntityType entityType = Entity1_15Types.getTypeFromId(getNewEntityId(typeId));
wrapper.user().get(EntityTracker.class).addEntity(entityId, entityType); wrapper.user().get(EntityTracker.class).addEntity(entityId, entityType);
wrapper.write(Type.VAR_INT, entityType.getId());
wrapper.passthrough(Type.DOUBLE);
wrapper.passthrough(Type.DOUBLE);
wrapper.passthrough(Type.DOUBLE);
wrapper.passthrough(Type.BYTE);
wrapper.passthrough(Type.BYTE);
wrapper.read(Types1_14.METADATA); // removed - probably sent in an update packet?
} }
}); });
} }