fix: swarm spawn location
This commit is contained in:
parent
ca87f6704c
commit
6dddd60405
@ -41,16 +41,16 @@ data class SwarmProjectionEffect(
|
|||||||
for (i in 0..(min(level.random.nextInt(maxCount - entities), 6))) {
|
for (i in 0..(min(level.random.nextInt(maxCount - entities), 6))) {
|
||||||
var spawnPos = BlockPos(
|
var spawnPos = BlockPos(
|
||||||
level.random.nextInt(area.minX(), area.maxX()),
|
level.random.nextInt(area.minX(), area.maxX()),
|
||||||
level.random.nextInt(area.minY(), area.maxY()),
|
area.minY(),
|
||||||
level.random.nextInt(area.minZ(), area.maxZ()),
|
level.random.nextInt(area.minZ(), area.maxZ()),
|
||||||
)
|
)
|
||||||
spawnPos = spawnPos.atY(level.getHeight(Heightmap.Types.WORLD_SURFACE, spawnPos.x, spawnPos.z))
|
spawnPos = spawnPos.atY(level.getHeight(Heightmap.Types.WORLD_SURFACE, spawnPos.x, spawnPos.z))
|
||||||
val belowState = level.getBlockState(spawnPos.below())
|
val belowState = level.getBlockState(spawnPos.below())
|
||||||
if (belowState.isAir || !belowState.fluidState.isEmpty || !belowState.canOcclude())
|
|
||||||
return
|
|
||||||
val state = level.getBlockState(spawnPos)
|
val state = level.getBlockState(spawnPos)
|
||||||
if (state.canOcclude() || !state.fluidState.isEmpty)
|
if (belowState.isAir || !belowState.fluidState.isEmpty || !belowState.canOcclude())
|
||||||
return
|
continue
|
||||||
|
if (!state.fluidState.isEmpty)
|
||||||
|
continue
|
||||||
ProjectedPersonEntity.entity.get().spawn(level, spawnPos, MobSpawnType.TRIGGERED)
|
ProjectedPersonEntity.entity.get().spawn(level, spawnPos, MobSpawnType.TRIGGERED)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user