Force adult entities; additional baby entities.

This commit (unfortunately) makes two somewhat unrelated changes:

- Forces certain ageable entities into adulthood to prevent the occasional baby spawns (fixes #687).
- Introduces support for baby versions of certain ageable entities (fixes #689).


Co-authored-by: Andreas Troelsen <garbagemule@gmail.com>
This commit is contained in:
Maroon28 2021-10-13 23:24:56 +02:00 committed by GitHub
parent caee8be6ca
commit 3693c039a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 3 deletions

View File

@ -13,6 +13,7 @@ These changes will (most likely) be included in the next version.
## [Unreleased]
### Added
- New monster variant `angry-bees` can be used to spawn angry bees.
- Husks, drowned, piglins, hoglins, and zoglins can now be spawned in their baby versions using the `baby` prefix seen on other monster types (e.g. `baby-zombie`).
- Pet names are now per-class configurable via the optional `pet-name` property, which defaults to `<display-name>'s pet` (the `<player-name>` variable is also supported).
- New per-arena setting `auto-leave-on-end` can be used to automatically "kick" spectators when the current session ends.
- Added boss abilities `disorient-all`, `fetch-all`, `pull-all`, and `throw-all`. These abilities work like their target-specific and distance-based counterparts, but affect all players in the arena.
@ -27,6 +28,7 @@ These changes will (most likely) be included in the next version.
### Fixed
- Pillagers and vindicators no longer spawn without their much-needed weapons.
- Piglins, piglin brutes, and hoglins no longer zombify. This fixes a bug where the mobs would despawn due to the zombification process.
- Zombies, husks, drowned, zombie villagers, piglins, hoglins, and zoglins without the `baby` prefix are now forced into adulthood to prevent them from occasionally spawning as babies.
- Reward groups with `nothing` in them no longer cause errors when earned/granted.
- The title-based announcer and the title-based boss health bar have been fixed to work with the breaking change to the Title API in Spigot 1.17.

View File

@ -5,20 +5,20 @@ import com.garbagemule.MobArena.framework.Arena;
import org.bukkit.Bukkit;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Bee;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Hoglin;
import org.bukkit.entity.PiglinAbstract;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.PigZombie;
import org.bukkit.entity.PiglinAbstract;
import org.bukkit.entity.Rabbit;
import org.bukkit.entity.Sheep;
import org.bukkit.entity.Slime;
import org.bukkit.entity.Wolf;
import org.bukkit.entity.Zoglin;
import org.bukkit.entity.Zombie;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
@ -131,19 +131,39 @@ public class MACreature {
case "magmacubehuge":
((Slime) e).setSize(4);
break;
case "babydrowned":
case "babyhusk":
case "babyzombievillager":
case "babyzombie":
((Zombie) e).setBaby(true);
break;
case "babyhoglin":
((Hoglin) e).setImmuneToZombification(true);
((Hoglin) e).setBaby();
break;
case "babypiglin":
((PiglinAbstract) e).setBaby();
((PiglinAbstract) e).setImmuneToZombification(true);
break;
case "babypigman":
case "babyzombifiedpiglin":
((Zombie) e).setBaby(true);
((PigZombie) e).setAngry(true);
break;
case "babyzoglin":
((Zoglin) e).setBaby();
break;
case "pigzombie":
case "zombiepigman":
case "zombifiedpiglin":
((PigZombie) e).setAngry(true);
((PigZombie) e).setBaby(false);
break;
case "husk":
case "drowned":
case "zombievillager":
case "zombie":
((Zombie) e).setBaby(false);
break;
case "killerbunny":
((Rabbit) e).setRabbitType(Rabbit.Type.THE_KILLER_BUNNY);
@ -151,9 +171,11 @@ public class MACreature {
case "piglin":
case "piglinbrute":
((PiglinAbstract) e).setImmuneToZombification(true);
((PiglinAbstract) e).setAdult();
break;
case "hoglin":
((Hoglin) e).setImmuneToZombification(true);
((Hoglin) e).setAdult();
break;
default:
break;
@ -241,6 +263,11 @@ public class MACreature {
//
put("angrybee", "angrybees", "BEE", null);
put("angrywolf", "angrywolves", "WOLF");
put("babydrowned", "babydrowned", "DROWNED");
put("babyhoglin", "babyhoglins", "HOGLIN", null);
put("babyhusk", "babyhusks", "HUSK");
put("babypiglin", "babypiglins", "PIGLIN", null);
put("babyzoglin", "babyzoglins", "ZOGLIN", null);
put("babyzombie", "babyzombies", "ZOMBIE");
put("babyzombievillager", "babyzombievillagers", "ZOMBIE_VILLAGER");
put("killerbunny", "killerbunnies", "RABBIT");