Package com.sijobe.spc.wrapper

Examples of com.sijobe.spc.wrapper.Coordinate


         ascendPlayer(new Player(player));
      }
   }

   private static boolean ascendPlayer(Player player) {
      Coordinate playerPos = player.getPosition();
      if(player.isClearBelow(playerPos) && playerPos.getY() > 0) {
         return false;
      }
      double y = playerPos.getY() - 1; // in case player was standing on ground
      while (y < 260) {
         if(player.isClear(new Coordinate(playerPos.getX(), y++, playerPos.getZ()))) {
            final double newY;
            if(playerPos.getY() > 0) {
               newY = y - 1;
            } else {
               newY = y;
            }
            Coordinate newPos = new Coordinate(playerPos.getX() + 0.5F, newY, playerPos.getZ() + 0.5F);
            player.setPosition(newPos);
            break;
         }
      }
      return true;
View Full Code Here


    * @see com.sijobe.spc.wrapper.CommandBase#execute(com.sijobe.spc.wrapper.CommandSender, java.util.List)
    */
   @Override
   public void execute(CommandSender sender, List<?> params) {
      Player player = getSenderAsPlayer(sender);
      Coordinate previous = player.getPosition();
      int y = previous.getBlockY() - 1;
      while (y > 0) {
         if (player.isClear(new Coordinate(previous.getBlockX(), y--, previous.getBlockZ()))) {
            player.setPosition(new Coordinate(previous.getBlockX() + 0.5F, ++y, previous.getBlockZ() + 0.5F));
            player.sendChatMessage("You descended " + FontColour.AQUA + (previous.getBlockY() - y) +
                     FontColour.WHITE + " blocks.");
            break;
         }
      }
   }
View Full Code Here

         }
         world.setThunder(thunder);
         world.setRaining(thunder);
         sender.sendMessageToPlayer("Thunder was " + FontColour.AQUA + (thunder ? "enabled" : "disabled"));
      } else if (argument.equalsIgnoreCase("lightning")) {
         Coordinate coordinate = player.trace(128.0);
         if (coordinate == null) {
            return;
         }
         world.useLightning(coordinate);
      } else {
View Full Code Here

      int removedDrops = removeItemDrops(player, 128);
      player.sendChatMessage("Cleared " + removedDrops + " item drop(s).");
   }

   public static int removeItemDrops(Player player, int radius) {
      Coordinate pos = player.getPosition();
      World world = player.getWorld().getMinecraftWorld();
      AxisAlignedBB boundingBox = AxisAlignedBB.getBoundingBox(
               pos.getX() - radius, pos.getY() - radius, pos.getZ() - radius,
               pos.getX() + radius, pos.getY() + radius, pos.getZ() + radius
      );
      List<?> nearbyEntities = world.getEntitiesWithinAABBExcludingEntity(
               player.getMinecraftPlayer(), boundingBox
      );
      int removedDrops = 0;
View Full Code Here

      if (params.size() == 0) {
         player.getWorld().createExplosion(player, player.getPosition(), DEFAULT_SIZE);
      } else if (params.size() == 1) {
         player.getWorld().createExplosion(player, player.getPosition(), (Integer)params.get(0));
      } else if (params.size() > 3) {
         Coordinate location = new Coordinate((Double)params.get(1), (Double)params.get(2), (Double)params.get(3));
         player.getWorld().createExplosion(player, location, (Integer)params.get(0));
      }
      sender.sendMessageToPlayer("Boom!");
   }
View Full Code Here

    * @see com.sijobe.spc.wrapper.CommandBase#execute(com.sijobe.spc.wrapper.CommandSender, java.util.List)
    */
   @Override
   public void execute(CommandSender sender, List<?> params) throws CommandException {
      Player player = getSenderAsPlayer(sender);
      Coordinate hit = player.trace(128);
      if (hit == null) {
         throw new CommandException("No block in sight.");
      }
      int y = hit.getBlockY() + 1;
      while (y < 260) {
         if (player.isClear(new Coordinate(hit.getBlockX(), y++, hit.getBlockZ()))) {
            player.setPosition(new Coordinate(hit.getBlockX() + 0.5F, --y, hit.getBlockZ() + 0.5F));
            break;
         }
      }
   }
View Full Code Here

      direction = speed / direction;
      forward *= direction;
      strafe *= direction;
      double f4 = Math.sin(player.getYaw() * Math.PI / 180.0F);
      double f5 = Math.cos(player.getYaw() * Math.PI / 180.0F);
      Coordinate motion = player.getMotion();
      double motionx = forward * f5 - strafe * f4;
      double motionz = strafe * f5 + forward * f4;
      player.setMotion(new Coordinate(motion.getX() + motionx * pspeed, motion.getY(), motion.getZ() + motionz * pspeed));
   }
View Full Code Here

TOP

Related Classes of com.sijobe.spc.wrapper.Coordinate

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.