Package org.spout.vanilla.component.world.sky

Examples of org.spout.vanilla.component.world.sky.Sky


    }
    player.add(PlayerItemCollector.class);
    player.add(Sleep.class);
    player.add(Level.class);
    player.getNetwork().getSession().setUncaughtExceptionHandler(new PasteExceptionHandler(player.getNetwork().getSession()));
    Sky sky = player.getWorld().get(Sky.class);
    if (sky != null) {
      sky.updatePlayer(player);
    }
  }
View Full Code Here


      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;
      }
    }

    if (sky != null && sky.getTime() < Time.DUSK.getTime()) {
      player.sendMessage(NOT_NIGHT_MESSAGE);
      return;
    }

    if (isOccupied(head)) {
View Full Code Here

      }
    }
    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

  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) {
      case RAIN:
        message = plugin.getPrefix() + ChatStyle.GREEN + "Weather set to " + ChatStyle.WHITE + "RAIN/SNOW" + ChatStyle.GREEN + ".";
        break;
View Full Code Here

    return getFireTick() >= 0 && !health.isDead();
  }

  @Override
  public void onTick(float dt) {
    Sky sky = getOwner().getWorld().get(Sky.class);
    Point point = getOwner().getPhysics().getPosition();
    if (sky != null && sky.hasWeather()) {
      if (sky.getWeatherSimulator().isRainingAt((int) point.getX(), (int) point.getY(), (int) point.getZ(), false)) {
        rainTimer += dt;
      } else {
        rainTimer = 0f;
      }
      if (rainTimer >= 2.0f) {
View Full Code Here

  @Override
  public void handleClient(ClientSession session, PlayerTimeMessage message) {
    Player player = session.getPlayer();
    World world = player.getWorld();

    Sky sky = world.add(Sky.class);
    sky.setTime(message.getTime());
  }
View Full Code Here

   *
   * @param block to check it nearby of
   * @return True if it is raining, False if not
   */
  public static boolean hasRainNearby(Block block) {
    Sky sky = block.getWorld().get(Sky.class);
    if (sky != null && sky.hasWeather()) {
      if (sky.getWeatherSimulator().isRainingAt(block.getX(), block.getY(), block.getZ(), false)) {
        for (BlockFace face : BlockFaces.NESW) {
          if (block.translate(face).isAtSurface()) {
            return true;
          }
        }
View Full Code Here

TOP

Related Classes of org.spout.vanilla.component.world.sky.Sky

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.