3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-27 08:30:10 +01: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 oldType old type of the higher version
* @param replacement new type of the higher version * @param replacement new type of the higher version
* @return created entity data * @return created entity data
@ -98,12 +100,7 @@ public abstract class EntityRewriterBase<T extends BackwardsProtocol> extends Re
try { try {
T newType = Enum.valueOf(newTypeClass, oldType.name()); T newType = Enum.valueOf(newTypeClass, oldType.name());
typeMapping.put(oldType.getId(), newType.getId()); typeMapping.put(oldType.getId(), newType.getId());
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException ignored) {
// 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());
}
} }
} }
} }

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); 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.HOGLIN, Entity1_16Types.EntityType.COW).jsonName("Hoglin");
mapEntity(Entity1_16Types.EntityType.ZOGLIN, Entity1_16Types.EntityType.COW).jsonName("Zoglin"); 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.PIGLIN, Entity1_16Types.EntityType.ZOMBIFIED_PIGLIN).jsonName("Piglin");
mapEntity(Entity1_16Types.EntityType.STRIDER, Entity1_16Types.EntityType.MAGMA_CUBE).jsonName("Strider"); 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.ZOGLIN, 16).removed();
registerMetaHandler().filter(Entity1_16Types.EntityType.HOGLIN, 15).removed(); registerMetaHandler().filter(Entity1_16Types.EntityType.HOGLIN, 15).removed();