mirror of
https://github.com/Bixilon/Minosoft.git
synced 2026-12-03 23:08:18 +00:00
fix potential crash when updating chunk neighbours if chunk is initializing
This commit is contained in:
2 files changed
+13
-19
No files matched your search
@@ -55,9 +55,6 @@ class ChunkNeighbours(val chunk: Chunk) {
|
||||
neighbours[index] = null
|
||||
if (current != null) {
|
||||
count--
|
||||
if (count < COUNT) {
|
||||
giveUp()
|
||||
}
|
||||
}
|
||||
chunk.lock.unlock()
|
||||
}
|
||||
@@ -71,6 +68,9 @@ class ChunkNeighbours(val chunk: Chunk) {
|
||||
}
|
||||
|
||||
private fun updateSectionNeighbours(neighbours: Array<Chunk>) {
|
||||
if (chunk.sections == null) {
|
||||
return
|
||||
}
|
||||
for ((index, section) in chunk.sections!!.withIndex()) {
|
||||
if (section == null) {
|
||||
continue
|
||||
@@ -80,10 +80,6 @@ class ChunkNeighbours(val chunk: Chunk) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun giveUp() {
|
||||
|
||||
}
|
||||
|
||||
operator fun get(index: Int): Chunk? {
|
||||
return neighbours[index]
|
||||
}
|
||||
|
||||
+10
-12
@@ -68,17 +68,15 @@ class ClientSettingsManager(
|
||||
if (connection.network.state != ProtocolStates.PLAY) {
|
||||
return
|
||||
}
|
||||
connection.sendPacket(
|
||||
SettingsC2SP(
|
||||
locale = language,
|
||||
chatColors = connection.profiles.gui.chat.chatColors,
|
||||
viewDistance = connection.profiles.block.viewDistance,
|
||||
chatMode = connection.profiles.gui.chat.chatMode,
|
||||
skinParts = profile.skin.parts.toTypedArray(),
|
||||
mainArm = profile.mainArm,
|
||||
disableTextFiltering = !connection.profiles.gui.chat.textFiltering,
|
||||
allowListing = profile.playerListing,
|
||||
)
|
||||
)
|
||||
connection.sendPacket(SettingsC2SP(
|
||||
locale = language,
|
||||
chatColors = connection.profiles.gui.chat.chatColors,
|
||||
viewDistance = connection.profiles.block.viewDistance,
|
||||
chatMode = connection.profiles.gui.chat.chatMode,
|
||||
skinParts = profile.skin.parts.toTypedArray(),
|
||||
mainArm = profile.mainArm,
|
||||
disableTextFiltering = !connection.profiles.gui.chat.textFiltering,
|
||||
allowListing = profile.playerListing,
|
||||
))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user