Extend modsupport API to deprecate numeric ID, meta values

This commit is contained in:
Mike Primm 2022-02-07 20:02:17 -06:00
parent b3de1dafe3
commit a2f8f9defa
23 changed files with 392 additions and 68 deletions

View File

@ -1,15 +1,23 @@
package org.dynmap.modsupport.impl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.dynmap.modsupport.BlockModel;
public abstract class BlockModelImpl implements BlockModel {
private int[] ids = new int[0];
private String[] names = new String[0];
private int metaMask = -1;
private BitSet meta = null;
private List<Map<String, String>> blockstates = null;
protected final ModModelDefinitionImpl mdf;
@Deprecated
public BlockModelImpl(int blkid, ModModelDefinitionImpl mdf) {
addBlockID(blkid);
this.mdf = mdf;
@ -24,6 +32,7 @@ public abstract class BlockModelImpl implements BlockModel {
* @param blockID - block ID
*/
@Override
@Deprecated
public void addBlockID(int blockID) {
if (blockID > 0) {
for (int i = 0; i < ids.length; i++) {
@ -56,6 +65,7 @@ public abstract class BlockModelImpl implements BlockModel {
* @return configured IDs
*/
@Override
@Deprecated
public int[] getBlockIDs() {
return ids;
}
@ -74,16 +84,12 @@ public abstract class BlockModelImpl implements BlockModel {
* @param data - value to match (-1 = all, 0-15 is meta value to match)
*/
@Override
@Deprecated
public void setMetaValue(int data) {
if (data < 0) { // Setting to all
metaMask = METAMASK_ALL;
}
else if (data < 16) {
if (metaMask == METAMASK_ALL) {
metaMask = 0;
}
metaMask |= (1 << data);
}
if (meta == null) {
meta = new BitSet();
}
meta.set(data);
}
/**
@ -91,12 +97,35 @@ public abstract class BlockModelImpl implements BlockModel {
* @return matching metadata mask: bit N is set if given metadata value matches
*/
@Override
@Deprecated
public int getMetaValueMask() {
return metaMask;
if (meta == null) { return METAMASK_ALL; }
return (int) meta.toLongArray()[0]; // Only works for 32 flags
}
/**
* Set matching block state mapping
* Any key-value pairs included must match, while any not included are assumed to match unconditionall
* @param statemap - map of attribute value pairs
*/
public void setBlockStateMapping(Map<String, String> statemap) {
if (blockstates == null) {
blockstates = new ArrayList<Map<String, String>>();
}
Map<String, String> nmap = new HashMap<String, String>();
nmap.putAll(statemap);
blockstates.add(nmap);
}
/**
* Get all state mappings accumulated for the block model
*/
public List<Map<String, String>> getBlockStateMappings() {
return blockstates;
}
public abstract String getLine();
// This is now getting state mappings too
protected String getIDsAndMeta() {
if ((ids.length == 0) && (names.length == 0)) {
return null;
@ -118,18 +147,32 @@ public abstract class BlockModelImpl implements BlockModel {
}
s += "id=%" + names[i];
}
// Add meta
if (this.metaMask == METAMASK_ALL) {
s += ",data=*";
// If we have state data, favor this
if (this.blockstates != null) {
for (Map<String, String> rec : this.blockstates) {
s += ",state=";
boolean first = true;
for (Entry<String, String> r : rec.entrySet()) {
if (first) {
first = false;
}
else {
s += '/';
}
s += r.getKey() + ":" + r.getValue();
}
}
}
else {
for (int i = 0; i < 16; i++) {
if ((metaMask & (1 << i)) != 0) {
s += ",data=" + i;
}
}
// If we have meta data, add this next
if (this.meta != null) {
for (int i = meta.nextSetBit(0); i != -1; i = meta.nextSetBit(i + 1)) {
s += ",data=" + i;
}
}
// If neither, just state=*
if ((this.meta == null) && (this.blockstates == null)) {
s += ",state=*";
}
return s;
}
}

View File

@ -2,6 +2,11 @@ package org.dynmap.modsupport.impl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.dynmap.hdmap.TexturePack;
import org.dynmap.modsupport.BlockSide;
@ -13,7 +18,8 @@ import org.dynmap.modsupport.TransparencyMode;
public class BlockTextureRecordImpl implements BlockTextureRecord {
private int[] ids = new int[0];
private String[] names = new String[0];
private int metaMask = -1;
private BitSet meta = null;
private List<Map<String, String>> blockstates = null;
private TransparencyMode transmode = TransparencyMode.OPAQUE;
private static class TexturePatch {
@ -96,6 +102,7 @@ public class BlockTextureRecordImpl implements BlockTextureRecord {
TexturePack.COLORMOD_FOLIAGEMULTTONED // FOLIAGEMULTTONED
};
@Deprecated
public BlockTextureRecordImpl(int blkid) {
addBlockID(blkid);
for (int i = 0; i < 6; i++) {
@ -115,6 +122,7 @@ public class BlockTextureRecordImpl implements BlockTextureRecord {
* @param blockID - block ID
*/
@Override
@Deprecated
public void addBlockID(int blockID) {
if (blockID > 0) {
for (int i = 0; i < ids.length; i++) {
@ -147,6 +155,7 @@ public class BlockTextureRecordImpl implements BlockTextureRecord {
* @return configured IDs
*/
@Override
@Deprecated
public int[] getBlockIDs() {
return ids;
}
@ -165,16 +174,12 @@ public class BlockTextureRecordImpl implements BlockTextureRecord {
* @param data - value to match (-1 = all, 0-15 is meta value to match)
*/
@Override
@Deprecated
public void setMetaValue(int data) {
if (data < 0) { // Setting to all
metaMask = METAMASK_ALL;
}
else if (data < 16) {
if (metaMask == METAMASK_ALL) {
metaMask = 0;
}
metaMask |= (1 << data);
}
if (meta == null) {
meta = new BitSet();
}
meta.set(data);
}
/**
@ -182,10 +187,32 @@ public class BlockTextureRecordImpl implements BlockTextureRecord {
* @return matching metadata mask: bit N is set if given metadata value matches
*/
@Override
@Deprecated
public int getMetaValueMask() {
return metaMask;
if (meta == null) { return METAMASK_ALL; }
return (int) meta.toLongArray()[0]; // Only works for 32 flags
}
/**
* Set matching block state mapping
* Any key-value pairs included must match, while any not included are assumed to match unconditionall
* @param statemap - map of attribute value pairs
*/
public void setBlockStateMapping(Map<String, String> statemap) {
if (blockstates == null) {
blockstates = new ArrayList<Map<String, String>>();
}
Map<String, String> nmap = new HashMap<String, String>();
nmap.putAll(statemap);
blockstates.add(nmap);
}
/**
* Get all state mappings accumulated for the block model
*/
public List<Map<String, String>> getBlockStateMappings() {
return blockstates;
}
/**
* Set transparency mode for block
* @param mode - transparency mode
@ -503,16 +530,31 @@ public class BlockTextureRecordImpl implements BlockTextureRecord {
s += "id=%" + names[i];
idcnt++;
}
// Add meta
if (this.metaMask == METAMASK_ALL) {
s += ",data=*";
// If we have state data, favor this
if (this.blockstates != null) {
for (Map<String, String> rec : this.blockstates) {
s += ",state=";
boolean first = true;
for (Entry<String, String> r : rec.entrySet()) {
if (first) {
first = false;
}
else {
s += '/';
}
s += r.getKey() + ":" + r.getValue();
}
}
}
else {
for (int i = 0; i < 16; i++) {
if ((metaMask & (1 << i)) != 0) {
s += ",data=" + i;
}
}
// If we have meta data, add this next
if (this.meta != null) {
for (int i = meta.nextSetBit(0); i != -1; i = meta.nextSetBit(i + 1)) {
s += ",data=" + i;
}
}
// If neither, just state=*
if ((this.meta == null) && (this.blockstates == null)) {
s += ",state=*";
}
for (int i = 0; i < txtPatches.size(); i++) {
TexturePatch tp = txtPatches.get(i);

View File

@ -12,6 +12,7 @@ public class BoxBlockModelImpl extends BlockModelImpl implements BoxBlockModel {
private double zmin = 0.0;
private double zmax = 1.0;
@Deprecated
public BoxBlockModelImpl(int blkid, ModModelDefinitionImpl mdf) {
super(blkid, mdf);
}

View File

@ -1,6 +1,12 @@
package org.dynmap.modsupport.impl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.dynmap.modsupport.CopyBlockTextureRecord;
import org.dynmap.modsupport.TransparencyMode;
@ -8,10 +14,12 @@ import org.dynmap.modsupport.TransparencyMode;
public class CopyBlockTextureRecordImpl implements CopyBlockTextureRecord {
private int[] ids = new int[0];
private String[] names = new String[0];
private int metaMask = -1;
private BitSet meta = null;
private List<Map<String, String>> blockstates = null;
private final int srcid;
private final String srcname;
private final int srcmeta;
private final Map<String, String> srcstatemap;
private TransparencyMode mode = null;
private int isNumber(String v) {
@ -27,6 +35,7 @@ public class CopyBlockTextureRecordImpl implements CopyBlockTextureRecord {
this.srcid = srcid;
this.srcname = null;
this.srcmeta = srcmeta;
this.srcstatemap = null;
}
public CopyBlockTextureRecordImpl(String blkname, String srcname, int srcmeta) {
@ -41,6 +50,23 @@ public class CopyBlockTextureRecordImpl implements CopyBlockTextureRecord {
this.srcid = id;
}
this.srcmeta = srcmeta;
this.srcstatemap = null;
}
public CopyBlockTextureRecordImpl(String blkname, String srcname, Map<String, String> srcstatemap) {
addBlockName(blkname);
int id = isNumber(srcname);
if (id < 0) {
this.srcname = srcname;
this.srcid = 0;
}
else {
this.srcname = null;
this.srcid = id;
}
this.srcmeta = -1;
this.srcstatemap = new HashMap<String, String>();
this.srcstatemap.putAll(srcstatemap);
}
/**
@ -98,16 +124,12 @@ public class CopyBlockTextureRecordImpl implements CopyBlockTextureRecord {
* @param data - value to match (-1 = all, 0-15 is meta value to match)
*/
@Override
@Deprecated
public void setMetaValue(int data) {
if (data < 0) { // Setting to all
metaMask = METAMASK_ALL;
}
else if (data < 16) {
if (metaMask == METAMASK_ALL) {
metaMask = 0;
}
metaMask |= (1 << data);
}
if (meta == null) {
meta = new BitSet();
}
meta.set(data);
}
/**
@ -115,8 +137,32 @@ public class CopyBlockTextureRecordImpl implements CopyBlockTextureRecord {
* @return matching metadata mask: bit N is set if given metadata value matches
*/
@Override
@Deprecated
public int getMetaValueMask() {
return metaMask;
if (meta == null) { return METAMASK_ALL; }
return (int) meta.toLongArray()[0]; // Only works for 32 flags
}
/**
* Set matching block state mapping
* Any key-value pairs included must match, while any not included are assumed to match unconditionall
* @param statemap - map of attribute value pairs
*/
@Override
public void setBlockStateMapping(Map<String, String> statemap) {
if (blockstates == null) {
blockstates = new ArrayList<Map<String, String>>();
}
Map<String, String> nmap = new HashMap<String, String>();
nmap.putAll(statemap);
blockstates.add(nmap);
}
/**
* Get all state mappings accumulated for the block model
*/
@Override
public List<Map<String, String>> getBlockStateMappings() {
return blockstates;
}
public String getLine() {
@ -142,23 +188,56 @@ public class CopyBlockTextureRecordImpl implements CopyBlockTextureRecord {
s += "id=%" + names[i];
idcnt++;
}
// Add meta
if (this.metaMask == METAMASK_ALL) {
s += ",data=*";
// If we have state data, favor this
if (this.blockstates != null) {
for (Map<String, String> rec : this.blockstates) {
s += ",state=";
boolean first = true;
for (Entry<String, String> r : rec.entrySet()) {
if (first) {
first = false;
}
else {
s += '/';
}
s += r.getKey() + ":" + r.getValue();
}
}
}
else {
for (int i = 0; i < 16; i++) {
if ((metaMask & (1 << i)) != 0) {
s += ",data=" + i;
}
}
// If we have meta data, add this next
if (this.meta != null) {
for (int i = meta.nextSetBit(0); i != -1; i = meta.nextSetBit(i + 1)) {
s += ",data=" + i;
}
}
// If neither, just state=*
if ((this.meta == null) && (this.blockstates == null)) {
s += ",state=*";
}
if (srcname != null) {
s += ",srcid=%" + srcname + ",srcmeta=" + srcmeta;
s += ",srcid=%" + srcname;
}
else {
s += ",srcid=" + srcid + ",srcmeta=" + srcmeta;
s += ",srcid=" + srcid;
}
// If source state, use it
if (this.srcstatemap != null) {
s += ",srcstate=";
boolean first = true;
for (Entry<String, String> r : this.srcstatemap.entrySet()) {
if (first) {
first = false;
}
else {
s += '/';
}
s += r.getKey() + ":" + r.getValue();
}
}
else {
s += ",srcmeta=" + srcmeta;
}
switch (this.mode) {
case TRANSPARENT:
s += ",transparency=TRANSPARENT";
@ -173,15 +252,25 @@ public class CopyBlockTextureRecordImpl implements CopyBlockTextureRecord {
}
@Override
@Deprecated
public int getSourceBlockID() {
return srcid;
}
@Override
@Deprecated
public int getSourceMeta() {
return srcmeta;
}
/**
* Get sourc state mappings accumulated for the block model
*/
@Override
public Map<String, String> getSourceBlockStateMapping() {
return srcstatemap;
}
@Override
public void setTransparencyMode(TransparencyMode mode) {
this.mode = mode;
@ -191,4 +280,8 @@ public class CopyBlockTextureRecordImpl implements CopyBlockTextureRecord {
public TransparencyMode getTransparencyMode() {
return mode;
}
@Override
public String getSourceBlockName() {
return srcname;
}
}

View File

@ -20,6 +20,7 @@ public class CuboidBlockModelImpl extends BlockModelImpl implements CuboidBlockM
private ArrayList<Cuboid> cuboids = new ArrayList<Cuboid>();
private ArrayList<Crossed> crosseds = new ArrayList<Crossed>();
@Deprecated
public CuboidBlockModelImpl(int blkid, ModModelDefinitionImpl mdf) {
super(blkid, mdf);
}

View File

@ -4,6 +4,7 @@ import org.dynmap.modsupport.DoorBlockModel;
public class DoorBlockModelImpl extends BlockModelImpl implements DoorBlockModel {
@Deprecated
public DoorBlockModelImpl(int blkid, ModModelDefinitionImpl mdf) {
super(blkid, mdf);
}

View File

@ -61,12 +61,14 @@ public class ModModelDefinitionImpl implements ModModelDefinition {
}
@Override
@Deprecated
public VolumetricBlockModel addVolumetricModel(int blockid, int scale) {
VolumetricBlockModelImpl mod = new VolumetricBlockModelImpl(blockid, this, scale);
blkModel.add(mod);
return null;
}
@Override
@Deprecated
public VolumetricBlockModel addVolumetricModel(String blockname, int scale) {
VolumetricBlockModelImpl mod = new VolumetricBlockModelImpl(blockname, this, scale);
blkModel.add(mod);
@ -74,6 +76,7 @@ public class ModModelDefinitionImpl implements ModModelDefinition {
}
@Override
@Deprecated
public StairBlockModel addStairModel(int blockid) {
StairBlockModelImpl mod = new StairBlockModelImpl(blockid, this);
blkModel.add(mod);
@ -87,6 +90,7 @@ public class ModModelDefinitionImpl implements ModModelDefinition {
}
@Override
@Deprecated
public WallFenceBlockModel addWallFenceModel(int blockid, FenceType type) {
WallFenceBlockModelImpl mod = new WallFenceBlockModelImpl(blockid, this, type);
blkModel.add(mod);
@ -100,6 +104,7 @@ public class ModModelDefinitionImpl implements ModModelDefinition {
}
@Override
@Deprecated
public CuboidBlockModel addCuboidModel(int blockid) {
CuboidBlockModelImpl mod = new CuboidBlockModelImpl(blockid, this);
blkModel.add(mod);
@ -114,6 +119,7 @@ public class ModModelDefinitionImpl implements ModModelDefinition {
}
@Override
@Deprecated
public PaneBlockModel addPaneModel(int blockid) {
PaneBlockModelImpl mod = new PaneBlockModelImpl(blockid, this);
blkModel.add(mod);
@ -127,6 +133,7 @@ public class ModModelDefinitionImpl implements ModModelDefinition {
}
@Override
@Deprecated
public PlantBlockModel addPlantModel(int blockid) {
PlantBlockModelImpl mod = new PlantBlockModelImpl(blockid, this);
blkModel.add(mod);
@ -140,6 +147,7 @@ public class ModModelDefinitionImpl implements ModModelDefinition {
}
@Override
@Deprecated
public BoxBlockModel addBoxModel(int blockid) {
BoxBlockModelImpl mod = new BoxBlockModelImpl(blockid, this);
blkModel.add(mod);
@ -153,6 +161,7 @@ public class ModModelDefinitionImpl implements ModModelDefinition {
}
@Override
@Deprecated
public DoorBlockModel addDoorModel(int blockid) {
DoorBlockModelImpl mod = new DoorBlockModelImpl(blockid, this);
blkModel.add(mod);
@ -166,6 +175,7 @@ public class ModModelDefinitionImpl implements ModModelDefinition {
}
@Override
@Deprecated
public PatchBlockModel addPatchModel(int blockid) {
PatchBlockModelImpl mod = new PatchBlockModelImpl(blockid, this);
blkModel.add(mod);
@ -179,6 +189,7 @@ public class ModModelDefinitionImpl implements ModModelDefinition {
}
@Override
@Deprecated
public PatchBlockModel addRotatedPatchModel(int blockid,
PatchBlockModel model, int xrot, int yrot, int zrot) {
PatchBlockModelImpl mod = new PatchBlockModelImpl(blockid, this, model, xrot, yrot, zrot);

View File

@ -5,6 +5,7 @@ import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map;
import org.dynmap.modsupport.BigChestTextureFile;
import org.dynmap.modsupport.BiomeTextureFile;
@ -227,6 +228,7 @@ public class ModTextureDefinitionImpl implements ModTextureDefinition {
* @return block texture record: use methods to set texture use on faces/patches
*/
@Override
@Deprecated
public BlockTextureRecord addBlockTextureRecord(int blockID) {
BlockTextureRecordImpl btr = new BlockTextureRecordImpl(blockID);
blkTextureRec.add(btr);
@ -245,6 +247,7 @@ public class ModTextureDefinitionImpl implements ModTextureDefinition {
}
@Override
@Deprecated
public CopyBlockTextureRecord addCopyBlockTextureRecord(int blockID,
int srcBlockID, int srcMeta) {
CopyBlockTextureRecordImpl btr = new CopyBlockTextureRecordImpl(blockID, srcBlockID, srcMeta);
@ -252,6 +255,7 @@ public class ModTextureDefinitionImpl implements ModTextureDefinition {
return btr;
}
@Override
@Deprecated
public CopyBlockTextureRecord addCopyBlockTextureRecord(String blockname,
String srcBlockName, int srcMeta) {
CopyBlockTextureRecordImpl btr = new CopyBlockTextureRecordImpl(blockname, srcBlockName, srcMeta);
@ -259,6 +263,15 @@ public class ModTextureDefinitionImpl implements ModTextureDefinition {
return btr;
}
@Override
public CopyBlockTextureRecord addCopyBlockTextureRecord(String blockname,
String srcBlockName, Map<String, String> srcStateMap) {
CopyBlockTextureRecordImpl btr = new CopyBlockTextureRecordImpl(blockname, srcBlockName, srcStateMap);
blkCopyTextureRec.add(btr);
return btr;
}
public boolean isPublished() {
return published;
}

View File

@ -3,6 +3,8 @@ package org.dynmap.modsupport.impl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import org.dynmap.modsupport.BlockSide;
import org.dynmap.modsupport.ModelBlockModel;
@ -21,7 +23,7 @@ public class ModelBlockModelImpl extends BlockModelImpl implements ModelBlockMod
private double xrot = 0, yrot = 0, zrot = 0;
private boolean shade;
@Override
public void addBlockSide(BlockSide side, double[] uv, SideRotation rot, int textureid) {
public void addBlockSide(BlockSide side, double[] uv, SideRotation rot, int textureid, int tintidx) {
ModelSide ms = new ModelSide();
ms.textureid = textureid;
if (uv != null) {
@ -38,11 +40,15 @@ public class ModelBlockModelImpl extends BlockModelImpl implements ModelBlockMod
if (side == BlockSide.FACE_5 || side == BlockSide.X_PLUS) side = BlockSide.EAST;
sides.put(side, ms);
}
}
@Override
public void addBlockSide(BlockSide side, double[] uv, SideRotation rot, int textureid) {
addBlockSide(side, uv, rot, textureid, -1);
}
}
private ArrayList<ModelBlockImpl> boxes = new ArrayList<ModelBlockImpl>();
private String rotsourceblockname;
private int rotsourcemetaindex;
private Map<String, String> rotsourcestatemap;
private int xrot, yrot, zrot;
public ModelBlockModelImpl(String blkname, ModModelDefinitionImpl mdf) {
@ -52,7 +58,8 @@ public class ModelBlockModelImpl extends BlockModelImpl implements ModelBlockMod
public ModelBlockModelImpl(String blkname, ModModelDefinitionImpl mdf, ModelBlockModel mod, int xrot, int yrot, int zrot) {
super(blkname, mdf);
this.rotsourceblockname = mod.getBlockNames()[0];
this.rotsourcemetaindex = Integer.numberOfTrailingZeros(mod.getMetaValueMask());
this.rotsourcestatemap = new HashMap<String, String>();
this.rotsourcestatemap.putAll(mod.getBlockStateMappings().get(0));
this.xrot = xrot; this.yrot = yrot; this.zrot = zrot;
}
@ -73,7 +80,20 @@ public class ModelBlockModelImpl extends BlockModelImpl implements ModelBlockMod
String line = String.format("patchblock:%s", ids);
// If rotating another model
if (rotsourceblockname != null) {
line += "\npatchrotate:id=" + rotsourceblockname + ",data=" + rotsourcemetaindex;
line += "\npatchrotate:id=" + rotsourceblockname;
if (rotsourcestatemap != null) {
line += ",state=";
boolean first = true;
for (Entry<String, String> r : rotsourcestatemap.entrySet()) {
if (first) {
first = false;
}
else {
line += '/';
}
line += r.getKey() + ":" + r.getValue();
}
}
if (xrot != 0) {
line += ",rotx=" + xrot;
}

View File

@ -4,6 +4,7 @@ import org.dynmap.modsupport.PaneBlockModel;
public class PaneBlockModelImpl extends BlockModelImpl implements PaneBlockModel {
@Deprecated
public PaneBlockModelImpl(int blkid, ModModelDefinitionImpl mdf) {
super(blkid, mdf);
}

View File

@ -8,6 +8,7 @@ import org.dynmap.renderer.RenderPatchFactory.SideVisible;
public class PatchBlockModelImpl extends BlockModelImpl implements PatchBlockModel {
private ArrayList<String> patches = new ArrayList<String>();
@Deprecated
public PatchBlockModelImpl(int blkid, ModModelDefinitionImpl mdf) {
super(blkid, mdf);
}
@ -15,6 +16,7 @@ public class PatchBlockModelImpl extends BlockModelImpl implements PatchBlockMod
super(blkname, mdf);
}
@Deprecated
public PatchBlockModelImpl(int blkid, ModModelDefinitionImpl mdf, PatchBlockModel mod, int xrot, int yrot, int zrot) {
super(blkid, mdf);
PatchBlockModelImpl m = (PatchBlockModelImpl) mod;

View File

@ -6,6 +6,7 @@ import org.dynmap.renderer.RenderPatchFactory.SideVisible;
public class PlantBlockModelImpl extends BlockModelImpl implements PlantBlockModel {
private String patch0;
@Deprecated
public PlantBlockModelImpl(int blkid, ModModelDefinitionImpl mdf) {
super(blkid, mdf);
patch0 = mdf.getPatchID(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, SideVisible.FLIP);

View File

@ -4,6 +4,7 @@ import org.dynmap.modsupport.StairBlockModel;
public class StairBlockModelImpl extends BlockModelImpl implements StairBlockModel {
@Deprecated
public StairBlockModelImpl(int blkid, ModModelDefinitionImpl mdf) {
super(blkid, mdf);
}

View File

@ -2,6 +2,7 @@ package org.dynmap.modsupport.impl;
import org.dynmap.modsupport.VolumetricBlockModel;
@Deprecated
public class VolumetricBlockModelImpl extends BlockModelImpl implements VolumetricBlockModel {
private boolean[][][] grid;

View File

@ -8,6 +8,7 @@ public class WallFenceBlockModelImpl extends BlockModelImpl implements WallFence
private final FenceType type;
private int[] linked = new int[0];
@Deprecated
public WallFenceBlockModelImpl(int blkid, ModModelDefinitionImpl mdf, FenceType type) {
super(blkid, mdf);
this.type = type;
@ -23,6 +24,7 @@ public class WallFenceBlockModelImpl extends BlockModelImpl implements WallFence
}
@Override
@Deprecated
public void addLinkedBlockID(int blkid) {
int len = linked.length;
linked = Arrays.copyOf(linked, len+1);
@ -30,6 +32,7 @@ public class WallFenceBlockModelImpl extends BlockModelImpl implements WallFence
}
@Override
@Deprecated
public int[] getLinkedBlockIDs() {
return linked;
}

View File

@ -1,5 +1,8 @@
package org.dynmap.modsupport;
import java.util.List;
import java.util.Map;
/**
* Generic block model
*/
@ -10,11 +13,13 @@ public interface BlockModel {
* Add block ID to mapping (in case multiple block IDs use same model)
* @param blockID - block ID
*/
@Deprecated
public void addBlockID(int blockID);
/**
* Get block IDs
* @return configured IDs
*/
@Deprecated
public int[] getBlockIDs();
/**
* Add block name to mapping (in case multiple block names use same model)
@ -30,10 +35,22 @@ public interface BlockModel {
* Set metadata value : default is for all values (data=*). Setting other values will match only the values that are set
* @param data - value to match (-1 = all, 0-15 is meta value to match)
*/
@Deprecated
public void setMetaValue(int data);
/**
* Get matching metadata value mask
* @return matching metadata mask: bit N is set if given metadata value matches
*/
@Deprecated
public int getMetaValueMask();
/**
* Set matching block state mapping
* Any key-value pairs included must match, while any not included are assumed to match unconditionall
* @param statemap - map of attribute value pairs
*/
public void setBlockStateMapping(Map<String, String> statemap);
/**
* Get all state mappings accumulated for the block model
*/
public List<Map<String, String>> getBlockStateMappings();
}

View File

@ -1,5 +1,8 @@
package org.dynmap.modsupport;
import java.util.List;
import java.util.Map;
/**
* Record representing a texture mapping for one or more blocks
*/
@ -10,11 +13,13 @@ public interface BlockTextureRecord {
* Add block ID to mapping (in case multiple block IDs use same texture mapping)
* @param blockID - block ID
*/
@Deprecated
public void addBlockID(int blockID);
/**
* Get block IDs
* @return configured IDs
*/
@Deprecated
public int[] getBlockIDs();
/**
* Add block name to mapping (in case multiple block names use same model)
@ -30,12 +35,24 @@ public interface BlockTextureRecord {
* Set metadata value : default is for all values (data=*). Setting other values will match only the values that are set
* @param data - value to match (-1 = all, 0-15 is meta value to match)
*/
@Deprecated
public void setMetaValue(int data);
/**
* Get matching metadata value mask
* @return matching metadata mask: bit N is set if given metadata value matches
*/
@Deprecated
public int getMetaValueMask();
/**
* Set matching block state mapping
* Any key-value pairs included must match, while any not included are assumed to match unconditionall
* @param statemap - map of attribute value pairs
*/
public void setBlockStateMapping(Map<String, String> statemap);
/**
* Get all state mappings accumulated for the block model
*/
public List<Map<String, String>> getBlockStateMappings();
/**
* Set transparency mode for block
* @param mode - transparency mode

View File

@ -1,5 +1,8 @@
package org.dynmap.modsupport;
import java.util.List;
import java.util.Map;
/**
* Record representing a texture mapping for one or more blocks, based on copying an existing one
*/
@ -10,11 +13,13 @@ public interface CopyBlockTextureRecord {
* Add block ID to mapping (in case multiple block IDs use same texture mapping)
* @param blockID - block ID
*/
@Deprecated
public void addBlockID(int blockID);
/**
* Get block IDs
* @return configured IDs
*/
@Deprecated
public int[] getBlockIDs();
/**
* Add block name to mapping (in case multiple block names use same model)
@ -30,22 +35,44 @@ public interface CopyBlockTextureRecord {
* Set metadata value : default is for all values (data=*). Setting other values will match only the values that are set
* @param data - value to match (-1 = all, 0-15 is meta value to match)
*/
@Deprecated
public void setMetaValue(int data);
/**
* Get matching metadata value mask
* @return matching metadata mask: bit N is set if given metadata value matches
*/
@Deprecated
public int getMetaValueMask();
/**
* Get source block ID
* @return source block ID
*/
@Deprecated
public int getSourceBlockID();
/**
* Get source metadata
* @return souce meta ID
*/
@Deprecated
public int getSourceMeta();
/**
* Set matching block state mapping
* Any key-value pairs included must match, while any not included are assumed to match unconditionall
* @param statemap - map of attribute value pairs
*/
public void setBlockStateMapping(Map<String, String> statemap);
/**
* Get all state mappings accumulated for the block model
*/
public List<Map<String, String>> getBlockStateMappings();
/**
* Get source block name
*/
public String getSourceBlockName();
/**
* Get source block state map
*/
public Map<String, String> getSourceBlockStateMapping();
/**
* Set transparency mode for block
* @param mode - transparency mode

View File

@ -25,6 +25,7 @@ public interface ModModelDefinition {
* @param scale - grid scale (subblock array is scale x scale x scale) : from 1 to 16
* @return block model: use methods to set occupied subblocks
*/
@Deprecated
public VolumetricBlockModel addVolumetricModel(int blockid, int scale);
/**
* Add volumetric model : default assumes all metadata values are matching
@ -32,12 +33,14 @@ public interface ModModelDefinition {
* @param scale - grid scale (subblock array is scale x scale x scale) : from 1 to 16
* @return block model: use methods to set occupied subblocks
*/
@Deprecated
public VolumetricBlockModel addVolumetricModel(String blockname, int scale);
/**
* Add standard stair model : default assumes all metadata values are matching
* @param blockid - block ID
* @return block model record
*/
@Deprecated
public StairBlockModel addStairModel(int blockid);
/**
* Add standard stair model : default assumes all metadata values are matching
@ -51,6 +54,7 @@ public interface ModModelDefinition {
* @param type - type of wall or fence
* @return block model record
*/
@Deprecated
public WallFenceBlockModel addWallFenceModel(int blockid, WallFenceBlockModel.FenceType type);
/**
* Add wall or fence model : default assumes all metadata values are matching
@ -64,6 +68,7 @@ public interface ModModelDefinition {
* @param blockid - block ID
* @return block model record
*/
@Deprecated
public CuboidBlockModel addCuboidModel(int blockid);
/**
* Add cuboid model : default assumes all metadata values are matching
@ -76,6 +81,7 @@ public interface ModModelDefinition {
* @param blockid - block ID
* @return block model record
*/
@Deprecated
public PaneBlockModel addPaneModel(int blockid);
/**
* Add pane model : default assumes all metadata values are matching
@ -88,6 +94,7 @@ public interface ModModelDefinition {
* @param blockid - block ID
* @return block model record
*/
@Deprecated
public PlantBlockModel addPlantModel(int blockid);
/**
* Add standard plant model : default assumes all metadata values are matching
@ -100,6 +107,7 @@ public interface ModModelDefinition {
* @param blockid - block ID
* @return block model record
*/
@Deprecated
public BoxBlockModel addBoxModel(int blockid);
/**
* Add standard box model : default assumes all metadata values are matching
@ -112,6 +120,7 @@ public interface ModModelDefinition {
* @param blockid - block ID
* @return block model record
*/
@Deprecated
public DoorBlockModel addDoorModel(int blockid);
/**
* Add door model
@ -124,6 +133,7 @@ public interface ModModelDefinition {
* @param blockid - block ID
* @return block model record
*/
@Deprecated
public PatchBlockModel addPatchModel(int blockid);
/**
* Add patch box model : default assumes all metadata values are matching
@ -140,6 +150,7 @@ public interface ModModelDefinition {
* @param zrot - z rotation in degrees (0, 90, 180, 270)
* @return block model record
*/
@Deprecated
public PatchBlockModel addRotatedPatchModel(int blockid, PatchBlockModel model, int xrot, int yrot, int zrot);
/**
* Add rotated patch box model, based on existing model : default assumes all metadata values are matching

View File

@ -1,5 +1,7 @@
package org.dynmap.modsupport;
import java.util.Map;
/**
* Interface for texture definition for a given mod
*/
@ -120,6 +122,7 @@ public interface ModTextureDefinition {
* @param blockID - block ID
* @return block texture record: use methods to set texture use on faces/patches
*/
@Deprecated
public BlockTextureRecord addBlockTextureRecord(int blockID);
/**
* Add block texture record : default assumes all metadata values are matching
@ -134,6 +137,7 @@ public interface ModTextureDefinition {
* @param srcMeta - source meta (definition copied from)
* @return block texture record: use methods to set texture use on faces/patches
*/
@Deprecated
public CopyBlockTextureRecord addCopyBlockTextureRecord(int blockID, int srcBlockID, int srcMeta);
/**
* Add block texture record, based on copying a record : default assumes all metadata values are matching
@ -142,5 +146,14 @@ public interface ModTextureDefinition {
* @param srcMeta - source meta (definition copied from)
* @return block texture record: use methods to set texture use on faces/patches
*/
@Deprecated
public CopyBlockTextureRecord addCopyBlockTextureRecord(String blockname, String srcBlockname, int srcMeta);
/**
* Add block texture record, based on copying a record : default assumes all state values match
* @param blockname - block name
* @param srcBlockname - source block name (definition copied from)
* @param srcStateMap - source block state mapping (definition copied from)
* @return block texture record: use methods to set texture use on faces/patches
*/
public CopyBlockTextureRecord addCopyBlockTextureRecord(String blockname, String srcBlockname, Map<String,String> srcStateMap);
}

View File

@ -18,7 +18,9 @@ public interface ModelBlockModel extends BlockModel {
* @param uv - bounds on UV (umin, vmin, umax, vmax): if null, default based on face range
* @param rot - rotation of the block side (default id DEG0)
* @param textureid - texture ID
* @param tintidx - tintindex (-1 if none)
*/
public void addBlockSide(BlockSide side, double[] uv, SideRotation rot, int textureid, int tintidx);
public void addBlockSide(BlockSide side, double[] uv, SideRotation rot, int textureid);
}
/**

View File

@ -3,6 +3,7 @@ package org.dynmap.modsupport;
/**
* Volumetric block model - uses standard 6 sides texture indices
*/
@Deprecated
public interface VolumetricBlockModel extends BlockModel {
/**
* Set subblock to be filled

View File

@ -27,10 +27,12 @@ public interface WallFenceBlockModel extends BlockModel {
* Add block IDs linked with (beyond normal self and opaque blocks)
* @param blkid - block ID to link to
*/
@Deprecated
public void addLinkedBlockID(int blkid);
/**
* Get linked block IDs
* @return linked block ids
*/
@Deprecated
public int[] getLinkedBlockIDs();
}