Search in sources :

Example 16 with BiomeMap

use of org.dynmap.common.BiomeMap in project dynmap by webbukkit.

the class DynmapPlugin method loadExtraBiomes.

public void loadExtraBiomes(String mcver) {
    int cnt = 0;
    BiomeMap.loadWellKnownByVersion(mcver);
    /* Find array of biomes in biomebase */
    Object[] biomelist = helper.getBiomeBaseList();
    /* Loop through list, skipping well known biomes */
    for (int i = 0; i < biomelist.length; i++) {
        Object bb = biomelist[i];
        if (bb != null) {
            String rl = helper.getBiomeBaseResourceLocsation(bb);
            float tmp = helper.getBiomeBaseTemperature(bb);
            float hum = helper.getBiomeBaseHumidity(bb);
            int watermult = helper.getBiomeBaseWaterMult(bb);
            Log.verboseinfo("biome[" + i + "]: hum=" + hum + ", tmp=" + tmp + ", mult=" + Integer.toHexString(watermult));
            BiomeMap bmap = BiomeMap.NULL;
            if (rl != null) {
                // If resource location, lookup by this
                bmap = BiomeMap.byBiomeResourceLocation(rl);
            } else {
                bmap = BiomeMap.byBiomeID(i);
            }
            if (bmap.isDefault() || (bmap == BiomeMap.NULL)) {
                String id = helper.getBiomeBaseIDString(bb);
                if (id == null) {
                    id = "BIOME_" + i;
                }
                bmap = new BiomeMap((rl != null) ? BiomeMap.NO_INDEX : i, id, tmp, hum, rl);
                Log.verboseinfo("Add custom biome [" + bmap.toString() + "] (" + i + ") rl=" + rl);
                // Log.info(String.format("rl=%s, bmap=%s", rl, bmap));
                cnt++;
            } else {
                bmap.setTemperature(tmp);
                bmap.setRainfall(hum);
            }
            if (watermult != -1) {
                bmap.setWaterColorMultiplier(watermult);
                Log.verboseinfo("Set watercolormult for " + bmap.toString() + " (" + i + ") to " + Integer.toHexString(watermult));
            }
        }
    }
    if (cnt > 0) {
        Log.info("Added " + cnt + " custom biome mappings");
    }
}
Also used : BiomeMap(org.dynmap.common.BiomeMap) JsonObject(org.bstats.json.JsonObjectBuilder.JsonObject)

Example 17 with BiomeMap

use of org.dynmap.common.BiomeMap in project dynmap by webbukkit.

the class DynmapExpCommand method loadExtraBiomes.

public void loadExtraBiomes(String mcver) {
    int cnt = 0;
    BiomeMap.loadWellKnownByVersion(mcver);
    Biome[] list = getBiomeList();
    for (int i = 0; i < list.length; i++) {
        Biome bb = list[i];
        if (bb != null) {
            String id = bb.biomeName;
            float tmp = bb.getDefaultTemperature(), hum = bb.getRainfall();
            BiomeMap bmap = BiomeMap.byBiomeID(i);
            if (bmap.isDefault()) {
                BiomeMap m = new BiomeMap(i, id, tmp, hum);
                Log.verboseinfo("Add custom biome [" + m.toString() + "] (" + i + ")");
                cnt++;
            } else {
                bmap.setTemperature(tmp);
                bmap.setRainfall(hum);
            }
        }
    }
    if (cnt > 0)
        Log.info("Added " + cnt + " custom biome mappings");
}
Also used : Biome(net.minecraft.world.biome.Biome) BiomeMap(org.dynmap.common.BiomeMap) TextComponentString(net.minecraft.util.text.TextComponentString)

Example 18 with BiomeMap

use of org.dynmap.common.BiomeMap in project dynmap by webbukkit.

the class DynmapExpCommand method loadExtraBiomes.

public void loadExtraBiomes(String mcver) {
    int cnt = 0;
    BiomeMap.loadWellKnownByVersion(mcver);
    Biome[] list = getBiomeList();
    for (int i = 0; i < list.length; i++) {
        Biome bb = list[i];
        if (bb != null) {
            String id = bb.toString();
            float tmp = bb.getTemperature(), hum = bb.getDownfall();
            int watermult = bb.getAmbience().waterColor;
            Log.verboseinfo("biome[" + i + "]: hum=" + hum + ", tmp=" + tmp + ", mult=" + Integer.toHexString(watermult));
            BiomeMap bmap = BiomeMap.byBiomeID(i);
            if (bmap.isDefault()) {
                bmap = new BiomeMap(i, id, tmp, hum);
                Log.verboseinfo("Add custom biome [" + bmap.toString() + "] (" + i + ")");
                cnt++;
            } else {
                bmap.setTemperature(tmp);
                bmap.setRainfall(hum);
            }
            if (watermult != -1) {
                bmap.setWaterColorMultiplier(watermult);
                Log.verboseinfo("Set watercolormult for " + bmap.toString() + " (" + i + ") to " + Integer.toHexString(watermult));
            }
        }
    }
    if (cnt > 0)
        Log.info("Added " + cnt + " custom biome mappings");
}
Also used : Biome(net.minecraft.world.biome.Biome) BiomeMap(org.dynmap.common.BiomeMap)

Example 19 with BiomeMap

use of org.dynmap.common.BiomeMap in project dynmap by webbukkit.

the class DynmapPlugin method loadExtraBiomes.

public void loadExtraBiomes(String mcver) {
    int cnt = 0;
    BiomeMap.loadWellKnownByVersion(mcver);
    Registry<Biome> biomeRegistry = getFabricServer().getBiomeRegistry();
    Biome[] list = getFabricServer().getBiomeList(biomeRegistry);
    for (int i = 0; i < list.length; i++) {
        Biome bb = list[i];
        if (bb != null) {
            String id = biomeRegistry.getId(bb).getPath();
            String rl = biomeRegistry.getId(bb).toString();
            float tmp = bb.getTemperature(), hum = bb.getDownfall();
            int watermult = ((BiomeEffectsAccessor) bb.getEffects()).getWaterColor();
            Log.verboseinfo("biome[" + i + "]: hum=" + hum + ", tmp=" + tmp + ", mult=" + Integer.toHexString(watermult));
            BiomeMap bmap = BiomeMap.NULL;
            if (rl != null) {
                // If resource location, lookup by this
                bmap = BiomeMap.byBiomeResourceLocation(rl);
            } else {
                bmap = BiomeMap.byBiomeID(i);
            }
            if (bmap.isDefault() || (bmap == BiomeMap.NULL)) {
                bmap = new BiomeMap((rl != null) ? BiomeMap.NO_INDEX : i, id, tmp, hum, rl);
                Log.verboseinfo("Add custom biome [" + bmap.toString() + "] (" + i + ")");
                cnt++;
            } else {
                bmap.setTemperature(tmp);
                bmap.setRainfall(hum);
            }
            if (watermult != -1) {
                bmap.setWaterColorMultiplier(watermult);
                Log.verboseinfo("Set watercolormult for " + bmap.toString() + " (" + i + ") to " + Integer.toHexString(watermult));
            }
        }
    }
    if (cnt > 0)
        Log.info("Added " + cnt + " custom biome mappings");
}
Also used : BiomeEffectsAccessor(org.dynmap.fabric_1_18_2.mixin.BiomeEffectsAccessor) Biome(net.minecraft.world.biome.Biome) BiomeMap(org.dynmap.common.BiomeMap)

Example 20 with BiomeMap

use of org.dynmap.common.BiomeMap in project dynmap by webbukkit.

the class DynmapPlugin method loadExtraBiomes.

public void loadExtraBiomes(String mcver) {
    int cnt = 0;
    BiomeMap.loadWellKnownByVersion(mcver);
    Registry<Biome> biomeRegistry = getFabricServer().getBiomeRegistry();
    Biome[] list = getFabricServer().getBiomeList(biomeRegistry);
    for (int i = 0; i < list.length; i++) {
        Biome bb = list[i];
        if (bb != null) {
            String id = biomeRegistry.getId(bb).getPath();
            String rl = biomeRegistry.getId(bb).toString();
            float tmp = bb.getTemperature(), hum = bb.getDownfall();
            int watermult = ((BiomeEffectsAccessor) bb.getEffects()).getWaterColor();
            Log.verboseinfo("biome[" + i + "]: hum=" + hum + ", tmp=" + tmp + ", mult=" + Integer.toHexString(watermult));
            BiomeMap bmap = BiomeMap.NULL;
            if (rl != null) {
                // If resource location, lookup by this
                bmap = BiomeMap.byBiomeResourceLocation(rl);
            } else {
                bmap = BiomeMap.byBiomeID(i);
            }
            if (bmap.isDefault() || (bmap == BiomeMap.NULL)) {
                bmap = new BiomeMap((rl != null) ? BiomeMap.NO_INDEX : i, id, tmp, hum, rl);
                Log.verboseinfo("Add custom biome [" + bmap.toString() + "] (" + i + ")");
                cnt++;
            } else {
                bmap.setTemperature(tmp);
                bmap.setRainfall(hum);
            }
            if (watermult != -1) {
                bmap.setWaterColorMultiplier(watermult);
                Log.verboseinfo("Set watercolormult for " + bmap.toString() + " (" + i + ") to " + Integer.toHexString(watermult));
            }
        }
    }
    if (cnt > 0)
        Log.info("Added " + cnt + " custom biome mappings");
}
Also used : BiomeEffectsAccessor(org.dynmap.fabric_1_19.mixin.BiomeEffectsAccessor) Biome(net.minecraft.world.biome.Biome) BiomeMap(org.dynmap.common.BiomeMap)

Aggregations

BiomeMap (org.dynmap.common.BiomeMap)20 Biome (net.minecraft.world.biome.Biome)11 Biome (net.minecraft.world.level.biome.Biome)4 DynmapBlockState (org.dynmap.renderer.DynmapBlockState)2 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 LineNumberReader (java.io.LineNumberReader)1 BitSet (java.util.BitSet)1 HashMap (java.util.HashMap)1 ZipException (java.util.zip.ZipException)1 ZipFile (java.util.zip.ZipFile)1 ResourceLocation (net.minecraft.resources.ResourceLocation)1 TextComponentString (net.minecraft.util.text.TextComponentString)1 JsonObject (org.bstats.json.JsonObjectBuilder.JsonObject)1 BiomeEffectsAccessor (org.dynmap.fabric_1_16_4.mixin.BiomeEffectsAccessor)1 BiomeEffectsAccessor (org.dynmap.fabric_1_17_1.mixin.BiomeEffectsAccessor)1 BiomeEffectsAccessor (org.dynmap.fabric_1_18.mixin.BiomeEffectsAccessor)1 BiomeEffectsAccessor (org.dynmap.fabric_1_18_2.mixin.BiomeEffectsAccessor)1