mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-22 10:05:12 +01:00
Handle ENTITY_TELEPORT's targeting the client player (#3296)
This commit is contained in:
parent
20d86374b5
commit
394be165fd
@ -106,6 +106,7 @@ public final class EntityPackets extends EntityRewriter<ClientboundPackets1_19_3
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_19_3.SET_PASSENGERS, new PacketHandlers() {
|
||||
@Override
|
||||
protected void register() {
|
||||
@ -131,6 +132,30 @@ public final class EntityPackets extends EntityRewriter<ClientboundPackets1_19_3
|
||||
}
|
||||
});
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_19_3.ENTITY_TELEPORT, new PacketHandlers() {
|
||||
@Override
|
||||
protected void register() {
|
||||
handler(wrapper -> {
|
||||
final int entityId = wrapper.read(Type.VAR_INT); // entity id
|
||||
final int clientEntityId = wrapper.user().getEntityTracker(Protocol1_19_4To1_19_3.class).clientEntityId();
|
||||
if (entityId != clientEntityId) {
|
||||
wrapper.write(Type.VAR_INT, entityId); // entity id
|
||||
return;
|
||||
}
|
||||
|
||||
wrapper.setPacketType(ClientboundPackets1_19_4.PLAYER_POSITION);
|
||||
wrapper.passthrough(Type.DOUBLE); // x
|
||||
wrapper.passthrough(Type.DOUBLE); // y
|
||||
wrapper.passthrough(Type.DOUBLE); // z
|
||||
wrapper.write(Type.FLOAT, wrapper.read(Type.BYTE) * 360F / 256F); // yaw
|
||||
wrapper.write(Type.FLOAT, wrapper.read(Type.BYTE) * 360F / 256F); // pitch
|
||||
wrapper.read(Type.BOOLEAN); // on ground
|
||||
wrapper.write(Type.BYTE, (byte) 0); // flags
|
||||
wrapper.write(Type.VAR_INT, -1); // teleport id
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_19_3.ENTITY_ANIMATION, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
|
Loading…
Reference in New Issue
Block a user