3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-07-28 09:58:04 +02:00

Fix entity rewriting

Dieser Commit ist enthalten in:
KennyTV 2020-04-30 17:16:47 +02:00
Ursprung e49c355580
Commit 446f46db83
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
2 geänderte Dateien mit 4 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -69,6 +69,8 @@ public abstract class EntityRewriterBase<T extends BackwardsProtocol> extends Re
}
/**
* Note that both types should be of the SAME version.
*
* @param oldType old type of the higher version
* @param replacement new type of the higher version
* @return created entity data
@ -98,12 +100,7 @@ public abstract class EntityRewriterBase<T extends BackwardsProtocol> extends Re
try {
T newType = Enum.valueOf(newTypeClass, oldType.name());
typeMapping.put(oldType.getId(), newType.getId());
} catch (IllegalArgumentException e) {
// Missing ones should be mapped BEFORE using this method
if (!typeMapping.containsKey(oldType.getId())) {
ViaBackwards.getPlatform().getLogger().warning("Could not find new entity type for " + oldType + "! " +
"Old type: " + oldType.getClass().getSimpleName() + " New type: " + newTypeClass.getSimpleName());
}
} catch (IllegalArgumentException ignored) {
}
}
}

Datei anzeigen

@ -111,14 +111,13 @@ public class EntityPackets1_16 extends EntityRewriter<Protocol1_15_2To1_16> {
});
mapEntityDirect(Entity1_16Types.EntityType.ZOMBIFIED_PIGLIN, Entity1_15Types.EntityType.ZOMBIE_PIGMAN);
mapTypes(Entity1_16Types.EntityType.values(), Entity1_15Types.EntityType.class);
mapEntity(Entity1_16Types.EntityType.HOGLIN, Entity1_16Types.EntityType.COW).jsonName("Hoglin");
mapEntity(Entity1_16Types.EntityType.ZOGLIN, Entity1_16Types.EntityType.COW).jsonName("Zoglin");
mapEntity(Entity1_16Types.EntityType.PIGLIN, Entity1_16Types.EntityType.ZOMBIFIED_PIGLIN).jsonName("Piglin");
mapEntity(Entity1_16Types.EntityType.STRIDER, Entity1_16Types.EntityType.MAGMA_CUBE).jsonName("Strider");
mapTypes(Entity1_16Types.EntityType.values(), Entity1_15Types.EntityType.class);
registerMetaHandler().filter(Entity1_16Types.EntityType.ZOGLIN, 16).removed();
registerMetaHandler().filter(Entity1_16Types.EntityType.HOGLIN, 15).removed();