Files
MinecraftForge/patches/minecraft/net/minecraft/world/WorldEntitySpawner.java.patch
T

81 lines
5.3 KiB
Diff

--- ../src-base/minecraft/net/minecraft/world/WorldEntitySpawner.java
+++ ../src-work/minecraft/net/minecraft/world/WorldEntitySpawner.java
@@ -79,15 +79,17 @@
{
if ((!enumcreaturetype.func_75599_d() || p_77192_3_) && (enumcreaturetype.func_75599_d() || p_77192_2_) && (!enumcreaturetype.func_82705_e() || p_77192_4_))
{
- int k4 = p_77192_1_.func_72907_a(enumcreaturetype.func_75598_a());
+ int k4 = p_77192_1_.countEntities(enumcreaturetype, true);
int l4 = enumcreaturetype.func_75601_b() * i / field_180268_a;
if (k4 <= l4)
{
+ java.util.ArrayList<ChunkPos> shuffled = com.google.common.collect.Lists.newArrayList(this.field_77193_b);
+ java.util.Collections.shuffle(shuffled);
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
label134:
- for (ChunkPos chunkpos1 : this.field_77193_b)
+ for (ChunkPos chunkpos1 : shuffled)
{
BlockPos blockpos = func_180621_a(p_77192_1_, chunkpos1.field_77276_a, chunkpos1.field_77275_b);
int k1 = blockpos.func_177958_n();
@@ -136,7 +138,7 @@
try
{
- entityliving = biome$spawnlistentry.field_76300_b.getConstructor(World.class).newInstance(p_77192_1_);
+ entityliving = biome$spawnlistentry.newInstance(p_77192_1_);
}
catch (Exception exception)
{
@@ -146,8 +148,10 @@
entityliving.func_70012_b((double)f, (double)i3, (double)f1, p_77192_1_.field_73012_v.nextFloat() * 360.0F, 0.0F);
- if (entityliving.func_70601_bi() && entityliving.func_70058_J())
+ net.minecraftforge.fml.common.eventhandler.Event.Result canSpawn = net.minecraftforge.event.ForgeEventFactory.canEntitySpawn(entityliving, p_77192_1_, f, i3, f1, false);
+ if (canSpawn == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW || (canSpawn == net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT && (entityliving.func_70601_bi() && entityliving.func_70058_J())))
{
+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(entityliving, p_77192_1_, f, i3, f1))
ientitylivingdata = entityliving.func_180482_a(p_77192_1_.func_175649_E(new BlockPos(entityliving)), ientitylivingdata);
if (entityliving.func_70058_J())
@@ -160,7 +164,7 @@
entityliving.func_70106_y();
}
- if (j2 >= entityliving.func_70641_bl())
+ if (j2 >= net.minecraftforge.event.ForgeEventFactory.getMaxSpawnPackSize(entityliving))
{
continue label134;
}
@@ -228,8 +232,9 @@
else
{
BlockPos blockpos = p_180267_2_.func_177977_b();
+ IBlockState state = p_180267_1_.func_180495_p(blockpos);
- if (!p_180267_1_.func_180495_p(blockpos).func_185896_q())
+ if (!state.func_177230_c().canCreatureSpawn(state, p_180267_1_, blockpos, p_180267_0_))
{
return false;
}
@@ -273,7 +278,7 @@
try
{
- entityliving = biome$spawnlistentry.field_76300_b.getConstructor(World.class).newInstance(p_77191_0_);
+ entityliving = biome$spawnlistentry.newInstance(p_77191_0_);
}
catch (Exception exception)
{
@@ -281,6 +286,7 @@
continue;
}
+ if (net.minecraftforge.event.ForgeEventFactory.canEntitySpawn(entityliving, p_77191_0_, j + 0.5f, (float) blockpos.func_177956_o(), k +0.5f, false) == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) continue;
entityliving.func_70012_b((double)((float)j + 0.5F), (double)blockpos.func_177956_o(), (double)((float)k + 0.5F), p_77191_6_.nextFloat() * 360.0F, 0.0F);
p_77191_0_.func_72838_d(entityliving);
ientitylivingdata = entityliving.func_180482_a(p_77191_0_.func_175649_E(new BlockPos(entityliving)), ientitylivingdata);