weird flex but ok. Pathfinding affected spawning

This commit is contained in:
gnembon committed 2020-03-10 13:10:03 -03:00
1 parent 926b1f20b9
commit fcd86537e6
2 files changed
+9 -1

No files matched your search

@@ -1088,6 +1088,9 @@ public class CarpetExpression
this.expr.addLazyFunction("see_sky", -1, (c, t, lv) -> this.expr.addLazyFunction("see_sky", -1, (c, t, lv) ->
genericStateTest(c, "see_sky", lv, (s, p, w) -> new NumericValue(w.isSkyVisible(p)))); genericStateTest(c, "see_sky", lv, (s, p, w) -> new NumericValue(w.isSkyVisible(p))));
this.expr.addLazyFunction("brightness", -1, (c, t, lv) ->
genericStateTest(c, "brightness", lv, (s, p, w) -> new NumericValue(w.getBrightness(p))));
this.expr.addLazyFunction("hardness", -1, (c, t, lv) -> this.expr.addLazyFunction("hardness", -1, (c, t, lv) ->
genericStateTest(c, "hardness", lv, (s, p, w) -> new NumericValue(s.getHardness(w, p)))); genericStateTest(c, "hardness", lv, (s, p, w) -> new NumericValue(s.getHardness(w, p))));
@@ -436,10 +436,15 @@ public class SpawnReporter
float f1 = (float)z + 0.5F; float f1 = (float)z + 0.5F;
mob.refreshPositionAndAngles((double)f, (double)y, (double)f1, worldIn.random.nextFloat() * 360.0F, 0.0F); mob.refreshPositionAndAngles((double)f, (double)y, (double)f1, worldIn.random.nextFloat() * 360.0F, 0.0F);
fits1 = worldIn.doesNotCollide(mob); fits1 = worldIn.doesNotCollide(mob);
EntityType etype = mob.getType();
for (int i = 0; i < 20; ++i) for (int i = 0; i < 20; ++i)
{ {
if (SpawnRestriction.canSpawn(mob.getType(),mob.getEntityWorld(), SpawnType.NATURAL, mob.getBlockPos(), mob.getEntityWorld().random)) if (
SpawnRestriction.canSpawn(etype,worldIn, SpawnType.NATURAL, pos, worldIn.random) &&
SpawnHelper.canSpawn(SpawnRestriction.getLocation(etype), worldIn, pos, etype) &&
mob.canSpawn(worldIn, SpawnType.NATURAL) // && mob.canSpawn(worldIn) // entity collisions
)
{ {
will_spawn += 1; will_spawn += 1;
} }