Skip to content

Commit

Permalink
Fix night lich spawning issues
Browse files Browse the repository at this point in the history
  • Loading branch information
barribob committed Apr 7, 2021
1 parent c066167 commit b611101
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,17 @@ class LichKillCounter(
if (sWorld.registryManager.dimensionTypes.getOrThrow(DimensionType.OVERWORLD_REGISTRY_KEY) == sWorld.dimension) {
eventScheduler.getWorldEventScheduler(sWorld).addEvent(TimedEvent({
val spawnPos =
sWorld.getTopPosition(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, BlockPos(playerEntity.pos)).asVec3d()
sWorld.getTopPosition(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, BlockPos(playerEntity.pos)).up(5).asVec3d()

val compoundTag = CompoundTag()
compoundTag.putString("id", Mod.identifier("lich").toString())

val spawned = MobPlacementLogic(
RangedSpawnPosition(spawnPos, 0.0, 10.0, ModRandom()),
RangedSpawnPosition(spawnPos, 2.0, 10.0, ModRandom()),
CompoundTagEntityProvider(compoundTag, sWorld, Mod.LOGGER),
MobEntitySpawnPredicate(sWorld),
SimpleMobSpawner(sWorld)
).tryPlacement(30)
).tryPlacement(100)

if (spawned) summonCounter.increment(playerEntity)
}, 100))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class MobEntitySpawnPredicate(private val worldView: WorldView) : ISpawnPredicat
val blockPos = BlockPos(pos)
val blockState = worldView.getBlockState(blockPos)
val fluidState = worldView.getFluidState(blockPos)
entity.updatePosition(pos.x, pos.y, pos.z)

return !worldView.containsFluid(entity.boundingBox) &&
worldView.intersectsEntities(entity) &&
Expand Down

0 comments on commit b611101

Please sign in to comment.