Rename DLodDirection -> EDhDirection and rename several methods

This commit is contained in:
James Seibel
2023-07-22 12:20:39 -05:00
parent 6ac5b7f9a3
commit a61b2cb2fc
8 changed files with 29 additions and 29 deletions
@@ -29,7 +29,7 @@ import com.mojang.math.Matrix4f;
import org.joml.Matrix4f;
#endif
import com.seibel.distanthorizons.core.enums.ELodDirection;
import com.seibel.distanthorizons.core.enums.EDhDirection;
import com.seibel.distanthorizons.core.pos.DhBlockPos;
import com.seibel.distanthorizons.core.pos.DhChunkPos;
import com.seibel.distanthorizons.coreapi.util.math.Mat4f;
@@ -89,12 +89,12 @@ public class McObjectConverter
static final Direction[] directions;
static final ELodDirection[] lodDirections;
static final EDhDirection[] lodDirections;
static {
ELodDirection[] lodDirs = ELodDirection.values();
EDhDirection[] lodDirs = EDhDirection.values();
directions = new Direction[lodDirs.length];
lodDirections = new ELodDirection[lodDirs.length];
for (ELodDirection lodDir : lodDirs)
lodDirections = new EDhDirection[lodDirs.length];
for (EDhDirection lodDir : lodDirs)
{
Direction dir;
switch (lodDir.name().toUpperCase())
@@ -138,11 +138,11 @@ public class McObjectConverter
return new ChunkPos(wrappedPos.x, wrappedPos.z);
}
public static Direction Convert(ELodDirection lodDirection)
public static Direction Convert(EDhDirection lodDirection)
{
return directions[lodDirection.ordinal()];
}
public static ELodDirection Convert(Direction direction)
public static EDhDirection Convert(Direction direction)
{
return lodDirections[direction.ordinal()];
}
@@ -22,7 +22,7 @@ package com.seibel.distanthorizons.common.wrappers.chunk;
import com.seibel.distanthorizons.api.enums.config.ELightGenerationMode;
import com.seibel.distanthorizons.common.wrappers.block.BiomeWrapper;
import com.seibel.distanthorizons.common.wrappers.block.BlockStateWrapper;
import com.seibel.distanthorizons.common.wrappers.worldGeneration.mimicObject.LightedWorldGenRegion;
import com.seibel.distanthorizons.common.wrappers.worldGeneration.mimicObject.DhLitWorldGenRegion;
import com.seibel.distanthorizons.core.config.Config;
import com.seibel.distanthorizons.core.pos.DhBlockPos;
import com.seibel.distanthorizons.core.pos.DhChunkPos;
@@ -96,7 +96,7 @@ public class ChunkWrapper implements IChunkWrapper
this.chunkPos = new DhChunkPos(chunk.getPos().x, chunk.getPos().z);
// TODO is this the best way to differentiate between when we are generating chunks and when MC gave us a chunk?
boolean isDhGeneratedChunk = (this.lightSource.getClass() == LightedWorldGenRegion.class);
boolean isDhGeneratedChunk = (this.lightSource.getClass() == DhLitWorldGenRegion.class);
this.useDhLightingEngine = isDhGeneratedChunk && (Config.Client.Advanced.WorldGenerator.worldGenLightingEngine.get() == ELightGenerationMode.DISTANT_HORIZONS);
weakMapLock.writeLock().lock();
@@ -167,13 +167,13 @@ public class ChunkWrapper implements IChunkWrapper
public ChunkAccess getChunk() { return this.chunk; }
@Override
public int getMaxX() { return this.chunk.getPos().getMaxBlockX(); }
public int getMaxBlockX() { return this.chunk.getPos().getMaxBlockX(); }
@Override
public int getMaxZ() { return this.chunk.getPos().getMaxBlockZ(); }
public int getMaxBlockZ() { return this.chunk.getPos().getMaxBlockZ(); }
@Override
public int getMinX() { return this.chunk.getPos().getMinBlockX(); }
public int getMinBlockX() { return this.chunk.getPos().getMinBlockX(); }
@Override
public int getMinZ() { return this.chunk.getPos().getMinBlockZ(); }
public int getMinBlockZ() { return this.chunk.getPos().getMinBlockZ(); }
@Override
public long getLongChunkPos() { return this.chunk.getPos().toLong(); }
@@ -259,7 +259,7 @@ public class ChunkWrapper implements IChunkWrapper
// note: this returns 0 if the chunk is unload
// MC lighting method
return this.lightSource.getBrightness(LightLayer.BLOCK, new BlockPos(relX +this.getMinX(), relY, relZ +this.getMinZ()));
return this.lightSource.getBrightness(LightLayer.BLOCK, new BlockPos(relX +this.getMinBlockX(), relY, relZ +this.getMinBlockZ()));
}
}
@@ -277,7 +277,7 @@ public class ChunkWrapper implements IChunkWrapper
else
{
// MC lighting method
return this.lightSource.getBrightness(LightLayer.SKY, new BlockPos(relX +this.getMinX(), relY, relZ +this.getMinZ()));
return this.lightSource.getBrightness(LightLayer.SKY, new BlockPos(relX +this.getMinBlockX(), relY, relZ +this.getMinBlockZ()));
}
}
@@ -307,9 +307,9 @@ public class ChunkWrapper implements IChunkWrapper
}
@Override
public boolean doesNearbyChunksExist()
public boolean doNearbyChunksExist()
{
if (this.lightSource instanceof LightedWorldGenRegion)
if (this.lightSource instanceof DhLitWorldGenRegion)
{
return true;
}
@@ -28,8 +28,8 @@ import com.mojang.blaze3d.platform.NativeImage;
import com.seibel.distanthorizons.common.wrappers.McObjectConverter;
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
import com.seibel.distanthorizons.common.wrappers.world.ServerLevelWrapper;
import com.seibel.distanthorizons.core.enums.EDhDirection;
import com.seibel.distanthorizons.coreapi.ModInfo;
import com.seibel.distanthorizons.core.enums.ELodDirection;
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftSharedWrapper;
@@ -108,7 +108,7 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
//=================//
@Override
public float getShade(ELodDirection lodDirection) {
public float getShade(EDhDirection lodDirection) {
if (mc.level != null)
{
Direction mcDir = McObjectConverter.Convert(lodDirection);
@@ -425,7 +425,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
EVENT_LOGGER.debug("Lod Generate Event: "+genEvent.minPos);
ArrayGridList<ChunkWrapper> chunkWrapperList;
LightedWorldGenRegion region;
DhLitWorldGenRegion region;
WorldGenLevelLightEngine lightEngine;
LightGetterAdaptor adaptor;
@@ -467,7 +467,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
totalChunks = new ArrayGridList<>(refSize, (x,z) -> generator.generate(x + refPosX,z + refPosZ));
genEvent.refreshTimeout();
region = new LightedWorldGenRegion(params.level, lightEngine, totalChunks,
region = new DhLitWorldGenRegion(params.level, lightEngine, totalChunks,
ChunkStatus.STRUCTURE_STARTS, refSize/2, generator);
adaptor.setRegion(region);
genEvent.threadedParam.makeStructFeat(region, params);
@@ -550,7 +550,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
}
public void generateDirect(GenerationEvent genEvent, ArrayGridList<ChunkWrapper> chunksToGenerate, int border,
EDhApiWorldGenerationStep step, LightedWorldGenRegion region) throws InterruptedException
EDhApiWorldGenerationStep step, DhLitWorldGenRegion region) throws InterruptedException
{
if (Thread.interrupted())
{
@@ -54,7 +54,7 @@ import net.minecraft.world.level.chunk.ImposterProtoChunk;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.lighting.LevelLightEngine;
public class LightedWorldGenRegion extends WorldGenRegion
public class DhLitWorldGenRegion extends WorldGenRegion
{
private static final Logger LOGGER = DhLoggerBuilder.getLogger(MethodHandles.lookup().lookupClass().getSimpleName());
@@ -87,7 +87,7 @@ public class LightedWorldGenRegion extends WorldGenRegion
#endif
#endif
public LightedWorldGenRegion(ServerLevel serverLevel, WorldGenLevelLightEngine lightEngine,
public DhLitWorldGenRegion(ServerLevel serverLevel, WorldGenLevelLightEngine lightEngine,
List<ChunkAccess> chunkList, ChunkStatus chunkStatus, int writeRadius,
BatchGenerationEnvironment.EmptyChunkGenerator generator)
{
@@ -34,7 +34,7 @@ import net.minecraft.world.level.chunk.LightChunk;
public class LightGetterAdaptor implements LightChunkGetter {
private final BlockGetter heightGetter;
public LightedWorldGenRegion genRegion = null;
public DhLitWorldGenRegion genRegion = null;
final boolean shouldReturnNull;
public LightGetterAdaptor(BlockGetter heightAccessor) {
@@ -42,7 +42,7 @@ public class LightGetterAdaptor implements LightChunkGetter {
shouldReturnNull = ModAccessorInjector.INSTANCE.get(IStarlightAccessor.class) != null;
}
public void setRegion(LightedWorldGenRegion region) {
public void setRegion(DhLitWorldGenRegion region) {
genRegion = region;
}
@@ -24,7 +24,7 @@ import java.util.ArrayList;
import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper;
import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGenerationEnvironment;
import com.seibel.distanthorizons.common.wrappers.worldGeneration.ThreadedParameters;
import com.seibel.distanthorizons.common.wrappers.worldGeneration.mimicObject.LightedWorldGenRegion;
import com.seibel.distanthorizons.common.wrappers.worldGeneration.mimicObject.DhLitWorldGenRegion;
import com.seibel.distanthorizons.core.util.gridList.ArrayGridList;
import net.minecraft.ReportedException;
@@ -51,7 +51,7 @@ public final class StepFeatures {
public final ChunkStatus STATUS = ChunkStatus.FEATURES;
public void generateGroup(ThreadedParameters tParams, LightedWorldGenRegion worldGenRegion,
public void generateGroup(ThreadedParameters tParams, DhLitWorldGenRegion worldGenRegion,
ArrayGridList<ChunkWrapper> chunkWrappers) {
ArrayList<ChunkAccess> chunksToDo = new ArrayList<ChunkAccess>();