TNT_Block

Particle.java

Sep 26th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. package de.cryptonicdev.cryptonic.particle;
  2.  
  3. import java.util.Random;
  4.  
  5. import org.lwjgl.input.Keyboard;
  6.  
  7. import de.cryptonicdev.cryptonic.utils.RenderUtils;
  8. import net.minecraft.client.gui.Gui;
  9. import net.minecraft.util.MathHelper;
  10.  
  11. public class Particle {
  12.  
  13. public int x;
  14. public int y;
  15. public int k;
  16. public ParticleGenerator pg;
  17. public boolean reset;
  18. public float size;
  19. private Random random = new Random();
  20. private int color;
  21.  
  22.  
  23. public Particle(int x, int y, int color) {
  24. this.x = x;
  25. this.y = y;
  26. this.color = color;
  27. this.size = genRandom(0.7F, 0.8F);
  28. }
  29.  
  30. public void draw() {
  31. if (x == -1){
  32. x = pg.breite;
  33. reset = true;
  34. }
  35.  
  36. if (y == -1){
  37. y = pg.höhe;
  38. reset = true;
  39. }
  40.  
  41. this.x -= random.nextInt(2);
  42. this.y -= random.nextInt(2);
  43.  
  44. int xx = (int) (MathHelper.cos(0.1F * (this.x + this.k)) * 10.0F);
  45. RenderUtils.drawBorderedCircle(this.x + xx, this.y, this.size, 0, color);
  46. }
  47.  
  48.  
  49. public float genRandom(float min, float max) {
  50. return (float) (min + Math.random() * (max - min + 1.0F));
  51. }
  52. }
Add Comment
Please, Sign In to add comment