Push type converting to new entity types.

This commit is contained in:
Myles 2016-08-10 19:38:59 +01:00
parent 04d87ebba7
commit 8cc2538e6c
2 changed files with 33 additions and 1 deletions

View File

@ -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;
}

View File

@ -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);
}
});
}