Package org.spout.api.geo

Examples of org.spout.api.geo.World


    final int blockZ = chunk.getBlockZ();
    if (Math.abs(blockX % DISTANCE) >= Chunk.BLOCKS.SIZE
        || Math.abs(blockZ % DISTANCE) >= Chunk.BLOCKS.SIZE) {
      return;
    }
    final World world = chunk.getWorld();
    if (random.nextInt(ODD) == 0) {
      final Fortress fortress = new Fortress(random);
      final int x = blockX + random.nextInt(VARIATION * 2 + 1) - VARIATION;
      final int y = random.nextInt(RAND_Y + 1) + BASE_Y;
      final int z = blockZ + random.nextInt(VARIATION * 2 + 1) - VARIATION;
View Full Code Here


  }

  private static BlockMaterial[][] getColumnTopmostMaterials(Point p) {
    BlockMaterial[][] materials = new BlockMaterial[Chunk.BLOCKS.SIZE][Chunk.BLOCKS.SIZE];

    World w = p.getWorld();

    for (int xx = 0; xx < Chunk.BLOCKS.SIZE; xx++) {
      for (int zz = 0; zz < Chunk.BLOCKS.SIZE; zz++) {
        materials[xx][zz] = w.getTopmostBlock(p.getBlockX() + xx, p.getBlockZ() + zz, LoadOption.LOAD_GEN);
      }
    }
    return materials;
  }
View Full Code Here

  }

  private static int[][] getColumnHeights(Point p) {
    int[][] heights = new int[Chunk.BLOCKS.SIZE][Chunk.BLOCKS.SIZE];

    World w = p.getWorld();

    for (int xx = 0; xx < Chunk.BLOCKS.SIZE; xx++) {
      for (int zz = 0; zz < Chunk.BLOCKS.SIZE; zz++) {
        heights[xx][zz] = w.getSurfaceHeight(p.getBlockX() + xx, p.getBlockZ() + zz, LoadOption.LOAD_GEN);
      }
    }
    return heights;
  }
View Full Code Here

      return;
    }
    if (random.nextInt(odd) != 0) {
      return;
    }
    final World world = chunk.getWorld();
    int x = chunk.getBlockX(random);
    int z = chunk.getBlockZ(random);
    int y = getHighestWorkableBlock(world, x, z);
    if (y == -1) {
      return;
View Full Code Here

  @Override
  public void onPlacement(Block block, short data, BlockFace against, Vector3 clickedPos, boolean isClickedBlock, Cause<?> cause) {
    List<PaintingType> list = new ArrayList<PaintingType>();

    World world = block.getWorld();
    for (PaintingType paintingType : PaintingType.values()) {
      if (paintingType.canBePlaced(block, against)) {
        list.add(paintingType);
      }
    }
    PaintingType paintingType = list.get(GenericMath.getRandom().nextInt(list.size() - 1));

    Entity e = world.createEntity(paintingType.getCenter(against, block.getPosition()), Painting.class);
    Painting painting = e.add(Painting.class);
    painting.setType(paintingType);
    painting.setFace(against);
    world.spawnEntity(e);
  }
View Full Code Here

    if (sleep == null) {
      return;
    }

    final Block head = getCorrectHalf(block, true);
    final World world = player.getWorld();
    final Sky sky = world.get(Sky.class);

    for (Entity e : world.getNearbyEntities(player, NEARBY_MONSTER_RANGE)) {
      if (e.get(Living.class) instanceof Hostile) {
        player.sendMessage(NEARBY_MONSTER_MESSAGE);
        return;
      }
    }
View Full Code Here

  public void onInteract(Entity entity, Block block, Action type, BlockFace face) {
    if (!(entity instanceof Player) || type != Action.RIGHT_CLICK || face == BlockFace.BOTTOM || face == BlockFace.THIS || face == BlockFace.TOP) {
      return;
    }

    World world = block.getWorld();
    Point pos = block.getPosition();
    Entity e = world.createEntity(new Point(world, pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()), ItemFrame.class);
    ItemFrame frame = e.add(ItemFrame.class);
    frame.setOrientation(face);
    world.spawnEntity(e);
  }
View Full Code Here

        if (mushroomType == VanillaMaterials.RED_MUSHROOM) {
          mushroom = new HugeMushroomObject(HugeMushroomType.RED);
        } else {
          mushroom = new HugeMushroomObject(HugeMushroomType.BROWN);
        }
        final World world = block.getWorld();
        final int x = block.getX();
        final int y = block.getY();
        final int z = block.getZ();
        if (mushroom.canPlaceObject(world, x, y, z)) {
          mushroom.placeObject(world, x, y, z);
View Full Code Here

        } catch (IllegalArgumentException e) {
          throw args.failure("time", args.currentArgument("time") + " is not a valid time.", true);
        }
      }
    }
    World world = args.popWorld("world", source);
    args.assertCompletelyParsed();

    Sky sky = world.get(Sky.class);
    if (sky == null) {
      throw new CommandException("The sky for " + world.getName() + " is not available.");
    }
    sky.setTime(relative ? (sky.getTime() + time) : time);
    if (getEngine() instanceof Client) {
      source.sendMessage(plugin.getPrefix() + ChatStyle.GREEN + "You set "
          + ChatStyle.WHITE + world.getName() + ChatStyle.GREEN
          + " to time: " + ChatStyle.WHITE + sky.getTime());
    } else {
      ((Server) getEngine()).broadcastMessage(plugin.getPrefix() + ChatStyle.WHITE
          + world.getName() + ChatStyle.GREEN + " set to: " + ChatStyle.WHITE + sky.getTime());
    }
  }
View Full Code Here

  @CommandDescription (aliases = "weather", usage = "<0|1|2|clear|rain|thunder> (0 = CLEAR, 1 = RAIN/SNOW, 2 = THUNDERSTORM) [world]", desc = "Changes the weather")
  @Permissible ("vanilla.command.weather")
  public void weather(CommandSource source, CommandArguments args) throws CommandException {
    Weather weather = args.popEnumValue("weather", Weather.class);
    World world = args.popWorld("world", source);
    args.assertCompletelyParsed();

    Sky sky = world.get(Sky.class);
    if (sky == null) {
      throw new CommandException("The sky of world '" + world.getName() + "' is not available.");
    }

    sky.setWeather(weather);
    String message;
    switch (weather) {
View Full Code Here

TOP

Related Classes of org.spout.api.geo.World

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.