Skip to content

Commit 54101c0

Browse files
committed
Merge branch 'master' into mc1.21.1
2 parents 98ab48d + 24ff647 commit 54101c0

File tree

33 files changed

+547
-152
lines changed

33 files changed

+547
-152
lines changed

api

common/src/main/java/de/bluecolored/bluemap/common/commands/commands/DebugCommand.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
import com.flowpowered.math.vector.Vector2i;
2828
import com.flowpowered.math.vector.Vector3d;
29-
import com.flowpowered.math.vector.Vector3i;
3029
import de.bluecolored.bluecommands.annotations.Argument;
3130
import de.bluecolored.bluecommands.annotations.Command;
3231
import de.bluecolored.bluemap.common.BlueMapService;
@@ -103,7 +102,6 @@ public Component block(CommandSource source, World world, @Argument("x") int x,
103102

104103
Chunk chunk = world.getChunkAtBlock(x, z);
105104
LightData lightData = chunk.getLightData(x, y, z, new LightData(0, 0));
106-
Vector3i spawnPoint = world.getSpawnPoint();
107105

108106
return paragraph("World-Info (debug)", lines(
109107
item("position", format("( x: % | y: % | z: % )",
@@ -138,12 +136,7 @@ public Component block(CommandSource source, World world, @Argument("x") int x,
138136
.append(details(BASE_COLOR,
139137
item("name", world.getName()),
140138
item("min-y", world.getDimensionType().getMinY()),
141-
item("height", world.getDimensionType().getHeight()),
142-
item("spawn", format("( x: % | y: % | z: % )",
143-
text(spawnPoint.getX()).color(HIGHLIGHT_COLOR),
144-
text(spawnPoint.getY()).color(HIGHLIGHT_COLOR),
145-
text(spawnPoint.getZ()).color(HIGHLIGHT_COLOR)
146-
))
139+
item("height", world.getDimensionType().getHeight())
147140
))
148141
)
149142
));

common/src/main/java/de/bluecolored/bluemap/common/config/MapConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public class MapConfig implements MapSettings {
6060

6161
private int sorting = 0;
6262

63-
@Nullable private Vector2i startPos = null;
63+
private Vector2i startPos = Vector2i.ZERO;
6464

6565
private String skyColor = "#7dabff";
6666
private String voidColor = "#000000";

common/src/main/java/de/bluecolored/bluemap/common/rendermanager/MapUpdatePreparationTask.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,8 @@ private Collection<RenderTask> createTasks(Collection<Vector2i> regions) {
112112
ArrayList<WorldRegionRenderTask> regionTasks = new ArrayList<>(regions.size());
113113
regions.forEach(region -> regionTasks.add(new WorldRegionRenderTask(map, region, force)));
114114

115-
// get spawn region
116-
World world = map.getWorld();
117-
Vector2i spawnPoint = world.getSpawnPoint().toVector2(true);
118-
Grid regionGrid = world.getRegionGrid();
119-
Vector2i spawnRegion = regionGrid.getCell(spawnPoint);
120-
121-
// sort tasks by distance to the spawn region
122-
regionTasks.sort(WorldRegionRenderTask.defaultComparator(spawnRegion));
115+
// sort tasks by distance to 0/0
116+
regionTasks.sort(WorldRegionRenderTask.defaultComparator(Vector2i.ZERO));
123117

124118
// save map before and after the whole update
125119
ArrayList<RenderTask> tasks = new ArrayList<>(regionTasks.size() + 2);

common/src/main/java/de/bluecolored/bluemap/common/rendermanager/WorldRegionRenderTask.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ private BoundsSituation checkTileBounds(Vector2i tile) {
329329
}
330330

331331
private @Nullable TileState checkTileRenderPreconditions(Vector2i tile) {
332+
boolean chunksAreGenerated = false;
332333
boolean chunksAreInhabited = false;
333334

334335
long minInhabitedTime = map.getMapSettings().getMinInhabitedTime();
@@ -344,12 +345,17 @@ private BoundsSituation checkTileBounds(Vector2i tile) {
344345
for (int chunkZ = minZ; chunkZ <= maxZ; chunkZ++) {
345346
Chunk chunk = map.getWorld().getChunk(chunkX, chunkZ);
346347
if (chunk == Chunk.ERRORED_CHUNK) return TileState.CHUNK_ERROR;
347-
if (!chunk.isGenerated()) return TileState.NOT_GENERATED;
348-
if (requireLight && !chunk.hasLightData()) return TileState.MISSING_LIGHT;
348+
if (requireLight) {
349+
if (!chunk.isGenerated()) return TileState.NOT_GENERATED;
350+
if (!chunk.hasLightData()) return TileState.MISSING_LIGHT;
351+
}
352+
if (chunk.isGenerated()) chunksAreGenerated = true;
349353
if (chunk.getInhabitedTime() >= minInhabitedTime) chunksAreInhabited = true;
350354
}
351355
}
352356

357+
if (!chunksAreGenerated) return TileState.NOT_GENERATED;
358+
353359
// second pass for increased inhabited-time-radius
354360
if (!chunksAreInhabited && minInhabitedTimeRadius > 0) {
355361
inhabitedRadiusCheck:

common/src/main/java/de/bluecolored/bluemap/common/web/LoggingRequestHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public LoggingRequestHandler(HttpRequestHandler delegate, String format) {
5757
public HttpResponse handle(HttpRequest request) {
5858

5959
// gather format parameters from request
60-
String source = request.getSource().toString();
60+
String source = request.getSource().getHostAddress();
6161
String xffSource = source;
6262
HttpHeader xffHeader = request.getHeader("X-Forwarded-For");
6363
if (xffHeader != null && !xffHeader.getValues().isEmpty()) {

common/src/main/resources/de/bluecolored/bluemap/config/maps/map.conf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ sorting: ${sorting}
2525

2626
# The position on the world where the map will be centered if you open it.
2727
# You can change this at any time.
28-
# This defaults to the world-spawn if you don't set it.
29-
#start-pos: {x:500, z:-820}
28+
# Default is { x: 0, z: 0 }
29+
start-pos: { x: 0, z: 0 }
3030

3131
# The color of the sky as a hex-color
3232
# You can change this at any time.
@@ -151,9 +151,9 @@ storage: "file"
151151
# If this is set to true BlueMap will render Chunks even if there is no light-data!
152152
# This can be useful for example if some mod prevents light-data from being saved correctly.
153153
# However, this also has a few drawbacks:
154-
# - For those chunks, every block will always be fully lit
154+
# - Cave rendering will always be enabled (BlueMap is using the sky-light data to detect "caves")
155+
# - Everything will be rendered fully lit (sky-light value of 15, looks similar to having night vision)
155156
# - Night-mode might not work correctly
156-
# - Caves will always be rendered (ignoring the 'renderCaves' setting)
157157
# Default is false
158158
ignore-missing-light-data: false
159159

common/webapp/package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/src/main/java/de/bluecolored/bluemap/core/map/MapSettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public interface MapSettings extends RenderSettings {
3232

3333
int getSorting();
3434

35-
@Nullable Vector2i getStartPos();
35+
Vector2i getStartPos();
3636

3737
String getSkyColor();
3838

core/src/main/java/de/bluecolored/bluemap/core/map/MapSettingsSerializer.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import de.bluecolored.bluemap.core.util.math.Color;
3434

3535
import java.lang.reflect.Type;
36-
import java.util.Optional;
3736

3837
public class MapSettingsSerializer implements JsonSerializer<BmMap> {
3938

@@ -67,9 +66,7 @@ public JsonElement serialize(BmMap map, Type typeOfSrc, JsonSerializationContext
6766
root.add("lowres", lowres);
6867

6968
// startPos
70-
Vector2i startPos = Optional.ofNullable(map.getMapSettings().getStartPos())
71-
.orElse(map.getWorld().getSpawnPoint().toVector2(true));
72-
root.add("startPos", context.serialize(startPos));
69+
root.add("startPos", context.serialize(map.getMapSettings().getStartPos()));
7370

7471
// skyColor
7572
Color skyColor = new Color().parse(map.getMapSettings().getSkyColor());

0 commit comments

Comments
 (0)