removed unused imports and added TODOs
This commit is contained in:
@@ -8,14 +8,14 @@ import net.minecraft.nbt.NbtList
|
||||
import net.minecraft.nbt.NbtString
|
||||
import net.minecraft.server.world.ServerWorld
|
||||
|
||||
class DisplayEntity(val properties: DisplayEntityProperties?) {
|
||||
class DisplayEntity(var properties: DisplayEntityProperties?) {
|
||||
private var hasSpawned = false
|
||||
private var entity: BlockDisplayEntity? = null
|
||||
|
||||
fun spawn(world: ServerWorld) : BlockDisplayEntity? {
|
||||
if (hasSpawned || properties == null) { return null }
|
||||
|
||||
val e = updateProperties(world, properties)
|
||||
val e = updateProperties(world, properties!!)
|
||||
world.spawnEntity(e)
|
||||
|
||||
this.hasSpawned = true
|
||||
@@ -72,6 +72,8 @@ class DisplayEntity(val properties: DisplayEntityProperties?) {
|
||||
e.refreshPositionAndAngles(properties.pos.x, properties.pos.y, properties.pos.z, properties.rot.x, properties.rot.y)
|
||||
|
||||
entity = e
|
||||
this.properties = properties
|
||||
|
||||
return e
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ class Particle(private val particleParams: ParticleParams) {
|
||||
|
||||
val properties = blockDisplay?.properties ?: return
|
||||
|
||||
val newProperties = calculateNewProperties(properties, particleParams)
|
||||
val newProperties = calculateNewProperties()
|
||||
|
||||
blockDisplay?.updateProperties(world, newProperties)
|
||||
|
||||
@@ -75,14 +75,14 @@ class Particle(private val particleParams: ParticleParams) {
|
||||
}
|
||||
|
||||
|
||||
private fun calculateNewProperties(propetries: DisplayEntityProperties, params: ParticleParams) : DisplayEntityProperties {
|
||||
private fun calculateNewProperties() : DisplayEntityProperties {
|
||||
val newBlockIdx = round(lerp(
|
||||
0.0f,
|
||||
params.blockCurve.lastIndex.toFloat(),
|
||||
(timeAlive.toFloat() / params.lifeTime.toFloat()).coerceIn(0.0f, 1.0f)
|
||||
particleParams.blockCurve.lastIndex.toFloat(),
|
||||
(timeAlive.toFloat() / particleParams.lifeTime.toFloat()).coerceIn(0.0f, 1.0f)
|
||||
)).toInt()
|
||||
|
||||
val newBlock = params.blockCurve[newBlockIdx]
|
||||
val newBlock = particleParams.blockCurve[newBlockIdx]
|
||||
|
||||
|
||||
val newProperties = DisplayEntityProperties(
|
||||
|
||||
Reference in New Issue
Block a user