mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-28 13:15:30 +01:00
Add 'hideores' option to make ore blocks look like plain stone
This commit is contained in:
parent
560fe3c539
commit
515b2f4afc
@ -28,6 +28,15 @@ public class ColorScheme {
|
||||
this.biomecolors = biomecolors;
|
||||
this.raincolors = raincolors;
|
||||
this.tempcolors = tempcolors;
|
||||
if(MapManager.mapman.getHideOres()) {
|
||||
for(int i = 0; i < colors.length; i++) {
|
||||
int id = MapManager.mapman.getBlockIDAlias(i);
|
||||
if(id != i) {
|
||||
this.colors[i] = this.colors[id];
|
||||
this.datacolors[i] = this.datacolors[id];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static File getColorSchemeDirectory() {
|
||||
|
@ -20,6 +20,7 @@ import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -46,6 +47,7 @@ public class MapManager {
|
||||
private int parallelrendercnt = 0;
|
||||
private int progressinterval = 100;
|
||||
private boolean saverestorepending = true;
|
||||
private boolean hideores = false;
|
||||
|
||||
private int zoomout_period = DEFAULT_ZOOMOUT_PERIOD; /* Zoom-out tile processing period, in seconds */
|
||||
/* Which fullrenders are active */
|
||||
@ -597,8 +599,13 @@ public class MapManager {
|
||||
public MapManager(DynmapPlugin plugin, ConfigurationNode configuration) {
|
||||
plug_in = plugin;
|
||||
mapman = this;
|
||||
|
||||
/* Get block hiding data, if any */
|
||||
hideores = configuration.getBoolean("hideores", false);
|
||||
|
||||
/* Clear color scheme */
|
||||
ColorScheme.reset();
|
||||
|
||||
/* Initialize HD map manager */
|
||||
hdmapman = new HDMapManager();
|
||||
hdmapman.loadHDShaders(plugin);
|
||||
@ -1137,4 +1144,22 @@ public class MapManager {
|
||||
public boolean getSwampShading() {
|
||||
return plug_in.swampshading;
|
||||
}
|
||||
|
||||
public boolean getHideOres() {
|
||||
return hideores;
|
||||
}
|
||||
/* Map block ID to aliased ID - used to hide ores */
|
||||
public int getBlockIDAlias(int id) {
|
||||
if(!hideores) return id;
|
||||
switch(id) {
|
||||
case 14: /* Gold Ore */
|
||||
case 15: /* Iron Ore */
|
||||
case 16: /* Coal Ore */
|
||||
case 21: /* Lapis Lazuli Ore */
|
||||
case 56: /* Diamond Ore */
|
||||
case 73: /* Redstone ore */
|
||||
return 1; /* Stone */
|
||||
}
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
@ -57,6 +57,8 @@ public class HDMapManager {
|
||||
}
|
||||
}
|
||||
Log.info("Loaded " + shaders.size() + " shaders.");
|
||||
/* Update ore mappings, if needed */
|
||||
TexturePack.handleHideOres();
|
||||
}
|
||||
|
||||
public void loadHDPerspectives(DynmapPlugin plugin) {
|
||||
|
@ -23,6 +23,7 @@ import org.bukkit.block.Biome;
|
||||
import org.dynmap.Color;
|
||||
import org.dynmap.DynmapPlugin;
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.MapManager;
|
||||
import org.dynmap.utils.DynmapBufferedImage;
|
||||
import org.dynmap.utils.MapIterator.BlockStep;
|
||||
import org.dynmap.kzedmap.KzedMap;
|
||||
@ -183,6 +184,13 @@ public class TexturePack {
|
||||
public static BlockTransparency getTransparency(int blkid) {
|
||||
return transp[blkid];
|
||||
}
|
||||
|
||||
private static void remapTexture(int id, int srcid) {
|
||||
for(int i = 0; i < 16; i++) {
|
||||
texmaps[(id<<4)+i] = texmaps[(srcid<<4)+i];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/** Get or load texture pack */
|
||||
public static TexturePack getTexturePack(String tpname) {
|
||||
@ -837,6 +845,20 @@ public class TexturePack {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Process any ore hiding mappings */
|
||||
public static void handleHideOres() {
|
||||
/* Now, fix mapping if we're hiding any ores */
|
||||
if(MapManager.mapman.getHideOres()) {
|
||||
for(int i = 0; i < 256; i++) {
|
||||
int id = MapManager.mapman.getBlockIDAlias(i);
|
||||
if(id != i) { /* New mapping? */
|
||||
HDTextureMap.remapTexture(i, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read color for given subblock coordinate, with given block id and data and face
|
||||
*/
|
||||
|
@ -240,6 +240,9 @@ enabletilehash: true
|
||||
# Optional - control darkening of biome-shaded colors in swamp biomes (1.9+) - default is true for 1.9+, false for 1.8.x
|
||||
#swampshaded: false
|
||||
|
||||
# Optional - hide ores: render as normal stone (so that they aren't revealed by maps)
|
||||
#hideores: true
|
||||
|
||||
render-triggers:
|
||||
#- chunkloaded
|
||||
#- playermove
|
||||
|
@ -50,6 +50,7 @@ worlds:
|
||||
# Use 'template: mycustomtemplate' to use the properties specified in the template 'mycustomtemplate' to this world. Default it is set to the environment-name (normal or nether).
|
||||
# template: mycustomtemplate
|
||||
# Rest of comes from template - uncomment to tailor for world specifically
|
||||
# # World center - default is spawn point
|
||||
# center:
|
||||
# x: 0
|
||||
# y: 64
|
||||
|
Loading…
Reference in New Issue
Block a user