fixed mob spawning in negative space
This commit is contained in:
1 parent
465eb44315
commit
afb80b62b4
1 file changed
+10
-3
@@ -11,6 +11,7 @@ import net.minecraft.entity.mob.MobEntity;
|
|||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Box;
|
import net.minecraft.util.math.Box;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.shape.VoxelShape;
|
import net.minecraft.util.shape.VoxelShape;
|
||||||
import net.minecraft.util.shape.VoxelShapes;
|
import net.minecraft.util.shape.VoxelShapes;
|
||||||
import net.minecraft.world.SpawnHelper;
|
import net.minecraft.world.SpawnHelper;
|
||||||
@@ -43,9 +44,15 @@ public class SpawnHelperMixin
|
|||||||
if (CarpetSettings.lagFreeSpawning)
|
if (CarpetSettings.lagFreeSpawning)
|
||||||
{
|
{
|
||||||
BlockPos.Mutable blockpos = new BlockPos.Mutable();
|
BlockPos.Mutable blockpos = new BlockPos.Mutable();
|
||||||
for (int y = (int)bb.minY, maxy = (int)Math.ceil(bb.maxY); y < maxy; y++)
|
int minX = MathHelper.floor(bb.minX);
|
||||||
for (int x = (int)bb.minX, maxx = (int)Math.ceil(bb.maxX); x < maxx; x++)
|
int maxX = MathHelper.ceil(bb.maxX);
|
||||||
for (int z = (int)bb.minZ, maxz = (int)Math.ceil(bb.maxZ); z < maxz; z++)
|
int minY = MathHelper.floor(bb.minY);
|
||||||
|
int maxY = MathHelper.ceil(bb.maxY);
|
||||||
|
int minZ = MathHelper.floor(bb.minZ);
|
||||||
|
int maxZ = MathHelper.ceil(bb.maxZ);
|
||||||
|
for (int y = minY; y < maxY; y++)
|
||||||
|
for (int x = minX; x < maxX; x++)
|
||||||
|
for (int z = minZ; z < maxZ; z++)
|
||||||
{
|
{
|
||||||
blockpos.set(x, y, z);
|
blockpos.set(x, y, z);
|
||||||
VoxelShape box = world.getBlockState(blockpos).getCollisionShape(world, blockpos);
|
VoxelShape box = world.getBlockState(blockpos).getCollisionShape(world, blockpos);
|
||||||
|
|||||||
Reference in new issue
Block a user