Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cat cotw on older versions #5096

Merged
merged 1 commit into from
Sep 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ private void spawnWolf(Location spawnLocation) {
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);

Expand All @@ -414,15 +415,13 @@ private void spawnCat(Location spawnLocation, EntityType entityType) {

//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
Expand Down
Loading