@@ -3,8 +3,10 @@ package de.randombyte.entityparticles
3
3
import com.flowpowered.math.vector.Vector3d
4
4
import com.flowpowered.math.vector.Vector3i
5
5
import de.randombyte.entityparticles.Config.Particle.Effect
6
+ import de.randombyte.kosp.extensions.deserialize
6
7
import de.randombyte.kosp.extensions.red
7
- import de.randombyte.kosp.extensions.toText
8
+ import de.randombyte.kosp.extensions.serialize
9
+ import de.randombyte.kosp.extensions.tryAsByteItem
8
10
import ninja.leaping.configurate.objectmapping.Setting
9
11
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable
10
12
import org.spongepowered.api.data.key.Keys
@@ -15,7 +17,6 @@ import org.spongepowered.api.entity.EntityTypes
15
17
import org.spongepowered.api.item.enchantment.Enchantment
16
18
import org.spongepowered.api.item.enchantment.EnchantmentTypes
17
19
import org.spongepowered.api.item.inventory.ItemStack
18
- import org.spongepowered.api.text.Text
19
20
20
21
@ConfigSerializable
21
22
internal data class Config (
@@ -26,8 +27,8 @@ internal data class Config(
26
27
@ConfigSerializable
27
28
internal data class Particle (
28
29
@Setting(" item" ) val item : String = " " ,
29
- @Setting(" display-name" ) val displayName : Text = Text . EMPTY ,
30
- @Setting(" item-description" ) val itemDescription : Text = Text . EMPTY ,
30
+ @Setting(" display-name" ) val displayName : String = " " ,
31
+ @Setting(" item-description" ) val itemDescription : String = " " ,
31
32
@Setting(" item-enchanted" ) val itemEnchanted : Boolean = false ,
32
33
@Setting(" glowing" ) val glowing : Boolean = false ,
33
34
@Setting(" effects" ) val effects : List <Effect > = emptyList()
@@ -44,32 +45,32 @@ internal data class Config(
44
45
)
45
46
46
47
fun createItemStack () = ItemStack .builder()
47
- .fromSnapshot(resolveByteItems( item))
48
+ .fromSnapshot(item.tryAsByteItem( ))
48
49
.quantity(1 ) // force single item
49
50
.apply {
50
51
if (itemEnchanted) {
51
52
add(Keys .ITEM_ENCHANTMENTS , listOf (Enchantment .of(EnchantmentTypes .LUCK_OF_THE_SEA , 0 )))
52
53
add(Keys .HIDE_ENCHANTMENTS , true )
53
54
}
54
55
}
55
- .add(Keys .DISPLAY_NAME , displayName)
56
- .add(Keys .ITEM_LORE , listOf (itemDescription))
56
+ .add(Keys .DISPLAY_NAME , displayName.deserialize() )
57
+ .add(Keys .ITEM_LORE , listOf (itemDescription.deserialize() ))
57
58
.build()
58
59
}
59
60
60
61
constructor () : this (
61
62
blockedEntities = listOf (EntityTypes .PLAYER ),
62
63
removerItem = Particle (
63
64
item = " minecraft:bone" ,
64
- displayName = " Particles remover" .toText() ,
65
- itemDescription = Text . EMPTY ,
65
+ displayName = " Particles remover" ,
66
+ itemDescription = " " ,
66
67
itemEnchanted = true
67
68
),
68
69
particles = mapOf (
69
70
" love" to Particle (
70
71
item = " minecraft:blaze_rod" ,
71
- displayName = " Love" .red(),
72
- itemDescription = " Right click an entity to apply this effect" .toText() ,
72
+ displayName = " Love" .red().serialize() ,
73
+ itemDescription = " Right click an entity to apply this effect" ,
73
74
itemEnchanted = true ,
74
75
glowing = false ,
75
76
effects = listOf (Effect (
0 commit comments