Fix not networking collision type
This commit is contained in:
parent
9c1772a766
commit
9bbef92ea9
@ -3,6 +3,7 @@ package ru.dbotthepony.kstarbound.network
|
|||||||
import ru.dbotthepony.kommons.io.readVarInt
|
import ru.dbotthepony.kommons.io.readVarInt
|
||||||
import ru.dbotthepony.kommons.io.writeVarInt
|
import ru.dbotthepony.kommons.io.writeVarInt
|
||||||
import ru.dbotthepony.kstarbound.defs.tile.BuiltinMetaMaterials
|
import ru.dbotthepony.kstarbound.defs.tile.BuiltinMetaMaterials
|
||||||
|
import ru.dbotthepony.kstarbound.world.physics.CollisionType
|
||||||
import java.io.DataInputStream
|
import java.io.DataInputStream
|
||||||
import java.io.DataOutputStream
|
import java.io.DataOutputStream
|
||||||
|
|
||||||
@ -66,7 +67,7 @@ data class LegacyNetworkCellState(
|
|||||||
val background: LegacyNetworkTileState,
|
val background: LegacyNetworkTileState,
|
||||||
val foreground: LegacyNetworkTileState,
|
val foreground: LegacyNetworkTileState,
|
||||||
|
|
||||||
val collisionType: Int, // ubyte
|
val collisionType: CollisionType, // ubyte
|
||||||
val blockBiomeIndex: Int, // ubyte
|
val blockBiomeIndex: Int, // ubyte
|
||||||
val environmentBiomeIndex: Int, // ubyte
|
val environmentBiomeIndex: Int, // ubyte
|
||||||
val liquid: LegacyNetworkLiquidState,
|
val liquid: LegacyNetworkLiquidState,
|
||||||
@ -76,22 +77,22 @@ data class LegacyNetworkCellState(
|
|||||||
background.write(stream)
|
background.write(stream)
|
||||||
foreground.write(stream)
|
foreground.write(stream)
|
||||||
|
|
||||||
stream.write(collisionType)
|
stream.writeByte(collisionType.ordinal)
|
||||||
stream.write(blockBiomeIndex)
|
stream.writeByte(blockBiomeIndex)
|
||||||
stream.write(environmentBiomeIndex)
|
stream.writeByte(environmentBiomeIndex)
|
||||||
liquid.write(stream)
|
liquid.write(stream)
|
||||||
stream.writeVarInt(dungeonId)
|
stream.writeVarInt(dungeonId)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val EMPTY = LegacyNetworkCellState(LegacyNetworkTileState.EMPTY, LegacyNetworkTileState.EMPTY, 0, 0, 0, LegacyNetworkLiquidState.EMPTY, 0)
|
val EMPTY = LegacyNetworkCellState(LegacyNetworkTileState.EMPTY, LegacyNetworkTileState.EMPTY, CollisionType.NONE, 0, 0, LegacyNetworkLiquidState.EMPTY, 0)
|
||||||
val NULL = LegacyNetworkCellState(LegacyNetworkTileState.NULL, LegacyNetworkTileState.NULL, 0, 0, 0, LegacyNetworkLiquidState.EMPTY, 0)
|
val NULL = LegacyNetworkCellState(LegacyNetworkTileState.NULL, LegacyNetworkTileState.NULL, CollisionType.NULL, 0, 0, LegacyNetworkLiquidState.EMPTY, 0)
|
||||||
|
|
||||||
fun read(stream: DataInputStream): LegacyNetworkCellState {
|
fun read(stream: DataInputStream): LegacyNetworkCellState {
|
||||||
return LegacyNetworkCellState(
|
return LegacyNetworkCellState(
|
||||||
LegacyNetworkTileState.read(stream),
|
LegacyNetworkTileState.read(stream),
|
||||||
LegacyNetworkTileState.read(stream),
|
LegacyNetworkTileState.read(stream),
|
||||||
stream.readUnsignedByte(),
|
CollisionType.entries[stream.readUnsignedByte()],
|
||||||
stream.readUnsignedByte(),
|
stream.readUnsignedByte(),
|
||||||
stream.readUnsignedByte(),
|
stream.readUnsignedByte(),
|
||||||
LegacyNetworkLiquidState.read(stream),
|
LegacyNetworkLiquidState.read(stream),
|
||||||
|
@ -4,6 +4,7 @@ import com.github.benmanes.caffeine.cache.Interner
|
|||||||
import ru.dbotthepony.kstarbound.Starbound
|
import ru.dbotthepony.kstarbound.Starbound
|
||||||
import ru.dbotthepony.kstarbound.network.LegacyNetworkCellState
|
import ru.dbotthepony.kstarbound.network.LegacyNetworkCellState
|
||||||
import ru.dbotthepony.kstarbound.util.HashTableInterner
|
import ru.dbotthepony.kstarbound.util.HashTableInterner
|
||||||
|
import ru.dbotthepony.kstarbound.world.physics.CollisionType
|
||||||
import java.io.DataInputStream
|
import java.io.DataInputStream
|
||||||
import java.io.DataOutputStream
|
import java.io.DataOutputStream
|
||||||
|
|
||||||
@ -21,7 +22,7 @@ sealed class AbstractCell {
|
|||||||
abstract fun mutable(): MutableCell
|
abstract fun mutable(): MutableCell
|
||||||
|
|
||||||
fun toLegacyNet(): LegacyNetworkCellState {
|
fun toLegacyNet(): LegacyNetworkCellState {
|
||||||
return LegacyNetworkCellState(background.toLegacyNet(), foreground.toLegacyNet(), 0, biome, envBiome, liquid.toLegacyNet(), dungeonId)
|
return LegacyNetworkCellState(background.toLegacyNet(), foreground.toLegacyNet(), foreground.material.value.collisionKind, biome, envBiome, liquid.toLegacyNet(), dungeonId)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun write(stream: DataOutputStream) {
|
fun write(stream: DataOutputStream) {
|
||||||
|
Loading…
Reference in New Issue
Block a user