Esempio n. 1
0
 public boolean isInLiquid() {
   BlockType below =
       BlockType.getById(
           world.getBlockIdAt((int) Math.floor(x), (int) Math.floor(y), (int) Math.floor(z)));
   BlockType above =
       BlockType.getById(
           world.getBlockIdAt((int) Math.floor(x), (int) Math.floor(y + 1), (int) Math.floor(z)));
   return below == BlockType.WATER
       || below == BlockType.LAVA
       || below == BlockType.STATIONARY_WATER
       || below == BlockType.STATIONARY_LAVA
       || above == BlockType.WATER
       || above == BlockType.LAVA
       || above == BlockType.STATIONARY_WATER
       || above == BlockType.STATIONARY_LAVA;
 }
Esempio n. 2
0
 public int getExperienceForLevel(int level) {
   if (level <= 15) return 17 * level;
   else if (level <= 30) return (int) ((1.5 * Math.pow(level, 2)) - (29.5 * level) + 360);
   else return (int) ((3.5 * Math.pow(level, 2)) - (151.5 * level) + 2220);
 }
Esempio n. 3
0
 private float getRotationY(double x, double y, double z) {
   double dis1 = y - (this.y + 1);
   double dis2 = Math.sqrt(Math.pow(x - this.x, 2) + Math.pow(z - this.z, 2));
   return (float) ((Math.atan2(dis2, dis1) * 180D) / Math.PI) - 90F;
 }
Esempio n. 4
0
 public boolean isOnGround() {
   int id = world.getBlockIdAt((int) Math.floor(x), (int) Math.floor(y - 1), (int) Math.floor(z));
   return y % 1 < 0.2 && BlockType.getById(id).isSolid();
 }
Esempio n. 5
0
 private float getRotationX(double x, double y, double z) {
   double d = this.x - x;
   double d1 = this.z - z;
   return (float) (((Math.atan2(d1, d) * 180D) / Math.PI) + 90) % 360;
 }