diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/client/world/ClientWorld.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/client/world/ClientWorld.kt index b98b5b45..a39ae0ee 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/client/world/ClientWorld.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/client/world/ClientWorld.kt @@ -55,19 +55,11 @@ class ClientWorld( val renderRegionsY = size.y / renderRegionHeight fun isValidRenderRegionX(value: Int): Boolean { - if (loopX) { - return true - } else { - return value in 0 .. renderRegionsX - } + return loopX || value in 0 .. renderRegionsX } fun isValidRenderRegionY(value: Int): Boolean { - if (loopY) { - return true - } else { - return value in 0 .. renderRegionsY - } + return loopY || value in 0 .. renderRegionsY } inner class RenderRegion(val x: Int, val y: Int) { diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/world/api/AbstractLiquidState.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/world/api/AbstractLiquidState.kt index 5672f0d9..dc8b6a79 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/world/api/AbstractLiquidState.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/world/api/AbstractLiquidState.kt @@ -2,6 +2,7 @@ package ru.dbotthepony.kstarbound.world.api import ru.dbotthepony.kstarbound.Registries import ru.dbotthepony.kstarbound.defs.tile.LiquidDefinition +import ru.dbotthepony.kstarbound.util.HashTableInterner import java.io.DataInputStream sealed class AbstractLiquidState { diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/world/api/MutableCell.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/world/api/MutableCell.kt index 04145915..2b4266d3 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/world/api/MutableCell.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/world/api/MutableCell.kt @@ -29,7 +29,10 @@ data class MutableCell( } override fun immutable(): ImmutableCell { - return ImmutableCell(foreground.immutable(), background.immutable(), liquid.immutable(), dungeonId, biome, envBiome, isIndestructible) + val result = ImmutableCell(foreground.immutable(), background.immutable(), liquid.immutable(), dungeonId, biome, envBiome, isIndestructible) + if (result == NULL) return NULL + if (result == EMPTY) return EMPTY + return result } override fun mutable(): MutableCell { diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/world/api/MutableLiquidState.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/world/api/MutableLiquidState.kt index 89d3e6b2..f6add68e 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/world/api/MutableLiquidState.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/world/api/MutableLiquidState.kt @@ -23,6 +23,8 @@ data class MutableLiquidState( } override fun immutable(): ImmutableLiquidState { - return ImmutableLiquidState(def, level, pressure, isInfinite) + val result = ImmutableLiquidState(def, level, pressure, isInfinite) + if (result == EMPTY) return EMPTY + return result } }