Fix cat cotw on older versions (#5096)

This commit is contained in:
Warrior 2024-09-28 22:23:28 +02:00 committed by GitHub
parent 3d7810c568
commit 5c68a176e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -402,6 +402,7 @@ public class TamingManager extends SkillManager {
callOfWildEntity.setCustomName(LocaleLoader.getString("Taming.Summon.Name.Format", getPlayer().getName(), StringUtils.getPrettyEntityTypeString(EntityType.WOLF)));
}
@SuppressWarnings("deprecation")
private void spawnCat(Location spawnLocation, EntityType entityType) {
LivingEntity callOfWildEntity = (LivingEntity) getPlayer().getWorld().spawnEntity(spawnLocation, entityType);
@ -414,15 +415,13 @@ public class TamingManager extends SkillManager {
//Randomize the cat
if (callOfWildEntity instanceof Ocelot) {
// Ocelot.Type is deprecated, but that's fine since this only runs on 1.13
int numberOfTypes = Ocelot.Type.values().length;
((Ocelot) callOfWildEntity).setCatType(Ocelot.Type.values()[Misc.getRandom().nextInt(numberOfTypes)]);
((Ocelot) callOfWildEntity).setAdult();
} else if (callOfWildEntity instanceof Cat) {
int numberOfTypes = Cat.Type.values().length;
((Cat) callOfWildEntity).setCatType(Cat.Type.values()[Misc.getRandom().nextInt(numberOfTypes)]);
((Cat) callOfWildEntity).setAdult();
}
((Ageable) callOfWildEntity).setAdult();
callOfWildEntity.setCustomName(LocaleLoader.getString("Taming.Summon.Name.Format", getPlayer().getName(), StringUtils.getPrettyEntityTypeString(entityType)));
//Particle effect