示例#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;
    }
  }
示例#2
0
 @Override
 public Position subtract(Vector3 x) {
   return this.add(-x.getX(), -x.getY(), -x.getZ());
 }
示例#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);
 }