Fix particle arguments, randomize reddustHandler

This commit is contained in:
Matsv 2018-04-04 21:45:23 +02:00
parent d066c2596b
commit 0ec5777f12
2 changed files with 14 additions and 7 deletions

View File

@ -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;

View File

@ -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();
}
}