use of org.dynmap.renderer.DynmapBlockState in project dynmap by webbukkit.
the class TexturePack method processCustomColorMap.
private void processCustomColorMap(String fname, String ids) {
// Register file name
int idx = findOrAddDynamicTileFile(fname, null, 1, 1, TileFileFormat.BIOME, new String[0]);
if (idx < 0) {
Log.info("Error registering custom color file: " + fname);
return;
}
Integer index = idx + IMG_CNT;
// Now, parse block ID list
for (String id : ids.split("\\s+")) {
String[] tok = id.split(":");
int meta = -1;
DynmapBlockState blk = null;
String blkname = null;
if (tok.length == 1) {
/* Only ID */
blkname = tok[0];
blk = DynmapBlockState.getBaseStateByName(blkname);
if (blk.isAir()) {
Log.info("Bad custom color block ID: " + tok[0]);
}
} else if (tok.length == 2) {
/* ID : meta */
blkname = tok[0];
try {
meta = Integer.parseInt(tok[1]);
} catch (NumberFormatException nfx) {
Log.info("Bad custom color meta ID: " + tok[1]);
}
blk = DynmapBlockState.getStateByNameAndIndex(blkname, meta);
if (blk.isAir()) {
Log.info("Bad custom color block ID: " + tok[0] + ":" + meta);
}
}
/* Add mappings for values */
HDBlockStateTextureMap bmap = HDBlockStateTextureMap.getByBlockState(blk);
if (bmap != null) {
if (meta >= 0) {
if (blk.isNotAir()) {
this.blockColoring.setBlkStateValue(blk, index);
}
} else if (meta == -1) {
/* All meta IDs */
for (int v = 0; v < blk.getStateCount(); v++) {
DynmapBlockState b = blk.getState(v);
if (b.isNotAir()) {
this.blockColoring.setBlkStateValue(b, index);
}
}
}
}
}
}
use of org.dynmap.renderer.DynmapBlockState in project dynmap by webbukkit.
the class TexturePack method loadTextureFile.
/**
* Load texture pack mappings from texture.txt file
*/
private static void loadTextureFile(InputStream txtfile, String txtname, ConfigurationNode config, DynmapCore core, String blockset) {
LineNumberReader rdr = null;
int cnt = 0;
HashMap<String, Integer> filetoidx = new HashMap<String, Integer>();
HashMap<String, Integer> varvals = new HashMap<String, Integer>();
final String mcver = core.getDynmapPluginPlatformVersion();
boolean mod_cfg_needed = false;
boolean mod_cfg_loaded = false;
// Default to minecraft base
String modname = "minecraft";
String modversion = null;
String texturemod = null;
String texturepath = null;
boolean terrain_ok = true;
BlockStateParser bsp = new BlockStateParser();
Map<DynmapBlockState, BitSet> bsprslt;
try {
String line;
rdr = new LineNumberReader(new InputStreamReader(txtfile));
while ((line = rdr.readLine()) != null) {
boolean skip = false;
int lineNum = rdr.getLineNumber();
if ((line.length() > 0) && (line.charAt(0) == '[')) {
// If version constrained like
// Find end
int end = line.indexOf(']');
if (end < 0) {
Log.severe("Format error - line " + lineNum + " of " + txtname + ": bad version limit");
return;
}
String vertst = line.substring(1, end);
String tver = mcver;
if (vertst.startsWith("mod:")) {
// If mod version ranged
tver = modversion;
vertst = vertst.substring(4);
}
if (!HDBlockModels.checkVersionRange(tver, vertst)) {
skip = true;
}
line = line.substring(end + 1);
}
if (line.startsWith("#") || line.startsWith(";")) {
skip = true;
}
// If we're skipping due to version restriction
if (skip)
continue;
// Split off <type>:
int typeend = line.indexOf(':');
String typeid = "";
if (typeend >= 0) {
typeid = line.substring(0, typeend);
line = line.substring(typeend + 1).trim();
}
if (typeid.equals("block")) {
// Parse block states
bsp.processLine(modname, line, lineNum, varvals);
int srctxtid = TXTID_TERRAINPNG;
if (!terrain_ok)
// Mark as not usable
srctxtid = TXTID_INVALID;
int[] faces = new int[] { TILEINDEX_BLANK, TILEINDEX_BLANK, TILEINDEX_BLANK, TILEINDEX_BLANK, TILEINDEX_BLANK, TILEINDEX_BLANK };
int[] txtidx = new int[] { -1, -1, -1, -1, -1, -1 };
byte[] layers = null;
BlockTransparency trans = BlockTransparency.OPAQUE;
int colorMult = 0;
int blockColorIdx = -1;
// Legacy top/bottom rotation
boolean stdrot = false;
CustomColorMultiplier custColorMult = null;
String[] args = line.split(",");
for (String a : args) {
String[] av = a.split("=");
if (av.length < 2)
continue;
else if (av[0].equals("txtid")) {
if (filetoidx.containsKey(av[1]))
srctxtid = filetoidx.get(av[1]);
else
Log.severe("Format error - line " + lineNum + " of " + txtname + ": bad texture " + av[1]);
}
}
bsprslt = bsp.getMatchingStates();
if (bsprslt.size() > 0) {
for (String a : args) {
String[] av = a.split("=");
if (av.length < 2)
continue;
if (av[0].equals("top") || av[0].equals("y-") || av[0].equals("face1")) {
faces[BlockStep.Y_MINUS.ordinal()] = parseTextureIndex(filetoidx, srctxtid, av[1]);
} else if (av[0].equals("bottom") || av[0].equals("y+") || av[0].equals("face0")) {
faces[BlockStep.Y_PLUS.ordinal()] = parseTextureIndex(filetoidx, srctxtid, av[1]);
} else if (av[0].equals("north") || av[0].equals("x+") || av[0].equals("face4")) {
faces[BlockStep.X_PLUS.ordinal()] = parseTextureIndex(filetoidx, srctxtid, av[1]);
} else if (av[0].equals("south") || av[0].equals("x-") || av[0].equals("face5")) {
faces[BlockStep.X_MINUS.ordinal()] = parseTextureIndex(filetoidx, srctxtid, av[1]);
} else if (av[0].equals("west") || av[0].equals("z-") || av[0].equals("face3")) {
faces[BlockStep.Z_MINUS.ordinal()] = parseTextureIndex(filetoidx, srctxtid, av[1]);
} else if (av[0].equals("east") || av[0].equals("z+") || av[0].equals("face2")) {
faces[BlockStep.Z_PLUS.ordinal()] = parseTextureIndex(filetoidx, srctxtid, av[1]);
} else if (av[0].startsWith("face")) {
int fid0, fid1;
String idrange = av[0].substring(4);
String[] ids = idrange.split("-");
if (ids.length > 1) {
fid0 = Integer.parseInt(ids[0]);
fid1 = Integer.parseInt(ids[1]);
} else {
fid0 = fid1 = Integer.parseInt(ids[0]);
}
if ((fid0 < 0) || (fid1 < fid0)) {
Log.severe("Texture mapping has invalid face index - " + av[1] + " - line " + lineNum + " of " + txtname);
return;
}
int[] faceToOrd = { BlockStep.Y_PLUS.ordinal(), BlockStep.Y_MINUS.ordinal(), BlockStep.Z_PLUS.ordinal(), BlockStep.Z_MINUS.ordinal(), BlockStep.X_PLUS.ordinal(), BlockStep.X_MINUS.ordinal() };
int txtid = parseTextureIndex(filetoidx, srctxtid, av[1]);
for (int i = fid0; (i <= fid1) && (i < 6); i++) {
faces[faceToOrd[i]] = txtid;
}
} else if (av[0].equals("allfaces")) {
int id = parseTextureIndex(filetoidx, srctxtid, av[1]);
for (int i = 0; i < 6; i++) {
faces[i] = id;
}
} else if (av[0].equals("allsides")) {
int id = parseTextureIndex(filetoidx, srctxtid, av[1]);
faces[BlockStep.X_PLUS.ordinal()] = id;
faces[BlockStep.X_MINUS.ordinal()] = id;
faces[BlockStep.Z_PLUS.ordinal()] = id;
faces[BlockStep.Z_MINUS.ordinal()] = id;
} else if (av[0].equals("topbottom")) {
faces[BlockStep.Y_MINUS.ordinal()] = faces[BlockStep.Y_PLUS.ordinal()] = parseTextureIndex(filetoidx, srctxtid, av[1]);
} else if (av[0].equals("blockcolor")) {
if (filetoidx.containsKey(av[1]))
blockColorIdx = filetoidx.get(av[1]);
else
Log.severe("Format error - line " + lineNum + " of " + txtname + ": bad texture " + av[1]);
} else if (av[0].startsWith("patch")) {
int patchid0, patchid1;
String idrange = av[0].substring(5);
String[] ids = idrange.split("-");
if (ids.length > 1) {
patchid0 = Integer.parseInt(ids[0]);
patchid1 = Integer.parseInt(ids[1]);
} else {
patchid0 = patchid1 = Integer.parseInt(ids[0]);
}
if ((patchid0 < 0) || (patchid1 < patchid0)) {
Log.severe("Texture mapping has invalid patch index - " + av[1] + " - line " + lineNum + " of " + txtname);
return;
}
if (faces.length <= patchid1) {
int[] newfaces = new int[patchid1 + 1];
Arrays.fill(newfaces, TILEINDEX_BLANK);
System.arraycopy(faces, 0, newfaces, 0, faces.length);
faces = newfaces;
int[] newtxtidx = new int[patchid1 + 1];
Arrays.fill(newtxtidx, -1);
System.arraycopy(txtidx, 0, newtxtidx, 0, txtidx.length);
txtidx = newtxtidx;
}
int txtid = parseTextureIndex(filetoidx, srctxtid, av[1]);
for (int i = patchid0; i <= patchid1; i++) {
faces[i] = txtid;
}
} else if (av[0].equals("transparency")) {
trans = BlockTransparency.valueOf(av[1]);
if (trans == null) {
trans = BlockTransparency.OPAQUE;
Log.severe("Texture mapping has invalid transparency setting - " + av[1] + " - line " + lineNum + " of " + txtname);
}
/* For leaves, base on leaf transparency setting */
if (trans == BlockTransparency.LEAVES) {
if (core.getLeafTransparency())
trans = BlockTransparency.TRANSPARENT;
else
trans = BlockTransparency.OPAQUE;
}
} else if (av[0].equals("colorMult")) {
colorMult = (int) Long.parseLong(av[1], 16);
} else if (av[0].equals("custColorMult")) {
try {
Class<?> cls = Class.forName(av[1]);
custColorMult = (CustomColorMultiplier) cls.newInstance();
} catch (Exception x) {
Log.severe("Error loading custom color multiplier - " + av[1] + ": " + x.getMessage());
}
} else if (av[0].equals("stdrot")) {
stdrot = av[1].equals("true");
}
}
for (String a : args) {
String[] av = a.split("=");
if (av.length < 2)
continue;
if (av[0].startsWith("layer")) {
if (layers == null) {
layers = new byte[faces.length];
Arrays.fill(layers, (byte) -1);
}
String[] v = av[0].substring(5).split("-");
int id1, id2;
id1 = id2 = Integer.parseInt(v[0]);
if (v.length > 1) {
id2 = Integer.parseInt(v[1]);
}
byte val = (byte) Integer.parseInt(av[1]);
for (; id1 <= id2; id1++) {
layers[id1] = val;
}
}
}
/* If we have everything, build block */
if (bsprslt.size() > 0) {
Integer colorIndex = (blockColorIdx >= 0) ? (blockColorIdx + IMG_CNT) : null;
HDBlockStateTextureMap map = new HDBlockStateTextureMap(faces, layers, colorMult, custColorMult, blockset, stdrot, colorIndex, trans);
map.addToTable(bsprslt);
cnt++;
} else {
Log.severe("Texture mapping missing required parameters = line " + lineNum + " of " + txtname);
}
}
} else if (typeid.equals("copyblock")) {
// Parse block states
bsp.processLine(modname, line, lineNum, varvals);
String[] args = line.split(",");
String srcname = null;
int srcmeta = 0;
BlockTransparency trans = null;
for (String a : args) {
String[] av = a.split("=");
if (av.length < 2)
continue;
if (av[0].equals("srcid")) {
srcname = getBlockName(modname, av[1]);
} else if (av[0].equals("srcmeta")) {
srcmeta = getIntValue(varvals, av[1]);
} else if (av[0].equals("transparency")) {
trans = BlockTransparency.valueOf(av[1]);
if (trans == null) {
trans = BlockTransparency.OPAQUE;
Log.severe("Texture mapping has invalid transparency setting - " + av[1] + " - line " + lineNum + " of " + txtname);
}
/* For leaves, base on leaf transparency setting */
if (trans == BlockTransparency.LEAVES) {
if (core.getLeafTransparency())
trans = BlockTransparency.TRANSPARENT;
else
trans = BlockTransparency.OPAQUE;
}
}
}
/* If we have everything, build block */
bsprslt = bsp.getMatchingStates();
if ((bsprslt.size() > 0) && (srcname != null)) {
DynmapBlockState srcblk = DynmapBlockState.getStateByNameAndIndex(srcname, srcmeta);
HDBlockStateTextureMap map = null;
if (srcblk != null)
map = HDBlockStateTextureMap.getByBlockState(srcblk);
if (map == null) {
Log.severe("Copy of texture mapping failed = line " + lineNum + " of " + txtname);
} else {
for (DynmapBlockState bblk : bsprslt.keySet()) {
BitSet stateids = bsprslt.get(bblk);
for (int stateid = stateids.nextSetBit(0); stateid >= 0; stateid = stateids.nextSetBit(stateid + 1)) {
DynmapBlockState dblk2 = bblk.getState(stateid);
HDBlockStateTextureMap.copyToStateIndex(dblk2, map, trans);
}
}
cnt++;
}
} else {
Log.severe("Texture mapping copy missing required parameters = line " + lineNum + " of " + txtname);
}
} else if (typeid.equals("addtotexturemap")) {
int srctxtid = -1;
String mapid = null;
String[] args = line.split(",");
for (String a : args) {
String[] av = a.split("=");
if (av.length < 2)
continue;
else if (av[0].equals("txtid")) {
if (filetoidx.containsKey(av[1]))
srctxtid = filetoidx.get(av[1]);
else
Log.severe("Format error - line " + lineNum + " of " + txtname);
} else if (av[0].equals("mapid")) {
mapid = av[1];
}
}
if (mapid != null) {
for (String a : args) {
String[] av = a.split("=");
if (av.length < 2)
continue;
if (av[0].startsWith("key:")) {
Integer key = getIntValue(varvals, av[0].substring(4));
if ((key != null) && (key > 0)) {
addTextureByKey(mapid, key, parseTextureIndex(filetoidx, srctxtid, av[1]));
}
}
}
} else {
Log.severe("Missing mapid - line " + lineNum + " of " + txtname);
}
} else if (typeid.equals("texturemap")) {
// Parse block states
bsp.processLine(modname, line, lineNum, varvals);
String mapid = null;
BlockTransparency trans = BlockTransparency.OPAQUE;
int colorMult = 0;
CustomColorMultiplier custColorMult = null;
String[] args = line.split(",");
for (String a : args) {
String[] av = a.split("=");
if (av.length < 2)
continue;
if (av[0].equals("mapid")) {
mapid = av[1];
} else if (av[0].equals("transparency")) {
trans = BlockTransparency.valueOf(av[1]);
if (trans == null) {
trans = BlockTransparency.OPAQUE;
Log.severe("Texture mapping has invalid transparency setting - " + av[1] + " - line " + lineNum + " of " + txtname);
}
/* For leaves, base on leaf transparency setting */
if (trans == BlockTransparency.LEAVES) {
if (core.getLeafTransparency())
trans = BlockTransparency.TRANSPARENT;
else
trans = BlockTransparency.OPAQUE;
}
} else if (av[0].equals("colorMult")) {
colorMult = Integer.valueOf(av[1], 16);
} else if (av[0].equals("custColorMult")) {
try {
Class<?> cls = Class.forName(av[1]);
custColorMult = (CustomColorMultiplier) cls.newInstance();
} catch (Exception x) {
Log.severe("Error loading custom color multiplier - " + av[1] + ": " + x.getMessage());
}
}
}
/* If we have everything, build texture map */
bsprslt = bsp.getMatchingStates();
if ((bsprslt.size() > 0) && (mapid != null)) {
addTextureIndex(mapid, bsprslt, trans, colorMult, custColorMult, blockset);
} else {
Log.severe("Texture map missing required parameters = line " + lineNum + " of " + txtname);
}
} else if (typeid.equals("texturefile") || typeid.equals("texture")) {
boolean istxt = typeid.equals("texture");
String[] args = line.split(",");
int xdim = 16, ydim = 16;
String fname = null;
String id = null;
TileFileFormat fmt = TileFileFormat.GRID;
MaterialType mt = null;
if (istxt) {
xdim = ydim = 1;
fmt = TileFileFormat.GRID;
}
for (String arg : args) {
String[] aval = arg.split("=");
if (aval.length < 2)
continue;
if (aval[0].equals("id")) {
id = aval[1];
if (fname == null) {
if (texturepath != null) {
fname = texturepath + id + ".png";
} else if (texturemod != null) {
fname = "mods/" + texturemod + "/textures/blocks/" + id + ".png";
}
}
} else if (aval[0].equals("filename"))
fname = aval[1];
else if (aval[0].equals("xcount"))
xdim = Integer.parseInt(aval[1]);
else if (aval[0].equals("ycount"))
ydim = Integer.parseInt(aval[1]);
else if (aval[0].equals("format")) {
fmt = TileFileFormat.valueOf(aval[1].toUpperCase());
if (fmt == null) {
Log.severe("Invalid format type " + aval[1] + " - line " + lineNum + " of " + txtname);
return;
}
} else if (aval[0].equals("material")) {
mt = MaterialType.valueOf(aval[1]);
if (mt == null) {
Log.warning("Bad custom material type: " + aval[1]);
}
}
}
if ((fname != null) && (id != null)) {
/* Register the file */
int fid = findOrAddDynamicTileFile(fname, modname, xdim, ydim, fmt, args);
filetoidx.put(id, fid);
/* Save lookup */
if (mt != null) {
addonfiles.get(fid).material = mt;
}
} else {
Log.severe("Format error - line " + lineNum + " of " + txtname);
return;
}
} else if (typeid.equals("enabled")) {
/* Test if texture file is enabled */
if (line.startsWith("true")) {
/* We're enabled? */
/* Nothing to do - keep processing */
} else if (line.startsWith("false")) {
/* Disabled */
return;
/* Quit */
} else /* If setting is not defined or false, quit */
if (config.getBoolean(line, false) == false) {
return;
} else {
Log.info(line + " textures enabled");
}
} else if (typeid.equals("var")) {
/* Test if variable declaration */
String[] args = line.split(",");
for (int i = 0; i < args.length; i++) {
String[] v = args[i].split("=");
if (v.length < 2) {
Log.severe("Format error - line " + lineNum + " of " + txtname);
return;
}
try {
int val = Integer.valueOf(v[1]);
/* Parse default value */
int parmval = config.getInteger(v[0], val);
/* Read value, with applied default */
varvals.put(v[0], parmval);
/* And save value */
} catch (NumberFormatException nfx) {
Log.severe("Format error - line " + lineNum + " of " + txtname + ": " + nfx.getMessage());
return;
}
}
} else if (typeid.equals("cfgfile")) {
/* If config file */
if (!mod_cfg_loaded) {
mod_cfg_needed = true;
}
File cfgfile = new File(line);
ForgeConfigFile cfg = new ForgeConfigFile(cfgfile);
if (cfg.load()) {
cfg.addBlockIDs(varvals);
mod_cfg_needed = false;
mod_cfg_loaded = true;
}
} else if (typeid.equals("modname")) {
String[] names = line.split(",");
boolean found = false;
for (String n : names) {
String[] ntok = n.split("[\\[\\]]");
String rng = null;
if (ntok.length > 1) {
n = ntok[0].trim();
rng = ntok[1].trim();
}
n = n.trim();
// If already supplied by mod, quit processing this file
if (loadedmods.contains(n)) {
return;
}
String modver = core.getServer().getModVersion(n);
if ((modver != null) && ((rng == null) || HDBlockModels.checkVersionRange(modver, rng))) {
found = true;
Log.info(n + "[" + modver + "] textures enabled");
modname = n;
modversion = modver;
if (texturemod == null)
texturemod = modname;
loadedmods.add(n);
// Prime values from block and item unique IDs
core.addModBlockItemIDs(modname, varvals);
break;
}
}
if (!found)
return;
} else if (typeid.equals("texturemod")) {
texturemod = line;
} else if (typeid.equals("texturepath")) {
texturepath = line.trim();
if (texturepath.charAt(texturepath.length() - 1) != '/') {
texturepath += "/";
}
} else if (typeid.equals("biome")) {
String[] args = line.split(",");
int id = 0;
int grasscolormult = -1;
int foliagecolormult = -1;
int watercolormult = -1;
double rain = -1.0;
double tmp = -1.0;
for (int i = 0; i < args.length; i++) {
String[] v = args[i].split("=");
if (v.length < 2) {
Log.severe("Format error - line " + lineNum + " of " + txtname);
return;
}
if (v[0].equals("id")) {
id = getIntValue(varvals, v[1]);
} else if (v[0].equals("grassColorMult")) {
grasscolormult = Integer.valueOf(v[1], 16);
} else if (v[0].equals("foliageColorMult")) {
foliagecolormult = Integer.valueOf(v[1], 16);
} else if (v[0].equals("waterColorMult")) {
watercolormult = Integer.valueOf(v[1], 16);
} else if (v[0].equals("temp")) {
tmp = Double.parseDouble(v[1]);
} else if (v[0].equals("rain")) {
rain = Double.parseDouble(v[1]);
}
}
if (id > 0) {
BiomeMap b = BiomeMap.byBiomeID(id);
/* Find biome */
if (b == null) {
Log.severe("Format error - line " + lineNum + " of " + txtname + ": " + id);
} else {
if (foliagecolormult != -1)
b.setFoliageColorMultiplier(foliagecolormult);
if (grasscolormult != -1)
b.setGrassColorMultiplier(grasscolormult);
if (watercolormult != -1)
b.setWaterColorMultiplier(watercolormult);
if (tmp != -1.0)
b.setTemperature(tmp);
if (rain != -1.0)
b.setRainfall(rain);
}
}
} else if (typeid.equals("version")) {
if (!HDBlockModels.checkVersionRange(mcver, line)) {
return;
}
} else if (typeid.equals("noterrainpng")) {
if (line.startsWith("true")) {
terrain_ok = false;
} else {
terrain_ok = true;
}
}
}
if (mod_cfg_needed) {
Log.severe("Error loading configuration file for " + modname);
}
Log.verboseinfo("Loaded " + cnt + " texture mappings from " + txtname);
} catch (IOException iox) {
Log.severe("Error reading " + txtname + " - " + iox.toString());
} catch (NumberFormatException nfx) {
Log.severe("Format error - line " + rdr.getLineNumber() + " of " + txtname + ": " + nfx.getMessage());
} finally {
if (rdr != null) {
try {
rdr.close();
rdr = null;
} catch (IOException e) {
}
}
}
}
use of org.dynmap.renderer.DynmapBlockState in project dynmap by webbukkit.
the class TFCWoodRenderer method getRenderPatchList.
@Override
public RenderPatch[] getRenderPatchList(MapDataContext ctx) {
/* Build connection map - check each axis */
int connect = 0;
for (int i = 0; i < sides.length; i++) {
DynmapBlockState blk = ctx.getBlockTypeAt(sides[i][0], sides[i][1], sides[i][2]);
if (blkbs.matchingBaseState(blk)) {
connect |= sides[i][3];
}
}
DynmapBlockState id = ctx.getBlockTypeAt(0, -1, 0);
if (id.isNotAir()) {
connect |= SIDE_YN;
}
return meshes[connect];
}
use of org.dynmap.renderer.DynmapBlockState in project dynmap by webbukkit.
the class ThaumFurnaceRenderer method calcTexture.
/* Calculate index of texture for given side */
private int calcTexture(MapDataContext ctx, int side) {
int meta = ctx.getBlockType().stateIndex;
int lvl = calcLevel(ctx);
int add = TXTIDX_FIRST_GRID;
DynmapBlockState sec = blkbs.getState(10);
if (blockTouching(ctx, sec, side)) {
add = TXTIDX_SECOND_GRID;
}
switch(side) {
case 0:
case 1:
if ((side == 1) && (lvl == 2)) {
switch(meta) {
case 2:
return TXTIDX_SPECIAL_23;
case 4:
return TXTIDX_SPECIAL_24;
case 6:
return TXTIDX_SPECIAL_40;
case 8:
return TXTIDX_SPECIAL_39;
}
}
if (add == TXTIDX_SECOND_GRID)
break;
if (meta == 5)
return TXTIDX_SPECIAL_7;
return (meta - 1) % 3 + (meta - 1) / 3 * 3;
case 2:
switch(meta) {
default:
if (lvl != 1)
return TXTIDX_SPECIAL_7;
return TXTIDX_SPECIAL_6;
case 1:
return 2 + (lvl * 3) + add;
case 2:
return 1 + (lvl * 3) + add;
case 3:
return 0 + (lvl * 3) + add;
}
case 3:
switch(meta) {
default:
if (lvl != 1)
return TXTIDX_SPECIAL_7;
return TXTIDX_SPECIAL_6;
case 7:
return 0 + (lvl * 3) + add;
case 8:
return 1 + (lvl * 3) + add;
case 9:
return 2 + (lvl * 3) + add;
}
case 4:
switch(meta) {
default:
if (lvl != 1)
return TXTIDX_SPECIAL_7;
return TXTIDX_SPECIAL_6;
case 1:
return 0 + (lvl * 3) + add;
case 4:
return 1 + (lvl * 3) + add;
case 7:
return 2 + (lvl * 3) + add;
}
case 5:
switch(meta) {
default:
if (lvl != 1)
return TXTIDX_SPECIAL_7;
return TXTIDX_SPECIAL_6;
case 3:
return 2 + (lvl * 3) + add;
case 6:
return 1 + (lvl * 3) + add;
case 9:
return 0 + (lvl * 3) + add;
}
}
return add == 0 ? TXTIDX_SPECIAL_7 : TXTIDX_SPECIAL_6;
}
use of org.dynmap.renderer.DynmapBlockState in project dynmap by webbukkit.
the class FenceWallBlockRenderer method addIDs.
private void addIDs(String bn) {
DynmapBlockState bbs = DynmapBlockState.getBaseStateByName(bn);
if (bbs.isNotAir()) {
for (int i = 0; i < bbs.getStateCount(); i++) {
DynmapBlockState bs = bbs.getState(i);
link_ids.set(bs.globalStateIndex);
}
}
}
Aggregations