mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-15 23:25:32 +01:00
Merge branch 'mc/1.13' into mc/1.12
This commit is contained in:
commit
98a253adc9
@ -111,9 +111,17 @@ public void renderMaps() throws IOException {
|
||||
Logger.global.logInfo("Preparing renderer for map '" + mapConfig.getId() + "' ...");
|
||||
World world = MCAWorld.load(worldFolder.toPath(), UUID.randomUUID(), configManager.getBlockIdConfig(), configManager.getBlockPropertiesConfig(), configManager.getBiomeConfig());
|
||||
|
||||
//slice world to render edges if configured
|
||||
if (mapConfig.isRenderEdges() && !(mapConfig.getMin().equals(RenderSettings.DEFAULT_MIN) && mapConfig.getMax().equals(RenderSettings.DEFAULT_MAX))) {
|
||||
world = new SlicedWorld(world, mapConfig.getMin(), mapConfig.getMax());
|
||||
//slice world if configured
|
||||
if (!mapConfig.getMin().equals(RenderSettings.DEFAULT_MIN) || !mapConfig.getMax().equals(RenderSettings.DEFAULT_MAX)) {
|
||||
if (mapConfig.isRenderEdges()) {
|
||||
world = new SlicedWorld(world, mapConfig.getMin(), mapConfig.getMax());
|
||||
} else {
|
||||
world = new SlicedWorld(
|
||||
world,
|
||||
mapConfig.getMin().min(mapConfig.getMin().sub(2, 2, 2)), // protect from int-overflow
|
||||
mapConfig.getMax().max(mapConfig.getMax().add(2, 2, 2)) // protect from int-overflow
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
HiresModelManager hiresModelManager = new HiresModelManager(
|
||||
|
@ -324,43 +324,19 @@ private Text createPrioritizeTaskText(RenderTask task) {
|
||||
}
|
||||
|
||||
private void createWorldRenderTask(CommandSource source, World world, Vector2i center, long blockRadius) {
|
||||
source.sendMessage(Text.of(TextColor.GOLD, "Collecting chunks to render..."));
|
||||
|
||||
String taskName = "world-render";
|
||||
|
||||
Predicate<Vector2i> filter;
|
||||
if (center == null || blockRadius < 0) {
|
||||
filter = c -> true;
|
||||
} else {
|
||||
filter = c -> c.mul(16).distanceSquared(center) <= blockRadius * blockRadius;
|
||||
taskName = "radius-render";
|
||||
}
|
||||
|
||||
Collection<Vector2i> chunks = world.getChunkList(filter);
|
||||
|
||||
source.sendMessage(Text.of(TextColor.GREEN, chunks.size() + " chunks found!"));
|
||||
|
||||
for (MapType map : bluemap.getMapTypes()) {
|
||||
if (!map.getWorld().getUUID().equals(world.getUUID())) continue;
|
||||
|
||||
source.sendMessage(Text.of(TextColor.GOLD, "Collecting tiles for map '" + map.getId() + "'"));
|
||||
|
||||
HiresModelManager hmm = map.getTileRenderer().getHiresModelManager();
|
||||
Collection<Vector2i> tiles = hmm.getTilesForChunks(chunks);
|
||||
|
||||
RenderTask task = new RenderTask(taskName, map);
|
||||
task.addTiles(tiles);
|
||||
task.optimizeQueue();
|
||||
bluemap.getRenderManager().addRenderTask(task);
|
||||
|
||||
source.sendMessage(Text.of(TextColor.GREEN, tiles.size() + " tiles found! Task created."));
|
||||
createMapRenderTask(source, map, center, blockRadius);
|
||||
}
|
||||
|
||||
source.sendMessage(Text.of(TextColor.GREEN, "All render tasks created! Use /bluemap to view the progress!"));
|
||||
}
|
||||
|
||||
private void createMapRenderTask(CommandSource source, MapType map, Vector2i center, long blockRadius) {
|
||||
source.sendMessage(Text.of(TextColor.GOLD, "Collecting chunks to render..."));
|
||||
source.sendMessage(Text.of(TextColor.GOLD, "Creating render-task for map: " + map.getId()));
|
||||
source.sendMessage(Text.of(TextColor.GOLD, "Collecting chunks..."));
|
||||
|
||||
String taskName = "world-render";
|
||||
|
||||
@ -375,7 +351,7 @@ private void createMapRenderTask(CommandSource source, MapType map, Vector2i cen
|
||||
Collection<Vector2i> chunks = map.getWorld().getChunkList(filter);
|
||||
|
||||
source.sendMessage(Text.of(TextColor.GREEN, chunks.size() + " chunks found!"));
|
||||
source.sendMessage(Text.of(TextColor.GOLD, "Collecting tiles for map '" + map.getId() + "'"));
|
||||
source.sendMessage(Text.of(TextColor.GOLD, "Collecting tiles..."));
|
||||
|
||||
HiresModelManager hmm = map.getTileRenderer().getHiresModelManager();
|
||||
Collection<Vector2i> tiles = hmm.getTilesForChunks(chunks);
|
||||
@ -386,7 +362,6 @@ private void createMapRenderTask(CommandSource source, MapType map, Vector2i cen
|
||||
bluemap.getRenderManager().addRenderTask(task);
|
||||
|
||||
source.sendMessage(Text.of(TextColor.GREEN, tiles.size() + " tiles found! Task created."));
|
||||
source.sendMessage(Text.of(TextColor.GREEN, "All render tasks created! Use /bluemap to view the progress!"));
|
||||
}
|
||||
|
||||
private boolean checkLoaded(CommandSource source) {
|
||||
|
@ -175,9 +175,17 @@ public synchronized void load() throws IOException, ParseResourceException {
|
||||
}
|
||||
}
|
||||
|
||||
//slice world to render edges if configured
|
||||
if (mapConfig.isRenderEdges() && !(mapConfig.getMin().equals(RenderSettings.DEFAULT_MIN) && mapConfig.getMax().equals(RenderSettings.DEFAULT_MAX))) {
|
||||
world = new SlicedWorld(world, mapConfig.getMin(), mapConfig.getMax());
|
||||
//slice world if configured
|
||||
if (!mapConfig.getMin().equals(RenderSettings.DEFAULT_MIN) || !mapConfig.getMax().equals(RenderSettings.DEFAULT_MAX)) {
|
||||
if (mapConfig.isRenderEdges()) {
|
||||
world = new SlicedWorld(world, mapConfig.getMin(), mapConfig.getMax());
|
||||
} else {
|
||||
world = new SlicedWorld(
|
||||
world,
|
||||
mapConfig.getMin().min(mapConfig.getMin().sub(2, 2, 2)), // protect from int-overflow
|
||||
mapConfig.getMax().max(mapConfig.getMax().add(2, 2, 2)) // protect from int-overflow
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
HiresModelManager hiresModelManager = new HiresModelManager(
|
||||
|
@ -32,6 +32,7 @@
|
||||
import com.flowpowered.math.vector.Vector2i;
|
||||
import com.flowpowered.math.vector.Vector3i;
|
||||
|
||||
import de.bluecolored.bluemap.core.logger.Logger;
|
||||
import de.bluecolored.bluemap.core.util.AABB;
|
||||
|
||||
/**
|
||||
@ -47,6 +48,8 @@ public SlicedWorld(World world, Vector3i min, Vector3i max) {
|
||||
this.world = world;
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
|
||||
Logger.global.logInfo("Sliced: " + min + max);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -116,23 +119,29 @@ public boolean isChunkGenerated(Vector2i chunkPos) throws IOException {
|
||||
|
||||
@Override
|
||||
public boolean isAreaGenerated(AABB area) throws IOException {
|
||||
if (!isInside(blockPosToChunkPos(area.getMin())) && !isInside(blockPosToChunkPos(area.getMax()))) return false;
|
||||
|
||||
return world.isAreaGenerated(area);
|
||||
return isAreaGenerated(area.getMin(), area.getMax());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAreaGenerated(Vector3i blockMin, Vector3i blockMax) throws IOException {
|
||||
if (!isInside(blockPosToChunkPos(blockMin)) && !isInside(blockPosToChunkPos(blockMax))) return false;
|
||||
|
||||
return world.isAreaGenerated(blockMin, blockMax);
|
||||
return isAreaGenerated(blockPosToChunkPos(blockMin), blockPosToChunkPos(blockMax));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAreaGenerated(Vector2i chunkMin, Vector2i chunkMax) throws IOException {
|
||||
if (!isInside(chunkMin) && !isInside(chunkMax)) return false;
|
||||
if (!isInside(chunkMin) &&
|
||||
!isInside(chunkMax) &&
|
||||
!isInside(new Vector2i(chunkMin.getX(), chunkMax.getY())) &&
|
||||
!isInside(new Vector2i(chunkMax.getX(), chunkMin.getY()))
|
||||
) return false;
|
||||
|
||||
return world.isAreaGenerated(chunkMin, chunkMax);
|
||||
for (int x = chunkMin.getX(); x <= chunkMax.getX(); x++) {
|
||||
for (int z = chunkMin.getY(); z <= chunkMax.getY(); z++) {
|
||||
if (!world.isChunkGenerated(new Vector2i(x, z))) return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -170,10 +179,11 @@ private boolean isInside(Vector2i chunkPos) {
|
||||
|
||||
private boolean isInside(int chunkX, int chunkZ) {
|
||||
return
|
||||
chunkX * 16 >= min.getX() &&
|
||||
chunkX * 16 + 15 <= max.getX() &&
|
||||
chunkZ * 16 >= min.getZ() &&
|
||||
chunkZ * 16 + 15 <= max.getZ();
|
||||
chunkX * 16 <= max.getX() &&
|
||||
chunkX * 16 + 15 >= min.getX() &&
|
||||
chunkZ * 16 <= max.getZ() &&
|
||||
chunkZ * 16 + 15 >= min.getZ();
|
||||
|
||||
}
|
||||
|
||||
private Block createAirBlock(Vector3i pos) {
|
||||
|
Loading…
Reference in New Issue
Block a user