Add patch for BCLib to solve patchy features gen issue

This commit is contained in:
tom lee
2022-01-29 16:11:52 +08:00
parent c09b07a21b
commit 4263ea9733
4 changed files with 37 additions and 8 deletions
@@ -83,6 +83,7 @@ import net.minecraft.server.level.ThreadedLevelLightEngine;
import net.minecraft.CrashReport;
import net.minecraft.CrashReportCategory;
import net.minecraft.ReportedException;
import net.minecraft.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Registry;
import net.minecraft.core.RegistryAccess;
@@ -623,7 +624,7 @@ public final class WorldGenerationStep {
}
e.pEvent.emptyNano = System.nanoTime();
e.refreshTimeout();
region = new LightedWorldGenRegion(params.level, lightEngine, chunks, ChunkStatus.STRUCTURE_STARTS, e.range + 1, e.lightMode, generator);
region = new LightedWorldGenRegion(params.level, lightEngine, chunks, ChunkStatus.STRUCTURE_STARTS, rangeEmpty, e.lightMode, generator);
adaptor.setRegion(region);
referencedChunks = chunks.subGrid(e.range);
referencedChunks = generateDirect(e, referencedChunks, e.target, region);
@@ -1069,6 +1070,7 @@ public final class WorldGenerationStep {
final WorldGenLevelLightEngine light;
final LightGenerationMode lightMode;
final EmptyChunkGenerator generator;
final int writeRadius;
Long2ObjectOpenHashMap<ChunkAccess> chunkMap = new Long2ObjectOpenHashMap<ChunkAccess>();
public LightedWorldGenRegion(ServerLevel serverLevel, WorldGenLevelLightEngine lightEngine, List<ChunkAccess> list, ChunkStatus chunkStatus, int i,
LightGenerationMode lightMode, EmptyChunkGenerator generator) {
@@ -1076,8 +1078,30 @@ public final class WorldGenerationStep {
this.lightMode = lightMode;
this.generator = generator;
light = lightEngine;
writeRadius = i;
}
// Bypass BCLib mixin overrides.
@Override
public boolean ensureCanWrite(BlockPos blockPos) {
int i = SectionPos.blockToSectionCoord(blockPos.getX());
int j = SectionPos.blockToSectionCoord(blockPos.getZ());
ChunkPos chunkPos = this.getCenter();
ChunkAccess center = this.getChunk(chunkPos.x, chunkPos.z);
int k = Math.abs(chunkPos.x - i);
int l = Math.abs(chunkPos.z - j);
if (k > this.writeRadius || l > this.writeRadius) {
return false;
}
if (center.isUpgrading()) {
LevelHeightAccessor levelHeightAccessor = center.getHeightAccessorForGeneration();
if (blockPos.getY() < levelHeightAccessor.getMinBuildHeight() || blockPos.getY() >= levelHeightAccessor.getMaxBuildHeight()) {
return false;
}
}
return true;
}
// Skip updating the related tile entities
@Override
public boolean setBlock(BlockPos blockPos, BlockState blockState, int i, int j) {
+9 -6
View File
@@ -40,29 +40,32 @@ dependencies {
}
// Starlight
// modImplementation "curse.maven:starlight-521783:${project.starlight_version_fabric}"
// modImplementation "curse.maven:starlight-521783:${rootProject.starlight_version_fabric}"
// Sodium
modImplementation "maven.modrinth:sodium:${rootProject.sodium_version}"
implementation "org.joml:joml:1.10.2"
// Lithium
// modImplementation "maven.modrinth:lithium:${project.lithium_version}"
// modImplementation "maven.modrinth:lithium:${rootProject.lithium_version}"
// Iris
// modImplementation "maven.modrinth:iris:${project.iris_version}"
// modImplementation "maven.modrinth:iris:${rootProject.iris_version}"
// BCLib
// modImplementation "com.github.paulevsGitch:BCLib:${rootProject.bclib_version}"
// Immersive Portals
/*
modImplementation("com.github.qouteall.ImmersivePortalsMod:build:${project.immersive_portals_version}") {
modImplementation("com.github.qouteall.ImmersivePortalsMod:build:${rootProject.immersive_portals_version}") {
exclude(group: "net.fabricmc.fabric-api")
transitive(false)
}
modImplementation("com.github.qouteall.ImmersivePortalsMod:imm_ptl_core:${project.immersive_portals_version}") {
modImplementation("com.github.qouteall.ImmersivePortalsMod:imm_ptl_core:${rootProject.immersive_portals_version}") {
exclude(group: "net.fabricmc.fabric-api")
transitive(false)
}
modImplementation("com.github.qouteall.ImmersivePortalsMod:q_misc_util:${project.immersive_portals_version}") {
modImplementation("com.github.qouteall.ImmersivePortalsMod:q_misc_util:${rootProject.immersive_portals_version}") {
exclude(group: "net.fabricmc.fabric-api")
transitive(false)
}
@@ -2,6 +2,7 @@ package com.seibel.lod.fabric.wrappers.modAccessor;
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IStarlightAccessor;
public class StarlightAccessor implements IStarlightAccessor {
@Override
+2 -1
View File
@@ -10,7 +10,7 @@ toml_version=3.6.0
# Mod info
mod_name=Distant Horizons
mod_description=This mod generates and renders simplified terrain beyond the normal view distance at a low performance cost. Allowing you to see much farther without turning your game into a slideshow.
mod_authors=James Seibel, Leonardo Amato, Cola, coolGi2007, Ran
mod_authors=James Seibel, Leonardo Amato, Cola, coolGi2007, Ran, LeeTom
# Fabric loader
fabric_loader_version=0.12.12
@@ -22,6 +22,7 @@ fabric_api_version=0.44.0+1.18
sodium_version=mc1.18-0.4.0-alpha5
iris_version=1.18.x-v1.1.4
immersive_portals_version = v1.0.4-1.18
bclib_version=1.2.5
# Forge loader
forge_version=39.0.44