コード例 #1
0
  @Override
  public void onSpaceDimensionChanged(
      World newWorld, EntityPlayerMP player, boolean ridingAutoRocket) {
    if (BlankPlanet.makelandingplatform) {
      int X = player.getPlayerCoordinates().posX;
      int Z = player.getPlayerCoordinates().posZ;
      if (newWorld.isAirBlock(X, 100, Z)
          && newWorld == DimensionManager.getWorld(BlankPlanet.dimensionid)) {
        for (int i = 0; i < 5; i++) {
          for (int j = 0; j < 5; j++) {
            newWorld.setBlock(X + i, 100, Z + j, Blocks.stone);
          }
        }

        for (int i = 0; i < 5; i++) {
          for (int j = 0; j < 5; j++) {
            newWorld.setBlock(X - i, 100, Z + j, Blocks.stone);
          }
        }

        for (int i = 0; i < 5; i++) {
          for (int j = 0; j < 5; j++) {
            newWorld.setBlock(X + i, 100, Z - j, Blocks.stone);
          }
        }

        for (int i = 0; i < 5; i++) {
          for (int j = 0; j < 5; j++) {
            newWorld.setBlock(X - i, 100, Z - j, Blocks.stone);
          }
        }
      }
    }
  }
コード例 #2
0
  /** Find all players in a specified range and narrowing down by other parameters */
  public List findPlayers(
      ChunkCoordinates par1ChunkCoordinates,
      int par2,
      int par3,
      int par4,
      int par5,
      int par6,
      int par7) {
    if (this.playerEntityList.isEmpty()) {
      return null;
    } else {
      Object var8 = new ArrayList();
      boolean var9 = par4 < 0;
      int var10 = par2 * par2;
      int var11 = par3 * par3;
      par4 = MathHelper.abs_int(par4);

      for (int var12 = 0; var12 < this.playerEntityList.size(); ++var12) {
        EntityPlayerMP var13 = (EntityPlayerMP) this.playerEntityList.get(var12);

        if (par1ChunkCoordinates != null && (par2 > 0 || par3 > 0)) {
          float var14 =
              par1ChunkCoordinates.getDistanceSquaredToChunkCoordinates(
                  var13.getPlayerCoordinates());

          if (par2 > 0 && var14 < (float) var10 || par3 > 0 && var14 > (float) var11) {
            continue;
          }
        }

        if ((par5 == EnumGameType.NOT_SET.getID()
                || par5 == var13.theItemInWorldManager.getGameType().getID())
            && (par6 <= 0 || var13.experienceLevel >= par6)
            && var13.experienceLevel <= par7) {
          ((List) var8).add(var13);
        }
      }

      if (par1ChunkCoordinates != null) {
        Collections.sort((List) var8, new PlayerPositionComparator(par1ChunkCoordinates));
      }

      if (var9) {
        Collections.reverse((List) var8);
      }

      if (par4 > 0) {
        var8 = ((List) var8).subList(0, Math.min(par4, ((List) var8).size()));
      }

      return (List) var8;
    }
  }
  public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) {
    if (par2ArrayOfStr.length < 2) {
      throw new WrongUsageException(this.getCommandUsage(par1ICommandSender), new Object[0]);
    } else {
      byte b0 = 0;
      int i = b0 + 1;
      String s = par2ArrayOfStr[b0];
      EntityPlayerMP entityplayermp = getPlayer(par1ICommandSender, par2ArrayOfStr[i++]);
      double d0 = (double) entityplayermp.getPlayerCoordinates().posX;
      double d1 = (double) entityplayermp.getPlayerCoordinates().posY;
      double d2 = (double) entityplayermp.getPlayerCoordinates().posZ;
      double d3 = 1.0D;
      double d4 = 1.0D;
      double d5 = 0.0D;

      if (par2ArrayOfStr.length > i) {
        d0 = func_110666_a(par1ICommandSender, d0, par2ArrayOfStr[i++]);
      }

      if (par2ArrayOfStr.length > i) {
        d1 = func_110665_a(par1ICommandSender, d1, par2ArrayOfStr[i++], 0, 0);
      }

      if (par2ArrayOfStr.length > i) {
        d2 = func_110666_a(par1ICommandSender, d2, par2ArrayOfStr[i++]);
      }

      if (par2ArrayOfStr.length > i) {
        d3 = func_110661_a(par1ICommandSender, par2ArrayOfStr[i++], 0.0D, 3.4028234663852886E38D);
      }

      if (par2ArrayOfStr.length > i) {
        d4 = func_110661_a(par1ICommandSender, par2ArrayOfStr[i++], 0.0D, 2.0D);
      }

      if (par2ArrayOfStr.length > i) {
        d5 = func_110661_a(par1ICommandSender, par2ArrayOfStr[i++], 0.0D, 1.0D);
      }

      double d6 = d3 > 1.0D ? d3 * 16.0D : 16.0D;
      double d7 = entityplayermp.getDistance(d0, d1, d2);

      if (d7 > d6) {
        if (d5 <= 0.0D) {
          throw new CommandException(
              "commands.playsound.playerTooFar", new Object[] {entityplayermp.getEntityName()});
        }

        double d8 = d0 - entityplayermp.posX;
        double d9 = d1 - entityplayermp.posY;
        double d10 = d2 - entityplayermp.posZ;
        double d11 = Math.sqrt(d8 * d8 + d9 * d9 + d10 * d10);
        double d12 = entityplayermp.posX;
        double d13 = entityplayermp.posY;
        double d14 = entityplayermp.posZ;

        if (d11 > 0.0D) {
          d12 += d8 / d11 * 2.0D;
          d13 += d9 / d11 * 2.0D;
          d14 += d10 / d11 * 2.0D;
        }

        entityplayermp.playerNetServerHandler.sendPacketToPlayer(
            new Packet62LevelSound(s, d12, d13, d14, (float) d5, (float) d4));
      } else {
        entityplayermp.playerNetServerHandler.sendPacketToPlayer(
            new Packet62LevelSound(s, d0, d1, d2, (float) d3, (float) d4));
      }

      notifyAdmins(
          par1ICommandSender,
          "commands.playsound.success",
          new Object[] {s, entityplayermp.getEntityName()});
    }
  }