Add support for config option (ic2-support) for enable of Industrial Craft
This commit is contained in:
parent
baf29dfa7c
commit
05511f0495
6 changed files with 56 additions and 16 deletions
|
|
@ -221,11 +221,6 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
|||
|
||||
dataDirectory = this.getDataFolder();
|
||||
|
||||
/* Load block models */
|
||||
HDBlockModels.loadModels(dataDirectory);
|
||||
/* Load texture mappings */
|
||||
TexturePack.loadTextureMapping(dataDirectory);
|
||||
|
||||
/* Initialize confguration.txt if needed */
|
||||
File f = new File(this.getDataFolder(), "configuration.txt");
|
||||
if(!createDefaultFileFromResource("/configuration.txt", f)) {
|
||||
|
|
@ -237,6 +232,11 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
|||
bukkitConfiguration.load();
|
||||
configuration = new ConfigurationNode(bukkitConfiguration);
|
||||
|
||||
/* Load block models */
|
||||
HDBlockModels.loadModels(dataDirectory, configuration);
|
||||
/* Load texture mappings */
|
||||
TexturePack.loadTextureMapping(dataDirectory, configuration);
|
||||
|
||||
/* Now, process worlds.txt - merge it in as an override of existing values (since it is only user supplied values) */
|
||||
f = new File(this.getDataFolder(), "worlds.txt");
|
||||
if(!createDefaultFileFromResource("/worlds.txt", f)) {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.Log;
|
||||
|
||||
/**
|
||||
|
|
@ -279,7 +280,7 @@ public class HDBlockModels {
|
|||
/**
|
||||
* Load models
|
||||
*/
|
||||
public static void loadModels(File datadir) {
|
||||
public static void loadModels(File datadir, ConfigurationNode config) {
|
||||
/* Reset models-by-ID-Data cache */
|
||||
models_by_id_data.clear();
|
||||
/* Reset scaled models by scale cache */
|
||||
|
|
@ -288,7 +289,7 @@ public class HDBlockModels {
|
|||
/* Load block models */
|
||||
InputStream in = TexturePack.class.getResourceAsStream("/models.txt");
|
||||
if(in != null) {
|
||||
loadModelFile(in, "models.txt");
|
||||
loadModelFile(in, "models.txt", config);
|
||||
try { in.close(); } catch (IOException iox) {} in = null;
|
||||
}
|
||||
File customdir = new File(datadir, "renderdata");
|
||||
|
|
@ -301,7 +302,7 @@ public class HDBlockModels {
|
|||
if(custom.canRead()) {
|
||||
try {
|
||||
in = new FileInputStream(custom);
|
||||
loadModelFile(in, custom.getPath());
|
||||
loadModelFile(in, custom.getPath(), config);
|
||||
} catch (IOException iox) {
|
||||
Log.severe("Error loading " + custom.getPath());
|
||||
} finally {
|
||||
|
|
@ -317,7 +318,7 @@ public class HDBlockModels {
|
|||
/**
|
||||
* Load models from file
|
||||
*/
|
||||
private static void loadModelFile(InputStream in, String fname) {
|
||||
private static void loadModelFile(InputStream in, String fname, ConfigurationNode config) {
|
||||
LineNumberReader rdr = null;
|
||||
int cnt = 0;
|
||||
try {
|
||||
|
|
@ -446,6 +447,22 @@ public class HDBlockModels {
|
|||
}
|
||||
else if(line.startsWith("#") || line.startsWith(";")) {
|
||||
}
|
||||
else if(line.startsWith("enabled:")) { /* Test if texture file is enabled */
|
||||
line = line.substring(8).trim();
|
||||
if(line.startsWith("true")) { /* We're enabled? */
|
||||
/* Nothing to do - keep processing */
|
||||
}
|
||||
else if(line.startsWith("false")) { /* Disabled */
|
||||
return; /* Quit */
|
||||
}
|
||||
/* If setting is not defined or false, quit */
|
||||
else if(config.getBoolean(line, false) == false) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
Log.info(line + " models enabled");
|
||||
}
|
||||
}
|
||||
else if(layerbits != 0) { /* If we're working pattern lines */
|
||||
/* Layerbits determine Y, rows count from North to South (X=0 to X=N-1), columns Z are West to East (N-1 to 0) */
|
||||
for(int i = 0; (i < scale) && (i < line.length()); i++) {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import javax.imageio.ImageIO;
|
|||
|
||||
import org.bukkit.block.Biome;
|
||||
import org.dynmap.Color;
|
||||
import org.dynmap.ConfigurationNode;
|
||||
import org.dynmap.DynmapPlugin;
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.MapManager;
|
||||
|
|
@ -772,7 +773,7 @@ public class TexturePack {
|
|||
/**
|
||||
* Load texture pack mappings
|
||||
*/
|
||||
public static void loadTextureMapping(File datadir) {
|
||||
public static void loadTextureMapping(File datadir, ConfigurationNode config) {
|
||||
/* Start clean with texture packs - need to be loaded after mapping */
|
||||
packs.clear();
|
||||
/* Initialize map with blank map for all entries */
|
||||
|
|
@ -780,7 +781,7 @@ public class TexturePack {
|
|||
/* Load block models */
|
||||
InputStream in = TexturePack.class.getResourceAsStream("/texture.txt");
|
||||
if(in != null) {
|
||||
loadTextureFile(in, "texture.txt");
|
||||
loadTextureFile(in, "texture.txt", config);
|
||||
if(in != null) { try { in.close(); } catch (IOException x) {} in = null; }
|
||||
}
|
||||
else
|
||||
|
|
@ -795,7 +796,7 @@ public class TexturePack {
|
|||
if(custom.canRead()) {
|
||||
try {
|
||||
in = new FileInputStream(custom);
|
||||
loadTextureFile(in, custom.getPath());
|
||||
loadTextureFile(in, custom.getPath(), config);
|
||||
} catch (IOException iox) {
|
||||
Log.severe("Error loading " + custom.getPath() + " - " + iox);
|
||||
} finally {
|
||||
|
|
@ -810,7 +811,7 @@ public class TexturePack {
|
|||
/**
|
||||
* Load texture pack mappings from texture.txt file
|
||||
*/
|
||||
private static void loadTextureFile(InputStream txtfile, String txtname) {
|
||||
private static void loadTextureFile(InputStream txtfile, String txtname, ConfigurationNode config) {
|
||||
LineNumberReader rdr = null;
|
||||
int cnt = 0;
|
||||
HashMap<String,Integer> filetoidx = new HashMap<String,Integer>();
|
||||
|
|
@ -946,6 +947,22 @@ public class TexturePack {
|
|||
}
|
||||
else if(line.startsWith("#") || line.startsWith(";")) {
|
||||
}
|
||||
else if(line.startsWith("enabled:")) { /* Test if texture file is enabled */
|
||||
line = line.substring(8).trim();
|
||||
if(line.startsWith("true")) { /* We're enabled? */
|
||||
/* Nothing to do - keep processing */
|
||||
}
|
||||
else if(line.startsWith("false")) { /* Disabled */
|
||||
return; /* Quit */
|
||||
}
|
||||
/* If setting is not defined or false, quit */
|
||||
else if(config.getBoolean(line, false) == false) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
Log.info(line + " textures enabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
Log.verboseinfo("Loaded " + cnt + " texture mappings from " + txtname);
|
||||
} catch (IOException iox) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue