mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2025-02-01 21:21:20 +01:00
Add hidden config to disable checking for removed regions on map-updates
This commit is contained in:
parent
9d14653172
commit
526d587dc6
@ -80,6 +80,8 @@ public class MapConfig implements MapSettings {
|
||||
private boolean enableFreeFlightView = true;
|
||||
private boolean enableHires = true;
|
||||
|
||||
private boolean checkForRemovedRegions = true;
|
||||
|
||||
private String storage = "file";
|
||||
|
||||
private boolean ignoreMissingLightData = false;
|
||||
|
@ -133,33 +133,35 @@ private static Collection<Vector2i> getRegions(BmMap map, Vector2i center, int r
|
||||
|
||||
// also update regions that are present as map-tile-state files (they might have been rendered before but deleted now)
|
||||
// (a little hacky as we are operating on raw tile-state files -> maybe find a better way?)
|
||||
Grid tileGrid = map.getHiresModelManager().getTileGrid();
|
||||
Grid cellGrid = MapTileState.GRID.multiply(tileGrid);
|
||||
try (Stream<GridStorage.Cell> stream = map.getStorage().tileState().stream()) {
|
||||
stream
|
||||
.filter(c -> {
|
||||
// filter out files that are fully UNKNOWN/NOT_GENERATED
|
||||
// this avoids unnecessarily converting UNKNOWN tiles into NOT_GENERATED tiles on force-updates
|
||||
try (CompressedInputStream in = c.read()) {
|
||||
if (in == null) return false;
|
||||
TileState[] states = TileInfoRegion.loadPalette(in.decompress());
|
||||
for (TileState state : states) {
|
||||
if (
|
||||
state != TileState.UNKNOWN &&
|
||||
state != TileState.NOT_GENERATED
|
||||
) return true;
|
||||
if (map.getMapSettings().isCheckForRemovedRegions()) {
|
||||
Grid tileGrid = map.getHiresModelManager().getTileGrid();
|
||||
Grid cellGrid = MapTileState.GRID.multiply(tileGrid);
|
||||
try (Stream<GridStorage.Cell> stream = map.getStorage().tileState().stream()) {
|
||||
stream
|
||||
.filter(c -> {
|
||||
// filter out files that are fully UNKNOWN/NOT_GENERATED
|
||||
// this avoids unnecessarily converting UNKNOWN tiles into NOT_GENERATED tiles on force-updates
|
||||
try (CompressedInputStream in = c.read()) {
|
||||
if (in == null) return false;
|
||||
TileState[] states = TileInfoRegion.loadPalette(in.decompress());
|
||||
for (TileState state : states) {
|
||||
if (
|
||||
state != TileState.UNKNOWN &&
|
||||
state != TileState.NOT_GENERATED
|
||||
) return true;
|
||||
}
|
||||
return false;
|
||||
} catch (IOException ignore) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} catch (IOException ignore) {
|
||||
return true;
|
||||
}
|
||||
})
|
||||
.map(c -> new Vector2i(c.getX(), c.getZ()))
|
||||
.flatMap(v -> cellGrid.getIntersecting(v, regionGrid).stream())
|
||||
.filter(regionRadiusFilter)
|
||||
.forEach(regions::add);
|
||||
} catch (IOException ex) {
|
||||
Logger.global.logError("Failed to load map tile state!", ex);
|
||||
})
|
||||
.map(c -> new Vector2i(c.getX(), c.getZ()))
|
||||
.flatMap(v -> cellGrid.getIntersecting(v, regionGrid).stream())
|
||||
.filter(regionRadiusFilter)
|
||||
.forEach(regions::add);
|
||||
} catch (IOException ex) {
|
||||
Logger.global.logError("Failed to load map tile state!", ex);
|
||||
}
|
||||
}
|
||||
|
||||
return regions;
|
||||
|
@ -60,6 +60,8 @@ public interface MapSettings extends RenderSettings {
|
||||
|
||||
boolean isEnableHires();
|
||||
|
||||
boolean isCheckForRemovedRegions();
|
||||
|
||||
@Override
|
||||
default boolean isSaveHiresLayer() {
|
||||
return isEnableHires();
|
||||
|
Loading…
Reference in New Issue
Block a user