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.nbt.NbtString
|
||||||
import net.minecraft.server.world.ServerWorld
|
import net.minecraft.server.world.ServerWorld
|
||||||
|
|
||||||
class DisplayEntity(val properties: DisplayEntityProperties?) {
|
class DisplayEntity(var properties: DisplayEntityProperties?) {
|
||||||
private var hasSpawned = false
|
private var hasSpawned = false
|
||||||
private var entity: BlockDisplayEntity? = null
|
private var entity: BlockDisplayEntity? = null
|
||||||
|
|
||||||
fun spawn(world: ServerWorld) : BlockDisplayEntity? {
|
fun spawn(world: ServerWorld) : BlockDisplayEntity? {
|
||||||
if (hasSpawned || properties == null) { return null }
|
if (hasSpawned || properties == null) { return null }
|
||||||
|
|
||||||
val e = updateProperties(world, properties)
|
val e = updateProperties(world, properties!!)
|
||||||
world.spawnEntity(e)
|
world.spawnEntity(e)
|
||||||
|
|
||||||
this.hasSpawned = true
|
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)
|
e.refreshPositionAndAngles(properties.pos.x, properties.pos.y, properties.pos.z, properties.rot.x, properties.rot.y)
|
||||||
|
|
||||||
entity = e
|
entity = e
|
||||||
|
this.properties = properties
|
||||||
|
|
||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class Particle(private val particleParams: ParticleParams) {
|
|||||||
|
|
||||||
val properties = blockDisplay?.properties ?: return
|
val properties = blockDisplay?.properties ?: return
|
||||||
|
|
||||||
val newProperties = calculateNewProperties(properties, particleParams)
|
val newProperties = calculateNewProperties()
|
||||||
|
|
||||||
blockDisplay?.updateProperties(world, newProperties)
|
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(
|
val newBlockIdx = round(lerp(
|
||||||
0.0f,
|
0.0f,
|
||||||
params.blockCurve.lastIndex.toFloat(),
|
particleParams.blockCurve.lastIndex.toFloat(),
|
||||||
(timeAlive.toFloat() / params.lifeTime.toFloat()).coerceIn(0.0f, 1.0f)
|
(timeAlive.toFloat() / particleParams.lifeTime.toFloat()).coerceIn(0.0f, 1.0f)
|
||||||
)).toInt()
|
)).toInt()
|
||||||
|
|
||||||
val newBlock = params.blockCurve[newBlockIdx]
|
val newBlock = particleParams.blockCurve[newBlockIdx]
|
||||||
|
|
||||||
|
|
||||||
val newProperties = DisplayEntityProperties(
|
val newProperties = DisplayEntityProperties(
|
||||||
|
|||||||
Reference in New Issue
Block a user