3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-26 00:00:28 +01:00

Fix particle arguments, randomize reddustHandler

Dieser Commit ist enthalten in:
Matsv 2018-04-04 21:45:23 +02:00
Ursprung d066c2596b
Commit 0ec5777f12
2 geänderte Dateien mit 14 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -4,13 +4,13 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import us.myles.ViaVersion.api.type.Type;
import java.util.Set;
import java.util.TreeSet;
import java.util.LinkedList;
import java.util.List;
@Data
public class Particle {
private int id;
private Set<ParticleData> arguments = new TreeSet<>();
private List<ParticleData> arguments = new LinkedList<>();
public Particle(int id) {
this.id = id;

Datei anzeigen

@ -9,6 +9,7 @@ import us.myles.ViaVersion.api.type.Type;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
public class ParticleRewriter {
private static List<NewParticle> particles = new LinkedList<>();
@ -102,14 +103,14 @@ public class ParticleRewriter {
Particle handler(Particle particle, Integer[] data);
}
// TODO TEST
// Randomized because the previous one was a lot of different colors at once! :)
private static ParticleDataHandler reddustHandler() {
return new ParticleDataHandler() {
@Override
public Particle handler(Particle particle, Integer[] data) {
particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, 1)); // Red 0 - 1
particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, 0)); // Green 0 - 1
particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, 0)); // Blue 0 - 1
particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, randomFloat())); // Red 0 - 1
particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, randomFloat())); // Green 0 - 1
particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, randomFloat())); // Blue 0 - 1
particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, 1));// Scale 0.01 - 4 TODO test scale
return particle;
}
@ -178,5 +179,11 @@ public class ParticleRewriter {
}
}
private static Random rand = new Random();
private static float randomFloat() {
return rand.nextFloat();
}
}