Package org.spout.api.geo.discrete

Examples of org.spout.api.geo.discrete.Point


      Health health = ((EntityCollideEntityEvent) event).getCollided().get(Health.class);
      if (health != null) {
        health.damage(0);
      }
    }
    spawnChickens(new Point(event.getContactInfo().getNormal(), getOwner().getWorld()));
    getOwner().remove();
  }
View Full Code Here


  }

  @Override
  public void onCollided(EntityCollideEvent event) {
    if (event instanceof EntityCollideEntityEvent) {
      Point point = ((EntityCollideEntityEvent) event).getCollided().getPhysics().getPosition();
      Health health = ((EntityCollideEntityEvent) event).getCollided().get(Health.class);
      if (health != null) {
        health.damage(getOwner().get(Damage.class).getDamageLevel(point.getWorld().getData().get(VanillaData.DIFFICULTY)).getAmount());
      }
    } else {
      //TODO: Fall damage
    }
  }
View Full Code Here

    for (byte attempts = 0; attempts < 10; attempts++) {
      final int x = random.nextInt(256) - 127;
      final int z = random.nextInt(256) - 127;
      final int y = getHighestSolidBlock(world, x, z);
      if (y != -1) {
        return new Point(world, x, y + 0.5f, z);
      }
    }
    return new Point(world, 0, 80, 0);
  }
View Full Code Here

  }

  @Override
  public void updateView() {
    Transform transform = getOwner().getPhysics().getTransform();
    Point point = transform.getPosition().add(0.0f, getHeight(), 0.0f);
    Matrix4f pos = Matrix4f.createTranslation(point.mul(-1));
    Matrix4f rot = getRotation();
    view = pos.mul(rot);
    frustum.update(projection, view, transform.getPosition());
  }
View Full Code Here

  }

  @Override
  public void updateReflectedView() {
    Transform transform = getOwner().getPhysics().getTransform();
    Point point = transform.getPosition().add(0.0f, getHeight(), 0.0f);
    Matrix4f pos = Matrix4f.createTranslation(point.mul(-1));
    Matrix4f rot = getRotation();
    view = Matrix4f.createScaling(new Vector4f(1, -1, 1, 1)).mul(pos).mul(rot);
    frustum.update(projection, view, transform.getPosition());
  }
View Full Code Here

  @Override
  public boolean canPlaceObject(World w, int x, int y, int z) {
    if (!super.canPlaceObject(w, x, y, z) || w.getBlockMaterial(x, y, z) instanceof Water) {
      return false;
    }
    final Point base = new Point(w, x, y, z);
    final byte availableSpace = getAvailableBlockSpace(base, base.add(0, totalHeight - 1, 0));
    if (availableSpace > baseHeight || availableSpace == -1) {
      if (availableSpace != -1) {
        totalHeight = availableSpace;
      }
      return true;
View Full Code Here

      final int groupZ = leafGroup.getBlockZ();
      for (int yy = groupY; yy < groupY + leafDistanceLimit; yy++) {
        generateGroupLayer(w, groupX, yy, groupZ, getLeafGroupLayerSize((byte) (yy - groupY)));
      }
    }
    final BlockIterator trunk = new BlockIterator(new Point(w, x, y - 1, z), new Point(w, x, y + trunkHeight, z));
    while (trunk.hasNext()) {
      trunk.next().setMaterial(VanillaMaterials.LOG, logMetadata);
    }
    generateBranches(w, x, y, z, leaves);
  }
View Full Code Here

      for (byte count = 0; count < groupsPerLayer; count++) {
        final float scale = widthScale * layerSize * (random.nextFloat() + 0.328f);
        Vector2f randomOffset = Vector2f.createRandomDirection(random).mul(scale);
        final int groupX = (int) (randomOffset.getX() + x + 0.5);
        final int groupZ = (int) (randomOffset.getY() + z + 0.5);
        final Point group = new Point(world, groupX, groupY, groupZ);
        if (getAvailableBlockSpace(group, group.add(0, leafDistanceLimit, 0)) != -1) {
          continue;
        }
        final byte xOff = (byte) (x - groupX);
        final byte zOff = (byte) (z - groupZ);
        final float horizontalDistanceToTrunk = (float) Math.sqrt(xOff * xOff + zOff * zOff);
        final float verticalDistanceToTrunk = horizontalDistanceToTrunk * branchSlope;
        final int base;
        final int yDiff = (int) (groupY - verticalDistanceToTrunk);
        if (yDiff > trunkTopY) {
          base = trunkTopY;
        } else {
          base = yDiff;
        }
        if (getAvailableBlockSpace(new Point(world, x, base, z), group) == -1) {
          groups.add(new PointBase(group, base));
        }
      }
      groupY--;
    }
View Full Code Here

  private void generateBranches(World world, int x, int y, int z, List<PointBase> groups) {
    for (PointBase group : groups) {
      final int baseY = group.getBase();
      if (baseY - y >= totalHeight * 0.2) {
        final Point base = new Point(world, x, baseY, z);
        final Vector3f angles = Quaternionf.fromRotationTo(Vector3f.FORWARD, group.sub(base)).getAxesAngleDeg();
        final BlockFace facing;
        if (angles.getX() < 135) {
          facing = BlockFace.fromYaw(angles.getY());
        } else {
View Full Code Here

    final Set<BoundingBox> placed = new HashSet<BoundingBox>();
    final Queue<StructurePiece> activeBranches = new LinkedList<StructurePiece>();
    final Map<StructurePiece, BoundingBox> lastBoxes = new HashMap<StructurePiece, BoundingBox>();
    final FortressCorridor corridor = new FortressCorridor(this);
    corridor.setStartOfFortress(true);
    corridor.setPosition(new Point(w, x, y, z));
    corridor.setRotation(Quaternionf.fromAngleDegAxis(random.nextInt(4) * 90, 0, 1, 0));
    corridor.randomize();
    activeBranches.add(corridor);
    final int size = random.nextInt(MAX_SIZE_RAND + 1) + MAX_SIZE_BASE;
    byte count = 0;
View Full Code Here

TOP

Related Classes of org.spout.api.geo.discrete.Point

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.