mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-23 02:25:19 +01:00
Fix particle arguments, randomize reddustHandler
This commit is contained in:
parent
d066c2596b
commit
0ec5777f12
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user