3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-11-16 04:50:10 +01:00

Also explicitly map entity data list type in 1.12

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-08-24 17:20:42 +02:00
Ursprung 24f67ffe80
Commit d6279757bb
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
2 geänderte Dateien mit 6 neuen und 29 gelöschten Zeilen

Datei anzeigen

@ -92,30 +92,6 @@ public abstract class LegacyEntityRewriter<C extends ClientboundPacketType, T ex
}); });
} }
@Override
public void registerSetEntityData(C packetType, Type<List<EntityData>> dataType, Type<List<EntityData>> mappedDataType) {
protocol.registerClientbound(packetType, new PacketHandlers() {
@Override
public void register() {
map(Types.VAR_INT); // 0 - Entity ID
if (dataType != null) {
map(dataType, mappedDataType);
} else {
map(mappedDataType);
}
handler(wrapper -> {
List<EntityData> entityDataList = wrapper.get(mappedDataType, 0);
handleEntityData(wrapper.get(Types.VAR_INT, 0), entityDataList, wrapper.user());
});
}
});
}
@Override
public void registerSetEntityData(C packetType, Type<List<EntityData>> dataType) {
registerSetEntityData(packetType, null, dataType);
}
protected PacketHandler getMobSpawnRewriter(Type<List<EntityData>> dataType, IdSetter idSetter) { protected PacketHandler getMobSpawnRewriter(Type<List<EntityData>> dataType, IdSetter idSetter) {
return wrapper -> { return wrapper -> {
int entityId = wrapper.get(Types.VAR_INT, 0); int entityId = wrapper.get(Types.VAR_INT, 0);

Datei anzeigen

@ -31,6 +31,7 @@ import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.api.type.types.version.Types1_12; import com.viaversion.viaversion.api.type.types.version.Types1_12;
import com.viaversion.viaversion.api.type.types.version.Types1_9;
import com.viaversion.viaversion.libs.gson.JsonElement; import com.viaversion.viaversion.libs.gson.JsonElement;
import com.viaversion.viaversion.protocols.v1_11_1to1_12.packet.ClientboundPackets1_12; import com.viaversion.viaversion.protocols.v1_11_1to1_12.packet.ClientboundPackets1_12;
import com.viaversion.viaversion.protocols.v1_9_1to1_9_3.packet.ClientboundPackets1_9_3; import com.viaversion.viaversion.protocols.v1_9_1to1_9_3.packet.ClientboundPackets1_9_3;
@ -83,13 +84,13 @@ public class EntityPacketRewriter1_12 extends LegacyEntityRewriter<ClientboundPa
map(Types.SHORT); // 9 - Velocity X map(Types.SHORT); // 9 - Velocity X
map(Types.SHORT); // 10 - Velocity Y map(Types.SHORT); // 10 - Velocity Y
map(Types.SHORT); // 11 - Velocity Z map(Types.SHORT); // 11 - Velocity Z
map(Types1_12.ENTITY_DATA_LIST); // 12 - Entity data map(Types1_12.ENTITY_DATA_LIST, Types1_9.ENTITY_DATA_LIST); // 12 - Entity data
// Track entity // Track entity
handler(getTrackerHandler()); handler(getTrackerHandler());
// Rewrite entity type / data // Rewrite entity type / data
handler(getMobSpawnRewriter1_11(Types1_12.ENTITY_DATA_LIST)); handler(getMobSpawnRewriter1_11(Types1_9.ENTITY_DATA_LIST));
} }
}); });
@ -105,9 +106,9 @@ public class EntityPacketRewriter1_12 extends LegacyEntityRewriter<ClientboundPa
map(Types.DOUBLE); // 4 - Z map(Types.DOUBLE); // 4 - Z
map(Types.BYTE); // 5 - Yaw map(Types.BYTE); // 5 - Yaw
map(Types.BYTE); // 6 - Pitch map(Types.BYTE); // 6 - Pitch
map(Types1_12.ENTITY_DATA_LIST); // 7 - Entity data list map(Types1_12.ENTITY_DATA_LIST, Types1_9.ENTITY_DATA_LIST); // 7 - Entity data list
handler(getTrackerAndDataHandler(Types1_12.ENTITY_DATA_LIST, EntityTypes1_12.EntityType.PLAYER)); handler(getTrackerAndDataHandler(Types1_9.ENTITY_DATA_LIST, EntityTypes1_12.EntityType.PLAYER));
} }
}); });
@ -142,7 +143,7 @@ public class EntityPacketRewriter1_12 extends LegacyEntityRewriter<ClientboundPa
registerRespawn(ClientboundPackets1_12.RESPAWN); registerRespawn(ClientboundPackets1_12.RESPAWN);
registerRemoveEntities(ClientboundPackets1_12.REMOVE_ENTITIES); registerRemoveEntities(ClientboundPackets1_12.REMOVE_ENTITIES);
registerSetEntityData(ClientboundPackets1_12.SET_ENTITY_DATA, Types1_12.ENTITY_DATA_LIST); registerSetEntityData(ClientboundPackets1_12.SET_ENTITY_DATA, Types1_12.ENTITY_DATA_LIST, Types1_9.ENTITY_DATA_LIST);
protocol.registerClientbound(ClientboundPackets1_12.UPDATE_ATTRIBUTES, new PacketHandlers() { protocol.registerClientbound(ClientboundPackets1_12.UPDATE_ATTRIBUTES, new PacketHandlers() {
@Override @Override