Esempio n. 1
0
  protected void checkBlockCollision() {
    Vector3 vector = new Vector3(0, 0, 0);

    for (Block block : this.getBlocksAround()) {
      block.onEntityCollide(this);
      block.addVelocityToEntity(this, vector);
    }

    if (vector.lengthSquared() > 0) {
      vector = vector.normalize();
      double d = 0.014d;
      this.motionX += vector.x * d;
      this.motionY += vector.y * d;
      this.motionZ += vector.z * d;
    }
  }
Esempio n. 2
0
 @Override
 public Position subtract(Vector3 x) {
   return this.add(-x.getX(), -x.getY(), -x.getZ());
 }
Esempio n. 3
0
 @Override
 public Position add(Vector3 x) {
   return new Position(this.x + x.getX(), this.y + x.getY(), this.z + x.getZ(), this.level);
 }