diff --git a/common/net/minecraftforge/event/ForgeEventFactory.java b/common/net/minecraftforge/event/ForgeEventFactory.java index e78ac6b33..d67cbedde 100644 --- a/common/net/minecraftforge/event/ForgeEventFactory.java +++ b/common/net/minecraftforge/event/ForgeEventFactory.java @@ -11,7 +11,7 @@ import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.Event.Result; -import net.minecraftforge.event.entity.living.LivingMaxCanSpawnEvent; +import net.minecraftforge.event.entity.living.LivingPackSizeEvent; import net.minecraftforge.event.entity.living.LivingSpawnEvent; import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; import net.minecraftforge.event.entity.player.PlayerEvent; @@ -69,10 +69,10 @@ public class ForgeEventFactory return event.list; } - public static int getMaxSpawnedInChunk(EntityLiving entity) + public static int getMaxSpawnPackSize(EntityLiving entity) { - LivingMaxCanSpawnEvent maxCanSpawnEvent = new LivingMaxCanSpawnEvent(entity); + LivingPackSizeEvent maxCanSpawnEvent = new LivingPackSizeEvent(entity); MinecraftForge.EVENT_BUS.post(maxCanSpawnEvent); - return maxCanSpawnEvent.getResult() == Result.ALLOW ? maxCanSpawnEvent.maxSpawnInChunk : entity.getMaxSpawnedInChunk(); + return maxCanSpawnEvent.getResult() == Result.ALLOW ? maxCanSpawnEvent.maxPackSize : entity.getMaxSpawnedInChunk(); } } diff --git a/common/net/minecraftforge/event/entity/living/LivingMaxCanSpawnEvent.java b/common/net/minecraftforge/event/entity/living/LivingMaxCanSpawnEvent.java deleted file mode 100644 index d41986958..000000000 --- a/common/net/minecraftforge/event/entity/living/LivingMaxCanSpawnEvent.java +++ /dev/null @@ -1,23 +0,0 @@ -package net.minecraftforge.event.entity.living; - -import net.minecraft.entity.EntityLiving; -import net.minecraftforge.event.Event.HasResult; - -@HasResult -public class LivingMaxCanSpawnEvent extends LivingEvent -{ - /** - * This event is fired when the spawning system tries to determine the - * maximum amount of the entity can spawn in a chunk. - * - * If you set the result to 'ALLOW', it means that you want to return - * the value of maxSpawnInChunk as the maximum amount allowed in the - * chunk. - */ - public int maxSpawnInChunk; - - public LivingMaxCanSpawnEvent(EntityLiving entity) - { - super(entity); - } -} diff --git a/common/net/minecraftforge/event/entity/living/LivingPackSizeEvent.java b/common/net/minecraftforge/event/entity/living/LivingPackSizeEvent.java new file mode 100644 index 000000000..01affa682 --- /dev/null +++ b/common/net/minecraftforge/event/entity/living/LivingPackSizeEvent.java @@ -0,0 +1,23 @@ +package net.minecraftforge.event.entity.living; + +import net.minecraft.entity.EntityLiving; +import net.minecraftforge.event.Event.HasResult; + +@HasResult +public class LivingPackSizeEvent extends LivingEvent +{ + /** + * This event is fired when the spawning system determines the + * maximum amount of the selected entity that can spawn at the same + * time. + * + * If you set the result to 'ALLOW', it means that you want to return + * the value of maxPackSize as the maximum pack size for current entity. + */ + public int maxPackSize; + + public LivingPackSizeEvent(EntityLiving entity) + { + super(entity); + } +} diff --git a/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch b/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch index 1d6b4ae23..d820f9872 100644 --- a/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch +++ b/patches/minecraft/net/minecraft/world/SpawnerAnimals.java.patch @@ -46,7 +46,7 @@ creatureSpecificInit(entityliving, par0WorldServer, f, f1, f2); - if (j2 >= entityliving.getMaxSpawnedInChunk()) -+ if (j2 >= ForgeEventFactory.getMaxSpawnedInChunk(entityliving)) ++ if (j2 >= ForgeEventFactory.getMaxSpawnPackSize(entityliving)) { continue label110; }