Merge branch 'main' of https://gitlab.com/jeseibel/minecraft-lod-mod
This commit is contained in:
+48
-19
@@ -50,6 +50,22 @@ import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import net.minecraft.core.QuartPos;
|
||||
#endif
|
||||
|
||||
#if MC_1_16_5
|
||||
import net.minecraft.world.level.chunk.LevelChunkSection;
|
||||
#endif
|
||||
|
||||
#if MC_1_17_1
|
||||
import net.minecraft.world.level.chunk.LevelChunkSection;
|
||||
#endif
|
||||
|
||||
#if MC_1_18_2
|
||||
import net.minecraft.world.level.chunk.LevelChunkSection;
|
||||
#endif
|
||||
|
||||
#if MC_1_19_2 || MC_1_19_4
|
||||
import net.minecraft.world.level.chunk.LevelChunkSection;
|
||||
#endif
|
||||
|
||||
#if POST_MC_1_20_1
|
||||
import net.minecraft.world.level.chunk.LevelChunkSection;
|
||||
import net.minecraft.world.level.lighting.LevelLightEngine;
|
||||
@@ -153,11 +169,25 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
LevelChunkSection[] sections = this.chunk.getSections();
|
||||
for (int index = 0; index < sections.length; index++)
|
||||
{
|
||||
#if MC_1_16_5
|
||||
if (!sections[index].isEmpty())
|
||||
{
|
||||
// convert from an index to a block coordinate
|
||||
return this.chunk.getSections()[index].bottomBlockY() * 16;
|
||||
}
|
||||
#elif MC_1_17_1
|
||||
if (!sections[index].isEmpty())
|
||||
{
|
||||
// convert from an index to a block coordinate
|
||||
return this.chunk.getSections()[index].bottomBlockY() * 16;
|
||||
}
|
||||
#else
|
||||
if (!sections[index].hasOnlyAir())
|
||||
{
|
||||
// convert from an index to a block coordinate
|
||||
return this.chunk.getSectionYFromSectionIndex(index) * 16;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
@@ -409,25 +439,6 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
@Override
|
||||
public boolean isStillValid() { return this.wrappedLevel.tryGetChunk(this.chunkPos) == this; }
|
||||
|
||||
#if POST_MC_1_20_1
|
||||
private static boolean checkLightSectionsOnChunk(LevelChunk chunk, LevelLightEngine engine)
|
||||
{
|
||||
LevelChunkSection[] sections = chunk.getSections();
|
||||
int minY = chunk.getMinSection();
|
||||
int maxY = chunk.getMaxSection();
|
||||
for (int y = minY; y < maxY; ++y)
|
||||
{
|
||||
LevelChunkSection section = sections[chunk.getSectionIndexFromSectionY(y)];
|
||||
if (section.hasOnlyAir()) continue;
|
||||
if (!engine.lightOnInSection(SectionPos.of(chunk.getPos(), y)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
public static void syncedUpdateClientLightStatus()
|
||||
{
|
||||
@@ -462,6 +473,24 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#if POST_MC_1_20_1
|
||||
private static boolean checkLightSectionsOnChunk(LevelChunk chunk, LevelLightEngine engine)
|
||||
{
|
||||
LevelChunkSection[] sections = chunk.getSections();
|
||||
int minY = chunk.getMinSection();
|
||||
int maxY = chunk.getMaxSection();
|
||||
for (int y = minY; y < maxY; ++y)
|
||||
{
|
||||
LevelChunkSection section = sections[chunk.getSectionIndexFromSectionY(y)];
|
||||
if (section.hasOnlyAir()) continue;
|
||||
if (!engine.lightOnInSection(SectionPos.of(chunk.getPos(), y)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -110,8 +110,6 @@ public final class StepStructureStart
|
||||
tParams.structFeat, chunk, environment.params.structures);
|
||||
#endif
|
||||
|
||||
structurePlacementLock.unlock();
|
||||
|
||||
#if POST_MC_1_18_2
|
||||
try
|
||||
{
|
||||
@@ -139,6 +137,8 @@ public final class StepStructureStart
|
||||
//throw new StepStructureStart.StructStartCorruptedException(secondEx);
|
||||
}
|
||||
}
|
||||
|
||||
structurePlacementLock.unlock();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -128,7 +128,7 @@ processResources {
|
||||
runClient {
|
||||
dependsOn(copyCoreResources)
|
||||
dependsOn(copyCommonLoaderResources)
|
||||
jvmArgs "-XX:-OmitStackTraceInFastThrow"
|
||||
jvmArgs([ "-XX:-OmitStackTraceInFastThrow", minecraftMemoryJavaArg ])
|
||||
finalizedBy(deleteResources)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ loom {
|
||||
setConfigName("Forge Client")
|
||||
ideConfigGenerated(true)
|
||||
runDir("run")
|
||||
vmArg("-XX:-OmitStackTraceInFastThrow")
|
||||
vmArgs("-XX:-OmitStackTraceInFastThrow", minecraftMemoryJavaArg)
|
||||
}
|
||||
server {
|
||||
server()
|
||||
|
||||
@@ -44,3 +44,6 @@ versionStr=
|
||||
# This defines what MC version Intellij will use for the preprocessor
|
||||
# and what version is used automatically by build and run commands
|
||||
mcVer=1.20.1
|
||||
|
||||
# Defines the maximum amount of memory Minecraft is allowed when run in a developement environment
|
||||
minecraftMemoryJavaArg="-Xmx4G"
|
||||
|
||||
Reference in New Issue
Block a user