Esempio n. 1
0
 private Renderer addColor(float r, float g, float b, float a) {
   renderer.color(
       MathUtil.snap(r, 0, 1),
       MathUtil.snap(g, 0, 1),
       MathUtil.snap(b, 0, 1),
       MathUtil.snap(a, 0, 1));
   return instance;
 }
 @Override
 public void update() {
   if (UtilM.isNull(UtilM.getThePlayer())) return;
   lastHandAlpha = handAlpha;
   handAlpha += UtilM.getThePlayer().isSneaking() ? 0.25 : -0.25;
   handAlpha = MathUtil.snap(handAlpha, 0, 1);
 }
Esempio n. 3
0
 /**
  * this method returns a random boolean with a custom chance of getting true. The higher the
  * number is the higher chance will be for getting a true return. Type in a number higher or equal
  * to 0 and lower or equal to 1.
  */
 public static boolean RB(double percentage) {
   percentage = MathUtil.snap(percentage, 0, 1);
   return percentage != 0 && (percentage == 1 || RF() < percentage);
 }