4
4
import de .ellpeck .naturesaura .packet .PacketHandler ;
5
5
import de .ellpeck .naturesaura .packet .PacketParticles ;
6
6
import net .minecraft .core .BlockPos ;
7
- import net .minecraft .nbt . CompoundTag ;
7
+ import net .minecraft .core . component . DataComponents ;
8
8
import net .minecraft .util .Mth ;
9
9
import net .minecraft .world .entity .Entity ;
10
10
import net .minecraft .world .entity .item .ItemEntity ;
@@ -57,35 +57,33 @@ public void tick() {
57
57
}
58
58
59
59
if (this .trackedEntity != null && !this .trackedEntity .isAlive ()) {
60
- if (this .trackedItem .hasTag ( )) {
60
+ if (this .trackedItem .has ( DataComponents . FIREWORKS )) {
61
61
float generateFactor = 0 ;
62
62
Set <Integer > usedColors = new HashSet <>();
63
63
64
- var compound = this .trackedItem .getTag ();
65
- var fireworks = compound .getCompound ("Fireworks" );
64
+ var fireworks = this .trackedItem .get (DataComponents .FIREWORKS );
66
65
67
- var flightTime = fireworks .getInt ( "Flight" );
68
- var explosions = fireworks .getList ( "Explosions" , 10 );
66
+ var flightTime = fireworks .flightDuration ( );
67
+ var explosions = fireworks .explosions ( );
69
68
if (!explosions .isEmpty ()) {
70
69
generateFactor += flightTime ;
71
70
72
- for (var base : explosions ) {
73
- var explosion = (CompoundTag ) base ;
71
+ for (var explosion : explosions ) {
74
72
generateFactor += 1.5F ;
75
73
76
- var flicker = explosion .getBoolean ( "Flicker" );
74
+ var flicker = explosion .hasTwinkle ( );
77
75
if (flicker )
78
76
generateFactor += 1 ;
79
77
80
- var trail = explosion .getBoolean ( "Trail" );
78
+ var trail = explosion .hasTrail ( );
81
79
if (trail )
82
80
generateFactor += 8 ;
83
81
84
- var type = explosion .getByte ( "Type" );
85
- generateFactor += new float []{0 , 1 , 0.5F , 20 , 0.5F }[type ];
82
+ var type = explosion .shape ( );
83
+ generateFactor += new float []{0 , 1 , 0.5F , 20 , 0.5F }[type . getId () ];
86
84
87
85
Set <Integer > colors = new HashSet <>();
88
- for (var color : explosion .getIntArray ( "Colors" )) {
86
+ for (var color : explosion .colors ( )) {
89
87
usedColors .add (color );
90
88
colors .add (color );
91
89
}
@@ -106,8 +104,8 @@ public void tick() {
106
104
data .add (this .worldPosition .getZ ());
107
105
data .addAll (usedColors );
108
106
PacketHandler .sendToAllLoaded (this .level , this .worldPosition , new PacketParticles (
109
- (float ) this .trackedEntity .getX (), (float ) this .trackedEntity .getY (), (float ) this .trackedEntity .getZ (),
110
- PacketParticles .Type .FIREWORK_GEN , Ints .toArray (data )));
107
+ (float ) this .trackedEntity .getX (), (float ) this .trackedEntity .getY (), (float ) this .trackedEntity .getZ (),
108
+ PacketParticles .Type .FIREWORK_GEN , Ints .toArray (data )));
111
109
}
112
110
}
113
111
@@ -122,7 +120,7 @@ public void tick() {
122
120
this .toRelease = 0 ;
123
121
124
122
PacketHandler .sendToAllLoaded (this .level , this .worldPosition ,
125
- new PacketParticles (this .worldPosition .getX (), this .worldPosition .getY (), this .worldPosition .getZ (), PacketParticles .Type .FLOWER_GEN_AURA_CREATION ));
123
+ new PacketParticles (this .worldPosition .getX (), this .worldPosition .getY (), this .worldPosition .getZ (), PacketParticles .Type .FLOWER_GEN_AURA_CREATION ));
126
124
}
127
125
}
128
126
}
@@ -132,4 +130,5 @@ public void tick() {
132
130
public boolean wantsLimitRemover () {
133
131
return true ;
134
132
}
133
+
135
134
}
0 commit comments