Package org.spout.api.geo.discrete

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


  }

  @CommandDescription (aliases = "getblock", usage = "<world> <x> <y> <z>", desc = "Finds block at the given coords")
  @Permissible ("vanilla.command.debug")
  public void getBlock(CommandSource source, CommandArguments args) throws CommandException {
    Point p = args.popPoint("loc", source);
    args.assertCompletelyParsed();

    Chunk c = p.getChunk(LoadOption.NO_LOAD);
    if (c == null) {
      throw new CommandException("Chunk not loaded");
    }
    int blockState = c.getBlockFullState(p.getBlockX(), p.getBlockY(), p.getBlockZ());
    BlockMaterial m = BlockMaterial.get(blockState);
    source.sendMessage("Material at " + p.getBlockX() + ", " + p.getBlockY() + ", " + p.getBlockZ() + " is " + m.getClass().getSimpleName());
  }
View Full Code Here


  @CommandDescription (aliases = "growtree", usage = "", desc = "grows a tree at the current location")
  @Permissible ("vanilla.command.debug")
  @Filter (PlayerFilter.class)
  public void growTree(Player player, CommandArguments args) throws CommandException {
    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

  @Permissible ("vanilla.command.debug")
  @Filter (PlayerFilter.class)
  public void explode(Player player, CommandArguments args) throws CommandException {
    args.assertCompletelyParsed();

    Point position = player.getPhysics().getPosition();
    ExplosionModels.SPHERICAL.execute(position, 4.0f);
  }
View Full Code Here

    } else {
      args.success("object", object);
    }
    args.assertCompletelyParsed();

    final Point loc = player.getPhysics().getPosition();
    final World world = loc.getWorld();
    final int x = loc.getBlockX();
    final int y = loc.getBlockY();
    final int z = loc.getBlockZ();
    final boolean force = args.has("force");
    if (!object.canPlaceObject(world, x, y, z)) {
      player.sendMessage("Couldn't place the object.");
      if (!force) {
        return;
View Full Code Here

    Player player = args.popPlayerOrMe("player", source);
    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());
View Full Code Here

    // Figure out what entity to affect
    // 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());
      if (distance < lastDistanceToEntity) {
        lastDistanceToEntity = distance;
        nearest = near;
        if (distance < 0.5) {
          break;
View Full Code Here

    for (byte attempts = 0; attempts < 10; attempts++) {
      final int x = random.nextInt(32) - 16;
      final int z = random.nextInt(32) - 16;
      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

   * @param block to get the facing for
   * @param entity to look at
   * @return The block facing
   */
  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;
View Full Code Here

    Collection<Chunk> chunks = null;

    List<ProtocolEvent> events = new ArrayList<ProtocolEvent>();

    if (activeColumns.add(x, z)) {
      Point p = c.getBase();
      int[][] heights = getColumnHeights(p);
      BlockMaterial[][] materials = getColumnTopmostMaterials(p);

      byte[][] packetChunkData = new byte[16][];

      for (int cube = 0; cube < 16; cube++) {
        int serverCube = rm.getInverse().convertChunkY(cube);
        Point pp = new Point(c.getWorld(), x << Chunk.BLOCKS.BITS, serverCube << Chunk.BLOCKS.BITS, z << Chunk.BLOCKS.BITS);
        packetChunkData[cube] = chunkInit.getChunkData(heights, materials, pp, events);
      }

      Chunk chunk = p.getWorld().getChunkFromBlock(p, LoadOption.LOAD_ONLY);
      byte[] biomeData = new byte[Chunk.BLOCKS.AREA];
View Full Code Here

    if (first) {
      PlayerSpawnPositionMessage pspMsg = new PlayerSpawnPositionMessage((int) live.getPosition().getX(), (int) live.getPosition().getY(), (int) live.getPosition().getZ(), getRepositionManager());
      event.getMessages().add(pspMsg);
      first = false;
    }
    Point p = event.getTransform().getPosition();
    Quaternionf rot = event.getTransform().getRotation();
    final Vector3f axesAngles = rot.getAxesAngleDeg();
    PlayerPositionLookMessage PPLMsg = new PlayerPositionLookMessage(p.getX(), p.getY() + STANCE, p.getZ(), p.getY(), axesAngles.getY(), axesAngles.getX(), true, VanillaBlockDataChannelMessage.CHANNEL_ID, getRepositionManager());
    event.getMessages().add(PPLMsg);
  }
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.