Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 16:12:42 +01:00
Handle pitch/yaw->data item frame rotation change in 1.16.4->1.17 (#4064)
See https://github.com/ViaVersion/ViaBackwards/pull/848
Dieser Commit ist enthalten in:
Ursprung
802e868b2e
Commit
aa22ca1d56
@ -48,6 +48,30 @@ public final class EntityPacketRewriter1_17 extends EntityRewriter<ClientboundPa
|
||||
registerTracker(ClientboundPackets1_16_2.ADD_PLAYER, EntityTypes1_17.PLAYER);
|
||||
registerSetEntityData(ClientboundPackets1_16_2.SET_ENTITY_DATA, Types1_16.ENTITY_DATA_LIST, Types1_17.ENTITY_DATA_LIST);
|
||||
|
||||
protocol.appendClientbound(ClientboundPackets1_16_2.ADD_ENTITY, wrapper -> {
|
||||
final int entityType = wrapper.get(Types.VAR_INT, 1);
|
||||
if (entityType != EntityTypes1_17.ITEM_FRAME.getId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Older clients will ignore the data field and the server sets the item frame rotation by the yaw/pitch field inside the packet,
|
||||
// newer clients do the opposite and ignore yaw/pitch and use the data field from the packet.
|
||||
final int entityId = wrapper.get(Types.VAR_INT, 0);
|
||||
|
||||
final byte pitch = wrapper.get(Types.BYTE, 0);
|
||||
final byte yaw = wrapper.get(Types.BYTE, 1);
|
||||
|
||||
final PacketWrapper setDirection = PacketWrapper.create(ClientboundPackets1_17.MOVE_ENTITY_ROT, wrapper.user());
|
||||
setDirection.write(Types.VAR_INT, entityId);
|
||||
setDirection.write(Types.BYTE, yaw);
|
||||
setDirection.write(Types.BYTE, pitch);
|
||||
setDirection.write(Types.BOOLEAN, false); // On Ground
|
||||
|
||||
wrapper.send(Protocol1_16_4To1_17.class);
|
||||
wrapper.cancel();
|
||||
setDirection.send(Protocol1_16_4To1_17.class);
|
||||
});
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_16_2.REMOVE_ENTITIES, null, wrapper -> {
|
||||
int[] entityIds = wrapper.read(Types.VAR_INT_ARRAY_PRIMITIVE);
|
||||
wrapper.cancel();
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren