mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-09-27 06:42:42 +02:00
Fix cave detection
This commit is contained in:
parent
d1452faa52
commit
a98917a288
@ -31,6 +31,7 @@
|
|||||||
import de.bluecolored.bluemap.core.BlueMap;
|
import de.bluecolored.bluemap.core.BlueMap;
|
||||||
import de.bluecolored.bluemap.core.MinecraftVersion;
|
import de.bluecolored.bluemap.core.MinecraftVersion;
|
||||||
import de.bluecolored.bluemap.core.logger.Logger;
|
import de.bluecolored.bluemap.core.logger.Logger;
|
||||||
|
import de.bluecolored.bluemap.core.resources.datapack.DataPack;
|
||||||
import de.bluecolored.bluemap.core.util.FileHelper;
|
import de.bluecolored.bluemap.core.util.FileHelper;
|
||||||
import de.bluecolored.bluemap.core.util.Key;
|
import de.bluecolored.bluemap.core.util.Key;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
@ -222,19 +223,19 @@ private Map<String, MapConfig> loadMapConfigs(Collection<ServerWorld> autoConfig
|
|||||||
Files.writeString(
|
Files.writeString(
|
||||||
mapConfigFolder.resolve("overworld.conf"),
|
mapConfigFolder.resolve("overworld.conf"),
|
||||||
createOverworldMapTemplate("Overworld", worldFolder,
|
createOverworldMapTemplate("Overworld", worldFolder,
|
||||||
new Key("minecraft", "overworld"), 0).build(),
|
DataPack.DIMENSION_OVERWORLD, 0).build(),
|
||||||
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING
|
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING
|
||||||
);
|
);
|
||||||
Files.writeString(
|
Files.writeString(
|
||||||
mapConfigFolder.resolve("nether.conf"),
|
mapConfigFolder.resolve("nether.conf"),
|
||||||
createNetherMapTemplate("Nether", worldFolder,
|
createNetherMapTemplate("Nether", worldFolder,
|
||||||
new Key("minecraft", "the_nether"), 0).build(),
|
DataPack.DIMENSION_THE_NETHER, 0).build(),
|
||||||
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING
|
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING
|
||||||
);
|
);
|
||||||
Files.writeString(
|
Files.writeString(
|
||||||
mapConfigFolder.resolve("end.conf"),
|
mapConfigFolder.resolve("end.conf"),
|
||||||
createEndMapTemplate("End", worldFolder,
|
createEndMapTemplate("End", worldFolder,
|
||||||
new Key("minecraft", "the_end"), 0).build(),
|
DataPack.DIMENSION_THE_END, 0).build(),
|
||||||
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING
|
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -252,7 +253,7 @@ private Map<String, MapConfig> loadMapConfigs(Collection<ServerWorld> autoConfig
|
|||||||
configFile = mapConfigFolder.resolve(id + '_' + (++i) + ".conf");
|
configFile = mapConfigFolder.resolve(id + '_' + (++i) + ".conf");
|
||||||
}
|
}
|
||||||
|
|
||||||
String name = worldFolder.getFileName() + " - " + dimensionName;
|
String name = worldFolder.getFileName() + " (" + dimensionName + ")";
|
||||||
if (i > 1) name = name + " (" + i + ")";
|
if (i > 1) name = name + " (" + i + ")";
|
||||||
|
|
||||||
ConfigTemplate template;
|
ConfigTemplate template;
|
||||||
|
@ -104,8 +104,14 @@ public void build(BlockNeighborhood<?> block, BlockState blockState, Variant var
|
|||||||
|
|
||||||
private final Color tintcolor = new Color();
|
private final Color tintcolor = new Color();
|
||||||
private void build() {
|
private void build() {
|
||||||
|
int blockLight = block.getBlockLightLevel();
|
||||||
|
int sunLight = block.getSunLightLevel();
|
||||||
|
|
||||||
// filter out blocks that are in a "cave" that should not be rendered
|
// filter out blocks that are in a "cave" that should not be rendered
|
||||||
if (this.block.isCave() && (renderSettings.isCaveDetectionUsesBlockLight() ? block.getBlockLightLevel() : block.getSunLightLevel()) == 0f) return;
|
if (
|
||||||
|
this.block.isRemoveIfCave() &&
|
||||||
|
(renderSettings.isCaveDetectionUsesBlockLight() ? Math.max(blockLight, sunLight) : sunLight) == 0f
|
||||||
|
) return;
|
||||||
|
|
||||||
int level = blockState.getLiquidLevel();
|
int level = blockState.getLiquidLevel();
|
||||||
if (level < 8 && !(level == 0 && isSameLiquid(block.getNeighborBlock(0, 1, 0)))){
|
if (level < 8 && !(level == 0 && isSameLiquid(block.getNeighborBlock(0, 1, 0)))){
|
||||||
@ -160,7 +166,7 @@ private void build() {
|
|||||||
blockColor.multiply(tintcolor);
|
blockColor.multiply(tintcolor);
|
||||||
|
|
||||||
// apply light
|
// apply light
|
||||||
float combinedLight = Math.max(block.getSunLightLevel() / 15f, block.getBlockLightLevel() / 15f);
|
float combinedLight = Math.max(sunLight, blockLight) / 15f;
|
||||||
combinedLight = (renderSettings.getAmbientLight() + combinedLight) / (renderSettings.getAmbientLight() + 1f);
|
combinedLight = (renderSettings.getAmbientLight() + combinedLight) / (renderSettings.getAmbientLight() + 1f);
|
||||||
blockColor.r *= combinedLight;
|
blockColor.r *= combinedLight;
|
||||||
blockColor.g *= combinedLight;
|
blockColor.g *= combinedLight;
|
||||||
|
@ -196,7 +196,10 @@ private void createElementFace(Element element, Direction faceDir, VectorM3f c0,
|
|||||||
int blockLight = Math.max(blockLightData.getBlockLight(), facedLightData.getBlockLight());
|
int blockLight = Math.max(blockLightData.getBlockLight(), facedLightData.getBlockLight());
|
||||||
|
|
||||||
// filter out faces that are in a "cave" that should not be rendered
|
// filter out faces that are in a "cave" that should not be rendered
|
||||||
if (block.isCave() && (renderSettings.isCaveDetectionUsesBlockLight() ? Math.max(blockLight, sunLight) : sunLight) == 0f) return;
|
if (
|
||||||
|
block.isRemoveIfCave() &&
|
||||||
|
(renderSettings.isCaveDetectionUsesBlockLight() ? Math.max(blockLight, sunLight) : sunLight) == 0f
|
||||||
|
) return;
|
||||||
|
|
||||||
// initialize the faces
|
// initialize the faces
|
||||||
blockModel.initialize();
|
blockModel.initialize();
|
||||||
|
@ -109,12 +109,14 @@ public boolean isInsideRenderBounds() {
|
|||||||
return insideRenderBounds;
|
return insideRenderBounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCave() {
|
public boolean isRemoveIfCave() {
|
||||||
if (!isCaveCalculated) {
|
if (!isCaveCalculated) {
|
||||||
isCave = getY() < renderSettings.getRemoveCavesBelowY() &&
|
isCave = getY() < renderSettings.getRemoveCavesBelowY() &&
|
||||||
|
(
|
||||||
!getChunk().hasOceanFloorHeights() ||
|
!getChunk().hasOceanFloorHeights() ||
|
||||||
getY() < getChunk().getOceanFloorY(getX(), getZ()) +
|
getY() < getChunk().getOceanFloorY(getX(), getZ()) +
|
||||||
renderSettings.getCaveDetectionOceanFloor();
|
renderSettings.getCaveDetectionOceanFloor()
|
||||||
|
);
|
||||||
isCaveCalculated = true;
|
isCaveCalculated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user