コード例 #1
0
  static MobRuleList$MobRuleEntry load(Properties properties, int index, int limit) {
    String skinList = properties.getProperty("skins." + index, "").trim().toLowerCase();
    int[] skins;
    int chooser;

    if (!skinList.equals("*") && !skinList.equals("all") && !skinList.equals("any")) {
      skins = MCPatcherUtils.parseIntegerList(skinList, 1, limit);

      if (skins.length <= 0) {
        return null;
      }

      for (chooser = 0; chooser < skins.length; ++chooser) {
        --skins[chooser];
      }
    } else {
      skins = new int[limit];

      for (chooser = 0; chooser < skins.length; skins[chooser] = chooser++) {;
      }
    }

    WeightedIndex var11 =
        WeightedIndex.create(skins.length, properties.getProperty("weights." + index, ""));

    if (var11 == null) {
      return null;
    } else {
      String biomeList = MCPatcherUtils.getStringProperty(properties, "biomes." + index, "");
      BitSet biomes;

      if (biomeList.isEmpty()) {
        biomes = null;
      } else {
        biomes = new BitSet();

        if (MobRuleList.access$000() != null) {
          try {
            MobRuleList.access$000().invoke((Object) null, new Object[] {biomeList, biomes});
          } catch (Throwable var10) {
            var10.printStackTrace();
            MobRuleList.access$002((Method) null);
          }
        }
      }

      int minHeight = MCPatcherUtils.getIntProperty(properties, "minHeight." + index, -1);
      int maxHeight =
          MCPatcherUtils.getIntProperty(properties, "maxHeight." + index, Integer.MAX_VALUE);

      if (minHeight < 0 || minHeight > maxHeight) {
        minHeight = -1;
        maxHeight = Integer.MAX_VALUE;
      }

      return new MobRuleList$MobRuleEntry(skins, var11, biomes, minHeight, maxHeight);
    }
  }
コード例 #2
0
  private void writeCustomImage() {
    try {
      BufferedImage image =
          new BufferedImage(width, outputFrames * height, BufferedImage.TYPE_INT_ARGB);
      IntBuffer intBuffer = scratchBuffer.asIntBuffer();
      int[] argb = new int[width * height];
      File path = MCPatcherUtils.getGamePath("custom_" + name + ".png");
      logger.info("generating %d %s frames", outputFrames, name);
      for (int i = 0; i < outputFrames; i++) {
        renderToItems(i * (360.0 / outputFrames));
        itemsFBO.read(scratchBuffer);
        intBuffer.position(0);
        for (int j = 0; j < argb.length; j++) {
          switch (MipmapHelper.TEX_FORMAT) {
            case GL12.GL_BGRA:
              int bgra = intBuffer.get(j);
              argb[j] =
                  (bgra << 24) | ((bgra & 0xff00) << 8) | ((bgra & 0xff0000) >> 8) | (bgra >>> 24);
              break;

            default:
              if (i == 0 && j == 0) {
                logger.warning(
                    "unhandled texture format %d, color channels may be incorrect",
                    MipmapHelper.TEX_FORMAT);
              }
              // fall through

            case GL11.GL_RGBA:
              argb[j] = Integer.rotateRight(intBuffer.get(j), 8);
              break;
          }
        }
        image.setRGB(0, i * height, width, height, argb, 0, width);
      }
      ImageIO.write(image, "png", path);
      logger.info("wrote %dx%d %s", image.getWidth(), image.getHeight(), path.getPath());
    } catch (Throwable e) {
      e.printStackTrace();
    }
  }