Package org.spout.api.geo

Examples of org.spout.api.geo.World


      return;
    }
    if (random.nextInt(odd) != 0) {
      return;
    }
    final World world = chunk.getWorld();
    final int amount = getAmount(random);
    for (byte count = 0; count < amount; count++) {
      final int x = chunk.getBlockX(random);
      final int y = random.nextBoolean() ? NormalGenerator.HEIGHT - 1 : random.nextInt(64);
      final int z = chunk.getBlockZ(random);
      final Mushroom mushroom = random.nextInt(4) == 0 ? VanillaMaterials.RED_MUSHROOM : VanillaMaterials.BROWN_MUSHROOM;
      for (byte size = 6; size > 0; size--) {
        final int xx = x - 7 + random.nextInt(15);
        final int zz = z - 7 + random.nextInt(15);
        final int yy = getHighestWorkableBlock(world, xx, y, zz);
        if (yy != -1 && world.getBlockMaterial(xx, yy, zz) == VanillaMaterials.AIR
            && mushroom.isValidPosition(world.getBlock(xx, yy, zz), BlockFace.BOTTOM, false)) {
          world.setBlockMaterial(xx, yy, zz, mushroom, (short) 0, null);
        }
      }
    }
  }
View Full Code Here


      return;
    }
    if (random.nextInt(odd) != 0) {
      return;
    }
    final World world = chunk.getWorld();
    final int amount = getAmount(random);
    for (byte count = 0; count < amount; count++) {
      final int x = chunk.getBlockX(random) - 7 + random.nextInt(15);
      final int z = chunk.getBlockZ(random) - 7 + random.nextInt(15);
      final int y = getHighestWorkableBlock(world, x, z);
      if (y != -1 && world.getBlockMaterial(x, y, z) == VanillaMaterials.AIR
          && VanillaMaterials.DEAD_BUSH.canAttachTo(world.getBlock(x, y - 1, z), BlockFace.TOP)) {
        world.setBlockMaterial(x, y, z, VanillaMaterials.DEAD_BUSH, (short) 0, null);
      }
    }
  }
View Full Code Here

  @Override
  public void handleClient(ClientSession session, PlayerPositionMessage message) {
    Player player = session.getPlayer();

    World world = session.getEngine().getDefaultWorld();
    player.getPhysics().setPosition(new Point(world, (float) message.getX(), (float) message.getY(), (float) message.getZ()));
    // TODO: player position isnt updated
    System.out.println(message.toString());
  }
View Full Code Here

  @Override
  public void populate(Chunk chunk, Random random) {
    if (chunk.getY() != 4) {
      return;
    }
    final World world = chunk.getWorld();
    final Biome decorating = chunk.getBiome(7, 7, 7);
    final byte amount = factory.amount(random);
    for (byte count = 0; count < amount; count++) {
      final TreeObject tree = factory.make(random);
      tree.setRandom(random);
      tree.randomize();
      final int x = chunk.getBlockX(random);
      final int z = chunk.getBlockZ(random);
      if (decorating != world.getBiome(x, 64, z)) {
        continue;
      }
      final int y = getHighestWorkableBlock(world, x, z);
      if (y == -1) {
        continue;
View Full Code Here

  @Override
  public void populate(Chunk chunk, Random random) {
    if (chunk.getY() != 4) {
      return;
    }
    final World world = chunk.getWorld();
    final CactusStackObject cactus = new CactusStackObject();
    cactus.setRandom(random);
    final int amount = getAmount(random);
    for (byte count = 0; count < amount; count++) {
      final int x = chunk.getBlockX(random);
View Full Code Here

    //TODO : Take Dimension ? : message.getDimension()
    //TODO : Take World height ? : message.getWorldHeight()
    //TODO : Take Level tpye ? : message.getWorldType()

    World world = player.getWorld();
    world.getData().put(VanillaData.DIFFICULTY, Difficulty.get(message.getDifficulty()));

    Human human = player.add(Human.class);
    human.setGamemode(GameMode.get(message.getGameMode()));
  }
View Full Code Here

  @Override
  public void populate(Chunk chunk, Random random) {
    if (chunk.getY() != 4) {
      return;
    }
    final World world = chunk.getWorld();
    final int amount = getAmount(random);
    for (byte count = 0; count < amount; count++) {
      final int x = chunk.getBlockX(random);
      final int z = chunk.getBlockZ(random);
      for (int y = NormalGenerator.SEA_LEVEL; y < NormalGenerator.HEIGHT; y++) {
        final int xx = x - 3 + random.nextInt(7);
        final int zz = z - 3 + random.nextInt(7);
        final Block block = world.getBlock(xx, y, zz);
        if (block.isMaterial(VanillaMaterials.AIR)) {
          final Block top = block.translate(BlockFace.TOP);
          if (top.isMaterial(VanillaMaterials.VINES)) {
            block.setMaterial(VanillaMaterials.VINES);
            block.setData(top.getBlockData());
View Full Code Here

public final class PlayerBedHandler extends MessageHandler<PlayerBedMessage> {
  @Override
  public void handleClient(ClientSession session, PlayerBedMessage message) {
    Player player = session.getPlayer();

    World world = player.getWorld();

    Entity entity = world.getEntity(message.getEntityId());

    Block block = world.getBlock(message.getX(), message.getY(), message.getZ());

    Sleep sleep = entity.get(Sleep.class);
    sleep.sleep(block);
  }
View Full Code Here

  @Override
  public void populate(Chunk chunk, Random random) {
    if (chunk.getY() != 4) {
      return;
    }
    final World world = chunk.getWorld();
    final BlockPatchObject sand = new BlockPatchObject(VanillaMaterials.SAND);
    sand.setRandom(random);
    for (byte count = 0; count < firstSandAmount; count++) {
      final int x = chunk.getBlockX(random);
      final int z = chunk.getBlockZ(random);
View Full Code Here

public final class PlayerSpawnPositionHandler extends MessageHandler<PlayerSpawnPositionMessage> {
  @Override
  public void handleClient(ClientSession session, PlayerSpawnPositionMessage message) {
    Player player = session.getPlayer();

    World world = player.getWorld();
    player.getPhysics().setPosition(new Point(world, message.getX(), message.getY(), message.getZ()));
    System.out.println(message.toString());
  }
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.