Adapt to the new SPELL spawn reason.
This new spawn reason was introduced somewhere between 1.18 and 1.18.1, and unfortunately it is a breaking change, so we have to employ it for MobArena to properly allow and register vexes (again...), but we also have to maintain a variation of the old logic so we don't break support for older server versions. Fixes #719
This commit is contained in:
@@ -31,6 +31,7 @@ These changes will (most likely) be included in the next version.
|
|||||||
- Pillagers and vindicators no longer spawn without their much-needed weapons.
|
- 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.
|
- 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.
|
- 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.
|
||||||
|
- Evokers are once again capable of spawning vexes on 1.18.1+.
|
||||||
- Reward groups with `nothing` in them no longer cause errors when earned/granted.
|
- 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.
|
- 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.
|
||||||
- Arena Signs now correctly update for arenas that don't have `kebab-case` names in the config-file.
|
- Arena Signs now correctly update for arenas that don't have `kebab-case` names in the config-file.
|
||||||
|
|||||||
@@ -393,8 +393,15 @@ public class ArenaListener
|
|||||||
* reason means MobArena didn't trigger the event. However, we
|
* reason means MobArena didn't trigger the event. However, we
|
||||||
* make an exception for certain mobs that spawn as results of
|
* make an exception for certain mobs that spawn as results of
|
||||||
* other entities spawning them, e.g. when Evokers summon Vexes.
|
* other entities spawning them, e.g. when Evokers summon Vexes.
|
||||||
|
* Note that the "spell" reason was introduced somewhere between
|
||||||
|
* 1.18 and 1.18.1, so "default" is kept only for compatibility
|
||||||
|
* with older server versions. Also note the use of `switch` as
|
||||||
|
* a workaround for the NoSuchFieldError that would occur if we
|
||||||
|
* used a simple equality check.
|
||||||
*/
|
*/
|
||||||
if (reason == SpawnReason.DEFAULT) {
|
switch (reason) {
|
||||||
|
case DEFAULT:
|
||||||
|
case SPELL: {
|
||||||
if (event.getEntityType() == EntityType.VEX) {
|
if (event.getEntityType() == EntityType.VEX) {
|
||||||
event.setCancelled(false);
|
event.setCancelled(false);
|
||||||
monsters.addMonster(event.getEntity());
|
monsters.addMonster(event.getEntity());
|
||||||
@@ -403,6 +410,7 @@ public class ArenaListener
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If not custom, we probably don't want it, so get rid of it
|
// If not custom, we probably don't want it, so get rid of it
|
||||||
if (reason != SpawnReason.CUSTOM) {
|
if (reason != SpawnReason.CUSTOM) {
|
||||||
|
|||||||
Reference in New Issue
Block a user