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,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();
}