13
0

Optimize stuff client side
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2022-03-25 17:36:58 +01:00
Ursprung dfb7e63df9
Commit 67d094a2b1
2 geänderte Dateien mit 18 neuen und 16 gelöschten Zeilen

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.lobby.particle;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Particle;
@ -41,16 +42,6 @@ public class DustSimpleParticle implements BaseParticle {
this.time = time;
}
public DustSimpleParticle(ParticleItem particleItem, Particle particle, float vx, float vy, float vz, double time, int count) {
this.particleItem = particleItem;
this.particle = particle;
this.vx = vx;
this.vy = vy;
this.vz = vz;
this.time = time;
this.count = count;
}
@Override
public ParticleItem getItem() {
return particleItem;
@ -59,6 +50,11 @@ public class DustSimpleParticle implements BaseParticle {
@Override
public void particle(ParticleData particleData) {
Location location = particleData.getLocation().add(0.0, 0.2, 0.0);
particleData.getWorld().spawnParticle(particle, location, count, vx, vy, vz, time, getParticleDust());
Bukkit.getOnlinePlayers().forEach(player -> {
int viewDistance = player.getClientViewDistance() * 16;
if (location.distanceSquared(player.getLocation()) <= viewDistance * viewDistance) {
player.spawnParticle(particle, location, count, vx, vy, vz, time, getParticleDust());
}
});
}
}

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.lobby.particle;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Particle;
@ -67,10 +68,15 @@ public class SimpleParticle implements BaseParticle {
@Override
public void particle(ParticleData particleData) {
Location location = particleData.getLocation().add(0.0, 0.2, 0.0);
if (customVelocity) {
particleData.getWorld().spawnParticle(particle, location, count, vx, vy, vz, time);
} else {
particleData.getWorld().spawnParticle(particle, location, count);
}
Bukkit.getOnlinePlayers().forEach(player -> {
int viewDistance = player.getClientViewDistance() * 16;
if (location.distanceSquared(player.getLocation()) <= viewDistance * viewDistance) {
if (customVelocity) {
player.spawnParticle(particle, location, count, vx, vy, vz, time);
} else {
player.spawnParticle(particle, location, count);
}
}
});
}
}