├── README
├── src
└── main
│ ├── java
│ └── org
│ │ └── dynmap
│ │ ├── modsupport
│ │ ├── BiomeTextureFile.java
│ │ ├── ChestTextureFile.java
│ │ ├── GridTextureFile.java
│ │ ├── SignTextureFile.java
│ │ ├── SkinTextureFile.java
│ │ ├── ShulkerTextureFile.java
│ │ ├── BigChestTextureFile.java
│ │ ├── PlantBlockModel.java
│ │ ├── DoorBlockModel.java
│ │ ├── TransparencyMode.java
│ │ ├── PaneBlockModel.java
│ │ ├── StairBlockModel.java
│ │ ├── TextureFileType.java
│ │ ├── BoxBlockModel.java
│ │ ├── ModSupportAPI.java
│ │ ├── VolumetricBlockModel.java
│ │ ├── BlockSide.java
│ │ ├── TextureFile.java
│ │ ├── WallFenceBlockModel.java
│ │ ├── CuboidBlockModel.java
│ │ ├── BlockModel.java
│ │ ├── TextureModifier.java
│ │ ├── CopyBlockTextureRecord.java
│ │ ├── CustomTextureFile.java
│ │ ├── PatchBlockModel.java
│ │ ├── ModModelDefinition.java
│ │ ├── ModTextureDefinition.java
│ │ └── BlockTextureRecord.java
│ │ ├── renderer
│ │ ├── RenderPatch.java
│ │ ├── CustomColorMultiplier.java
│ │ ├── MapDataContext.java
│ │ ├── RenderPatchFactory.java
│ │ └── CustomRenderer.java
│ │ ├── markers
│ │ ├── MarkerDescription.java
│ │ ├── Marker.java
│ │ ├── MarkerIcon.java
│ │ ├── PlayerSet.java
│ │ ├── PolyLineMarker.java
│ │ ├── CircleMarker.java
│ │ ├── GenericMarker.java
│ │ ├── MarkerAPI.java
│ │ ├── AreaMarker.java
│ │ └── MarkerSet.java
│ │ ├── permissions
│ │ └── PermissionsHandler.java
│ │ ├── DynmapCommonAPIListener.java
│ │ └── DynmapCommonAPI.java
│ └── assembly
│ └── package.xml
├── .gitignore
├── pom.xml
└── LICENSE
/README:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/BiomeTextureFile.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | public interface BiomeTextureFile extends TextureFile {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/ChestTextureFile.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | public interface ChestTextureFile extends TextureFile {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/GridTextureFile.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | public interface GridTextureFile extends TextureFile {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/SignTextureFile.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | public interface SignTextureFile extends TextureFile {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/SkinTextureFile.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | public interface SkinTextureFile extends TextureFile {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/ShulkerTextureFile.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | public interface ShulkerTextureFile extends TextureFile {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/BigChestTextureFile.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | public interface BigChestTextureFile extends TextureFile {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Eclipse stuff
2 | /.classpath
3 | /.project
4 | /.settings
5 |
6 | # netbeans
7 | /nbproject
8 |
9 | # we use maven!
10 | /build.xml
11 |
12 | # maven
13 | /target
14 |
15 | # vim
16 | .*.sw[a-p]
17 |
18 | # various other potential build files
19 | /build
20 | /bin
21 | /dist
22 | /manifest.mf
23 |
24 | # Mac filesystem dust
25 | /.DS_Store
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/PlantBlockModel.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | /**
4 | * Standard plant block model - two texture (patch0, patch1), one for each surface (typically the same)
5 | */
6 | public interface PlantBlockModel extends BlockModel {
7 | public static final int PATCH_FACE0 = 0;
8 | public static final int PATCH_FACE1 = 1;
9 | }
10 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/DoorBlockModel.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | /**
4 | * Standard door block model
5 | *
6 | * patch0 - the texture to be used for the tops of the door
7 | * patch1 - the texture to be used for the bottom of the door
8 | */
9 | public interface DoorBlockModel extends BlockModel {
10 | public static final int PATCH_TOP = 0;
11 | public static final int PATCH_BOTTOM = 1;
12 | }
13 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/TransparencyMode.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | public enum TransparencyMode {
4 | OPAQUE, // Block is solid and opaque: block light and has faces lit based on adjacent block's light level
5 | TRANSPARENT, // Block does not block light, and is lit based on its own light level
6 | SEMITRANSPARENT // Block is not solid, but blocks light and is lit by adjacent blocks (slabs, stairs)
7 | }
8 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/renderer/RenderPatch.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.renderer;
2 |
3 | /**
4 | * Interface for an allocated render patch - constructred using factory provided to CustomRenderer during
5 | * initialize() and/or during getRenderPatchList() call (via MapDataContext). Values are read-only once created,
6 | * and will be reused when possible.
7 | */
8 | public interface RenderPatch {
9 | public int getTextureIndex();
10 | }
11 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/markers/MarkerDescription.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.markers;
2 |
3 | public interface MarkerDescription extends GenericMarker {
4 | /**
5 | * Set marker description (HTML markup shown in popup when clicked)
6 | * @param desc - HTML markup description
7 | */
8 | public void setDescription(String desc);
9 | /**
10 | * Get marker description
11 | * @return descrption
12 | */
13 | public String getDescription();
14 | }
15 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/PaneBlockModel.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | /**
4 | * Glass pane / iron fence block model
5 | *
6 | * patch0 - Texture used for all the faces of the pane model (the "glass")
7 | * patch1 - Texture used for the edges of the panel model (the "frame")
8 | */
9 | public interface PaneBlockModel extends BlockModel {
10 | public static final int PATCH_FACE = 0;
11 | public static final int PATCH_EDGE = 1;
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/StairBlockModel.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | /**
4 | * Standard stairs block model
5 | *
6 | * patch0 - the texture to be used for any of the sides (vertical faces) of the block
7 | * patch1 - the texture to be used for the tops of the block
8 | * patch2 - the texture to be used for the bottom of the block
9 | */
10 | public interface StairBlockModel extends BlockModel {
11 | public static final int PATCH_SIDES = 0;
12 | public static final int PATCH_TOP = 1;
13 | public static final int PATCH_BOTTOM = 2;
14 | }
15 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/TextureFileType.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | public enum TextureFileType {
4 | GRID, // Default type - file is N x N grid of square textures (including simple single texture files
5 | CHEST, // Standard single chest texture
6 | BIGCHEST, // Standard double chest texture
7 | SIGN, // Standard signpost texture
8 | SKIN, // Standard player or humanoid model texture (zombie, skeleton)
9 | SHULKER, // Standard shulker and shulker box texture
10 | CUSTOM, // Custom patch layout in texture
11 | BIOME // Biome color map (256 x 256)
12 | }
13 |
--------------------------------------------------------------------------------
/src/main/assembly/package.xml:
--------------------------------------------------------------------------------
1 |
2 | bin
3 | false
4 |
5 | zip
6 |
7 |
8 |
9 |
10 |
11 | ${project.build.directory}/${artifactId}-${version}.jar
12 | /
13 | dynmap-api.jar
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/BoxBlockModel.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | /**
4 | * Standard box block model: cube with limits on X, Y, and/or Z - standard cube texture indexes
5 | */
6 | public interface BoxBlockModel extends BlockModel {
7 | /**
8 | * Set x range
9 | * @param xmin - x minimum
10 | * @param xmax - x maximum
11 | */
12 | public void setXRange(double xmin, double xmax);
13 | /**
14 | * Set y range
15 | * @param ymin - y minimum
16 | * @param ymax - y maximum
17 | */
18 | public void setYRange(double ymin, double ymax);
19 | /**
20 | * Set z range
21 | * @param zmin - z minimum
22 | * @param zmax - z maximum
23 | */
24 | public void setZRange(double zmin, double zmax);
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/ModSupportAPI.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | /**
4 | * API interface for mods to publish block rendering details to Dynmap
5 | */
6 | public abstract class ModSupportAPI {
7 | protected static ModSupportAPI api = null;
8 | /**
9 | * Get access to mod support API
10 | * Call and use before postInit()
11 | * @return API interface
12 | */
13 | public static ModSupportAPI getAPI() {
14 | return api;
15 | }
16 | /**
17 | * Get texture definition object for calling mod
18 | * @param modid - Mod ID
19 | * @param modver - Mod version
20 | * @return texture definition to be populated for the mod
21 | */
22 | public abstract ModTextureDefinition getModTextureDefinition(String modid, String modver);
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/renderer/CustomColorMultiplier.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.renderer;
2 |
3 | /**
4 | * Base class for custom color multiplier
5 | */
6 | public abstract class CustomColorMultiplier {
7 | /**
8 | * Default constructor - required
9 | */
10 | protected CustomColorMultiplier() {
11 | }
12 | /**
13 | * Cleanup custom color multiplier
14 | *
15 | * If overridden, super.cleanupColorMultiplier() should be called
16 | */
17 | public void cleanupColorMultiplier() {
18 | }
19 | /**
20 | * Compute color multiplier for current block, given context
21 | * @param mapDataCtx - Map data context: can be used to read any data available for map.
22 | * @return color multiplier (0xRRGGBB)
23 | */
24 | public abstract int getColorMultiplier(MapDataContext mapDataCtx);
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/VolumetricBlockModel.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | /**
4 | * Volumetric block model - uses standard 6 sides texture indices
5 | */
6 | public interface VolumetricBlockModel extends BlockModel {
7 | /**
8 | * Set subblock to be filled
9 | * @param x - x coordinate within grid (0 to (scale-1))
10 | * @param y - y coordinate within grid (0 to (scale-1))
11 | * @param z - z coordinate within grid (0 to (scale-1))
12 | */
13 | public void setSubBlockToFilled(int x, int y, int z);
14 | /**
15 | * Set subblock to be empty
16 | * @param x - x coordinate within grid (0 to (scale-1))
17 | * @param y - y coordinate within grid (0 to (scale-1))
18 | * @param z - z coordinate within grid (0 to (scale-1))
19 | */
20 | public void setSubBlockToEmpty(int x, int y, int z);
21 | }
22 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/BlockSide.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | /**
4 | * Standard block sides (and sets of sides) - for non-patch-index based models and default solid blocks
5 | */
6 | public enum BlockSide {
7 | FACE_0, // Standard MC face 0 (bottom - negative Y)
8 | FACE_1, // Standard MC face 1 (top - positive Y)
9 | FACE_2, // Standard MC face 2 (north - negative Z)
10 | FACE_3, // Standard MC face 3 (south - positive Z)
11 | FACE_4, // Standard MC face 4 (west - negative X)
12 | FACE_5, // Standard MC face 5 (east - positive X)
13 | BOTTOM, // FACE0
14 | TOP, // FACE1
15 | NORTH, // FACE2
16 | SOUTH, // FACE3
17 | WEST, // FACE4
18 | EAST, // FACE5
19 | Y_MINUS, // FACE0
20 | Y_PLUS, // FACE1
21 | Z_MINUS, // FACE2
22 | Z_PLUS, // FACE3
23 | X_MINUS, // FACE4
24 | X_PLUS, // FACE5
25 | ALLSIDES, // All sides: FACE2 | FACE3 | FACE4 | FACE5
26 | ALLFACES // All faces: FACE0 | FACE1 | ALLSIDES
27 | }
28 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 | us.dynmap
5 | DynmapCoreAPI
6 |
7 |
8 |
9 | org.apache.maven.plugins
10 | maven-compiler-plugin
11 | 2.0.2
12 |
13 | 1.7
14 | 1.7
15 |
16 |
17 |
18 | org.apache.maven.plugins
19 | maven-source-plugin
20 | 2.2.1
21 |
22 |
23 | attach-sources
24 |
25 | jar
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | 2.6-beta-1
35 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/TextureFile.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | public interface TextureFile {
4 | /**
5 | * Get texture ID
6 | * @return texture ID
7 | */
8 | public String getTextureID();
9 | /**
10 | * Get texture file name
11 | * @return texture file path and name
12 | */
13 | public String getTextureFile();
14 | /**
15 | * Get horizontal dimension (xcount) of texture file, in standard square patches (16 x 16 default, unless scaled)
16 | * @return xcount (horizontal dimension)
17 | */
18 | public int getXCount();
19 | /**
20 | * Get vertical dimension (ycount) of texture file, in standard square patches (16 x 16 default, unless scaled)
21 | * @return ycount (vertcal dimension)
22 | */
23 | public int getYCount();
24 | /**
25 | * Get texture file format type
26 | * @return format type
27 | */
28 | public TextureFileType getFileType();
29 | /**
30 | * Get patch count for file (xcount x ycount for GRID, type specific counts for others). Patches are from 0 to (count-1)
31 | * @return patch count
32 | */
33 | public int getPatchCount();
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/WallFenceBlockModel.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | /**
4 | * Standard fence or wall block model
5 | *
6 | * patch0 - the texture to be used for any of the sides (vertical faces) of the block
7 | * patch1 - the texture to be used for the tops of the block
8 | * patch2 - the texture to be used for the bottom of the block
9 | */
10 | public interface WallFenceBlockModel extends BlockModel {
11 | public static final int PATCH_SIDES = 0;
12 | public static final int PATCH_TOP = 1;
13 | public static final int PATCH_BOTTOM = 2;
14 | /**
15 | * Type wall/fence
16 | */
17 | public enum FenceType {
18 | FENCE, // Standard fence
19 | WALL // Standard wall
20 | }
21 | /**
22 | * Get fence type
23 | * return fence type
24 | */
25 | public FenceType getFenceType();
26 | /**
27 | * Add block IDs linked with (beyond normal self and opaque blocks)
28 | * @param blkid - block ID to link to
29 | */
30 | public void addLinkedBlockID(int blkid);
31 | /**
32 | * Get linked block IDs
33 | * @return linked block ids
34 | */
35 | public int[] getLinkedBlockIDs();
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/markers/Marker.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.markers;
2 |
3 | /**
4 | * This defines the public interface to a marker object, for use with the MarkerAPI
5 | */
6 | public interface Marker extends MarkerDescription {
7 | /**
8 | * Get marker's X coordinate
9 | * @return x coordinate
10 | */
11 | public double getX();
12 | /**
13 | * Get marker's Y coordinate
14 | * @return y coordinate
15 | */
16 | public double getY();
17 | /**
18 | * Get marker's Z coordinate
19 | * @return z coordinate
20 | */
21 | public double getZ();
22 | /**
23 | * Update the marker's location
24 | * @param worldid - world ID
25 | * @param x - x coord
26 | * @param y - y coord
27 | * @param z - z coord
28 | */
29 | public void setLocation(String worldid, double x, double y, double z);
30 | /**
31 | * Get the marker's icon
32 | * @return marker icon
33 | */
34 | public MarkerIcon getMarkerIcon();
35 | /**
36 | * Set the marker's icon
37 | * @param icon - new marker icon
38 | * @return true if new marker icon set, false if not allowed
39 | */
40 | public boolean setMarkerIcon(MarkerIcon icon);
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/CuboidBlockModel.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | /**
4 | * Cuboid block model
5 | */
6 | public interface CuboidBlockModel extends BlockModel {
7 | /**
8 | * Add cuboid to model
9 | *
10 | * @param xmin - minimum x
11 | * @param ymin - minimum y
12 | * @param zmin - minimum z
13 | * @param xmax - maximum x
14 | * @param ymax - maximum y
15 | * @param zmax - maximum z
16 | * @param patchIndices - array of patch indexes, ordered by standard block face order (y-, y+, z-, z+, x-, x+): if null, default is 0,1,2,3,4,5
17 | */
18 | public void addCuboid(double xmin, double ymin, double zmin, double xmax, double ymax, double zmax, int[] patchIndices);
19 | /**
20 | * Add crossed patches (like plants) to model
21 | * @param xmin - minimum x
22 | * @param ymin - minimum y
23 | * @param zmin - minimum z
24 | * @param xmax - maximum x
25 | * @param ymax - maximum y
26 | * @param zmax - maximum z
27 | * @param patchIndex - index of patch to use for both patches
28 | */
29 | public void addCrossedPatches(double xmin, double ymin, double zmin, double xmax, double ymax, double zmax, int patchIndex);
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/BlockModel.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | /**
4 | * Generic block model
5 | */
6 | public interface BlockModel {
7 | public static final int METAMASK_ALL = -1;
8 |
9 | /**
10 | * Add block ID to mapping (in case multiple block IDs use same model)
11 | * @param blockID - block ID
12 | */
13 | public void addBlockID(int blockID);
14 | /**
15 | * Get block IDs
16 | * @return configured IDs
17 | */
18 | public int[] getBlockIDs();
19 | /**
20 | * Add block name to mapping (in case multiple block names use same model)
21 | * @param blockname - block name
22 | */
23 | public void addBlockName(String blockname);
24 | /**
25 | * Get block names
26 | * @return configured names
27 | */
28 | public String[] getBlockNames();
29 | /**
30 | * Set metadata value : default is for all values (data=*). Setting other values will match only the values that are set
31 | * @param data - value to match (-1 = all, 0-15 is meta value to match)
32 | */
33 | public void setMetaValue(int data);
34 | /**
35 | * Get matching metadata value mask
36 | * @return matching metadata mask: bit N is set if given metadata value matches
37 | */
38 | public int getMetaValueMask();
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/TextureModifier.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | /**
4 | * Texture presentation modifier
5 | */
6 | public enum TextureModifier {
7 | NONE, // No modifier
8 | GRASSTONED, // Tone texture using grass biome colormap
9 | FOLIAGETONED, // Tone texture using foliage biome colormap
10 | WATERTONED, // Tone texture using water biome colormap
11 | ROT90, // Rotate texture 90 degrees
12 | ROT180, // Rotate texture 180 degrees
13 | ROT270, // Rotate texture 270 degrees
14 | FLIPHORIZ, // Flip texture horizontally
15 | SHIFTDOWNHALF, // Shift texture down 50% of block height
16 | SHIFTDOWNHALFANDFLIPHORIZ, // SHIFTDOWNHALF and FLIPHORIZ
17 | INCLINEDTORCH, // Shear texture for side of torch
18 | GRASSSIDE, // Block is grass side: overlay grass side or snow side if snow above
19 | CLEARINSIDE, // Block is transparent solid: don't render interior surfaces
20 | PINETONED, // Tone texture using pine leaves colormap
21 | BIRCHTONED, // Tone texture using birch leaves colormap
22 | LILYTONED, // Tone texture using lily pad colormap
23 | MULTTONED, // Tone texture using fixed color multipler, or custom multiplier
24 | GRASSTONED270, // GRASSTONED and ROT280
25 | FOLIAGETONED270, // FOLIAGETONED and ROT270
26 | WATERTONED270, // WATERTONED and ROT270
27 | MULTTONED_CLEARINSIDE, // MULTTONED and CLEARINSIDE
28 | FOLIAGEMULTTONED // FOLIAGETONED and MULTTONED
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/markers/MarkerIcon.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.markers;
2 |
3 | import java.io.InputStream;
4 |
5 | /**
6 | * This defines the public interface to a marker icon, for use with the MarkerAPI
7 | */
8 | public interface MarkerIcon {
9 | /** Default marker icon - always exists */
10 | public static final String DEFAULT = "default";
11 | /** Default sign marker icon - always exists */
12 | public static final String SIGN = "sign";
13 | /** Default world marker icon - always exists */
14 | public static final String WORLD = "world";
15 |
16 | public enum MarkerSize {
17 | MARKER_8x8("8x8"),
18 | MARKER_16x16("16x16"),
19 | MARKER_32x32("32x32");
20 |
21 | String sz;
22 | MarkerSize(String sz) {
23 | this.sz = sz;
24 | }
25 | public String getSize() {
26 | return sz;
27 | }
28 | }
29 | /**
30 | * Get ID of the marker icon (unique among marker icons)
31 | * @return ID
32 | */
33 | public String getMarkerIconID();
34 | /**
35 | * Get label for marker icon (descriptive - for helping select icon, or for legend/key)
36 | * @return icon label
37 | */
38 | public String getMarkerIconLabel();
39 | /**
40 | * Set label for marker icon
41 | */
42 | public void setMarkerIconLabel(String lbl);
43 | /**
44 | * Replace icon image for icon
45 | * @param in - input stream for PNG file
46 | */
47 | public void setMarkerIconImage(InputStream in);
48 | /**
49 | * Delete icon (not functional on builtin icons)
50 | */
51 | public void deleteIcon();
52 | /**
53 | * Is builtin marker
54 | * @return true
55 | */
56 | public boolean isBuiltIn();
57 | /**
58 | * Get marker size
59 | */
60 | public MarkerSize getMarkerIconSize();
61 | }
62 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/CopyBlockTextureRecord.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | /**
4 | * Record representing a texture mapping for one or more blocks, based on copying an existing one
5 | */
6 | public interface CopyBlockTextureRecord {
7 | public static final int METAMASK_ALL = -1;
8 |
9 | /**
10 | * Add block ID to mapping (in case multiple block IDs use same texture mapping)
11 | * @param blockID - block ID
12 | */
13 | public void addBlockID(int blockID);
14 | /**
15 | * Get block IDs
16 | * @return configured IDs
17 | */
18 | public int[] getBlockIDs();
19 | /**
20 | * Add block name to mapping (in case multiple block names use same model)
21 | * @param blockname - block name
22 | */
23 | public void addBlockName(String blockname);
24 | /**
25 | * Get block names
26 | * @return configured names
27 | */
28 | public String[] getBlockNames();
29 | /**
30 | * Set metadata value : default is for all values (data=*). Setting other values will match only the values that are set
31 | * @param data - value to match (-1 = all, 0-15 is meta value to match)
32 | */
33 | public void setMetaValue(int data);
34 | /**
35 | * Get matching metadata value mask
36 | * @return matching metadata mask: bit N is set if given metadata value matches
37 | */
38 | public int getMetaValueMask();
39 | /**
40 | * Get source block ID
41 | * @return source block ID
42 | */
43 | public int getSourceBlockID();
44 | /**
45 | * Get source metadata
46 | * @return souce meta ID
47 | */
48 | public int getSourceMeta();
49 | /**
50 | * Set transparency mode for block
51 | * @param mode - transparency mode
52 | */
53 | public void setTransparencyMode(TransparencyMode mode);
54 | /**
55 | * Get transparency mode for block
56 | * @return transparency mode
57 | */
58 | public TransparencyMode getTransparencyMode();
59 | }
60 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/permissions/PermissionsHandler.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.permissions;
2 |
3 | import java.util.Set;
4 |
5 |
6 | public abstract class PermissionsHandler {
7 | /**
8 | * Location to install provider (used by DynmapCBBridge)
9 | */
10 | private static PermissionsHandler handler = null;
11 |
12 | /**
13 | * Set handler (used by DynmapCBBridge)
14 | */
15 | public static void setHandler(PermissionsHandler ph) {
16 | handler = ph;
17 | }
18 | /**
19 | * Get handler
20 | */
21 | public static PermissionsHandler getHandler() {
22 | return handler;
23 | }
24 | /**
25 | * Test if given logged in user has given permissions
26 | *
27 | * @param username - user name
28 | * @param perm - permission (relative ID - e.g. 'dynmap.fullrender' is 'fullrender')
29 | * @return true if has permission, false if not
30 | *
31 | */
32 | public abstract boolean hasPermission(String username, String perm);
33 | /**
34 | * Test if given logged in user has given permission node
35 | *
36 | * @param username - user name
37 | * @param perm - permission (relative ID - e.g. 'dynmap.fullrender' is 'fullrender')
38 | * @return true if has permission, false if not
39 | *
40 | */
41 | public abstract boolean hasPermissionNode(String username, String perm);
42 | /**
43 | * Test if given (potentially offline) user has the given permissions
44 | *
45 | * @param username - user name
46 | * @param perms - permissions to be tested
47 | * @return set of permissions granted to user
48 | */
49 | public abstract Set hasOfflinePermissions(String username, Set perms);
50 | /**
51 | * Test if given (potentially offline) user has the given permission
52 | *
53 | * @param player - user name
54 | * @param perm - permission
55 | * @return true if has permission, false if not
56 | */
57 | public abstract boolean hasOfflinePermission(String player, String perm);
58 | }
59 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/markers/PlayerSet.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.markers;
2 |
3 | import java.util.Set;
4 |
5 | /**
6 | * Interface defining a set of players that can be made visible on the map to other players with the needed permissions.
7 | * The set can have symmetric access - meaning that any player in the set can see the other players in the set.
8 | * In any case, players with the permission node 'dynmap.playerset.<set-id>' can see players in the set.
9 | */
10 | public interface PlayerSet {
11 | /**
12 | * Get player set ID
13 | * @return set ID
14 | */
15 | public String getSetID();
16 | /**
17 | * Get player in set
18 | * @return set of player IDs
19 | */
20 | public Set getPlayers();
21 | /**
22 | * Set players in set (replace existing list)
23 | * @param players - set of players
24 | */
25 | public void setPlayers(Set players);
26 | /**
27 | * Add player to set
28 | * @param player - player ID
29 | */
30 | public void addPlayer(String player);
31 | /**
32 | * Delete player from set
33 | * @param player - player ID
34 | */
35 | public void removePlayer(String player);
36 | /**
37 | * Test if player is in set
38 | * @param player - player ID
39 | * @return true if in set, false if not
40 | */
41 | public boolean isPlayerInSet(String player);
42 | /**
43 | * Delete player set
44 | */
45 | public void deleteSet();
46 | /**
47 | * Test if set is symmetric (players in set can see other players in set)
48 | *
49 | * @return true if players in set can see other players in set (independent of privileges)
50 | */
51 | public boolean isSymmetricSet();
52 | /**
53 | * Set the symmetric access for the set
54 | * @param symmetric - true=players in set can see players in set, false=privilege is always required
55 | */
56 | public void setSymmetricSet(boolean symmetric);
57 | /**
58 | * Test if set is persistent (stored across restarts)
59 | *
60 | * @return true if persistent, false if transient
61 | */
62 | public boolean isPersistentSet();
63 | }
64 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/CustomTextureFile.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | /**
4 | * Interface for custom texture files - provides methods needed to define custom patches within the texture file
5 | */
6 | public interface CustomTextureFile extends TextureFile {
7 | /**
8 | * Set custom patch within texture file. Coordinates assume that nominal dimensions of the texture file are 16*xcount wide and 16*ycount high.
9 | * @param patchID - ID of the patch within the file (must start from 0, and be consecutive)
10 | * @param xpos - horizontal position of top-left corner of the texture within the file (left column = 0, right column = (16*xcount - 1)
11 | * @param ypos - vertical positon of the top-left corner of the texture within the file (top row = 0, bottom row = (16*ycount - 1)
12 | * @param xdim - width of the patch, in scaled pixels
13 | * @param ydim - height of the patch, in scaled pixels
14 | * @param xdest - horizontal position within the destination patch of the top-left corner
15 | * @param ydest - vertical position within the destination oatch of the top-left corner
16 | * @return true if good patch, false if error
17 | */
18 | public boolean setCustomPatch(int patchID, int xpos, int ypos, int xdim, int ydim, int xdest, int ydest);
19 | /**
20 | * Set custom patch within texture file. Coordinates assume that nominal dimensions of the texture file are 16*xcount wide and 16*ycount high.
21 | * Resulting patch is square with top-left corner of source in top-left corner of patch.
22 | * @param patchID - ID of the patch within the file (must start from 0, and be consecutive)
23 | * @param xpos - horizontal position of top-left corner of the texture within the file (left column = 0, right column = (16*xcount - 1)
24 | * @param ypos - vertical positon of the top-left corner of the texture within the file (top row = 0, bottom row = (16*ycount - 1)
25 | * @param xdim - width of the patch, in scaled pixels
26 | * @param ydim - height of the patch, in scaled pixels
27 | * @return true if good patch, false if error
28 | */
29 | public boolean setCustomPatch(int patchID, int xpos, int ypos, int xdim, int ydim);
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/markers/PolyLineMarker.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.markers;
2 |
3 | /**
4 | * This defines the public interface to a poly-line marker object, for use with the MarkerAPI
5 | */
6 | public interface PolyLineMarker extends MarkerDescription {
7 | /**
8 | * Get corner location count
9 | */
10 | public int getCornerCount();
11 | /**
12 | * Get X coordinate of corner N
13 | * @param n - corner index
14 | * @return coordinate
15 | */
16 | public double getCornerX(int n);
17 | /**
18 | * Get Y coordinate of corner N
19 | * @param n - corner index
20 | * @return coordinate
21 | */
22 | public double getCornerY(int n);
23 | /**
24 | * Get Z coordinate of corner N
25 | * @param n - corner index
26 | * @return coordinate
27 | */
28 | public double getCornerZ(int n);
29 | /**
30 | * Set coordinates of corner N
31 | * @param n - index of corner: append new corner if >= corner count, else replace existing
32 | * @param x - x coordinate
33 | * @param y - y coordinate
34 | * @param z - z coordinate
35 | */
36 | public void setCornerLocation(int n, double x, double y, double z);
37 | /**
38 | * Set/replace all corners
39 | * @param x - list of x coordinates
40 | * @param y - list of y coordinates
41 | * @param z - list of z coordinates
42 | */
43 | public void setCornerLocations(double[] x, double[] y, double[] z);
44 | /**
45 | * Delete corner N - shift corners after N forward
46 | * @param n - index of corner
47 | */
48 | public void deleteCorner(int n);
49 | /**
50 | * Set line style
51 | * @param weight - stroke weight
52 | * @param opacity - stroke opacity
53 | * @param color - stroke color (0xRRGGBB)
54 | */
55 | public void setLineStyle(int weight, double opacity, int color);
56 | /**
57 | * Get line weight
58 | * @return weight
59 | */
60 | public int getLineWeight();
61 | /**
62 | * Get line opacity
63 | * @return opacity (0.0-1.0)
64 | */
65 | public double getLineOpacity();
66 | /**
67 | * Get line color
68 | * @return color (0xRRGGBB)
69 | */
70 | public int getLineColor();
71 | }
72 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/renderer/MapDataContext.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.renderer;
2 |
3 | /**
4 | * Interface allowing a custom renderer to access the available map data needed to generate the render patch
5 | * list for the requested block data.
6 | * The context assures availability of the block data for the block requested, all blocks within the chunk
7 | * containing the block, and all the blocks adjacent to the block, at a minimum.
8 | */
9 | public interface MapDataContext {
10 | /**
11 | * Get render patch factory - for allocating patches
12 | * @return render patch factory
13 | */
14 | public RenderPatchFactory getPatchFactory();
15 | /**
16 | * Get block type ID of requested block
17 | */
18 | public int getBlockTypeID();
19 | /**
20 | * Get block data of the requested block
21 | */
22 | public int getBlockData();
23 | /**
24 | * Get Tile Entity field value for requested block
25 | * @param fieldId - field ID
26 | * @return value, or null of not found or available
27 | */
28 | public Object getBlockTileEntityField(String fieldId);
29 | /**
30 | * Get block type ID of block at relative offset from requested block
31 | * @param xoff - offset on X axis
32 | * @param yoff - offset on Y axis
33 | * @param zoff - offset on Z axis
34 | */
35 | public int getBlockTypeIDAt(int xoff, int yoff, int zoff);
36 | /**
37 | * Get block data of block at relative offset from requested block
38 | * @param xoff - offset on X axis
39 | * @param yoff - offset on Y axis
40 | * @param zoff - offset on Z axis
41 | */
42 | public int getBlockDataAt(int xoff, int yoff, int zoff);
43 | /**
44 | * Get Tile Entity field value of block at relative offset from requested block
45 | * @param fieldId - field ID
46 | * @param xoff - offset on X axis
47 | * @param yoff - offset on Y axis
48 | * @param zoff - offset on Z axis
49 | * @return value, or null of not found or available
50 | */
51 | public Object getBlockTileEntityFieldAt(String fieldId, int xoff, int yoff, int zoff);
52 | /**
53 | * Get current X coordinate
54 | */
55 | public int getX();
56 | /**
57 | * Get current Y coordinate
58 | */
59 | public int getY();
60 | /**
61 | * Get current Z coordinate
62 | */
63 | public int getZ();
64 | }
65 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/markers/CircleMarker.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.markers;
2 |
3 | /**
4 | * This defines the public interface to a circle marker object, for use with the MarkerAPI
5 | */
6 | public interface CircleMarker extends MarkerDescription {
7 | /**
8 | * Get center X coordinate
9 | * @return x coordinate
10 | */
11 | public double getCenterX();
12 | /**
13 | * Get center Y coordinate
14 | * @return y coordinate
15 | */
16 | public double getCenterY();
17 | /**
18 | * Get center Z coordinate
19 | * @return z coordinate
20 | */
21 | public double getCenterZ();
22 | /**
23 | * Update the cenerlocation
24 | * @param worldid - world ID
25 | * @param x - x coord
26 | * @param y - y coord
27 | * @param z - z coord
28 | */
29 | public void setCenter(String worldid, double x, double y, double z);
30 | /**
31 | * Get radius - X axis
32 | *
33 | * @return radius, in blocks, of X axis
34 | */
35 | public double getRadiusX();
36 | /**
37 | * Get radius - Z axis
38 | *
39 | * @return radius, in blocks, of Z axis
40 | */
41 | public double getRadiusZ();
42 | /**
43 | * Set X and Z radii
44 | *
45 | * @param xr - radius on X axis
46 | * @param zr - radius on Z axis
47 | */
48 | public void setRadius(double xr, double zr);
49 | /**
50 | * Set line style
51 | * @param weight - stroke weight
52 | * @param opacity - stroke opacity
53 | * @param color - stroke color (0xRRGGBB)
54 | */
55 | public void setLineStyle(int weight, double opacity, int color);
56 | /**
57 | * Get line weight
58 | * @return weight
59 | */
60 | public int getLineWeight();
61 | /**
62 | * Get line opacity
63 | * @return opacity (0.0-1.0)
64 | */
65 | public double getLineOpacity();
66 | /**
67 | * Get line color
68 | * @return color (0xRRGGBB)
69 | */
70 | public int getLineColor();
71 | /**
72 | * Set fill style
73 | * @param opacity - fill color opacity
74 | * @param color - fill color (0xRRGGBB)
75 | */
76 | public void setFillStyle(double opacity, int color);
77 | /**
78 | * Get fill opacity
79 | * @return opacity (0.0-1.0)
80 | */
81 | public double getFillOpacity();
82 | /**
83 | * Get fill color
84 | * @return color (0xRRGGBB)
85 | */
86 | public int getFillColor();
87 | /**
88 | * Set resolution boost flag
89 | * @param bflag - boost flag
90 | */
91 | public void setBoostFlag(boolean bflag);
92 | /**
93 | * Get resolution boost flag
94 | * @return boost flag
95 | */
96 | public boolean getBoostFlag();
97 | }
98 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/markers/GenericMarker.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.markers;
2 |
3 | /**
4 | * This defines the public interface to a generic marker object, for use with the MarkerAPI
5 | */
6 | public interface GenericMarker {
7 | /**
8 | * Get ID of the marker (unique string within the MarkerSet)
9 | * @return id of marker
10 | */
11 | public String getMarkerID();
12 | /**
13 | * Get the marker set for the marker
14 | * @return marker set
15 | */
16 | public MarkerSet getMarkerSet();
17 | /**
18 | * Set the marker set for the marker
19 | */
20 | public void setMarkerSet(MarkerSet newset);
21 | /**
22 | * Delete the marker
23 | */
24 | public void deleteMarker();
25 | /**
26 | * Get marker's world ID
27 | * @return world id
28 | */
29 | public String getWorld();
30 | /**
31 | * Get marker's world ID (normalized - used for directory and URL names in Dynmap - '/' replaced with '_')
32 | * @return world id
33 | */
34 | public String getNormalizedWorld();
35 | /**
36 | * Test if marker is persistent
37 | */
38 | public boolean isPersistentMarker();
39 | /**
40 | * Get the marker's label
41 | */
42 | public String getLabel();
43 | /**
44 | * Update the marker's label (plain text)
45 | */
46 | public void setLabel(String lbl);
47 | /**
48 | * Update the marker's label and markup flag
49 | * @param lbl - label string
50 | * @param markup - if true, label is processed as HTML (innerHTML for <span> used for label); false implies plaintext
51 | */
52 | public void setLabel(String lbl, boolean markup);
53 | /**
54 | * Test if marker label is processed as HTML
55 | */
56 | public boolean isLabelMarkup();
57 | /**
58 | * Get minimum zoom level for marker to be visible (overrides minzoom for marker set, if any)
59 | * @return -1 if no minimum, >0 = lowest level of zoom marker is shown
60 | */
61 | public int getMinZoom();
62 | /**
63 | * Set minimum zoom level for marker to be visible (overrides minzoom for marker set, if any)
64 | * @param zoom : -1 if no minimum, >0 = lowest level of zoom marker is shown
65 | */
66 | public void setMinZoom(int zoom);
67 | /**
68 | * Get maximum zoom level for marker to be visible (overrides maxzoom for marker set, if any)
69 | * @return -1 if no maximum, >0 = highest level of zoom marker is shown
70 | */
71 | public int getMaxZoom();
72 | /**
73 | * Set maximum zoom level for marker to be visible (overrides maxzoom for marker set, if any)
74 | * @param zoom : -1 if no maximum, >0 = highest level of zoom marker is shown
75 | */
76 | public void setMaxZoom(int zoom);
77 | }
78 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/markers/MarkerAPI.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.markers;
2 |
3 | import java.io.InputStream;
4 | import java.util.Set;
5 |
6 | /**
7 | * This defines the public interface to the MarkerAPI (as retrieved by the getMarkerAPI() method in the DynmapPlugin class).
8 | */
9 | public interface MarkerAPI {
10 | /**
11 | * Get set of defined marker sets
12 | * @return set of marker sets
13 | */
14 | public Set getMarkerSets();
15 | /**
16 | * Find marker set by ID
17 | * @param id - ID of marker set
18 | * @return marker set, or null if not found
19 | */
20 | public MarkerSet getMarkerSet(String id);
21 | /**
22 | * Create marker set
23 | * @param id - ID for marker set (must be unique among marker set - limit to alphanumerics, periods, underscores)
24 | * @param lbl - Label for marker set
25 | * @param iconlimit - set of allowed marker icons (if null, any marker icon can be used in set)
26 | * @param persistent - if true, set is persistent (and can contain persistent markers)
27 | * @return marker set, or null if failed to be created
28 | */
29 | public MarkerSet createMarkerSet(String id, String lbl, Set iconlimit, boolean persistent);
30 | /**
31 | * Get set of defined marker icons
32 | * @return set of marker icons
33 | */
34 | public Set getMarkerIcons();
35 | /**
36 | * Find marker icon by ID
37 | * @param id - ID of marker icon
38 | * @return marker icon, or null if not found
39 | */
40 | public MarkerIcon getMarkerIcon(String id);
41 | /**
42 | * Register a new marker icon
43 | * @param id - ID of marker icon (must be unique among marker icons - letters, numbers, periods, underscores only)
44 | * @param label - label for marker icon
45 | * @param marker_png - stream containing PNG encoded icon for marker (will be read and copied)
46 | * @return marker icon object, or null if failed
47 | */
48 | public MarkerIcon createMarkerIcon(String id, String label, InputStream marker_png);
49 | /**
50 | * Get set of player sets defined
51 | */
52 | public Set getPlayerSets();
53 | /**
54 | * Get player set by ID
55 | * @param id - player set ID
56 | * @return set, or null if not found
57 | */
58 | public PlayerSet getPlayerSet(String id);
59 | /**
60 | * Create a new player set
61 | * @param id - ID of player set (must be unique among player sets - letters, numbers, periods, underscores only)
62 | * @param symmetric - is symmetric acccess (players in set can see other players in set) if true
63 | * @param players - players in the set (ID strings)
64 | * @param persistent - if true, set is persistent
65 | * @return player set, or null if failed
66 | */
67 | public PlayerSet createPlayerSet(String id, boolean symmetric, Set players, boolean persistent);
68 | }
69 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/markers/AreaMarker.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.markers;
2 |
3 | /**
4 | * This defines the public interface to an area marker object, for use with the MarkerAPI
5 | */
6 | public interface AreaMarker extends MarkerDescription {
7 | /**
8 | * Get top Y coordinate
9 | * @return coordinate
10 | */
11 | public double getTopY();
12 | /**
13 | * Get bottom Y coordinate
14 | * @return coordinate
15 | */
16 | public double getBottomY();
17 | /**
18 | * Set Y coordinate range
19 | * @param ytop - y coordinate of top
20 | * @param ybottom - y coordinate of bottom (=top for 2D)
21 | */
22 | public void setRangeY(double ytop, double ybottom);
23 | /**
24 | * Get corner location count
25 | */
26 | public int getCornerCount();
27 | /**
28 | * Get X coordinate of corner N
29 | * @param n - corner index
30 | * @return coordinate
31 | */
32 | public double getCornerX(int n);
33 | /**
34 | * Get Z coordinate of corner N
35 | * @param n - corner index
36 | * @return coordinate
37 | */
38 | public double getCornerZ(int n);
39 | /**
40 | * Set coordinates of corner N
41 | * @param n - index of corner: append new corner if >= corner count, else replace existing
42 | * @param x - x coordinate
43 | * @param z - z coordinate
44 | */
45 | public void setCornerLocation(int n, double x, double z);
46 | /**
47 | * Set/replace all corners
48 | * @param x - list of x coordinates
49 | * @param z - list of z coordinates
50 | */
51 | public void setCornerLocations(double[] x, double[] z);
52 | /**
53 | * Delete corner N - shift corners after N forward
54 | * @param n - index of corner
55 | */
56 | public void deleteCorner(int n);
57 | /**
58 | * Set line style
59 | * @param weight - stroke weight
60 | * @param opacity - stroke opacity
61 | * @param color - stroke color (0xRRGGBB)
62 | */
63 | public void setLineStyle(int weight, double opacity, int color);
64 | /**
65 | * Get line weight
66 | * @return weight
67 | */
68 | public int getLineWeight();
69 | /**
70 | * Get line opacity
71 | * @return opacity (0.0-1.0)
72 | */
73 | public double getLineOpacity();
74 | /**
75 | * Get line color
76 | * @return color (0xRRGGBB)
77 | */
78 | public int getLineColor();
79 | /**
80 | * Set fill style
81 | * @param opacity - fill color opacity
82 | * @param color - fill color (0xRRGGBB)
83 | */
84 | public void setFillStyle(double opacity, int color);
85 | /**
86 | * Get fill opacity
87 | * @return opacity (0.0-1.0)
88 | */
89 | public double getFillOpacity();
90 | /**
91 | * Get fill color
92 | * @return color (0xRRGGBB)
93 | */
94 | public int getFillColor();
95 | /**
96 | * Set resolution boost flag
97 | * @param bflag - boost flag
98 | */
99 | public void setBoostFlag(boolean bflag);
100 | /**
101 | * Get resolution boost flag
102 | * @return boost flag
103 | */
104 | public boolean getBoostFlag();
105 | }
106 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/DynmapCommonAPIListener.java:
--------------------------------------------------------------------------------
1 | package org.dynmap;
2 |
3 | import java.util.concurrent.CopyOnWriteArrayList;
4 |
5 | /**
6 | * Listener class for dynmap API lifecycle - addresses issues with startup order, restarts, etc
7 | * Listeners should subclass, provide needed methods, and register listener using
8 | * DynmapCommonAPIListener.register() method and unregister using
9 | * DynmapCommonAPIListener.unregister()
10 | */
11 | public abstract class DynmapCommonAPIListener {
12 | /**
13 | * Called when API becomes enabled, or during call to register listener if API is already enabled
14 | *
15 | * @param api - API interface (note: may be platform specific subclass, such as bukkit-specific API)
16 | */
17 | public abstract void apiEnabled(DynmapCommonAPI api);
18 | /**
19 | * Called when API becomes disabled/obsolete
20 | *
21 | * @param api - API interface being disabled (not usable immediately after call completes)
22 | */
23 | public void apiDisabled(DynmapCommonAPI api) {
24 | }
25 | /**
26 | * Called when API listener added before API ready (internal use)
27 | */
28 | public void apiListenerAdded() {
29 | }
30 | /**
31 | * Callback when web chat event is being processed:
32 | * @param source
33 | * @param name
34 | * @param message
35 | * @return true if not cancelled and not processed
36 | */
37 | public boolean webChatEvent(String source, String name, String message) {
38 | return true;
39 | }
40 |
41 | private static DynmapCommonAPI dynmapapi = null;
42 |
43 | private static CopyOnWriteArrayList listeners = new CopyOnWriteArrayList();
44 | /**
45 | * Register listener instance
46 | *
47 | * @param listener - listener to register
48 | */
49 | public static void register(DynmapCommonAPIListener listener) {
50 | listeners.add(listener);
51 | if(dynmapapi != null) {
52 | listener.apiEnabled(dynmapapi);
53 | }
54 | else {
55 | for (DynmapCommonAPIListener l : listeners) {
56 | l.apiListenerAdded();
57 | }
58 | }
59 | }
60 | /**
61 | * Unregister listener instance
62 | *
63 | * @param listener - listener to unregister
64 | */
65 | public static void unregister(DynmapCommonAPIListener listener) {
66 | listeners.remove(listener);
67 | }
68 | // Internal call - MODS/PLUGINS MUST NOT USE
69 | public static void apiInitialized(DynmapCommonAPI api) {
70 | if(dynmapapi != null) {
71 | apiTerminated();
72 | }
73 | dynmapapi = api;
74 | if(dynmapapi != null) {
75 | for (DynmapCommonAPIListener l : listeners) {
76 | l.apiEnabled(api);
77 | }
78 | }
79 | }
80 | // Internal call - MODS/PLUGINS MUST NOT USE
81 | public static void apiTerminated() {
82 | if(dynmapapi != null) {
83 | for (DynmapCommonAPIListener l : listeners) {
84 | l.apiDisabled(dynmapapi);
85 | }
86 | dynmapapi = null;
87 | }
88 | }
89 | // Internal call - MODS/PLUGINS MUST NOT USE
90 | public static boolean fireWebChatEvent(String source, String name, String message) {
91 | boolean noCancel = true;
92 | if(dynmapapi != null) {
93 | for (DynmapCommonAPIListener l : listeners) {
94 | noCancel = l.webChatEvent(source, name, message) && noCancel;
95 | }
96 | }
97 | return noCancel;
98 | }
99 |
100 | }
101 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/PatchBlockModel.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | import org.dynmap.renderer.RenderPatchFactory.SideVisible;
4 |
5 | /**
6 | * Patch block model
7 | */
8 | public interface PatchBlockModel extends BlockModel {
9 | /**
10 | * Add patch with given attributes.
11 | *
12 | * Definition is a 2D parallelogram surface, with origin <x0,y0,z0> within the block, and defined by two edge vectors -
13 | * one with and end point of <xu,yu,zu>, and a second with an end point of <xv,yv,zv>. The patch is
14 | * defined within the unit vector range umin to umax (parallel to the U vecotr) and vmin to vmax
15 | * (parallel to the V vector).
16 | * The surface can be visible via one side (SideVisible.TOP, SideVisible.BOTTOM) or both sides (SideVisible.BOTH).
17 | *
18 | * @param x0 - X coordinate of origin of patch
19 | * @param y0 - Y coordinate of origin of patch
20 | * @param z0 - Z coordinate of origin of patch
21 | * @param xu - X coordinate of end of U vector
22 | * @param yu - Y coordinate of end of U vector
23 | * @param zu - Z coordinate of end of U vector
24 | * @param xv - X coordinate of end of V vector
25 | * @param yv - Y coordinate of end of V vector
26 | * @param zv - Z coordinate of end of V vector
27 | * @param umin - lower bound for visibility along U vector (use 0.0 by default)
28 | * @param umax - upper bound for visibility along U vector (use 1.0 by default)
29 | * @param vmin - lower bound for visibility along V vector (use 0.0 by default)
30 | * @param vmax - upper bound for visibility along V vector (use 1.0 by default)
31 | * @param uplusvmax - upper bound for visibility for U+V (use 100.0 by default: <=1.0 for triangle)
32 | * @param sidevis - Controls which sides of the surface are visible (U cross V defines normal - TOP is from that side, BOTTOM is opposite side)
33 | * @return patch ID
34 | */
35 | public String addPatch(double x0, double y0, double z0, double xu,
36 | double yu, double zu, double xv, double yv, double zv, double umin,
37 | double umax, double vmin, double vmax, double uplusvmax, SideVisible sidevis);
38 | /**
39 | * Add patch with given attributes.
40 | *
41 | * Definition is a 2D parallelogram surface, with origin <x0,y0,z0> within the block, and defined by two edge vectors -
42 | * one with and end point of <xu,yu,zu>, and a second with an end point of <xv,yv,zv>. The patch is
43 | * defined within the unit vector range 0.0 to 1.0 (parallel to the U vecotr) and 0.0 to 1.0
44 | * (parallel to the V vector).
45 | * The surface can be visible via one side (SideVisible.TOP, SideVisible.BOTTOM) or both sides (SideVisible.BOTH).
46 | *
47 | * @param x0 - X coordinate of origin of patch
48 | * @param y0 - Y coordinate of origin of patch
49 | * @param z0 - Z coordinate of origin of patch
50 | * @param xu - X coordinate of end of U vector
51 | * @param yu - Y coordinate of end of U vector
52 | * @param zu - Z coordinate of end of U vector
53 | * @param xv - X coordinate of end of V vector
54 | * @param yv - Y coordinate of end of V vector
55 | * @param zv - Z coordinate of end of V vector
56 | * @param sidevis - Controls which sides of the surface are visible (U cross V defines normal - TOP is from that side, BOTTOM is opposite side)
57 | * @return patch ID
58 | */
59 | public String addPatch(double x0, double y0, double z0, double xu,
60 | double yu, double zu, double xv, double yv, double zv, SideVisible sidevis);
61 | /**
62 | * Add patch with given attributes.
63 | *
64 | * Definition is a 2D parallelogram surface, with origin <x0,y0,z0> within the block, and defined by two edge vectors -
65 | * one with and end point of <xu,yu,zu>, and a second with an end point of <xv,yv,zv>. The patch is
66 | * defined within the unit vector range 0.0 to 1.0 (parallel to the U vecotr) and 0.0 to 1.0
67 | * (parallel to the V vector).
68 | * The surface is visible on both sides
69 | *
70 | * @param x0 - X coordinate of origin of patch
71 | * @param y0 - Y coordinate of origin of patch
72 | * @param z0 - Z coordinate of origin of patch
73 | * @param xu - X coordinate of end of U vector
74 | * @param yu - Y coordinate of end of U vector
75 | * @param zu - Z coordinate of end of U vector
76 | * @param xv - X coordinate of end of V vector
77 | * @param yv - Y coordinate of end of V vector
78 | * @param zv - Z coordinate of end of V vector
79 | * @return patch ID
80 | */
81 | public String addPatch(double x0, double y0, double z0, double xu,
82 | double yu, double zu, double xv, double yv, double zv);
83 | /**
84 | * Add rotated patch
85 | * @param patchid - existing patch ID
86 | * @param xrot - x axis rotation (0, 90, 180, 270)
87 | * @param yrot - y axis rotation (0, 90, 180, 270)
88 | * @param zrot - z axis rotation (0, 90, 180, 270)
89 | * @return patch ID
90 | */
91 | public String addRotatedPatch(String patchid, int xrot, int yrot, int zrot);
92 | }
93 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/renderer/RenderPatchFactory.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.renderer;
2 |
3 | public interface RenderPatchFactory {
4 | public enum SideVisible { TOP, BOTTOM, BOTH, FLIP };
5 |
6 | /**
7 | * Get/create patch with given attributes.
8 | *
9 | * Definition is a 2D parallelogram surface, with origin <x0,y0,z0> within the block, and defined by two edge vectors -
10 | * one with and end point of <xu,yu,zu>, and a second with an end point of <xv,yv,zv>. The patch is
11 | * defined within the unit vector range umin to umax (parallel to the U vecotr) and vmin to vmax
12 | * (parallel to the V vector).
13 | * The surface can be visible via one side (SideVisible.TOP, SideVisible.BOTTOM) or both sides (SideVisible.BOTH).
14 | * The surface also needs to define the index of the texture to be used for shading the surface.
15 | *
16 | * @param x0 - X coordinate of origin of patch
17 | * @param y0 - Y coordinate of origin of patch
18 | * @param z0 - Z coordinate of origin of patch
19 | * @param xu - X coordinate of end of U vector
20 | * @param yu - Y coordinate of end of U vector
21 | * @param zu - Z coordinate of end of U vector
22 | * @param xv - X coordinate of end of V vector
23 | * @param yv - Y coordinate of end of V vector
24 | * @param zv - Z coordinate of end of V vector
25 | * @param umin - lower bound for visibility along U vector (use 0.0 by default)
26 | * @param umax - upper bound for visibility along U vector (use 1.0 by default)
27 | * @param vmin - lower bound for visibility along V vector (use 0.0 by default)
28 | * @param vmax - upper bound for visibility along V vector (use 1.0 by default)
29 | * @param sidevis - Controls which sides of the surface are visible (U cross V defines normal - TOP is from that side, BOTTOM is opposite side)
30 | * @param textureidx - texture index to be used for patch
31 | */
32 | public RenderPatch getPatch(double x0, double y0, double z0, double xu, double yu, double zu, double xv, double yv, double zv, double umin, double umax, double vmin, double vmax, SideVisible sidevis, int textureidx);
33 | /**
34 | * Get/create patch with given attributes.
35 | *
36 | * Definition is a 2D triangular surface, with origin <x0,y0,z0> within the block, and defined by two edge vectors -
37 | * one with and end point of <xu,yu,zu>, and a second with an end point of <xv,yv,zv>. The visibility of
38 | * the patch is limited to the sum of the unit vector values for U and V via uplusvmax.
39 | * The surface can be visible via one side (SideVisible.TOP, SideVisible.BOTTOM) or both sides (SideVisible.BOTH).
40 | * The surface also needs to define the index of the texture to be used for shading the surface.
41 | *
42 | * @param x0 - X coordinate of origin of patch
43 | * @param y0 - Y coordinate of origin of patch
44 | * @param z0 - Z coordinate of origin of patch
45 | * @param xu - X coordinate of end of U vector
46 | * @param yu - Y coordinate of end of U vector
47 | * @param zu - Z coordinate of end of U vector
48 | * @param xv - X coordinate of end of V vector
49 | * @param yv - Y coordinate of end of V vector
50 | * @param zv - Z coordinate of end of V vector
51 | * @param uplusvmax - limit on sum of unit vectors for U and V (use 1.0 for triangle extending from origin to U and to V)
52 | * @param sidevis - Controls which sides of the surface are visible (U cross V defines normal - TOP is from that side, BOTTOM is opposite side)
53 | * @param textureidx - texture index to be used for patch
54 | */
55 | public RenderPatch getPatch(double x0, double y0, double z0, double xu, double yu, double zu, double xv, double yv, double zv, double uplusvmax, SideVisible sidevis, int textureidx);
56 | /**
57 | * Get/create patch with given attributes.
58 | *
59 | * Generate from existing patch, after rotating xrot degrees around the X axis then yrot degrees around the Y axis, and then zrot degrees arond Z.
60 | *
61 | * @param patch - original patch
62 | * @param xrot - degrees to rotate around X
63 | * @param yrot - degrees to rotate around Y
64 | * @param zrot - degrees to rotate around Z
65 | * @param textureidx - texture index to be used for rotated patch
66 | * @return patch requested
67 | */
68 | public RenderPatch getRotatedPatch(RenderPatch patch, int xrot, int yrot, int zrot, int textureidx);
69 | /**
70 | * Get named patch with given attributes. Name can encode rotation and patch index info
71 | * "name" - simple name
72 | * "name@rot" - name with rotation around Y
73 | * "name@x/y/z" - name with rotation around x, then y, then z axis
74 | * "name#patch" - name with explicit patch index
75 | *
76 | * @param name - name of patch (must be defined in same config file as custom renderer): supports name@yrot, name@xrot/yrot/zrot
77 | * @param textureidx - texture index to be used for patch, if not provided in name encoding (#patchid suffix)
78 | * @return patch requested
79 | */
80 | public RenderPatch getNamedPatch(final String name, int textureidx);
81 | /**
82 | * Get index of texture from texture map, using given key value
83 | * @param id - texture map ID
84 | * @param key - key of requested texture
85 | * @return index of texture, or -1 if not found
86 | */
87 | public int getTextureIndexFromMap(String id, int key);
88 | /**
89 | * Get number of textures defined in given texture map
90 | * @param id - texture map ID
91 | * @return number of textures, or -1 if map not found
92 | */
93 | public int getTextureCountFromMap(String id);
94 | }
95 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/DynmapCommonAPI.java:
--------------------------------------------------------------------------------
1 | package org.dynmap;
2 |
3 | import org.dynmap.markers.MarkerAPI;
4 |
5 | /**
6 | * This is the interface representing the published API for the Dynmap plugin, common for all Dynmap
7 | * implementations (not Bukkit specific).
8 | */
9 | public interface DynmapCommonAPI {
10 | /**
11 | * This method can return null if the 'markers' component has not been configured -
12 | * a warning message will be issued to the server.log in this event.
13 | *
14 | * @return MarkerAPI, or null if not configured
15 | */
16 | public MarkerAPI getMarkerAPI();
17 | /**
18 | * Test if the marker API has been initialized yet
19 | *
20 | * @return true if it has been initialized
21 | */
22 | public boolean markerAPIInitialized();
23 | /**
24 | * Send generic message to all web users
25 | * @param sender - label for sender of message ("Message from <plugin>:") - if null, no from notice
26 | * @param msg - message to be sent
27 | */
28 | public boolean sendBroadcastToWeb(String sender, String msg);
29 | /**
30 | * Trigger update on tiles associated with given locations. The volume is the rectangular prism ("cuboid")
31 | * with the two locations on opposite corners, (minx, miny, minz) and (maxx, maxy, maxz).
32 | *
33 | * @param wid - world ID
34 | * @param minx - minimum x of volume
35 | * @param miny - minimum y of volume
36 | * @param minz - minimum z of volume
37 | * @param maxx - maximum x of volume
38 | * @param maxy - maximum y of volume
39 | * @param maxz - maximum z of volume
40 | *
41 | * @return number of tiles queued to be rerendered (@deprecated return value - just returns 0)
42 | */
43 | public int triggerRenderOfVolume(String wid, int minx, int miny, int minz, int maxx, int maxy, int maxz);
44 | /**
45 | * Trigger update on tiles associated with given block location.
46 | *
47 | * @param wid - world ID
48 | * @param x - x coordinate of block
49 | * @param y - y coordinate of block
50 | * @param z - z coordinate of block
51 | *
52 | * @return number of tiles queued to be rerendered (@deprecated return value - just returns 0)
53 | */
54 | public int triggerRenderOfBlock(String wid, int x, int y, int z);
55 | /*
56 | * Pause full/radius render processing
57 | * @param dopause - true to pause, false to unpause
58 | */
59 | public void setPauseFullRadiusRenders(boolean dopause);
60 | /*
61 | * Test if full renders are paused
62 | */
63 | public boolean getPauseFullRadiusRenders();
64 | /*
65 | * Pause update render processing
66 | * @param dopause - true to pause, false to unpause
67 | */
68 | public void setPauseUpdateRenders(boolean dopause);
69 | /*
70 | * Test if update renders are paused
71 | */
72 | public boolean getPauseUpdateRenders();
73 | /**
74 | * Set player visibility (configuration - persistent)
75 | * @param player - player ID
76 | * @param is_visible - true if visible, false if hidden
77 | */
78 | public void setPlayerVisiblity(String player, boolean is_visible);
79 | /**
80 | * Test if player is visible
81 | * @param player - player ID
82 | *
83 | * @return true if visible, false if not
84 | */
85 | public boolean getPlayerVisbility(String player);
86 | /**
87 | * Set player visibility (transient - if player is configured to be visible, they are hidden if one or more plugins assert their invisiblity)
88 | * @param player - player ID
89 | * @param is_invisible - true if asserting player should be invisible, false if no assertion
90 | * @param plugin_id - ID of asserting plugin
91 | */
92 | public void assertPlayerInvisibility(String player, boolean is_invisible, String plugin_id);
93 | /**
94 | * Set player visibility (transient - if player is configured to be hidden, they are made visibile if one or more plugins assert their visibility))
95 | * @param player - player ID
96 | * @param is_visible - true if asserting that hidden player should be visible, false if no assertion
97 | * @param plugin_id - ID of asserting plugin
98 | */
99 | public void assertPlayerVisibility(String player, boolean is_visible, String plugin_id);
100 | /**
101 | * Post message from player to web
102 | * @param playerid - player ID
103 | * @param playerdisplay - player display name
104 | * @param message - message text
105 | */
106 | public void postPlayerMessageToWeb(String playerid, String playerdisplay, String message);
107 | /**
108 | * Post join/quit message for player to web
109 | * @param playerid - player ID
110 | * @param playerdisplay - player display name
111 | * @param isjoin - if true, join message; if false, quit message
112 | */
113 | public void postPlayerJoinQuitToWeb(String playerid, String playerdisplay, boolean isjoin);
114 | /**
115 | * Get version of dynmap core
116 | * @return version - format is "major.minor-build" or "major.minor.patch-build"
117 | */
118 | public String getDynmapCoreVersion();
119 | /**
120 | * Disable chat message processing (used by mods that will handle sending chat to the web themselves, via sendBroadcastToWeb()
121 | * @param disable - if true, suppress internal chat-to-web messages
122 | */
123 | public boolean setDisableChatToWebProcessing(boolean disable);
124 | /**
125 | * Test if given player can see another player on the map (based on dynmap settings, player sets, etc).
126 | * @param player - player attempting to observe
127 | * @param player_to_see - player to be observed by 'player'
128 | * @return true if can be seen on map, false if cannot be seen
129 | */
130 | public boolean testIfPlayerVisibleToPlayer(String player, String player_to_see);
131 | /**
132 | * Test if player position/information is protected on map view
133 | * @return true if protected, false if visible to guests and all players
134 | */
135 | public boolean testIfPlayerInfoProtected();
136 | /**
137 | * Process sign change
138 | * @param blkid - block ID
139 | * @param world - world name
140 | * @param x - x coord
141 | * @param y - y coord
142 | * @param z - z coord
143 | * @param lines - sign lines (input and output)
144 | * @param playerid - player ID
145 | */
146 | public void processSignChange(int blkid, String world, int x, int y, int z, String[] lines, String playerid);
147 | }
148 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/ModModelDefinition.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | /**
4 | * Model definition for a mod
5 | */
6 | public interface ModModelDefinition {
7 | /**
8 | * Get mod ID
9 | * @return mod ID
10 | */
11 | public String getModID();
12 | /**
13 | * Get mod version
14 | * @return mod version
15 | */
16 | public String getModVersion();
17 | /**
18 | * Get texture definition associated with the model definition
19 | * @return texture definition
20 | */
21 | public ModTextureDefinition getTextureDefinition();
22 | /**
23 | * Add volumetric model : default assumes all metadata values are matching
24 | * @param blockid - block ID
25 | * @param scale - grid scale (subblock array is scale x scale x scale) : from 1 to 16
26 | * @return block model: use methods to set occupied subblocks
27 | */
28 | public VolumetricBlockModel addVolumetricModel(int blockid, int scale);
29 | /**
30 | * Add volumetric model : default assumes all metadata values are matching
31 | * @param blockname - block name
32 | * @param scale - grid scale (subblock array is scale x scale x scale) : from 1 to 16
33 | * @return block model: use methods to set occupied subblocks
34 | */
35 | public VolumetricBlockModel addVolumetricModel(String blockname, int scale);
36 | /**
37 | * Add standard stair model : default assumes all metadata values are matching
38 | * @param blockid - block ID
39 | * @return block model record
40 | */
41 | public StairBlockModel addStairModel(int blockid);
42 | /**
43 | * Add standard stair model : default assumes all metadata values are matching
44 | * @param blockname - block name
45 | * @return block model record
46 | */
47 | public StairBlockModel addStairModel(String blockname);
48 | /**
49 | * Add wall or fence model : default assumes all metadata values are matching
50 | * @param blockid - block ID
51 | * @param type - type of wall or fence
52 | * @return block model record
53 | */
54 | public WallFenceBlockModel addWallFenceModel(int blockid, WallFenceBlockModel.FenceType type);
55 | /**
56 | * Add wall or fence model : default assumes all metadata values are matching
57 | * @param blockname - block name
58 | * @param type - type of wall or fence
59 | * @return block model record
60 | */
61 | public WallFenceBlockModel addWallFenceModel(String blockname, WallFenceBlockModel.FenceType type);
62 | /**
63 | * Add cuboid model : default assumes all metadata values are matching
64 | * @param blockid - block ID
65 | * @return block model record
66 | */
67 | public CuboidBlockModel addCuboidModel(int blockid);
68 | /**
69 | * Add cuboid model : default assumes all metadata values are matching
70 | * @param blockname - block name
71 | * @return block model record
72 | */
73 | public CuboidBlockModel addCuboidModel(String blockname);
74 | /**
75 | * Add pane model : default assumes all metadata values are matching
76 | * @param blockid - block ID
77 | * @return block model record
78 | */
79 | public PaneBlockModel addPaneModel(int blockid);
80 | /**
81 | * Add pane model : default assumes all metadata values are matching
82 | * @param blockname - block name
83 | * @return block model record
84 | */
85 | public PaneBlockModel addPaneModel(String blockname);
86 | /**
87 | * Add standard plant model : default assumes all metadata values are matching
88 | * @param blockid - block ID
89 | * @return block model record
90 | */
91 | public PlantBlockModel addPlantModel(int blockid);
92 | /**
93 | * Add standard plant model : default assumes all metadata values are matching
94 | * @param blockname - block name
95 | * @return block model record
96 | */
97 | public PlantBlockModel addPlantModel(String blockname);
98 | /**
99 | * Add standard box model : default assumes all metadata values are matching
100 | * @param blockid - block ID
101 | * @return block model record
102 | */
103 | public BoxBlockModel addBoxModel(int blockid);
104 | /**
105 | * Add standard box model : default assumes all metadata values are matching
106 | * @param blockname - block name
107 | * @return block model record
108 | */
109 | public BoxBlockModel addBoxModel(String blockname);
110 | /**
111 | * Add door model
112 | * @param blockid - block ID
113 | * @return block model record
114 | */
115 | public DoorBlockModel addDoorModel(int blockid);
116 | /**
117 | * Add door model
118 | * @param blockname - block name
119 | * @return block model record
120 | */
121 | public DoorBlockModel addDoorModel(String blockname);
122 | /**
123 | * Add patch box model : default assumes all metadata values are matching
124 | * @param blockid - block ID
125 | * @return block model record
126 | */
127 | public PatchBlockModel addPatchModel(int blockid);
128 | /**
129 | * Add patch box model : default assumes all metadata values are matching
130 | * @param blockname - block name
131 | * @return block model record
132 | */
133 | public PatchBlockModel addPatchModel(String blockname);
134 | /**
135 | * Add rotated patch box model, based on existing model : default assumes all metadata values are matching
136 | * @param blockid - block ID
137 | * @param model - existing model to be rotated
138 | * @param xrot - x rotation in degrees (0, 90, 180, 270)
139 | * @param yrot - y rotation in degrees (0, 90, 180, 270)
140 | * @param zrot - z rotation in degrees (0, 90, 180, 270)
141 | * @return block model record
142 | */
143 | public PatchBlockModel addRotatedPatchModel(int blockid, PatchBlockModel model, int xrot, int yrot, int zrot);
144 | /**
145 | * Add rotated patch box model, based on existing model : default assumes all metadata values are matching
146 | * @param blockname - block name
147 | * @param model - existing model to be rotated
148 | * @param xrot - x rotation in degrees (0, 90, 180, 270)
149 | * @param yrot - y rotation in degrees (0, 90, 180, 270)
150 | * @param zrot - z rotation in degrees (0, 90, 180, 270)
151 | * @return block model record
152 | */
153 | public PatchBlockModel addRotatedPatchModel(String blockname, PatchBlockModel model, int xrot, int yrot, int zrot);
154 | /**
155 | * Final call for model definition: publishes definiiton to Dynmap to be used for the mod
156 | * @return true if successful, false if error
157 | */
158 | public boolean publishDefinition();
159 | }
160 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/ModTextureDefinition.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | /**
4 | * Interface for texture definition for a given mod
5 | */
6 | public interface ModTextureDefinition {
7 | /**
8 | * Get mod ID
9 | * @return mod ID
10 | */
11 | public String getModID();
12 | /**
13 | * Get mod version
14 | * @return mod version
15 | */
16 | public String getModVersion();
17 | /**
18 | * Get model definition for mod associated with texture definition
19 | * Only needed if mod needs to define models for non-simple,solid blocks
20 | * @return model definition
21 | */
22 | public ModModelDefinition getModelDefinition();
23 | /**
24 | * Final call for texture definition: publishes definiiton to Dynmap to be used for the mod
25 | * @return true if successful, false if error
26 | */
27 | public boolean publishDefinition();
28 |
29 | /**
30 | * Set texture path for texture resources (base path for resource loads from mod - for 1.6.x, default is assets/<modid>/textures/blocks)
31 | * @param txtpath - texture resource base path
32 | */
33 | public void setTexturePath(String txtpath);
34 | /**
35 | * Get texture path for texture resources
36 | * @return texture resource base path
37 | */
38 | public String getTexturePath();
39 |
40 | /**
41 | * Register texture file
42 | * This is suitable for typical 1.5+ single texture-per-file textures. File is assumed to be at -texturePath-/-id-.png
43 | * @param id - texture ID
44 | * @return TextureFile associated with resource
45 | */
46 | public GridTextureFile registerTextureFile(String id);
47 | /**
48 | * Register texture file with explicit file path and name (texturePath is not used)
49 | * This is suitable for typical 1.5+ single texture-per-file textures
50 | * @param id - texture ID
51 | * @param filename - texture file name (including .png)
52 | * @return TextureFile associated with resource
53 | */
54 | public GridTextureFile registerTextureFile(String id, String filename);
55 | /**
56 | * Register texture file with CHEST layout (standard single chest texture)
57 | * @param id - texture ID
58 | * @param filename - texture file name (including .png)
59 | * @return TextureFile associated with resource
60 | */
61 | public ChestTextureFile registerChestTextureFile(String id, String filename);
62 | /**
63 | * Register texture file with BIGCHEST layout (standard double chest texture)
64 | * @param id - texture ID
65 | * @param filename - texture file name (including .png)
66 | * @return TextureFile associated with resource
67 | */
68 | public BigChestTextureFile registerBigChestTextureFile(String id, String filename);
69 | /**
70 | * Register texture file with SIGN layout (standard signpost texture )
71 | * @param id - texture ID
72 | * @param filename - texture file name (including .png)
73 | * @return TextureFile associated with resource
74 | */
75 | public SignTextureFile registerSignTextureFile(String id, String filename);
76 | /**
77 | * Register texture file with SKIN layout (standard player/humanoid skin texture)
78 | * @param id - texture ID
79 | * @param filename - texture file name (including .png)
80 | * @return TextureFile associated with resource
81 | */
82 | public SkinTextureFile registerSkinTextureFile(String id, String filename);
83 | /**
84 | * Register texture file with SHULKER layout (standard shulker and shulker box texture)
85 | * @param id - texture ID
86 | * @param filename - texture file name (including .png)
87 | * @return TextureFile associated with resource
88 | */
89 | public ShulkerTextureFile registerShulkerTextureFile(String id, String filename);
90 | /**
91 | * Register texture file with GRID layout (array of xcount x ycount square textures)
92 | * @param id - texture ID
93 | * @param filename - texture file name (including .png)
94 | * @param xcount - horizontal patch count in texture file
95 | * @param ycount - vertical patch count in texture file
96 | * @return TextureFile associated with resource
97 | */
98 | public GridTextureFile registerGridTextureFile(String id, String filename, int xcount, int ycount);
99 | /**
100 | * Register texture file with CUSTOM layout (custom defined patches within file)
101 | * The xcount and ycount attributes indicate the default horizontal and vertical dimensions of the texture file, assuming normal default
102 | * scale of 16 x 16 pixels for a texture patch (if the file is bigger, these data allow calculation of the texture scale)
103 | * @param id - texture ID
104 | * @param filename - texture file name (including .png)
105 | * @param xcount - horizontal patch count in texture file
106 | * @param ycount - vertical patch count in texture file
107 | * @return CustomTextureFile associated with resource: use methods on this to define the custom patches within the file
108 | */
109 | public CustomTextureFile registerCustomTextureFile(String id, String filename, int xcount, int ycount);
110 | /**
111 | * Register texture file with BIOME layout
112 | * @param id - texture ID
113 | * @param filename - texture file name (including .png)
114 | * @return TextureFile associated with resource
115 | */
116 | public BiomeTextureFile registerBiomeTextureFile(String id, String filename);
117 |
118 | /**
119 | * Add block texture record : default assumes all metadata values are matching
120 | * @param blockID - block ID
121 | * @return block texture record: use methods to set texture use on faces/patches
122 | */
123 | public BlockTextureRecord addBlockTextureRecord(int blockID);
124 | /**
125 | * Add block texture record : default assumes all metadata values are matching
126 | * @param blockname - block name
127 | * @return block texture record: use methods to set texture use on faces/patches
128 | */
129 | public BlockTextureRecord addBlockTextureRecord(String blockname);
130 | /**
131 | * Add block texture record, based on copying a record : default assumes all metadata values are matching
132 | * @param blockID - block ID
133 | * @param srcBlockID - source block ID (definition copied from)
134 | * @param srcMeta - source meta (definition copied from)
135 | * @return block texture record: use methods to set texture use on faces/patches
136 | */
137 | public CopyBlockTextureRecord addCopyBlockTextureRecord(int blockID, int srcBlockID, int srcMeta);
138 | /**
139 | * Add block texture record, based on copying a record : default assumes all metadata values are matching
140 | * @param blockname - block name
141 | * @param srcBlockname - source block name (definition copied from)
142 | * @param srcMeta - source meta (definition copied from)
143 | * @return block texture record: use methods to set texture use on faces/patches
144 | */
145 | public CopyBlockTextureRecord addCopyBlockTextureRecord(String blockname, String srcBlockname, int srcMeta);
146 | }
147 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/modsupport/BlockTextureRecord.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.modsupport;
2 |
3 | /**
4 | * Record representing a texture mapping for one or more blocks
5 | */
6 | public interface BlockTextureRecord {
7 | public static final int METAMASK_ALL = -1;
8 |
9 | /**
10 | * Add block ID to mapping (in case multiple block IDs use same texture mapping)
11 | * @param blockID - block ID
12 | */
13 | public void addBlockID(int blockID);
14 | /**
15 | * Get block IDs
16 | * @return configured IDs
17 | */
18 | public int[] getBlockIDs();
19 | /**
20 | * Add block name to mapping (in case multiple block names use same model)
21 | * @param blockname - block name
22 | */
23 | public void addBlockName(String blockname);
24 | /**
25 | * Get block names
26 | * @return configured names
27 | */
28 | public String[] getBlockNames();
29 | /**
30 | * Set metadata value : default is for all values (data=*). Setting other values will match only the values that are set
31 | * @param data - value to match (-1 = all, 0-15 is meta value to match)
32 | */
33 | public void setMetaValue(int data);
34 | /**
35 | * Get matching metadata value mask
36 | * @return matching metadata mask: bit N is set if given metadata value matches
37 | */
38 | public int getMetaValueMask();
39 | /**
40 | * Set transparency mode for block
41 | * @param mode - transparency mode
42 | */
43 | public void setTransparencyMode(TransparencyMode mode);
44 | /**
45 | * Get transparency mode for block
46 | * @return transparency mode
47 | */
48 | public TransparencyMode getTransparencyMode();
49 | /**
50 | * Set side texture (standard cube block model)
51 | * @param txtFileID - texture file ID (first texture in file used)
52 | * @param side - side to apply texture to
53 | */
54 | public void setSideTexture(String txtFileID, BlockSide side);
55 | /**
56 | * Set side texture (standard cube block model)
57 | * @param txtFile - texture file (first texture in file used)
58 | * @param side - side to apply texture to
59 | */
60 | public void setSideTexture(TextureFile txtFile, BlockSide side);
61 | /**
62 | * Set side texture (standard cube block model) with given texture index
63 | * @param txtFileID - texture file ID
64 | * @param txtIndex - texture index
65 | * @param side - side to apply texture to
66 | */
67 | public void setSideTexture(String txtFileID, int txtIndex, BlockSide side);
68 | /**
69 | * Set side texture (standard cube block model) with givcen texture index
70 | * @param txtFile - texture file
71 | * @param txtIndex - texture index
72 | * @param side - side to apply texture to
73 | */
74 | public void setSideTexture(TextureFile txtFile, int txtIndex, BlockSide side);
75 | /**
76 | * Set side texture (standard cube block model) with texture modifier
77 | * @param txtFileID - texture file ID (first texture in file used)
78 | * @param modifier - texture modifier
79 | * @param side - side to apply texture to
80 | */
81 | public void setSideTexture(String txtFileID, TextureModifier modifier, BlockSide side);
82 | /**
83 | * Set side texture (standard cube block model) with modifier
84 | * @param txtFile - texture file (first texture in file used)
85 | * @param modifier - texture modifier
86 | * @param side - side to apply texture to
87 | */
88 | public void setSideTexture(TextureFile txtFile, TextureModifier modifier, BlockSide side);
89 | /**
90 | * Set side texture (standard cube block model) with texture modifier and texture index
91 | * @param txtFileID - texture file ID
92 | * @param txtIndex - texture index
93 | * @param modifier - texture modifier
94 | * @param side - side to apply texture to
95 | */
96 | public void setSideTexture(String txtFileID, int txtIndex, TextureModifier modifier, BlockSide side);
97 | /**
98 | * Set side texture (standard cube block model) with texture modifier and texture index
99 | * @param txtFile - texture file
100 | * @param txtIndex - texture index
101 | * @param modifier - texture modifier
102 | * @param side - side to apply texture to
103 | */
104 | public void setSideTexture(TextureFile txtFile, int txtIndex, TextureModifier modifier, BlockSide side);
105 | /**
106 | * Set patch texture
107 | * @param txtFileID - texture file ID (first texture in file used)
108 | * @param patchIndex - patch index to apply texture to
109 | */
110 | public void setPatchTexture(String txtFileID, int patchIndex);
111 | /**
112 | * Set patch texture
113 | * @param txtFile - texture file (first texture in file used)
114 | * @param patchIndex - patch index to apply texture to
115 | */
116 | public void setPatchTexture(TextureFile txtFile, int patchIndex);
117 | /**
118 | * Set patch texture with given texture index
119 | * @param txtFileID - texture file ID
120 | * @param txtIndex - texture index
121 | * @param patchIndex - patch index to apply texture to
122 | */
123 | public void setPatchTexture(String txtFileID, int txtIndex, int patchIndex);
124 | /**
125 | * Set patch texture with givcen texture index
126 | * @param txtFile - texture file
127 | * @param txtIndex - texture index
128 | * @param patchIndex - patch index to apply texture to
129 | */
130 | public void setPatchTexture(TextureFile txtFile, int txtIndex, int patchIndex);
131 | /**
132 | * Set patch texture with texture modifier
133 | * @param txtFileID - texture file ID (first texture in file used)
134 | * @param modifier - texture modifier
135 | * @param patchIndex - patch index to apply texture to
136 | */
137 | public void setPatchTexture(String txtFileID, TextureModifier modifier, int patchIndex);
138 | /**
139 | * Set patch texture with modifier
140 | * @param txtFile - texture file (first texture in file used)
141 | * @param modifier - texture modifier
142 | * @param patchIndex - patch index to apply texture to
143 | */
144 | public void setPatchTexture(TextureFile txtFile, TextureModifier modifier, int patchIndex);
145 | /**
146 | * Set patch texture with texture modifier and texture index
147 | * @param txtFileID - texture file ID
148 | * @param txtIndex - texture index
149 | * @param modifier - texture modifier
150 | * @param patchIndex - patch index to apply texture to
151 | */
152 | public void setPatchTexture(String txtFileID, int txtIndex, TextureModifier modifier, int patchIndex);
153 | /**
154 | * Set patch texture with texture modifier and texture index
155 | * @param txtFile - texture file
156 | * @param txtIndex - texture index
157 | * @param modifier - texture modifier
158 | * @param patchIndex - patch index to apply texture to
159 | */
160 | public void setPatchTexture(TextureFile txtFile, int txtIndex, TextureModifier modifier, int patchIndex);
161 | /**
162 | * Get texture ID for given side
163 | * @param side - side
164 | * @return texture ID
165 | */
166 | public String getSideTextureID(BlockSide side);
167 | /**
168 | * Get texture modifier for given side
169 | * @param side - side
170 | * @return texture modifier
171 | */
172 | public TextureModifier getSideTextureModifier(BlockSide side);
173 | /**
174 | * Get texture index for given side
175 | * @param side - side
176 | * @return texture index
177 | */
178 | public int getSideTextureIndex(BlockSide side);
179 | /**
180 | * Get texture ID for given patch index
181 | * @param patchIndex - patch index
182 | * @return texture ID
183 | */
184 | public String getPatchTextureID(int patchIndex);
185 | /**
186 | * Get texture modifier for given patch index
187 | * @param patchIndex - patch index
188 | * @return texture modifier
189 | */
190 | public TextureModifier getPatchTextureModifier(int patchIndex);
191 | /**
192 | * Get texture index for given patch index
193 | * @param patchIndex - patch index
194 | * @return texture index
195 | */
196 | public int getPatchTextureIndex(int patchIndex);
197 |
198 | /**
199 | * Set block color map
200 | * @param txtFileID - texture file ID
201 | */
202 | public void setBlockColorMapTexture(String txtFileID);
203 | /**
204 | * Set block color map
205 | * @param txtFile - texture file
206 | */
207 | public void setBlockColorMapTexture(TextureFile txtFile);
208 |
209 | }
210 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/renderer/CustomRenderer.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.renderer;
2 |
3 | import java.util.List;
4 | import java.util.Map;
5 |
6 | import org.dynmap.renderer.RenderPatchFactory.SideVisible;
7 |
8 | /**
9 | * Abstract base class for custom renderers - used to allow creation of customized patch sets for blocks
10 | *
11 | * Custom renderer classes are loaded by classname, and must have a default constructor
12 | */
13 | public abstract class CustomRenderer {
14 | /**
15 | * Constructor - subclass must have public default constructor
16 | */
17 | protected CustomRenderer() {
18 |
19 | }
20 | /**
21 | * Initialize custom renderer
22 | *
23 | * If overridden, super.initializeRenderer() should be called and cause exit if false is returned
24 | *
25 | * @param rpf - render patch factory (used for allocating patches)
26 | * @param blkid - block type ID
27 | * @param blockdatamask - block data mask (bit N=1 if block data value N is to be handled by renderer)
28 | * @param custparm - parameter strings for custom renderer - renderer specific
29 | * @return true if initialized successfully, false if not
30 | */
31 | public boolean initializeRenderer(RenderPatchFactory rpf, int blkid, int blockdatamask, Map custparm) {
32 | return true;
33 | }
34 | /**
35 | * Cleanup custom renderer
36 | *
37 | * If overridden, super.cleanupRenderer() should be called
38 | */
39 | public void cleanupRenderer() {
40 |
41 | }
42 | /**
43 | * Return list of fields from the TileEntity associated with the blocks initialized for the renderer, if any.
44 | *
45 | * @return array of field ID strings, or null if none (the default)
46 | */
47 | public String[] getTileEntityFieldsNeeded() {
48 | return null;
49 | }
50 | /**
51 | * Return the maximum number of texture indices that may be returned by the renderer. Used to validate
52 | * the teture mapping defined for the block definitions.
53 | * @return highest texture index that may be returned, plus 1. Default is 1.
54 | */
55 | protected int getMaximumTextureCount() {
56 | return 1;
57 | }
58 | /**
59 | * Return the maximum number of texture indices that may be returned by the renderer. Used to validate
60 | * the teture mapping defined for the block definitions.
61 | *
62 | * @param rpf - render patch factory (used for allocating patches)
63 | * @return highest texture index that may be returned, plus 1. Default is 1.
64 | */
65 | public int getMaximumTextureCount(RenderPatchFactory rpf) {
66 | return getMaximumTextureCount();
67 | }
68 |
69 | /**
70 | * Return list of patches for block at given coordinates. List will be treated as read-only, so the same list can
71 | * and should be returned, when possible, for different blocks with the same patch list. The provided map data
72 | * context will always allow reading of data for the requested block, any data within its chunk, and any block
73 | * within one block in any direction of the requested block, at a minimum. Also will include any requested tile
74 | * entity data for those blocks.
75 | *
76 | * @param mapDataCtx - Map data context: can be used to read any data available for map.
77 | * @return patch list for given block
78 | */
79 | public abstract RenderPatch[] getRenderPatchList(MapDataContext mapDataCtx);
80 |
81 | private static final int[] default_patches = { 0, 0, 0, 0, 0, 0 };
82 |
83 | private static void addIfNonNull(List list, RenderPatch p) {
84 | if (p != null)
85 | list.add(p);
86 | }
87 | /**
88 | * Utility method: add simple box to give list
89 | * @param rpf - patch factory
90 | * @param list - list to add patches to
91 | * @param xmin - minimum for X axis
92 | * @param xmax - maximum for X axis
93 | * @param ymin - minimum for Y axis
94 | * @param ymax - maximum for Y axis
95 | * @param zmin - minimum for Z axis
96 | * @param zmax - maximum for Z axis
97 | * @param patchids - patch IDs for each face (bottom,top,xmin,xmax,zmin,zmax)
98 | */
99 | public static void addBox(RenderPatchFactory rpf, List list, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, int[] patchids) {
100 | if(patchids == null) {
101 | patchids = default_patches;
102 | }
103 | /* Add bottom */
104 | if(patchids[0] >= 0)
105 | addIfNonNull(list, rpf.getPatch(0, ymin, 0, 1, ymin, 0, 0, ymin, 1, xmin, xmax, zmin, zmax, SideVisible.TOP, patchids[0]));
106 | /* Add top */
107 | if(patchids[1] >= 0)
108 | addIfNonNull(list, rpf.getPatch(0, ymax, 1, 1, ymax, 1, 0, ymax, 0, xmin, xmax, 1-zmax, 1-zmin, SideVisible.TOP, patchids[1]));
109 | /* Add minX side */
110 | if(patchids[2] >= 0)
111 | addIfNonNull(list, rpf.getPatch(xmin, 0, 0, xmin, 0, 1, xmin, 1, 0, zmin, zmax, ymin, ymax, SideVisible.TOP, patchids[2]));
112 | /* Add maxX side */
113 | if(patchids[3] >= 0)
114 | addIfNonNull(list, rpf.getPatch(xmax, 0, 1, xmax, 0, 0, xmax, 1, 1, 1-zmax, 1-zmin, ymin, ymax, SideVisible.TOP, patchids[3]));
115 | /* Add minZ side */
116 | if(patchids[4] >= 0)
117 | addIfNonNull(list, rpf.getPatch(1, 0, zmin, 0, 0, zmin, 1, 1, zmin, 1-xmax, 1-xmin, ymin, ymax, SideVisible.TOP, patchids[4]));
118 | /* Add maxZ side */
119 | if(patchids[5] >= 0)
120 | addIfNonNull(list, rpf.getPatch(0, 0, zmax, 1, 0, zmax, 0, 1, zmax, xmin, xmax, ymin, ymax, SideVisible.TOP, patchids[5]));
121 | }
122 | /**
123 | * Get patch corresponding to side N (per MC side index: 0=bottom (y-), 1=top (y+), 2=z-, 3=z+, 4=x-, 5=x+)
124 | * @param rpf - patch factory
125 | * @param side - side number
126 | * @param setback - amount face is set back from block edge (0=on side, 0.5=at middle)
127 | * @param umin - texture horizontal minimum
128 | * @param umax - texture horizontal maximum
129 | * @param vmin - texture vertical minimum
130 | * @param vmax - texture vertical maximum
131 | * @param rot - rotation of texture (clockwise on given side)
132 | * @param textureidx - texture index
133 | */
134 | public RenderPatch getSidePatch(RenderPatchFactory rpf, int side, double setback, double umin, double umax, double vmin, double vmax, int rot, int textureidx) {
135 | RenderPatch rp = null;
136 | switch(side) {
137 | case 0:
138 | rp = rpf.getPatch(0, setback, 0, 1, setback, 0, 0, setback, 1, umin, umax, vmin, vmax, SideVisible.TOP, textureidx);
139 | if (rot != 0) {
140 | rp = rpf.getRotatedPatch(rp, 0, rot, 0, textureidx);
141 | }
142 | break;
143 | case 1:
144 | rp = rpf.getPatch(0, 1.0-setback, 1, 1, 1.0-setback, 1, 0, 1.0-setback, 0, umin, umax, 1-vmax, 1-vmin, SideVisible.TOP, textureidx);
145 | if (rot != 0) {
146 | rp = rpf.getRotatedPatch(rp, 0, 360-rot, 0, textureidx);
147 | }
148 | break;
149 | case 2:
150 | rp = rpf.getPatch(1, 0, setback, 0, 0, setback, 1, 1, setback, 1-umax, 1-umin, vmin, vmax, SideVisible.TOP, textureidx);
151 | if (rot != 0) {
152 | rp = rpf.getRotatedPatch(rp, 0, 0, rot, textureidx);
153 | }
154 | break;
155 | case 3:
156 | rp = rpf.getPatch(0, 0, 1.0-setback, 1, 0, 1.0-setback, 0, 1, 1.0-setback, umin, umax, vmin, vmax, SideVisible.TOP, textureidx);
157 | if (rot != 0) {
158 | rp = rpf.getRotatedPatch(rp, 0, 0, 360-rot, textureidx);
159 | }
160 | break;
161 | case 4:
162 | rp = rpf.getPatch(setback, 0, 0, setback, 0, 1, setback, 1, 0, umin, umax, vmin, vmax, SideVisible.TOP, textureidx);
163 | if (rot != 0) {
164 | rp = rpf.getRotatedPatch(rp, rot, 0, 0, textureidx);
165 | }
166 | break;
167 | case 5:
168 | rp = rpf.getPatch(1.0-setback, 0, 1, 1.0-setback, 0, 0, 1.0-setback, 1, 1, 1-umax, 1-umin, vmin, vmax, SideVisible.TOP, textureidx);
169 | if (rot != 0) {
170 | rp = rpf.getRotatedPatch(rp, 360-rot, 0, 0, textureidx);
171 | }
172 | break;
173 | }
174 | return rp;
175 | }
176 | /**
177 | * Get patch corresponding to side N (per MC side index: 0=bottom (y-), 1=top (y+), 2=z-, 3=z+, 4=x-, 5=x+)
178 | * @param rpf - patch factory
179 | * @param side - side number
180 | * @param rot - rotation of texture (clockwise on given side)
181 | * @param textureidx - texture index
182 | */
183 | public RenderPatch getSidePatch(RenderPatchFactory rpf, int side, int rot, int textureidx) {
184 | return getSidePatch(rpf, side, 0.0, 0.0, 1.0, 0.0, 1.0, rot, textureidx);
185 | }
186 | }
187 |
--------------------------------------------------------------------------------
/src/main/java/org/dynmap/markers/MarkerSet.java:
--------------------------------------------------------------------------------
1 | package org.dynmap.markers;
2 |
3 | import java.util.Set;
4 |
5 | /**
6 | * This defines the public interface to a marker set object, for use with the MarkerAPI.
7 | * This represents a logical set of markers, which are presented as a labelled layer on the web UI.
8 | * Marker sets can be created as persistent or non-persistent, but only persistent marker sets can contain persistent markers.
9 | */
10 | public interface MarkerSet {
11 | public static final String DEFAULT = "markers"; /* Default set - always exists */
12 |
13 | /**
14 | * Get set of all markers currently in the set
15 | * @return set of markers (set is copy - safe to iterate)
16 | */
17 | public Set getMarkers();
18 | /**
19 | * Get set of all area markers currently in the set
20 | * @return set of area markers (set is copy - safe to iterate)
21 | */
22 | public Set getAreaMarkers();
23 | /**
24 | * Get set of all poly-line markers currently in the set
25 | * @return set of poly-line markers (set is copy - safe to iterate)
26 | */
27 | public Set getPolyLineMarkers();
28 | /**
29 | * Get set of all circle markers currently in the set
30 | * @return set of circle markers (set is copy - safe to iterate)
31 | */
32 | public Set getCircleMarkers();
33 | /**
34 | * Create a new marker in the marker set
35 | *
36 | * @param id - ID of the marker - must be unique within the set: if null, unique ID is generated
37 | * @param label - Label for the marker (plain text)
38 | * @param world - world ID
39 | * @param x - x coord
40 | * @param y - y coord
41 | * @param z - z coord
42 | * @param icon - Icon for the marker
43 | * @param is_persistent - if true, marker is persistent (saved and reloaded on restart). If set is not persistent, this must be false.
44 | * @return created marker, or null if cannot be created.
45 | */
46 | public Marker createMarker(String id, String label, String world, double x, double y, double z, MarkerIcon icon, boolean is_persistent);
47 | /**
48 | * Create a new marker in the marker set
49 | *
50 | * @param id - ID of the marker - must be unique within the set: if null, unique ID is generated
51 | * @param label - Label for the marker
52 | * @param markup - if true, label is processed as HTML. if false, label is processed as plain text.
53 | * @param world - world ID
54 | * @param x - x coord
55 | * @param y - y coord
56 | * @param z - z coord
57 | * @param icon - Icon for the marker
58 | * @param is_persistent - if true, marker is persistent (saved and reloaded on restart). If set is not persistent, this must be false.
59 | * @return created marker, or null if cannot be created.
60 | */
61 | public Marker createMarker(String id, String label, boolean markup, String world, double x, double y, double z, MarkerIcon icon, boolean is_persistent);
62 | /**
63 | * Get marker by ID
64 | * @param id - ID of the marker
65 | * @return marker, or null if cannot be found
66 | */
67 | public Marker findMarker(String id);
68 | /**
69 | * Find marker by label - best matching substring
70 | * @param lbl - label to find (same = best match)
71 | * @return marker, or null if none found
72 | */
73 | public Marker findMarkerByLabel(String lbl);
74 | /**
75 | * Create area marker
76 | * @param id - marker ID
77 | * @param lbl - label
78 | * @param markup - if true, label is HTML markup
79 | * @param world - world id
80 | * @param x - x coord list
81 | * @param z - z coord list
82 | * @param persistent - true if persistent
83 | */
84 | public AreaMarker createAreaMarker(String id, String lbl, boolean markup, String world, double x[], double z[], boolean persistent);
85 | /**
86 | * Get area marker by ID
87 | * @param id - ID of the area marker
88 | * @return marker, or null if cannot be found
89 | */
90 | public AreaMarker findAreaMarker(String id);
91 | /**
92 | * Find area marker by label - best matching substring
93 | * @param lbl - label to find (same = best match)
94 | * @return marker, or null if none found
95 | */
96 | public AreaMarker findAreaMarkerByLabel(String lbl);
97 |
98 | /**
99 | * Create poly-line marker
100 | * @param id - marker ID
101 | * @param lbl - label
102 | * @param markup - if true, label is HTML markup
103 | * @param world - world id
104 | * @param x - x coord list
105 | * @param y - y coord list
106 | * @param z - z coord list
107 | * @param persistent - true if persistent
108 | */
109 | public PolyLineMarker createPolyLineMarker(String id, String lbl, boolean markup, String world, double x[], double[] y, double z[], boolean persistent);
110 | /**
111 | * Get poly-line marker by ID
112 | * @param id - ID of the poly-line marker
113 | * @return marker, or null if cannot be found
114 | */
115 | public PolyLineMarker findPolyLineMarker(String id);
116 | /**
117 | * Find poly-line marker by label - best matching substring
118 | * @param lbl - label to find (same = best match)
119 | * @return marker, or null if none found
120 | */
121 | public PolyLineMarker findPolyLineMarkerByLabel(String lbl);
122 |
123 |
124 | /**
125 | * Create circle marker
126 | * @param id - marker ID
127 | * @param lbl - label
128 | * @param markup - if true, label is HTML markup
129 | * @param world - world id
130 | * @param x - x of center
131 | * @param y - y of center
132 | * @param z - z of center
133 | * @param xr - radius on x axis
134 | * @param zr - radius on z axis
135 | * @param persistent - true if persistent
136 | */
137 | public CircleMarker createCircleMarker(String id, String lbl, boolean markup, String world, double x, double y, double z, double xr, double zr, boolean persistent);
138 | /**
139 | * Get circle marker by ID
140 | * @param id - ID of the circle marker
141 | * @return marker, or null if cannot be found
142 | */
143 | public CircleMarker findCircleMarker(String id);
144 | /**
145 | * Find area marker by label - best matching substring
146 | * @param lbl - label to find (same = best match)
147 | * @return marker, or null if none found
148 | */
149 | public CircleMarker findCircleMarkerByLabel(String lbl);
150 |
151 | /**
152 | * Get ID of marker set - unique among marker sets
153 | * @return ID
154 | */
155 | public String getMarkerSetID();
156 | /**
157 | * Get label for marker set
158 | * @return label
159 | */
160 | public String getMarkerSetLabel();
161 | /**
162 | * Update label for marker set
163 | * @param lbl - label for marker set
164 | */
165 | public void setMarkerSetLabel(String lbl);
166 | /**
167 | * Test if marker set is persistent
168 | * @return true if the set is persistent
169 | */
170 | public boolean isMarkerSetPersistent();
171 | /**
172 | * Get marker icons allowed in set (if restricted)
173 | * @return set of allowed marker icons
174 | */
175 | public Set getAllowedMarkerIcons();
176 | /**
177 | * Add marker icon to allowed set (must have been created restricted)
178 | * @param icon - icon to be added
179 | */
180 | public void addAllowedMarkerIcon(MarkerIcon icon);
181 | /**
182 | * Remove marker icon from allowed set (must have been created restricted)
183 | * @param icon - icon to be added
184 | */
185 | public void removeAllowedMarkerIcon(MarkerIcon icon);
186 | /**
187 | * Test if marker icon is allowed
188 | * @param icon - marker icon
189 | * @return true if allowed, false if not
190 | */
191 | public boolean isAllowedMarkerIcon(MarkerIcon icon);
192 | /**
193 | * Get distinct set of marker icons used by set (based on markers currently in set)
194 | * @return set of marker icons
195 | */
196 | public Set getMarkerIconsInUse();
197 | /**
198 | * Delete marker set
199 | */
200 | public void deleteMarkerSet();
201 | /**
202 | * Set hide/show default
203 | * @param hide - if true, layer for set will be hidden by default
204 | */
205 | public void setHideByDefault(boolean hide);
206 | /**
207 | * Get hide/show default
208 | * @return true if layer for set will be hidden by default
209 | */
210 | public boolean getHideByDefault();
211 | /**
212 | * Set layer ordering priority (0=default, low before high in layer order)
213 | */
214 | public void setLayerPriority(int prio);
215 | /**
216 | * Get layer ordering priority (0=default, low before high in layer order)
217 | */
218 | public int getLayerPriority();
219 | /**
220 | * Get min zoom-in for display of layer (hide when zoom is below this setting)
221 | * @return minzoom (-1 if no minimum)
222 | */
223 | public int getMinZoom();
224 | /**
225 | * Set min zoom-in for display of layer
226 | * @param minzoom - min zoom to display layer (-1 = no minimum)
227 | */
228 | public void setMinZoom(int minzoom);
229 | /**
230 | * Get max zoom-in for display of layer (hide when zoom is above this setting)
231 | * @return maxzoom (-1 if no max)
232 | */
233 | public int getMaxZoom();
234 | /**
235 | * Set max zoom-in for display of layer
236 | * @param maxzoom - max zoom to display layer (-1 = no maximum)
237 | */
238 | public void setMaxZoom(int maxzoom);
239 | /**
240 | * Set show/hide label for markers in set
241 | * @param show - if true, show labels; if false, hide (show on hover); if null, use global default
242 | */
243 | public void setLabelShow(Boolean show);
244 | /**
245 | * Get show/hide label for markers
246 | * @return true, show labels; false, hide (show on hover); null, use global default
247 | */
248 | public Boolean getLabelShow();
249 | /**
250 | * Set the default marker icon for markers added to this set
251 | * @param defmark - default marker
252 | */
253 | public void setDefaultMarkerIcon(MarkerIcon defmark);
254 | /**
255 | * Get the default marker icon for the markers added to this set
256 | * @return default marker
257 | */
258 | public MarkerIcon getDefaultMarkerIcon();
259 | }
260 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------