Files
MinecraftForge/patches/minecraft/net/minecraft/world/WorldEntitySpawner.java.patch
T
2017-01-17 14:18:28 -08:00

73 lines
4.7 KiB
Diff

--- ../src-base/minecraft/net/minecraft/world/WorldEntitySpawner.java
+++ ../src-work/minecraft/net/minecraft/world/WorldEntitySpawner.java
@@ -78,15 +78,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();
label411:
- 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();
@@ -135,7 +137,7 @@
try
{
- entityliving = (EntityLiving)biome$spawnlistentry.field_76300_b.getConstructor(new Class[] {World.class}).newInstance(new Object[] {p_77192_1_});
+ entityliving = (EntityLiving)biome$spawnlistentry.newInstance(p_77192_1_);
}
catch (Exception exception)
{
@@ -145,8 +147,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);
+ 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())
@@ -159,7 +163,7 @@
entityliving.func_70106_y();
}
- if (j2 >= entityliving.func_70641_bl())
+ if (j2 >= net.minecraftforge.event.ForgeEventFactory.getMaxSpawnPackSize(entityliving))
{
continue label411;
}
@@ -212,8 +216,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;
}
@@ -257,7 +262,7 @@
try
{
- entityliving = (EntityLiving)biome$spawnlistentry.field_76300_b.getConstructor(new Class[] {World.class}).newInstance(new Object[] {p_77191_0_});
+ entityliving = (EntityLiving)biome$spawnlistentry.newInstance(p_77191_0_);
}
catch (Exception exception)
{