|
37 | 37 | */ |
38 | 38 | public interface BlueMapMap { |
39 | 39 |
|
40 | | - /** |
41 | | - * Returns this maps id, this is equal to the id configured in bluemap's config for this map. |
42 | | - * @return the id of this map |
43 | | - */ |
44 | | - String getId(); |
45 | | - |
46 | | - /** |
47 | | - * Returns this maps display-name, this is equal to the name configured in bluemap's config for this map. |
48 | | - * @return the name of this map |
49 | | - */ |
50 | | - String getName(); |
51 | | - |
52 | | - /** |
53 | | - * Getter for the {@link BlueMapWorld} of this map. |
54 | | - * @return the {@link BlueMapWorld} of this map |
55 | | - */ |
56 | | - BlueMapWorld getWorld(); |
57 | | - |
58 | | - /** |
59 | | - * Getter for the size of all tiles on this map in blocks. |
60 | | - * @return the tile-size in blocks |
61 | | - */ |
62 | | - Vector2i getTileSize(); |
63 | | - |
64 | | - /** |
65 | | - * Getter for the offset of the tile-grid on this map.<br> |
66 | | - * E.g. an offset of (2|-1) would mean that the tile (0|0) has block (2|0|-1) at it's min-corner. |
67 | | - * @return the tile-offset in blocks |
68 | | - */ |
69 | | - Vector2i getTileOffset(); |
70 | | - |
71 | | - /** |
72 | | - * <p>Sets a filter that determines if a specific (hires) tile of this map should be updated or not. |
73 | | - * If this filter returns false for a tile, the "render"-process of this tile will be cancelled and the tile will be left untouched.</p> |
74 | | - * <p><b>Warning:</b> Using this method will harm the integrity of the map! Since BlueMap will still assume that the tile got updated properly.</p> |
75 | | - * <p>Any previously set filters will get overwritten with the new one. You can get the current filter using {@link #getTileFilter()} and combine them if you wish.</p> |
76 | | - * @param filter The filter that will be used from now on. |
77 | | - */ |
78 | | - void setTileFilter(Predicate<Vector2i> filter); |
79 | | - |
80 | | - /** |
81 | | - * Freezes or unfreezes the map in the same way the `/bluemap freeze` command does. |
82 | | - * BlueMap will no longer attempt to update this map if it is frozen. |
83 | | - * @param frozen Whether the map will be frozen or not |
84 | | - */ |
85 | | - void setFrozen(boolean frozen); |
86 | | - |
87 | | - /** |
88 | | - * Checks if the map is currently frozen |
89 | | - * @return true if the map is frozen, false otherwise |
90 | | - */ |
91 | | - boolean isFrozen(); |
92 | | - |
93 | | - /** |
94 | | - * Returns the currently set TileFilter. The default TileFilter is equivalent to <code>t -> true</code>. |
95 | | - */ |
96 | | - Predicate<Vector2i> getTileFilter(); |
97 | | - |
98 | | - /** |
99 | | - * Converts a block-position to a map-tile-coordinate for this map |
100 | | - * |
101 | | - * @param blockX the x-position of the block |
102 | | - * @param blockZ the z-position of the block |
103 | | - * @return the tile position |
104 | | - */ |
105 | | - default Vector2i posToTile(double blockX, double blockZ){ |
106 | | - Vector2i offset = getTileOffset(); |
107 | | - Vector2i size = getTileSize(); |
108 | | - |
109 | | - return Vector2i.from( |
110 | | - (int) Math.floor((blockX - offset.getX()) / size.getX()), |
111 | | - (int) Math.floor((blockZ - offset.getY()) / size.getY()) |
112 | | - ); |
113 | | - } |
114 | | - |
115 | | - /** |
116 | | - * Converts a block-position to a map-tile-coordinate for this map |
117 | | - * |
118 | | - * @param pos the position of the block |
119 | | - * @return the tile position |
120 | | - */ |
121 | | - default Vector2i posToTile(Vector3i pos){ |
122 | | - return posToTile(pos.getX(), pos.getZ()); |
123 | | - } |
124 | | - |
125 | | - /** |
126 | | - * Converts a block-position to a map-tile-coordinate for this map |
127 | | - * |
128 | | - * @param pos the position of the block |
129 | | - * @return the tile position |
130 | | - */ |
131 | | - default Vector2i posToTile(Vector3d pos){ |
132 | | - return posToTile(pos.getX(), pos.getZ()); |
133 | | - } |
134 | | - |
| 40 | + /** |
| 41 | + * Returns this maps id, this is equal to the id configured in bluemap's config for this map. |
| 42 | + * @return the id of this map |
| 43 | + */ |
| 44 | + String getId(); |
| 45 | + |
| 46 | + /** |
| 47 | + * Returns this maps display-name, this is equal to the name configured in bluemap's config for this map. |
| 48 | + * @return the name of this map |
| 49 | + */ |
| 50 | + String getName(); |
| 51 | + |
| 52 | + /** |
| 53 | + * Getter for the {@link BlueMapWorld} of this map. |
| 54 | + * @return the {@link BlueMapWorld} of this map |
| 55 | + */ |
| 56 | + BlueMapWorld getWorld(); |
| 57 | + |
| 58 | + /** |
| 59 | + * Getter for the size of all tiles on this map in blocks. |
| 60 | + * @return the tile-size in blocks |
| 61 | + */ |
| 62 | + Vector2i getTileSize(); |
| 63 | + |
| 64 | + /** |
| 65 | + * Getter for the offset of the tile-grid on this map.<br> |
| 66 | + * E.g. an offset of (2|-1) would mean that the tile (0|0) has block (2|0|-1) at it's min-corner. |
| 67 | + * @return the tile-offset in blocks |
| 68 | + */ |
| 69 | + Vector2i getTileOffset(); |
| 70 | + |
| 71 | + /** |
| 72 | + * <p>Sets a filter that determines if a specific (hires) tile of this map should be updated or not. |
| 73 | + * If this filter returns false for a tile, the "render"-process of this tile will be cancelled and the tile will be left untouched.</p> |
| 74 | + * <p><b>Warning:</b> Using this method will harm the integrity of the map! Since BlueMap will still assume that the tile got updated properly.</p> |
| 75 | + * <p>Any previously set filters will get overwritten with the new one. You can get the current filter using {@link #getTileFilter()} and combine them if you wish.</p> |
| 76 | + * @param filter The filter that will be used from now on. |
| 77 | + */ |
| 78 | + void setTileFilter(Predicate<Vector2i> filter); |
| 79 | + |
| 80 | + /** |
| 81 | + * Freezes or unfreezes the map in the same way the `/bluemap freeze` command does. |
| 82 | + * BlueMap will no longer attempt to update this map if it is frozen. |
| 83 | + * @param frozen Whether the map will be frozen or not |
| 84 | + */ |
| 85 | + void setFrozen(boolean frozen); |
| 86 | + |
| 87 | + /** |
| 88 | + * Checks if the map is currently frozen |
| 89 | + * @return true if the map is frozen, false otherwise |
| 90 | + */ |
| 91 | + boolean isFrozen(); |
| 92 | + |
| 93 | + /** |
| 94 | + * Returns the currently set TileFilter. The default TileFilter is equivalent to <code>t -> true</code>. |
| 95 | + */ |
| 96 | + Predicate<Vector2i> getTileFilter(); |
| 97 | + |
| 98 | + /** |
| 99 | + * Converts a block-position to a map-tile-coordinate for this map |
| 100 | + * |
| 101 | + * @param blockX the x-position of the block |
| 102 | + * @param blockZ the z-position of the block |
| 103 | + * @return the tile position |
| 104 | + */ |
| 105 | + default Vector2i posToTile(double blockX, double blockZ){ |
| 106 | + Vector2i offset = getTileOffset(); |
| 107 | + Vector2i size = getTileSize(); |
| 108 | + |
| 109 | + return Vector2i.from( |
| 110 | + (int) Math.floor((blockX - offset.getX()) / size.getX()), |
| 111 | + (int) Math.floor((blockZ - offset.getY()) / size.getY()) |
| 112 | + ); |
| 113 | + } |
| 114 | + |
| 115 | + /** |
| 116 | + * Converts a block-position to a map-tile-coordinate for this map |
| 117 | + * |
| 118 | + * @param pos the position of the block |
| 119 | + * @return the tile position |
| 120 | + */ |
| 121 | + default Vector2i posToTile(Vector3i pos){ |
| 122 | + return posToTile(pos.getX(), pos.getZ()); |
| 123 | + } |
| 124 | + |
| 125 | + /** |
| 126 | + * Converts a block-position to a map-tile-coordinate for this map |
| 127 | + * |
| 128 | + * @param pos the position of the block |
| 129 | + * @return the tile position |
| 130 | + */ |
| 131 | + default Vector2i posToTile(Vector3d pos){ |
| 132 | + return posToTile(pos.getX(), pos.getZ()); |
| 133 | + } |
| 134 | + |
135 | 135 | } |
0 commit comments