44import net .minestom .server .coordinate .Vec ;
55import net .minestom .server .network .packet .server .play .ParticlePacket ;
66import net .minestom .server .particle .Particle ;
7- import net .minestom .server .particle .data .DustColorTransitionParticleData ;
8- import net .minestom .server .particle .data .DustParticleData ;
97
108import java .util .Map ;
119
@@ -19,7 +17,6 @@ public static ParticlePacket buildParticle(Particle particleType, double x, doub
1917 else if (particleType == Particle .DUST_COLOR_TRANSITION ) return buildDustTransition (x , y , z , size , r , g , b , r2 , g2 , b2 );
2018 else if (particleType == Particle .NOTE ) return buildNote (x , y , z , r , g , b );
2119 else if (particleType == Particle .ENTITY_EFFECT ) return buildEffect (x , y , z , r , g , b );
22- else if (particleType == Particle .AMBIENT_ENTITY_EFFECT ) return buildEffectAmbient (x , y , z , r , g , b );
2320 else if (particleType == Particle .FLAME
2421 || particleType == Particle .SMOKE
2522 || particleType == Particle .FIREWORK
@@ -29,8 +26,8 @@ else if (particleType == Particle.FLAME
2926 }
3027
3128 private static ParticlePacket buildDustTransition (double x , double y , double z , double size , double r , double g , double b , double r2 , double g2 , double b2 ) {
32- DustColorTransitionParticleData data = new DustColorTransitionParticleData (new Color ((int ) (r * 255 ), (int ) (g * 255 ), (int ) (b * 255 )), (float ) size , new Color ((int ) (r2 * 255 ), (int ) (g2 * 255 ), (int ) (b2 * 255 )));
33- return new ParticlePacket (Particle . DUST_COLOR_TRANSITION . id () , true , x , y , z , 0 , 0 , 0 , 0 , 0 , data );
29+ Particle . DustColorTransition data = Particle . DUST_COLOR_TRANSITION . withProperties (new Color ((int ) (r * 255 ), (int ) (g * 255 ), (int ) (b * 255 )), (float ) size , new Color ((int ) (r2 * 255 ), (int ) (g2 * 255 ), (int ) (b2 * 255 ))) ;
30+ return new ParticlePacket (data , true , x , y , z , 0 , 0 , 0 , 0 , 0 );
3431 }
3532
3633 private static ParticlePacket buildGeneric (Particle p , double x , double y , double z ) {
@@ -42,20 +39,16 @@ private static ParticlePacket buildDirectional(Particle p, double x, double y, d
4239 double size = vec .length ();
4340 vec = vec .normalize ();
4441
45- return new ParticlePacket (p . id () , true , x , y , z , (float ) vec .x (), (float ) vec .y (), (float ) vec .z (), (float ) size , 0 , p . data () );
42+ return new ParticlePacket (p , true , x , y , z , (float ) vec .x (), (float ) vec .y (), (float ) vec .z (), (float ) size , 0 );
4643 }
4744
4845 private static ParticlePacket buildDust (double x , double y , double z , double size , double r , double g , double b ) {
49- DustParticleData data = new DustParticleData (new Color ((int ) (r * 255 ), (int ) (g * 255 ), (int ) (b * 255 )), (float ) size );
50- return new ParticlePacket (Particle . DUST . id () , true , x , y , z , 0 , 0 , 0 , 0 , 0 , data );
46+ Particle . Dust data = Particle . DUST . withProperties (new Color ((int ) (r * 255 ), (int ) (g * 255 ), (int ) (b * 255 )), (float ) size );
47+ return new ParticlePacket (data , true , x , y , z , 0 , 0 , 0 , 0 , 0 );
5148 }
5249
5350 private static ParticlePacket buildEffect (double x , double y , double z , double r , double g , double b ) {
54- return new ParticlePacket (Particle .ENTITY_EFFECT .id (), true , x , y , z , (float ) r , (float ) g , (float ) b , 1 , 0 , Particle .ENTITY_EFFECT .data ());
55- }
56-
57- private static ParticlePacket buildEffectAmbient (double x , double y , double z , double r , double g , double b ) {
58- return new ParticlePacket (Particle .AMBIENT_ENTITY_EFFECT .id (), true , x , y , z , (float ) r , (float ) g , (float ) b , 1 , 0 , Particle .AMBIENT_ENTITY_EFFECT .data ());
51+ return new ParticlePacket (Particle .ENTITY_EFFECT , true , x , y , z , (float ) r , (float ) g , (float ) b , 1 , 0 );
5952 }
6053
6154 private static final Map <Vec , Double > noteColours = Map .ofEntries (
@@ -79,6 +72,6 @@ private static double calculateMinDiff(double r, double g, double b) {
7972 }
8073
8174 private static ParticlePacket buildNote (double x , double y , double z , double r , double g , double b ) {
82- return new ParticlePacket (Particle .NOTE . id () , true , x , y , z , (float ) (calculateMinDiff (r , g , b )), 0 , 0 , 1 , 0 , Particle . NOTE . data () );
75+ return new ParticlePacket (Particle .NOTE , true , x , y , z , (float ) (calculateMinDiff (r , g , b )), 0 , 0 , 1 , 0 );
8376 }
8477}
0 commit comments