mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-08-03 19:17:27 -04:00
ChunkLoader Upgrade now loads a 3x3 chunk area centered on the robot.
This commit is contained in:
parent
c8358ce31f
commit
32ebe03ace
@ -59,15 +59,21 @@ object ChunkloaderUpgradeHandler extends LoadingCallback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def updateLoadedChunk(loader: UpgradeChunkloader) {
|
def updateLoadedChunk(loader: UpgradeChunkloader) {
|
||||||
val robotChunk = new ChunkCoordIntPair(math.floor(loader.owner.xPosition).toInt >> 4, math.floor(loader.owner.zPosition).toInt >> 4)
|
val centerChunk = new ChunkCoordIntPair(math.floor(loader.owner.xPosition).toInt >> 4, math.floor(loader.owner.zPosition).toInt >> 4)
|
||||||
|
val robotChunks = (for (x <- -1 to 1; z <- -1 to 1) yield new ChunkCoordIntPair(centerChunk.chunkXPos+x, centerChunk.chunkZPos+z))
|
||||||
|
|
||||||
loader.ticket.foreach(ticket => {
|
loader.ticket.foreach(ticket => {
|
||||||
ticket.getChunkList.collect {
|
ticket.getChunkList.collect {
|
||||||
case chunk: ChunkCoordIntPair if chunk != robotChunk => ForgeChunkManager.unforceChunk(ticket, chunk)
|
case chunk: ChunkCoordIntPair if !robotChunks.contains(chunk) => ForgeChunkManager.unforceChunk(ticket, chunk)
|
||||||
}
|
}
|
||||||
ForgeChunkManager.forceChunk(ticket, robotChunk)
|
|
||||||
|
for (chunk <- robotChunks) {
|
||||||
|
ForgeChunkManager.forceChunk(ticket, chunk)
|
||||||
|
}
|
||||||
|
|
||||||
ticket.getModData.setString("address", loader.node.address)
|
ticket.getModData.setString("address", loader.node.address)
|
||||||
ticket.getModData.setInteger("x", robotChunk.chunkXPos)
|
ticket.getModData.setInteger("x", centerChunk.chunkXPos)
|
||||||
ticket.getModData.setInteger("z", robotChunk.chunkZPos)
|
ticket.getModData.setInteger("z", centerChunk.chunkZPos)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user