3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-26 16:12:42 +01:00

Push type converting to new entity types.

Dieser Commit ist enthalten in:
Myles 2016-08-10 19:38:59 +01:00
Ursprung 04d87ebba7
Commit 8cc2538e6c
2 geänderte Dateien mit 33 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -32,12 +32,40 @@ public class MetadataRewriter {
if (currentType == 54) {
// ZombieVillager - 27
// Husk - 23
Optional<Metadata> options = getById(metadata, 13);
if (options.isPresent()) {
if (((int) options.get().getValue()) == 0) {
return currentType;
}
if (((int) options.get().getValue()) == 6) {
return 23;
}
int profession = ((int) options.get().getValue()) - 1;
}
}
if (currentType == 100) {
// SkeletonHorse - 28
// ZombieHorse - 29
// Donkey - 31
// Mule - 32
Optional<Metadata> options = getById(metadata, 14);
if (options.isPresent()) {
if (((int) options.get().getValue()) == 0) {
return currentType;
}
if (((int) options.get().getValue()) == 1) {
return 31;
}
if (((int) options.get().getValue()) == 2) {
return 32;
}
if (((int) options.get().getValue()) == 3) {
return 29;
}
if (((int) options.get().getValue()) == 4) {
return 28;
}
}
}
return currentType;
}

Datei anzeigen

@ -38,8 +38,12 @@ public class ProtocolSnapshotTo1_10 extends Protocol {
handler(new PacketHandler() {
@Override
public void handle(PacketWrapper wrapper) throws Exception {
// Change Type :)
int type = wrapper.get(Type.VAR_INT, 1);
type = MetadataRewriter.rewriteEntityType(type, wrapper.get(Types1_9.METADATA_LIST, 0));
wrapper.set(Type.VAR_INT, 1, type);
// Register Type ID
wrapper.user().get(EntityTracker.class).getClientEntityTypes().put(wrapper.get(Type.VAR_INT, 0), wrapper.get(Type.VAR_INT, 1));
wrapper.user().get(EntityTracker.class).getClientEntityTypes().put(wrapper.get(Type.VAR_INT, 0), type);
}
});
}