perf: hoist last two DustOptions out of particle loops
Сфера взрыва SWORD — 36 частиц за вызов, превью разрушения щита — 8, и обе внутри циклов, каждые 4 тика на игрока. Осталось три аллокации DustOptions на весь плагин: две здесь и grenadeDust(размер) у GRENADE, где размер вычисляется и константой не обойтись.
This commit is contained in:
@@ -197,7 +197,7 @@ public class MagicListener implements Listener {
|
||||
cancel(); return;
|
||||
}
|
||||
Location loc = p.getLocation().add(0,1,0);
|
||||
for(int i=0;i<8;i++){ double a=(double)i/8*Math.PI*2 + System.currentTimeMillis()*0.005; Location ring=loc.clone().add(Math.cos(a)*1.1, Math.sin(a*2)*0.2, Math.sin(a)*1.1); p.getWorld().spawnParticle(Particle.DUST, ring,1,0,0,0,0,new Particle.DustOptions(Color.fromRGB(200,200,255),1f)); }
|
||||
for(int i=0;i<8;i++){ double a=(double)i/8*Math.PI*2 + System.currentTimeMillis()*0.005; Location ring=loc.clone().add(Math.cos(a)*1.1, Math.sin(a*2)*0.2, Math.sin(a)*1.1); p.getWorld().spawnParticle(Particle.DUST, ring,1,0,0,0,0,Particles.PALE_10); }
|
||||
p.getWorld().spawnParticle(Particle.END_ROD, loc,1,0.1,0.1,0.1,0);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -142,4 +142,6 @@ public final class Particles {
|
||||
public static final Particle.DustOptions ICE_13 = dust(136, 204, 255, 1.3f);
|
||||
/** Тёмно-серый, размер 1.5 — сфера SWORD. */
|
||||
public static final Particle.DustOptions DARKGREY_15 = dust(30, 30, 30, 1.5f);
|
||||
/** Тёмно-серый, размер 0.9 — сфера взрыва SWORD, 36 частиц за вызов. */
|
||||
public static final Particle.DustOptions DARKGREY_09 = dust(30, 30, 30, 0.9f);
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public class SwordAttack {
|
||||
for (int h = -1; h <= 1; h++) {
|
||||
Location sphere = expl.clone().add(Math.cos(a) * 0.5, h * 0.25, Math.sin(a) * 0.5);
|
||||
sphere.getWorld().spawnParticle(Particle.SMOKE, sphere, 1, 0.02, 0.02, 0.02, 0);
|
||||
sphere.getWorld().spawnParticle(Particle.DUST, sphere, 1, 0, 0, 0, 0, new Particle.DustOptions(Color.fromRGB(30, 30, 30), 0.9f));
|
||||
sphere.getWorld().spawnParticle(Particle.DUST, sphere, 1, 0, 0, 0, 0, Particles.DARKGREY_09);
|
||||
}
|
||||
}
|
||||
expl.getWorld().spawnParticle(Particle.CRIT, expl, 6, 0.2, 0.2, 0.2, 0.05);
|
||||
|
||||
Reference in New Issue
Block a user