Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zly2006 committed Nov 16, 2024
1 parent 0695872 commit e7baa02
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/kotlin/com/github/zly2006/enclosure/ServerMain.kt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import net.minecraft.util.Identifier
import net.minecraft.util.hit.BlockHitResult
import net.minecraft.util.hit.HitResult
import net.minecraft.util.math.BlockPos
import net.minecraft.util.math.ChunkPos
import net.minecraft.world.PersistentState
import net.minecraft.world.RaycastContext
import net.minecraft.world.World
Expand Down Expand Up @@ -283,7 +284,7 @@ object ServerMain: ModInitializer {
}

fun getSmallestEnclosure(world: ServerWorld, pos: BlockPos?): EnclosureArea? {
return (world.getChunk(pos) as? ChunkAccess)?.cache
return (world.getChunkAsView(ChunkPos(pos).x, ChunkPos(pos).z) as? ChunkAccess)?.cache
?.firstOrNull { it.contains(pos!!) }
?.areaOf(pos!!)
}
Expand Down

0 comments on commit e7baa02

Please sign in to comment.