mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-19 12:25:12 -04:00
fix global position reading, bump entity data to 22w16b
This commit is contained in:
parent
e2d81e55d4
commit
2adad42f7e
@ -17,6 +17,7 @@ import de.bixilon.kotlinglm.vec3.Vec3i
|
||||
import de.bixilon.minosoft.data.direction.Directions
|
||||
import de.bixilon.minosoft.data.entities.EntityRotation
|
||||
import de.bixilon.minosoft.data.entities.data.EntityData
|
||||
import de.bixilon.minosoft.data.entities.data.EntityDataField
|
||||
import de.bixilon.minosoft.data.entities.entities.Entity
|
||||
import de.bixilon.minosoft.data.entities.entities.SynchronizedEntityData
|
||||
import de.bixilon.minosoft.data.registries.Motive
|
||||
@ -33,14 +34,19 @@ class Painting(
|
||||
data: EntityData,
|
||||
position: Vec3i,
|
||||
@get:SynchronizedEntityData val direction: Directions,
|
||||
@get:SynchronizedEntityData val motive: Motive?,
|
||||
val fixedMotive: Motive?,
|
||||
) : Entity(connection, entityType, data, position.entityPosition, EntityRotation(0.0f, 0.0f)) {
|
||||
|
||||
@get:SynchronizedEntityData
|
||||
val motive: Motive?
|
||||
get() = fixedMotive ?: data.get<Motive?>(MOTIVE_DATA, null)
|
||||
|
||||
companion object : EntityFactory<Painting> {
|
||||
override val RESOURCE_LOCATION: ResourceLocation = ResourceLocation("painting")
|
||||
private val MOTIVE_DATA = EntityDataField("MOTIVE")
|
||||
|
||||
override fun build(connection: PlayConnection, entityType: EntityType, data: EntityData, position: Vec3d, rotation: EntityRotation): Painting {
|
||||
return Painting(connection, entityType, data, position.toVec3i(), Directions.NORTH, null) // ToDo: Get data from entity data (22w16a+)
|
||||
return Painting(connection, entityType, data, position.toVec3i(), Directions.NORTH, null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ import de.bixilon.kotlinglm.vec3.Vec3d
|
||||
import de.bixilon.kutil.json.JsonObject
|
||||
import de.bixilon.minosoft.data.abilities.Gamemodes
|
||||
import de.bixilon.minosoft.data.entities.EntityRotation
|
||||
import de.bixilon.minosoft.data.entities.GlobalPosition
|
||||
import de.bixilon.minosoft.data.entities.Poses
|
||||
import de.bixilon.minosoft.data.entities.data.EntityData
|
||||
import de.bixilon.minosoft.data.entities.data.EntityDataField
|
||||
@ -76,6 +77,10 @@ abstract class PlayerEntity(
|
||||
val rightShoulderData: JsonObject?
|
||||
get() = data.get(RIGHT_SHOULDER_DATA_DATA, null)
|
||||
|
||||
@get:SynchronizedEntityData
|
||||
val lastDeathPosition: GlobalPosition?
|
||||
get() = data.get(LAST_DEATH_POSITION_DATA, null)
|
||||
|
||||
override val spawnSprintingParticles: Boolean
|
||||
get() = super.spawnSprintingParticles && gamemode != Gamemodes.SPECTATOR
|
||||
|
||||
@ -108,5 +113,6 @@ abstract class PlayerEntity(
|
||||
private val MAIN_ARM_DATA = EntityDataField("PLAYER_SKIN_MAIN_HAND")
|
||||
private val LEFT_SHOULDER_DATA_DATA = EntityDataField("PLAYER_LEFT_SHOULDER_DATA")
|
||||
private val RIGHT_SHOULDER_DATA_DATA = EntityDataField("PLAYER_RIGHT_SHOULDER_DATA")
|
||||
private val LAST_DEATH_POSITION_DATA = EntityDataField("PLAYER_LAST_DEATH_POSITION")
|
||||
}
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ object Vec3iUtil {
|
||||
return when (this) {
|
||||
is List<*> -> Vec3i(this[0].toInt(), this[1].toInt(), this[2].toInt())
|
||||
is Map<*, *> -> Vec3i(this["x"]?.toInt() ?: 0.0f, this["y"]?.toInt() ?: 0.0f, this["z"]?.toInt() ?: 0.0f)
|
||||
is IntArray -> Vec3i(this[0], this[1], this[2])
|
||||
is Number -> Vec3i(this.toInt())
|
||||
else -> null
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user