mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-22 18:15:39 +01:00
Push type converting to new entity types.
This commit is contained in:
parent
04d87ebba7
commit
8cc2538e6c
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user