updated the BDE to handle extra properties
This commit is contained in:
@@ -48,9 +48,6 @@ import kotlin.reflect.full.declaredMemberProperties
|
|||||||
|
|
||||||
|
|
||||||
// TODO: (future additions)
|
// TODO: (future additions)
|
||||||
// Allowing the use of regular Minecraft particles instead of just BDEs.
|
|
||||||
// Will basically require a whole new system.
|
|
||||||
// Most likely wont ever happen.
|
|
||||||
// Cylinder and cone force field shape.
|
// Cylinder and cone force field shape.
|
||||||
// Copying particle params in-game.
|
// Copying particle params in-game.
|
||||||
// Custom curve equation command args (parse from strings).
|
// Custom curve equation command args (parse from strings).
|
||||||
|
|||||||
@@ -25,21 +25,6 @@ class DisplayEntity(private var properties: DisplayEntityProperties?) {
|
|||||||
|
|
||||||
|
|
||||||
fun updateProperties(properties: DisplayEntityProperties) {
|
fun updateProperties(properties: DisplayEntityProperties) {
|
||||||
val customModelRegex = "^([^/]+)(?:/([0-9]+))?$".toRegex()
|
|
||||||
val matchResult = customModelRegex.find(properties.model)
|
|
||||||
|
|
||||||
val modelName: String
|
|
||||||
val customModelNum: Int
|
|
||||||
|
|
||||||
if (matchResult != null) {
|
|
||||||
modelName = matchResult.groupValues[1]
|
|
||||||
customModelNum = matchResult.groupValues[2].toIntOrNull() ?: 0
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
modelName = properties.model
|
|
||||||
customModelNum = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
val nbt = NbtCompound().apply {
|
val nbt = NbtCompound().apply {
|
||||||
val tagList = NbtList()
|
val tagList = NbtList()
|
||||||
|
|
||||||
@@ -49,11 +34,11 @@ class DisplayEntity(private var properties: DisplayEntityProperties?) {
|
|||||||
|
|
||||||
put("Tags", tagList)
|
put("Tags", tagList)
|
||||||
|
|
||||||
if (modelName != "none") {
|
if (properties.model != "none") {
|
||||||
put("item", NbtCompound().apply {
|
put("item", NbtCompound().apply {
|
||||||
putString("id", modelName)
|
putString("id", properties.model)
|
||||||
putInt("count", 1)
|
putInt("count", 1)
|
||||||
put("components", NbtCompound().apply { putInt("minecraft:custom_model_data", customModelNum) })
|
put("components", NbtCompound().apply { putInt("minecraft:custom_model_data", properties.customModel) })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,10 +74,18 @@ class DisplayEntity(private var properties: DisplayEntityProperties?) {
|
|||||||
|
|
||||||
putFloat("view_range", properties.viewRange)
|
putFloat("view_range", properties.viewRange)
|
||||||
|
|
||||||
if (properties.name != null) {
|
putString("billboard", properties.billboard)
|
||||||
putString("CustomName", properties.name)
|
|
||||||
|
if (properties.customName != null) {
|
||||||
|
putString("CustomName", properties.customName)
|
||||||
putByte("CustomNameVisible", 1)
|
putByte("CustomNameVisible", 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (properties.brightnessOverride != null) {
|
||||||
|
put("brightness", NbtCompound().apply {
|
||||||
|
putInt("block", properties.brightnessOverride!!)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entity?.readNbt(nbt)
|
entity?.readNbt(nbt)
|
||||||
|
|||||||
@@ -9,14 +9,25 @@ data class DisplayEntityProperties (
|
|||||||
val pos: Vec3d = Vec3d(0.0, 0.0, 0.0),
|
val pos: Vec3d = Vec3d(0.0, 0.0, 0.0),
|
||||||
val rot: Vector2f = Vector2f(0.0f, 0.0f),
|
val rot: Vector2f = Vector2f(0.0f, 0.0f),
|
||||||
|
|
||||||
val model: String = "minecraft:purple_concrete", // end with "/{num}" for custom model
|
val model: String = "minecraft:purple_concrete",
|
||||||
|
val customModel: Int = 0,
|
||||||
val tags: Array<String> = emptyArray(),
|
val tags: Array<String> = emptyArray(),
|
||||||
|
val viewRange: Float = 2.0f,
|
||||||
|
var customName: String? = null,
|
||||||
|
var brightnessOverride: Int? = null,
|
||||||
|
var billboard: String = Billboard.FIXED,
|
||||||
|
|
||||||
val translation: Vector3f = Vector3f(-0.5f, -0.5f, -0.5f),
|
val translation: Vector3f = Vector3f(0.0f, 0.0f, 0.0f),
|
||||||
val leftRotation: Vector4f = Vector4f(0.0f, 0.0f, 0.0f, 1.0f),
|
val leftRotation: Vector4f = Vector4f(0.0f, 0.0f, 0.0f, 1.0f),
|
||||||
val scale: Vector3f = Vector3f(1.0f, 1.0f, 1.0f),
|
val scale: Vector3f = Vector3f(1.0f, 1.0f, 1.0f),
|
||||||
val rightRotation: Vector4f = Vector4f(0.0f, 0.0f, 0.0f, 1.0f),
|
val rightRotation: Vector4f = Vector4f(0.0f, 0.0f, 0.0f, 1.0f)
|
||||||
|
|
||||||
val viewRange: Float = 2.0f,
|
|
||||||
var name: String? = null
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
class Billboard () {
|
||||||
|
companion object {
|
||||||
|
const val FIXED: String = "fixed"
|
||||||
|
const val VERTICAL: String = "vertical"
|
||||||
|
const val HORIZONTAL: String = "horizontal"
|
||||||
|
const val CENTER: String = "center"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package com.bytedice.bde_particles.particles
|
||||||
|
|
||||||
|
class ParticleDebug {
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user