Created
February 21, 2018 20:44
-
-
Save Exerosis/8db360a2dec7034ab3fe832c0f148572 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class Particle { | |
| private final String id; | |
| private int count = 0; | |
| private float data, x, y, z = 0; | |
| public Particle(String id) { | |
| this.id = id; | |
| } | |
| public static Particle create(String id) { | |
| return new Particle(id); | |
| } | |
| @NotNull | |
| public Particle color(@NotNull Color color) { | |
| return color(color.getRed(), color.getGreen(), color.getBlue()); | |
| } | |
| @NotNull | |
| public Particle color(@NotNull Number red, @NotNull Number green, @NotNull Number blue) { | |
| x = red.intValue() / 255f; | |
| y = green.intValue() / 255f; | |
| z = blue.intValue() / 255f; | |
| return this; | |
| } | |
| @NotNull | |
| public Particle offset(@NotNull Vector vector) { | |
| x = (float) vector.getX(); | |
| y = (float) vector.getY(); | |
| z = (float) vector.getZ(); | |
| return this; | |
| } | |
| @NotNull | |
| public Particle offset(@NotNull Number randSeed) { | |
| return offset(randSeed, randSeed, randSeed); | |
| } | |
| @NotNull | |
| public Particle offset(@NotNull Number x, @NotNull Number y, @NotNull Number z) { | |
| this.x = x.floatValue(); | |
| this.y = y.floatValue(); | |
| this.z = z.floatValue(); | |
| return this; | |
| } | |
| @NotNull | |
| public Particle data(float data) { | |
| this.data = data; | |
| return this; | |
| } | |
| @NotNull | |
| public Particle count(@NotNull Number count) { | |
| this.count = count.intValue(); | |
| return this; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment