Ejemplo n.º 1
0
  public DefaultTileRenderer(DynmapCore core, ConfigurationNode configuration) {
    name = configuration.getString("name", null);
    prefix = configuration.getString("prefix", name);
    maximumHeight = configuration.getInteger("maximumheight", 127);
    shadowstrength = configuration.getDouble("shadowstrength", 0.0);
    if (shadowstrength > 0.0) {
      shadowscale = new int[16];
      shadowscale[15] = 256;
      /* Normal brightness weight in MC is a 20% relative dropoff per step */
      for (int i = 14; i >= 0; i--) {
        double v = shadowscale[i + 1] * (1.0 - (0.2 * shadowstrength));
        shadowscale[i] = (int) v;
        if (shadowscale[i] > 256) shadowscale[i] = 256;
        if (shadowscale[i] < 0) shadowscale[i] = 0;
      }
    }
    ambientlight = configuration.getInteger("ambientlight", 15);
    if (ambientlight < 15) {
      lightscale = new int[16];
      for (int i = 0; i < 16; i++) {
        if (i < (15 - ambientlight)) lightscale[i] = 0;
        else lightscale[i] = i - (15 - ambientlight);
      }
    }
    colorScheme = ColorScheme.getScheme(core, (String) configuration.get("colorscheme"));
    night_and_day = configuration.getBoolean("night-and-day", false);
    transparency = configuration.getBoolean("transparency", true); /* Default on */
    String biomeopt = configuration.getString("biomecolored", "none");
    if (biomeopt.equals("biome")) {
      biomecolored = BiomeColorOption.BIOME;
    } else if (biomeopt.equals("temperature")) {
      biomecolored = BiomeColorOption.TEMPERATURE;
    } else if (biomeopt.equals("rainfall")) {
      biomecolored = BiomeColorOption.RAINFALL;
    } else {
      biomecolored = BiomeColorOption.NONE;
    }

    title = configuration.getString("title");
    icon = configuration.getString("icon");
    bg_cfg = configuration.getString("background");
    bg_day_cfg = configuration.getString("backgroundday");
    bg_night_cfg = configuration.getString("backgroundnight");
    mapzoomin = configuration.getInteger("mapzoomin", 2);
    is_protected = configuration.getBoolean("protected", false);
  }
Ejemplo n.º 2
0
 public DefaultTileRenderer(ConfigurationNode configuration) {
   this.configuration = configuration;
   name = (String) configuration.get("prefix");
   Object o = configuration.get("maximumheight");
   if (o != null) {
     maximumHeight = Integer.parseInt(String.valueOf(o));
     if (maximumHeight > 127) maximumHeight = 127;
   }
   o = configuration.get("shadowstrength");
   if (o != null) {
     double shadowweight = Double.parseDouble(String.valueOf(o));
     if (shadowweight > 0.0) {
       shadowscale = new int[16];
       shadowscale[15] = 256;
       /* Normal brightness weight in MC is a 20% relative dropoff per step */
       for (int i = 14; i >= 0; i--) {
         double v = shadowscale[i + 1] * (1.0 - (0.2 * shadowweight));
         shadowscale[i] = (int) v;
         if (shadowscale[i] > 256) shadowscale[i] = 256;
         if (shadowscale[i] < 0) shadowscale[i] = 0;
       }
     }
   }
   o = configuration.get("ambientlight");
   if (o != null) {
     int v = Integer.parseInt(String.valueOf(o));
     lightscale = new int[16];
     for (int i = 0; i < 16; i++) {
       if (i < (15 - v)) lightscale[i] = 0;
       else lightscale[i] = i - (15 - v);
     }
   }
   colorScheme = ColorScheme.getScheme((String) configuration.get("colorscheme"));
   night_and_day = configuration.getBoolean("night-and-day", false);
   transparency = configuration.getBoolean("transparency", true); /* Default on */
 }