Fix Mob Spawner logic with CustomSpawnRules. Closes #8398

This commit is contained in:
LexManos committed 2022-02-22 14:18:52 -08:00
1 parent bc24487d0e
commit a9237cff75
3 files changed
+20 -6

No files matched your search

@@ -204,6 +204,7 @@ public class ForgeEventFactory
return event.getResult();
}
@Deprecated(forRemoval = true, since = "1.18.1")
public static boolean canEntitySpawnSpawner(Mob entity, Level world, float x, float y, float z, BaseSpawner spawner)
{
Result result = canEntitySpawn(entity, world, x, y, z, spawner, MobSpawnType.SPAWNER);
@@ -213,7 +214,12 @@ public class ForgeEventFactory
return result == Result.ALLOW;
}
@Deprecated(forRemoval = true, since = "1.18.1")
public static boolean doSpecialSpawn(Mob entity, Level world, float x, float y, float z, BaseSpawner spawner, MobSpawnType spawnReason)
{
return doSpecialSpawn(entity, (LevelAccessor)world, x, y, z, spawner, spawnReason);
}
public static boolean doSpecialSpawn(Mob entity, LevelAccessor world, float x, float y, float z, BaseSpawner spawner, MobSpawnType spawnReason)
{
return MinecraftForge.EVENT_BUS.post(new LivingSpawnEvent.SpecialSpawn(entity, world, x, y, z, spawner, spawnReason));
}
@@ -255,7 +261,7 @@ public class ForgeEventFactory
MinecraftForge.EVENT_BUS.post(event);
return event.getDisplayname();
}
public static Component getPlayerTabListDisplayName(Player player)
{
PlayerEvent.TabListNameFormat event = new PlayerEvent.TabListNameFormat(player);
@@ -118,7 +118,7 @@ public class LivingSpawnEvent extends LivingEvent
* SpecialSpawn is fired when an Entity is to be spawned.<br>
* This allows you to do special inializers in the new entity.<br>
* <br>
* This event is fired via the {@link ForgeEventFactory#doSpecialSpawn(Mob, Level, float, float, float, BaseSpawner, MobSpawnType)}.<br>
* This event is fired via the {@link ForgeEventFactory#doSpecialSpawn(Mob, LevelAccessor, float, float, float, BaseSpawner, MobSpawnType)}.<br>
* <br>
* This event is {@link net.minecraftforge.eventbus.api.Cancelable}.<br>
* If this event is canceled, the Entity is not spawned.<br>
@@ -137,7 +137,13 @@ public class LivingSpawnEvent extends LivingEvent
/**
* @param spawner the position of a tileentity or approximate position of an entity that initiated the spawn if any
*/
@Deprecated(forRemoval = true, since = "1.18.1")
public SpecialSpawn(Mob entity, Level world, double x, double y, double z, @Nullable BaseSpawner spawner, MobSpawnType spawnReason)
{
this(entity, (LevelAccessor)world, x, y, z, spawner, spawnReason);
}
public SpecialSpawn(Mob entity, LevelAccessor world, double x, double y, double z, @Nullable BaseSpawner spawner, MobSpawnType spawnReason)
{
super(entity, world, x, y, z);
this.spawner = spawner;