mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-15 23:25:32 +01: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.MinecraftVersion;
|
||||
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.Key;
|
||||
import lombok.Builder;
|
||||
@ -222,19 +223,19 @@ private Map<String, MapConfig> loadMapConfigs(Collection<ServerWorld> autoConfig
|
||||
Files.writeString(
|
||||
mapConfigFolder.resolve("overworld.conf"),
|
||||
createOverworldMapTemplate("Overworld", worldFolder,
|
||||
new Key("minecraft", "overworld"), 0).build(),
|
||||
DataPack.DIMENSION_OVERWORLD, 0).build(),
|
||||
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING
|
||||
);
|
||||
Files.writeString(
|
||||
mapConfigFolder.resolve("nether.conf"),
|
||||
createNetherMapTemplate("Nether", worldFolder,
|
||||
new Key("minecraft", "the_nether"), 0).build(),
|
||||
DataPack.DIMENSION_THE_NETHER, 0).build(),
|
||||
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING
|
||||
);
|
||||
Files.writeString(
|
||||
mapConfigFolder.resolve("end.conf"),
|
||||
createEndMapTemplate("End", worldFolder,
|
||||
new Key("minecraft", "the_end"), 0).build(),
|
||||
DataPack.DIMENSION_THE_END, 0).build(),
|
||||
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING
|
||||
);
|
||||
} else {
|
||||
@ -252,7 +253,7 @@ private Map<String, MapConfig> loadMapConfigs(Collection<ServerWorld> autoConfig
|
||||
configFile = mapConfigFolder.resolve(id + '_' + (++i) + ".conf");
|
||||
}
|
||||
|
||||
String name = worldFolder.getFileName() + " - " + dimensionName;
|
||||
String name = worldFolder.getFileName() + " (" + dimensionName + ")";
|
||||
if (i > 1) name = name + " (" + i + ")";
|
||||
|
||||
ConfigTemplate template;
|
||||
|
@ -104,8 +104,14 @@ public void build(BlockNeighborhood<?> block, BlockState blockState, Variant var
|
||||
|
||||
private final Color tintcolor = new Color();
|
||||
private void build() {
|
||||
int blockLight = block.getBlockLightLevel();
|
||||
int sunLight = block.getSunLightLevel();
|
||||
|
||||
// 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();
|
||||
if (level < 8 && !(level == 0 && isSameLiquid(block.getNeighborBlock(0, 1, 0)))){
|
||||
@ -160,7 +166,7 @@ private void build() {
|
||||
blockColor.multiply(tintcolor);
|
||||
|
||||
// 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);
|
||||
blockColor.r *= 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());
|
||||
|
||||
// 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
|
||||
blockModel.initialize();
|
||||
|
@ -109,12 +109,14 @@ public boolean isInsideRenderBounds() {
|
||||
return insideRenderBounds;
|
||||
}
|
||||
|
||||
public boolean isCave() {
|
||||
public boolean isRemoveIfCave() {
|
||||
if (!isCaveCalculated) {
|
||||
isCave = getY() < renderSettings.getRemoveCavesBelowY() &&
|
||||
!getChunk().hasOceanFloorHeights() ||
|
||||
(
|
||||
!getChunk().hasOceanFloorHeights() ||
|
||||
getY() < getChunk().getOceanFloorY(getX(), getZ()) +
|
||||
renderSettings.getCaveDetectionOceanFloor();
|
||||
renderSettings.getCaveDetectionOceanFloor()
|
||||
);
|
||||
isCaveCalculated = true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user