Package org.spout.math.vector

Examples of org.spout.math.vector.Vector3f


    args.assertCompletelyParsed();
    Point pos = player.getPhysics().getPosition();

    BigTreeObject tree = new BigTreeObject();
    tree.placeObject(pos.getWorld(), pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
    player.getPhysics().setPosition(pos.add(new Vector3f(0, 50, 0)));
  }
View Full Code Here


  }

  @CommandDescription (aliases = "sun", usage = "<x> <y> <z>", desc = "Sets the sun direction.")
  @Permissible ("vanilla.command.debug")
  public void setSunDirection(CommandSource source, CommandArguments args) throws CommandException {
    Vector3f dir = args.popVector3("dir", null);
    args.assertCompletelyParsed();
    LightRenderEffect.setSun(dir);
    SkyRenderEffect.setSun(dir);
  }
View Full Code Here

    args.assertCompletelyParsed();

    if (action.contains("look")) {
      Quaternionf rotation = player.getData().get(VanillaData.HEAD_ROTATION);
      Point startPosition = player.getPhysics().getPosition();
      Vector3f offset = rotation.getDirection().mul(0.1);
      for (int i = 0; i < 100; i++) {
        startPosition = startPosition.add(offset);
        GeneralEffects.NOTE_PARTICLE.playGlobal(startPosition);
      }
      final Vector3f axesAngles = rotation.getAxesAngleDeg();
      player.sendMessage("Yaw = " + axesAngles.getY());
      player.sendMessage("Pitch = " + axesAngles.getX());
    } else if (action.contains("packets")) {
      player.add(ForceMessages.class);
    } else {
      if (getEngine() instanceof Client) {
        throw new CommandException("You cannot resend chunks in client mode.");
View Full Code Here

    // Note: this could be put in a method in the Vanilla human component instead
    // This version is rather inaccurate...
    double lastDistanceToEntity = 5.0;
    Point point = player.getPhysics().getPosition();
    Human human = player.get(Human.class);
    Vector3f direction;
    if (human == null) {
      direction = player.getPhysics().getRotation().getDirection();
    } else {
      direction = human.getHead().getLookingAt();
    }
    Entity nearest = null;
    for (double d = 0.0; d <= 50.0; d += 0.25) {
      Point pos = point.add(direction.mul(d));
      Entity near = point.getWorld().getNearestEntity(pos, player, (int) lastDistanceToEntity);
      if (near == null) {
        continue;
      }
      double distance = pos.distance(near.getPhysics().getPosition());
View Full Code Here

  }

  @Override
  protected void generateTerrain(CuboidBlockMaterialBuffer blockData, int x, int y, int z, BiomeManager biomes, long seed) {
    PERLIN.setSeed((int) seed * 23);
    final Vector3f size = blockData.getSize();
    final int sizeX = size.getFloorX();
    final int sizeY = size.getFloorY();
    final int sizeZ = size.getFloorZ();
    final double[][][] noise = WorldGeneratorUtils.fastNoise(NOISE, sizeX, sizeY, sizeZ, 4, x, y, z);
    for (int xx = 0; xx < sizeX; xx++) {
      for (int zz = 0; zz < sizeZ; zz++) {
        final int totalX = x + xx;
        final int totalZ = z + zz;
View Full Code Here

    }
  }

  @Override
  public void bulkEmittingInitialize(ImmutableCuboidBlockMaterialBuffer buffer, final int[][][] light, int[][] height) {
    Vector3f base = buffer.getBase();

    final int baseX = base.getFloorX();
    final int baseY = base.getFloorY();
    final int baseZ = base.getFloorZ();

    buffer.forEach(new CuboidBlockMaterialProcedure() {
      @Override
      public boolean execute(int x, int y, int z, short id, short data) {
        x -= baseX;
View Full Code Here

  }

  @Override
  public void bulkEmittingInitialize(ImmutableCuboidBlockMaterialBuffer buffer, int[][][] light, int[][] genHeight) {

    Vector3f size = buffer.getSize();

    final int sizeX = size.getFloorX();
    final int sizeY = size.getFloorY();
    final int sizeZ = size.getFloorZ();

    Vector3f base = buffer.getBase();

    final int baseX = base.getFloorX();
    final int baseY = base.getFloorY();
    final int baseZ = base.getFloorZ();

    final int topY = buffer.getTop().getFloorY();

    final int[][] height = new int[sizeX][sizeZ];
View Full Code Here

  public static BlockFace getBlockFacing(Block block, Entity entity) {
    Point position;
    EntityHead head = entity.get(EntityHead.class);
    position = head != null ? head.getPosition() : entity.getPhysics().getPosition();

    Vector3f diff = position.sub(block.getX(), block.getY(), block.getZ());
    if (Math.abs(diff.getX()) < 2.0f && Math.abs(diff.getZ()) < 2.0f) {
      if (diff.getY() > 1.8f) {
        return BlockFace.TOP;
      } else if (diff.getY() < -0.2f) {
        return BlockFace.BOTTOM;
      }
    }
    return getFacing(entity).getOpposite();
  }
View Full Code Here

    EntityHead head = entity.add(EntityHead.class);
    Block b = head.getBlockView(1).next();
    if (!b.isMaterial(VanillaMaterials.WATER)) {
      return;
    }
    this.spawnEntity(b, new Vector3f(0.0, 0.25, 0.0));
  }
View Full Code Here

  @Override
  public void populate(CuboidBlockMaterialBuffer blockData, int x, int y, int z, BiomeManager biomes, long seed) {
    if (y < 0 || y >= NormalGenerator.HEIGHT) {
      return;
    }
    final Vector3f size = blockData.getSize();
    final int sizeX = size.getFloorX();
    final int sizeY = GenericMath.clamp(size.getFloorY(), 0, NormalGenerator.HEIGHT);
    final int sizeZ = size.getFloorZ();
    for (int xx = 0; xx < sizeX; xx++) {
      for (int zz = 0; zz < sizeZ; zz++) {
        final Biome biome = biomes.getBiome(xx, 0, zz);
        if (!(biome instanceof GroundCoverBiome)) {
          continue;
View Full Code Here

TOP

Related Classes of org.spout.math.vector.Vector3f

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.