예제 #1
0
 @Override
 public void buildClientConfiguration(JSONObject worldObject) {
   ConfigurationNode c = configuration;
   JSONObject o = new JSONObject();
   s(o, "type", "KzedMapType");
   s(o, "name", c.getString("name"));
   s(o, "title", c.getString("title"));
   s(o, "icon", c.getString("icon"));
   s(o, "prefix", c.getString("prefix"));
   s(o, "background", c.getString("background"));
   s(o, "nightandday", c.getBoolean("night-and-day", false));
   s(o, "backgroundday", c.getString("backgroundday"));
   s(o, "backgroundnight", c.getString("backgroundnight"));
   a(worldObject, "maps", o);
 }
예제 #2
0
  /**
   * Load marker from configuration node
   *
   * @param node - configuration node
   */
  boolean loadPersistentData(ConfigurationNode node) {
    label = node.getString("label", markerid);
    markup = node.getBoolean("markup", false);
    x = node.getDouble("x", 0);
    y = node.getDouble("y", 64);
    z = node.getDouble("z", 0);
    world = node.getString("world", "world");
    desc = node.getString("desc", null);
    icon = MarkerAPIImpl.getMarkerIconImpl(node.getString("icon", MarkerIcon.DEFAULT));
    ispersistent = true; /* Loaded from config, so must be */

    return true;
  }
예제 #3
0
 public ShadowHDLighting(DynmapCore core, ConfigurationNode configuration) {
   super(core, configuration);
   double shadowweight = configuration.getDouble("shadowstrength", 0.0);
   defLightingTable = new int[16];
   defLightingTable[15] = 256;
   /* Normal brightness weight in MC is a 20% relative dropoff per step */
   for (int i = 14; i >= 0; i--) {
     double v = defLightingTable[i + 1] * (1.0 - (0.2 * shadowweight));
     defLightingTable[i] = (int) v;
     if (defLightingTable[i] > 256) defLightingTable[i] = 256;
     if (defLightingTable[i] < 0) defLightingTable[i] = 0;
   }
   int v = configuration.getInteger("ambientlight", -1);
   if (v < 0) v = 15;
   if (v > 15) v = 15;
   lightscale = new int[16];
   for (int i = 0; i < 16; i++) {
     if (i < (15 - v)) lightscale[i] = 0;
     else lightscale[i] = i - (15 - v);
   }
   night_and_day = configuration.getBoolean("night-and-day", false);
   smooth = configuration.getBoolean("smooth-lighting", MapManager.mapman.getSmoothLighting());
 }
예제 #4
0
  public IsoHDPerspective(ConfigurationNode configuration) {
    name = configuration.getString("name", null);
    if (name == null) {
      Log.severe("Perspective definition missing name - must be defined and unique");
      return;
    }
    azimuth =
        configuration.getDouble("azimuth", 135.0); /* Get azimuth (default to classic kzed POV */
    inclination = configuration.getDouble("inclination", 60.0);
    if (inclination > MAX_INCLINATION) inclination = MAX_INCLINATION;
    if (inclination < MIN_INCLINATION) inclination = MIN_INCLINATION;
    scale = configuration.getDouble("scale", MIN_SCALE);
    if (scale < MIN_SCALE) scale = MIN_SCALE;
    if (scale > MAX_SCALE) scale = MAX_SCALE;
    /* Get max and min height */
    maxheight = configuration.getInteger("maximumheight", 127);
    if (maxheight > 127) maxheight = 127;
    minheight = configuration.getInteger("minimumheight", 0);
    if (minheight < 0) minheight = 0;

    /* Generate transform matrix for world-to-tile coordinate mapping */
    /* First, need to fix basic coordinate mismatches before rotation - we want zero azimuth to have north to top
     * (world -X -> tile +Y) and east to right (world -Z to tile +X), with height being up (world +Y -> tile +Z)
     */
    Matrix3D transform = new Matrix3D(0.0, 0.0, -1.0, -1.0, 0.0, 0.0, 0.0, 1.0, 0.0);
    /* Next, rotate world counterclockwise around Z axis by azumuth angle */
    transform.rotateXY(180 - azimuth);
    /* Next, rotate world by (90-inclination) degrees clockwise around +X axis */
    transform.rotateYZ(90.0 - inclination);
    /* Finally, shear along Z axis to normalize Z to be height above map plane */
    transform.shearZ(0, Math.tan(Math.toRadians(90.0 - inclination)));
    /* And scale Z to be same scale as world coordinates, and scale X and Y based on setting */
    transform.scale(scale, scale, Math.sin(Math.toRadians(inclination)));
    world_to_map = transform;
    /* Now, generate map to world tranform, by doing opposite actions in reverse order */
    transform = new Matrix3D();
    transform.scale(1.0 / scale, 1.0 / scale, 1 / Math.sin(Math.toRadians(inclination)));
    transform.shearZ(0, -Math.tan(Math.toRadians(90.0 - inclination)));
    transform.rotateYZ(-(90.0 - inclination));
    transform.rotateXY(-180 + azimuth);
    Matrix3D coordswap = new Matrix3D(0.0, -1.0, 0.0, 0.0, 0.0, 1.0, -1.0, 0.0, 0.0);
    transform.multiply(coordswap);
    map_to_world = transform;
    /* Scaled models for non-cube blocks */
    modscale = (int) Math.ceil(scale);
    scalemodels = HDBlockModels.getModelsForScale(modscale);
    ;
  }
예제 #5
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 */
 }
예제 #6
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);
  }
예제 #7
0
  @Override
  public ConfigurationNode saveConfiguration() {
    ConfigurationNode cn = new ConfigurationNode();
    cn.put("class", this.getClass().getName());
    cn.put("name", name);
    if (title != null) cn.put("title", title);
    if (icon != null) cn.put("icon", icon);
    cn.put("maximumheight", maximumHeight);
    cn.put("shadowstrength", shadowstrength);
    cn.put("ambientlight", ambientlight);
    if (colorScheme != null) cn.put("colorscheme", colorScheme.name);
    cn.put("night-and-day", night_and_day);
    cn.put("transparency", transparency);
    cn.put("protected", is_protected);
    String bcolor = "none";
    switch (biomecolored) {
      case BIOME:
        bcolor = "biome";
        break;
      case TEMPERATURE:
        bcolor = "temperature";
        break;
      case RAINFALL:
        bcolor = "rainfall";
        break;
    }
    cn.put("biomecolored", bcolor);
    if (bg_cfg != null) cn.put("background", bg_cfg);
    if (bg_day_cfg != null) cn.put("backgroundday", bg_day_cfg);
    if (bg_night_cfg != null) cn.put("backgroundnight", bg_night_cfg);
    cn.put("mapzoomin", mapzoomin);

    return cn;
  }