mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-24 19:25:15 +01:00
Add support for config option (ic2-support) for enable of Industrial Craft
This commit is contained in:
parent
baf29dfa7c
commit
05511f0495
@ -1,3 +1,6 @@
|
||||
# Industrial Craft 2 Texture mapping
|
||||
# define ic2-support: true in configuration.txt to enable
|
||||
enabled:ic2-support
|
||||
# Wire - set render alg
|
||||
linkmap:id=228,linkalg=5,linkid=223,linkid=225,linkid=226,linkid=227,linkid=228,linkid=233,linkid=237,linkid=246,linkid=250
|
||||
# Wire - (data is faked: 1=north,2=east,4=south,8=west)
|
||||
@ -195,4 +198,4 @@ block:id=232,data=11,scale=16
|
||||
rotate:id=232,data=7,rot=270
|
||||
# Iron Fence - north, south, east, west neightbors
|
||||
block:id=232,data=15,scale=16
|
||||
layer:id=232,data=15,rot=0
|
||||
rotate:id=232,data=15,rot=0
|
@ -1,6 +1,6 @@
|
||||
# Industrial Craft 2 Block mapping
|
||||
# rename file to ic2-texture.txt to make active
|
||||
#
|
||||
# define ic2-support: true in configuration.txt to enable
|
||||
enabled:ic2-support
|
||||
# Files
|
||||
texturefile:id=blk0,filename=ic2/sprites/block_0.png,xcount=16,ycount=16
|
||||
texturefile:id=cable,filename=ic2/sprites/block_cable.png,xcount=16,ycount=16
|
@ -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) {
|
||||
|
@ -278,6 +278,9 @@ enabletilehash: true
|
||||
# 'newnorth' is used to rotate maps and rose (requires fullrender of any HDMap map - same as 'newrose' for FlatMap or KzedMap)
|
||||
#compass-mode: newnorth
|
||||
|
||||
# Enable Industrial Craft 2 block rendering support
|
||||
#ic2-support: true
|
||||
|
||||
render-triggers:
|
||||
#- chunkloaded
|
||||
#- playermove
|
||||
|
Loading…
Reference in New Issue
Block a user