Update all pos objects to use getters to match with DhBlockPos
I'd prefer not to need getters/setters since it's cleaner to just call pos.x, but that doesn't allow for immutable/mutable distinction.
This commit is contained in:
@@ -26,7 +26,7 @@ import com.seibel.distanthorizons.core.generation.DhLightingEngine;
|
||||
import com.seibel.distanthorizons.core.level.IDhLevel;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.logging.f3.F3Screen;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||
import com.seibel.distanthorizons.core.render.renderer.DebugRenderer;
|
||||
import com.seibel.distanthorizons.core.sql.dto.BeaconBeamDTO;
|
||||
@@ -255,7 +255,7 @@ public class SharedApi
|
||||
else
|
||||
{
|
||||
// neighboring chunk
|
||||
DhChunkPos neighbourPos = new DhChunkPos(chunkWrapper.getChunkPos().x + xOffset, chunkWrapper.getChunkPos().z + zOffset);
|
||||
DhChunkPos neighbourPos = new DhChunkPos(chunkWrapper.getChunkPos().getX() + xOffset, chunkWrapper.getChunkPos().getZ() + zOffset);
|
||||
IChunkWrapper neighbourChunk = dhLevel.getLevelWrapper().tryGetChunk(neighbourPos);
|
||||
if (neighbourChunk != null)
|
||||
{
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ import com.seibel.distanthorizons.core.dataObjects.transformers.FullDataToRender
|
||||
import com.seibel.distanthorizons.core.file.DataSourcePool;
|
||||
import com.seibel.distanthorizons.core.file.IDataSource;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||
import com.seibel.distanthorizons.core.dataObjects.render.columnViews.ColumnArrayView;
|
||||
|
||||
+1
-2
@@ -21,10 +21,9 @@ package com.seibel.distanthorizons.core.dataObjects.render.bufferBuilding;
|
||||
|
||||
import com.seibel.distanthorizons.api.DhApi;
|
||||
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiRenderParam;
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.render.glObject.GLProxy;
|
||||
import com.seibel.distanthorizons.core.render.glObject.buffer.GLVertexBuffer;
|
||||
import com.seibel.distanthorizons.core.render.renderer.LodRenderer;
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ import com.seibel.distanthorizons.core.dataObjects.render.ColumnRenderSource;
|
||||
import com.seibel.distanthorizons.core.level.IDhClientLevel;
|
||||
import com.seibel.distanthorizons.core.logging.ConfigBasedLogger;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.core.render.glObject.GLProxy;
|
||||
import com.seibel.distanthorizons.core.util.ColorUtil;
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ import com.seibel.distanthorizons.core.dataObjects.render.columnViews.ColumnArra
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.level.IDhClientLevel;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.core.util.ColorUtil;
|
||||
import com.seibel.distanthorizons.core.util.FullDataPointUtil;
|
||||
|
||||
+8
-8
@@ -31,8 +31,8 @@ import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSour
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.enums.EDhDirection;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPosMutable;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPosMutable;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.core.util.FullDataPointUtil;
|
||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||
@@ -67,8 +67,8 @@ public class LodDataBuilder
|
||||
|
||||
|
||||
|
||||
int sectionPosX = getXOrZSectionPosFromChunkPos(chunkWrapper.getChunkPos().x);
|
||||
int sectionPosZ = getXOrZSectionPosFromChunkPos(chunkWrapper.getChunkPos().z);
|
||||
int sectionPosX = getXOrZSectionPosFromChunkPos(chunkWrapper.getChunkPos().getX());
|
||||
int sectionPosZ = getXOrZSectionPosFromChunkPos(chunkWrapper.getChunkPos().getZ());
|
||||
long pos = DhSectionPos.encode(DhSectionPos.SECTION_BLOCK_DETAIL_LEVEL, sectionPosX, sectionPosZ);
|
||||
|
||||
FullDataSourceV2 dataSource = FullDataSourceV2.createEmpty(pos);
|
||||
@@ -78,8 +78,8 @@ public class LodDataBuilder
|
||||
|
||||
// compute the chunk dataSource offset
|
||||
// this offset is used to determine where in the dataSource this chunk's data should go
|
||||
int chunkOffsetX = chunkWrapper.getChunkPos().x;
|
||||
if (chunkWrapper.getChunkPos().x < 0)
|
||||
int chunkOffsetX = chunkWrapper.getChunkPos().getX();
|
||||
if (chunkWrapper.getChunkPos().getX() < 0)
|
||||
{
|
||||
// expected offset positions:
|
||||
// chunkPos -> offset
|
||||
@@ -106,8 +106,8 @@ public class LodDataBuilder
|
||||
}
|
||||
chunkOffsetX *= LodUtil.CHUNK_WIDTH;
|
||||
|
||||
int chunkOffsetZ = chunkWrapper.getChunkPos().z;
|
||||
if (chunkWrapper.getChunkPos().z < 0)
|
||||
int chunkOffsetZ = chunkWrapper.getChunkPos().getZ();
|
||||
if (chunkWrapper.getChunkPos().getZ() < 0)
|
||||
{
|
||||
chunkOffsetZ = ((chunkOffsetZ) % FullDataSourceV2.NUMB_OF_CHUNKS_WIDE);
|
||||
if (chunkOffsetZ != 0)
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ package com.seibel.distanthorizons.core.file.subDimMatching;
|
||||
|
||||
import com.electronwill.nightconfig.core.file.CommentedFileConfig;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.IWrapperFactory;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||
|
||||
|
||||
+6
-6
@@ -33,7 +33,7 @@ public class AdjacentChunkHolder
|
||||
{
|
||||
for (int zOffset = -1; zOffset <= 1; zOffset++)
|
||||
{
|
||||
DhChunkPos adjacentPos = new DhChunkPos(centerChunkPos.x + xOffset, centerChunkPos.z + zOffset);
|
||||
DhChunkPos adjacentPos = new DhChunkPos(centerChunkPos.getX() + xOffset, centerChunkPos.getZ() + zOffset);
|
||||
requestedAdjacentPositions.add(adjacentPos);
|
||||
}
|
||||
}
|
||||
@@ -69,13 +69,13 @@ public class AdjacentChunkHolder
|
||||
DhChunkPos centerPos = this.chunkArray[4].getChunkPos();
|
||||
DhChunkPos offsetPos = centerWrapper.getChunkPos();
|
||||
|
||||
int offsetX = offsetPos.x - centerPos.x;
|
||||
int offsetX = offsetPos.getX() - centerPos.getX();
|
||||
if (offsetX < -1 || offsetX > 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int offsetZ = offsetPos.z - centerPos.z;
|
||||
int offsetZ = offsetPos.getZ() - centerPos.getZ();
|
||||
if (offsetZ < -1 || offsetZ > 1)
|
||||
{
|
||||
return;
|
||||
@@ -91,18 +91,18 @@ public class AdjacentChunkHolder
|
||||
int chunkZ = BitShiftUtil.divideByPowerOfTwo(blockZ, 4);
|
||||
IChunkWrapper centerChunk = this.chunkArray[4];
|
||||
DhChunkPos centerPos = centerChunk.getChunkPos();
|
||||
if (centerPos.x == chunkX && centerPos.z == chunkZ)
|
||||
if (centerPos.getX() == chunkX && centerPos.getZ() == chunkZ)
|
||||
{
|
||||
return centerChunk;
|
||||
}
|
||||
|
||||
int offsetX = chunkX - centerPos.x;
|
||||
int offsetX = chunkX - centerPos.getX();
|
||||
if (offsetX < -1 || offsetX > 1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int offsetZ = chunkZ - centerPos.z;
|
||||
int offsetZ = chunkZ - centerPos.getZ();
|
||||
if (offsetZ < -1 || offsetZ > 1)
|
||||
{
|
||||
return null;
|
||||
|
||||
@@ -21,8 +21,8 @@ package com.seibel.distanthorizons.core.generation;
|
||||
|
||||
import com.seibel.distanthorizons.core.enums.EDhDirection;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPosMutable;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPosMutable;
|
||||
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.core.render.renderer.DebugRenderer;
|
||||
@@ -109,7 +109,7 @@ public class DhLightingEngine
|
||||
{
|
||||
for (int zOffset = -1; zOffset <= 1; zOffset++)
|
||||
{
|
||||
DhChunkPos adjacentPos = new DhChunkPos(centerChunkPos.x + xOffset, centerChunkPos.z + zOffset);
|
||||
DhChunkPos adjacentPos = new DhChunkPos(centerChunkPos.getX() + xOffset, centerChunkPos.getZ() + zOffset);
|
||||
requestedAdjacentPositions.add(adjacentPos);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ package com.seibel.distanthorizons.core.generation;
|
||||
|
||||
import com.seibel.distanthorizons.core.generation.tasks.IWorldGenTaskTracker;
|
||||
import com.seibel.distanthorizons.core.generation.tasks.WorldGenResult;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.core.render.LodQuadTree;
|
||||
|
||||
|
||||
+5
-5
@@ -27,7 +27,7 @@ import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSour
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.generation.tasks.*;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
@@ -456,8 +456,8 @@ public class WorldGenerationQueue implements IFullDataSourceRetrievalQueue, IDeb
|
||||
case VANILLA_CHUNKS:
|
||||
{
|
||||
return this.generator.generateChunks(
|
||||
chunkPosMin.x,
|
||||
chunkPosMin.z,
|
||||
chunkPosMin.getX(),
|
||||
chunkPosMin.getZ(),
|
||||
granularity,
|
||||
targetDataDetail,
|
||||
generatorMode,
|
||||
@@ -482,8 +482,8 @@ public class WorldGenerationQueue implements IFullDataSourceRetrievalQueue, IDeb
|
||||
case API_CHUNKS:
|
||||
{
|
||||
return this.generator.generateApiChunks(
|
||||
chunkPosMin.x,
|
||||
chunkPosMin.z,
|
||||
chunkPosMin.getX(),
|
||||
chunkPosMin.getZ(),
|
||||
granularity,
|
||||
targetDataDetail,
|
||||
generatorMode,
|
||||
|
||||
@@ -179,7 +179,7 @@ public abstract class AbstractDhLevel implements IDhLevel
|
||||
|
||||
ApiEventInjector.INSTANCE.fireAllEvents(
|
||||
DhApiChunkModifiedEvent.class,
|
||||
new DhApiChunkModifiedEvent.EventParam(this.getLevelWrapper(), chunkPos.x, chunkPos.z));
|
||||
new DhApiChunkModifiedEvent.EventParam(this.getLevelWrapper(), chunkPos.getX(), chunkPos.getZ()));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -27,7 +27,7 @@ import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.file.AbstractDataSourceHandler;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.FullDataSourceProviderV2;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.render.LodQuadTree;
|
||||
import com.seibel.distanthorizons.core.render.RenderBufferHandler;
|
||||
import com.seibel.distanthorizons.core.render.renderer.generic.GenericObjectRenderer;
|
||||
|
||||
@@ -25,7 +25,7 @@ import com.seibel.distanthorizons.core.file.fullDatafile.FullDataSourceProviderV
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.RemoteFullDataSourceProvider;
|
||||
import com.seibel.distanthorizons.core.file.structure.AbstractSaveStructure;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.render.RenderBufferHandler;
|
||||
import com.seibel.distanthorizons.core.render.renderer.generic.GenericObjectRenderer;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper;
|
||||
|
||||
@@ -28,8 +28,8 @@ import com.seibel.distanthorizons.core.render.RenderBufferHandler;
|
||||
import com.seibel.distanthorizons.core.render.renderer.DebugRenderer;
|
||||
import com.seibel.distanthorizons.core.file.structure.AbstractSaveStructure;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.render.renderer.generic.GenericObjectRenderer;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IProfilerWrapper;
|
||||
|
||||
@@ -22,7 +22,7 @@ package com.seibel.distanthorizons.core.level;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.FullDataSourceProviderV2;
|
||||
import com.seibel.distanthorizons.core.file.structure.AbstractSaveStructure;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.render.RenderBufferHandler;
|
||||
import com.seibel.distanthorizons.core.render.renderer.generic.GenericObjectRenderer;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
package com.seibel.distanthorizons.core.level;
|
||||
|
||||
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiRenderParam;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IProfilerWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IBiomeWrapper;
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.seibel.distanthorizons.core.file.fullDatafile.GeneratedFullDataSource
|
||||
import com.seibel.distanthorizons.core.generation.IFullDataSourceRetrievalQueue;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.logging.f3.F3Screen;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos2D;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.Closeable;
|
||||
|
||||
@@ -19,12 +19,23 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.pos;
|
||||
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||
|
||||
/**
|
||||
* immutable <br><br>
|
||||
*
|
||||
* Dev note: if for some reason we want to store these as longs check the old commits. <br>
|
||||
* That logic was removed since it wasn't needed at the time
|
||||
*/
|
||||
public class DhChunkPos
|
||||
{
|
||||
public final int x; // Low 32 bits
|
||||
public final int z; // High 32 bits
|
||||
private final int x;
|
||||
public int getX() { return x; }
|
||||
|
||||
private final int z;
|
||||
public int getZ() { return z; }
|
||||
|
||||
/** cached to improve hashing speed */
|
||||
public final int hashCode;
|
||||
@@ -45,7 +56,7 @@ public class DhChunkPos
|
||||
}
|
||||
public DhChunkPos(DhBlockPos blockPos)
|
||||
{
|
||||
// >> 4 is the Same as div 16
|
||||
// >> 4 is the Same as divide by 16
|
||||
this(blockPos.getX() >> 4, blockPos.getZ() >> 4);
|
||||
}
|
||||
public DhChunkPos(DhBlockPos2D blockPos)
|
||||
@@ -53,7 +64,6 @@ public class DhChunkPos
|
||||
// >> 4 is the Same as div 16
|
||||
this(blockPos.x >> 4, blockPos.z >> 4);
|
||||
}
|
||||
public DhChunkPos(long packed) { this(getXFromPackedLong(packed), getZFromPackedLong(packed)); }
|
||||
|
||||
|
||||
|
||||
@@ -61,13 +71,8 @@ public class DhChunkPos
|
||||
// methods //
|
||||
//=========//
|
||||
|
||||
public DhBlockPos center() { return new DhBlockPos(8 + this.x << 4, 0, 8 + this.z << 4); }
|
||||
public DhBlockPos corner() { return new DhBlockPos(this.x << 4, 0, this.z << 4); }
|
||||
|
||||
public static long toLong(int x, int z) { return ((long) x & 0xFFFFFFFFL) << 32 | (long) z & 0xFFFFFFFFL; }
|
||||
|
||||
private static int getXFromPackedLong(long chunkPos) { return (int) (chunkPos >> 32); }
|
||||
private static int getZFromPackedLong(long chunkPos) { return (int) (chunkPos & 0xFFFFFFFFL); }
|
||||
public DhBlockPos centerBlockPos() { return new DhBlockPos(8 + this.x << 4, 0, 8 + this.z << 4); }
|
||||
public DhBlockPos minCornerBlockPos() { return new DhBlockPos(this.x << 4, 0, this.z << 4); }
|
||||
|
||||
public int getMinBlockX() { return this.x << 4; }
|
||||
public int getMinBlockZ() { return this.z << 4; }
|
||||
@@ -85,7 +90,6 @@ public class DhChunkPos
|
||||
&& minBlockZ <= pos.getZ() && pos.getZ() <= maxBlockZ;
|
||||
}
|
||||
|
||||
public long getLong() { return toLong(this.x, this.z); }
|
||||
|
||||
|
||||
//================//
|
||||
@@ -116,39 +120,4 @@ public class DhChunkPos
|
||||
@Override
|
||||
public String toString() { return "C[" + this.x + "," + this.z + "]"; }
|
||||
|
||||
|
||||
|
||||
//=======================//
|
||||
// static helper methods //
|
||||
//=======================//
|
||||
|
||||
public static void _DebugCheckPacker(int x, int z, long expected)
|
||||
{
|
||||
long packed = toLong(x, z);
|
||||
if (packed != expected)
|
||||
{
|
||||
throw new IllegalArgumentException("Packed values don't match: " + packed + " != " + expected);
|
||||
}
|
||||
|
||||
DhChunkPos pos = new DhChunkPos(packed);
|
||||
if (pos.x != x || pos.z != z)
|
||||
{
|
||||
throw new IllegalArgumentException("Values after decode don't match: " + pos + " != " + x + ", " + z);
|
||||
}
|
||||
}
|
||||
|
||||
/** @return true if testPos is within the area defined by the min and max positions. */
|
||||
public static boolean isChunkPosBetween(DhChunkPos minChunkPos, DhChunkPos testPos, DhChunkPos maxChunkPos)
|
||||
{
|
||||
int minChunkX = Math.min(minChunkPos.x, maxChunkPos.x);
|
||||
int minChunkZ = Math.min(minChunkPos.z, maxChunkPos.z);
|
||||
|
||||
int maxChunkX = Math.max(minChunkPos.x, maxChunkPos.x);
|
||||
int maxChunkZ = Math.max(minChunkPos.z, maxChunkPos.z);
|
||||
|
||||
return minChunkX <= testPos.x && testPos.x <= maxChunkX &&
|
||||
minChunkZ <= testPos.z && testPos.z <= maxChunkZ;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
package com.seibel.distanthorizons.core.pos;
|
||||
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.coreapi.util.BitShiftUtil;
|
||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -47,6 +48,10 @@ public class DhLodPos implements Comparable<DhLodPos>
|
||||
|
||||
|
||||
|
||||
//==============//
|
||||
// constructors //
|
||||
//==============//
|
||||
|
||||
public DhLodPos(byte detailLevel, int x, int z)
|
||||
{
|
||||
this.detailLevel = detailLevel;
|
||||
|
||||
@@ -36,6 +36,10 @@ public class DhLodUnit
|
||||
|
||||
|
||||
|
||||
//==============//
|
||||
// constructors //
|
||||
//==============//
|
||||
|
||||
public DhLodUnit(byte detailLevel, int numberOfLodSectionsWide)
|
||||
{
|
||||
this.detailLevel = detailLevel;
|
||||
@@ -43,6 +47,11 @@ public class DhLodUnit
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=========//
|
||||
// methods //
|
||||
//=========//
|
||||
|
||||
/** @return the size of this LOD unit in Minecraft blocks */
|
||||
public int toBlockWidth() { return BitShiftUtil.pow(this.numberOfLodSectionsWide, this.detailLevel); }
|
||||
/** @return the LOD Unit relative to the given block width and detail level */
|
||||
|
||||
@@ -21,6 +21,8 @@ package com.seibel.distanthorizons.core.pos;
|
||||
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.enums.EDhDirection;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||
import com.seibel.distanthorizons.coreapi.util.BitShiftUtil;
|
||||
|
||||
@@ -113,8 +115,8 @@ public class DhSectionPos
|
||||
/** Returns the section pos at the requested detail level containing the given ChunkPos */
|
||||
public static long encodeContaining(byte outputSectionDetailLevel, DhChunkPos pos)
|
||||
{
|
||||
int sectionPosX = getXOrZSectionPosFromChunkOrBlockPos(pos.x, true);
|
||||
int sectionPosZ = getXOrZSectionPosFromChunkOrBlockPos(pos.z, true);
|
||||
int sectionPosX = getXOrZSectionPosFromChunkOrBlockPos(pos.getX(), true);
|
||||
int sectionPosZ = getXOrZSectionPosFromChunkOrBlockPos(pos.getZ(), true);
|
||||
long blockPos = DhSectionPos.encode(DhSectionPos.SECTION_BLOCK_DETAIL_LEVEL, sectionPosX, sectionPosZ);
|
||||
return convertToDetailLevel(blockPos, outputSectionDetailLevel);
|
||||
}
|
||||
|
||||
@@ -23,15 +23,23 @@ import com.seibel.distanthorizons.coreapi.util.MathUtil;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/** immutable */
|
||||
public class Pos2D
|
||||
{
|
||||
public static final Pos2D ZERO = new Pos2D(0, 0);
|
||||
|
||||
public final int x;
|
||||
public final int y;
|
||||
private final int x;
|
||||
public int getX() { return this.x; }
|
||||
|
||||
private final int y;
|
||||
public int getY() { return this.y; }
|
||||
|
||||
|
||||
|
||||
//==============//
|
||||
// constructors //
|
||||
//==============//
|
||||
|
||||
public Pos2D(int x, int y)
|
||||
{
|
||||
this.x = x;
|
||||
@@ -40,6 +48,11 @@ public class Pos2D
|
||||
|
||||
|
||||
|
||||
|
||||
//======//
|
||||
// math //
|
||||
//======//
|
||||
|
||||
public Pos2D add(Pos2D other) { return new Pos2D(this.x + other.x, this.y + other.y); }
|
||||
public Pos2D subtract(Pos2D other) { return new Pos2D(this.x - other.x, this.y - other.y); }
|
||||
public Pos2D subtract(int value) { return new Pos2D(this.x - value, this.y - value); }
|
||||
@@ -72,10 +85,17 @@ public class Pos2D
|
||||
|
||||
|
||||
|
||||
//================//
|
||||
// base overrides //
|
||||
//================//
|
||||
|
||||
@Override
|
||||
public int hashCode() { return Objects.hash(this.x, this.y); }
|
||||
|
||||
@Override
|
||||
public String toString() { return "[" + this.x + ", " + this.y + "]"; }
|
||||
|
||||
@Override
|
||||
public boolean equals(Object otherObj)
|
||||
{
|
||||
if (otherObj == this)
|
||||
|
||||
+9
-2
@@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.distanthorizons.core.pos;
|
||||
package com.seibel.distanthorizons.core.pos.blockPos;
|
||||
|
||||
import com.seibel.distanthorizons.core.enums.EDhDirection;
|
||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||
@@ -26,7 +26,14 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import java.util.Objects;
|
||||
|
||||
/** @see DhBlockPosMutable */
|
||||
/**
|
||||
* immutable <br><br>
|
||||
*
|
||||
* Dev note: if for some reason we want to store these as longs check the old commits. <br>
|
||||
* That logic was removed since it wasn't needed at the time.
|
||||
*
|
||||
* @see DhBlockPosMutable
|
||||
*/
|
||||
public class DhBlockPos
|
||||
{
|
||||
/** Useful for methods that need a position passed in but won't actually be used */
|
||||
+4
-2
@@ -17,10 +17,12 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.distanthorizons.core.pos;
|
||||
package com.seibel.distanthorizons.core.pos.blockPos;
|
||||
|
||||
import com.seibel.distanthorizons.core.pos.Pos2D;
|
||||
import com.seibel.distanthorizons.coreapi.util.MathUtil;
|
||||
|
||||
/** immutable */
|
||||
public class DhBlockPos2D
|
||||
{
|
||||
public static final DhBlockPos2D ZERO = new DhBlockPos2D(0, 0);
|
||||
@@ -45,7 +47,7 @@ public class DhBlockPos2D
|
||||
this.z = blockPos.getZ();
|
||||
}
|
||||
|
||||
public static DhBlockPos2D fromPos2D(Pos2D pos) { return new DhBlockPos2D(pos.x, pos.y); }
|
||||
public static DhBlockPos2D fromPos2D(Pos2D pos) { return new DhBlockPos2D(pos.getX(), pos.getY()); }
|
||||
|
||||
|
||||
|
||||
+1
-6
@@ -17,14 +17,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.distanthorizons.core.pos;
|
||||
package com.seibel.distanthorizons.core.pos.blockPos;
|
||||
|
||||
import com.seibel.distanthorizons.core.enums.EDhDirection;
|
||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class DhBlockPosMutable extends DhBlockPos
|
||||
{
|
||||
@@ -19,19 +19,16 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.render;
|
||||
|
||||
import com.seibel.distanthorizons.api.enums.config.EDhApiHorizontalQuality;
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.config.listeners.ConfigChangeListener;
|
||||
import com.seibel.distanthorizons.core.dataObjects.render.ColumnRenderSource;
|
||||
import com.seibel.distanthorizons.core.enums.EDhDirection;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.FullDataSourceProviderV2;
|
||||
import com.seibel.distanthorizons.core.level.IDhClientLevel;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.core.render.renderer.DebugRenderer;
|
||||
import com.seibel.distanthorizons.core.render.renderer.IDebugRenderable;
|
||||
import com.seibel.distanthorizons.core.sql.repo.BeaconBeamRepo;
|
||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||
import com.seibel.distanthorizons.core.util.ThreadUtil;
|
||||
import com.seibel.distanthorizons.core.util.objects.quadTree.QuadNode;
|
||||
|
||||
@@ -30,7 +30,7 @@ import com.seibel.distanthorizons.core.enums.EDhDirection;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.FullDataSourceProviderV2;
|
||||
import com.seibel.distanthorizons.core.level.IDhClientLevel;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.core.render.glObject.GLProxy;
|
||||
import com.seibel.distanthorizons.core.render.renderer.IDebugRenderable;
|
||||
|
||||
@@ -195,11 +195,11 @@ public class RenderBufferHandler implements AutoCloseable
|
||||
int abPosDifference;
|
||||
if (axisDirection.getAxis().equals(EDhDirection.Axis.X))
|
||||
{
|
||||
abPosDifference = aPos.x - bPos.x;
|
||||
abPosDifference = aPos.getX() - bPos.getX();
|
||||
}
|
||||
else
|
||||
{
|
||||
abPosDifference = aPos.y - bPos.y;
|
||||
abPosDifference = aPos.getY() - bPos.getY();
|
||||
}
|
||||
|
||||
if (abPosDifference == 0)
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import com.seibel.distanthorizons.core.config.types.ConfigEntry;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.logging.ConfigBasedLogger;
|
||||
import com.seibel.distanthorizons.core.logging.ConfigBasedSpamLogger;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.pos.DhLodPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.core.render.glObject.GLState;
|
||||
|
||||
@@ -30,7 +30,7 @@ import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.logging.ConfigBasedLogger;
|
||||
import com.seibel.distanthorizons.core.logging.ConfigBasedSpamLogger;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.render.DhApiRenderProxy;
|
||||
import com.seibel.distanthorizons.core.render.RenderBufferHandler;
|
||||
import com.seibel.distanthorizons.core.render.glObject.GLProxy;
|
||||
|
||||
+1
-2
@@ -28,7 +28,7 @@ import com.seibel.distanthorizons.api.objects.render.DhApiRenderableBoxGroupShad
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||
import com.seibel.distanthorizons.core.sql.dto.BeaconBeamDTO;
|
||||
import com.seibel.distanthorizons.core.sql.repo.BeaconBeamRepo;
|
||||
@@ -44,7 +44,6 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
package com.seibel.distanthorizons.core.sql.dto;
|
||||
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
package com.seibel.distanthorizons.core.sql.repo;
|
||||
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.core.sql.dto.BeaconBeamDTO;
|
||||
|
||||
@@ -19,11 +19,9 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.sql.repo;
|
||||
|
||||
import com.seibel.distanthorizons.core.file.structure.AbstractSaveStructure;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||
import com.seibel.distanthorizons.core.sql.dto.ChunkHashDTO;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
@@ -56,7 +54,7 @@ public class ChunkHashRepo extends AbstractDhRepo<DhChunkPos, ChunkHashDTO>
|
||||
public String getTableName() { return "ChunkHash"; }
|
||||
|
||||
@Override
|
||||
public String createWhereStatement(DhChunkPos pos) { return "ChunkPosX = '"+pos.x+"' AND ChunkPosZ = '"+pos.z+"'"; }
|
||||
public String createWhereStatement(DhChunkPos pos) { return "ChunkPosX = '"+ pos.getX() +"' AND ChunkPosZ = '"+ pos.getZ() +"'"; }
|
||||
|
||||
|
||||
|
||||
@@ -93,8 +91,8 @@ public class ChunkHashRepo extends AbstractDhRepo<DhChunkPos, ChunkHashDTO>
|
||||
PreparedStatement statement = this.createPreparedStatement(sql);
|
||||
|
||||
int i = 1;
|
||||
statement.setObject(i++, dto.pos.x);
|
||||
statement.setObject(i++, dto.pos.z);
|
||||
statement.setObject(i++, dto.pos.getX());
|
||||
statement.setObject(i++, dto.pos.getZ());
|
||||
|
||||
statement.setObject(i++, dto.chunkHash);
|
||||
|
||||
@@ -119,8 +117,8 @@ public class ChunkHashRepo extends AbstractDhRepo<DhChunkPos, ChunkHashDTO>
|
||||
statement.setObject(i++, dto.chunkHash);
|
||||
statement.setObject(i++, System.currentTimeMillis()); // last modified unix time
|
||||
|
||||
statement.setObject(i++, dto.pos.x);
|
||||
statement.setObject(i++, dto.pos.z);
|
||||
statement.setObject(i++, dto.pos.getX());
|
||||
statement.setObject(i++, dto.pos.getZ());
|
||||
|
||||
return statement;
|
||||
}
|
||||
|
||||
@@ -87,11 +87,11 @@ public class ArrayGridList<T> extends ArrayList<T>
|
||||
|
||||
public final T get(Pos2D pos)
|
||||
{
|
||||
return get(pos.x, pos.y);
|
||||
return get(pos.getX(), pos.getY());
|
||||
}
|
||||
public final T set(Pos2D pos, T e)
|
||||
{
|
||||
return set(pos.x, pos.y, e);
|
||||
return set(pos.getX(), pos.getY(), e);
|
||||
}
|
||||
public T get(int x, int y)
|
||||
{
|
||||
|
||||
+32
-32
@@ -49,7 +49,7 @@ public class MovableGridRingList<T> extends ArrayList<T> implements List<T>
|
||||
// constructors //
|
||||
//==============//
|
||||
|
||||
public MovableGridRingList(int halfWidth, Pos2D center) { this(halfWidth, center.x, center.y); }
|
||||
public MovableGridRingList(int halfWidth, Pos2D center) { this(halfWidth, center.getX(), center.getY()); }
|
||||
public MovableGridRingList(int halfWidth, int centerX, int centerY)
|
||||
{
|
||||
super((halfWidth * 2 + 1) * (halfWidth * 2 + 1));
|
||||
@@ -68,7 +68,7 @@ public class MovableGridRingList<T> extends ArrayList<T> implements List<T>
|
||||
//=====================//
|
||||
|
||||
/** see {@link MovableGridRingList#get(int, int)} for full documentation */
|
||||
public T get(Pos2D pos) { return this.get(pos.x, pos.y); }
|
||||
public T get(Pos2D pos) { return this.get(pos.getX(), pos.getY()); }
|
||||
/** returns null if x,y is outside the grid */
|
||||
public T get(int x, int y)
|
||||
{
|
||||
@@ -100,7 +100,7 @@ public class MovableGridRingList<T> extends ArrayList<T> implements List<T>
|
||||
|
||||
|
||||
/** see {@link MovableGridRingList#set(int, int, T)} for full documentation */
|
||||
public boolean set(Pos2D pos, T item) { return this.set(pos.x, pos.y, item); }
|
||||
public boolean set(Pos2D pos, T item) { return this.set(pos.getX(), pos.getY(), item); }
|
||||
/** returns false if x,y is outside the grid */
|
||||
public boolean set(int x, int y, T item)
|
||||
{
|
||||
@@ -132,7 +132,7 @@ public class MovableGridRingList<T> extends ArrayList<T> implements List<T>
|
||||
}
|
||||
|
||||
/** see {@link MovableGridRingList#setChained(int, int, T)} for full documentation */
|
||||
public T setChained(Pos2D pos, T item) { return this.setChained(pos.x, pos.y, item); }
|
||||
public T setChained(Pos2D pos, T item) { return this.setChained(pos.getX(), pos.getY(), item); }
|
||||
/**
|
||||
* returns null if x,y is outside the grid
|
||||
* Otherwise, returns the new value
|
||||
@@ -146,7 +146,7 @@ public class MovableGridRingList<T> extends ArrayList<T> implements List<T>
|
||||
//================//
|
||||
|
||||
/** see {@link MovableGridRingList#swap(int, int, T)} for full documentation */
|
||||
public T swap(Pos2D pos, T item) { return this.swap(pos.x, pos.y, item); }
|
||||
public T swap(Pos2D pos, T item) { return this.swap(pos.getX(), pos.getY(), item); }
|
||||
/** returns the input item if x,y is outside the grid */
|
||||
public T swap(int x, int y, T item)
|
||||
{
|
||||
@@ -178,7 +178,7 @@ public class MovableGridRingList<T> extends ArrayList<T> implements List<T>
|
||||
|
||||
|
||||
/** see {@link MovableGridRingList#remove(int, int)} for full documentation */
|
||||
public T remove(Pos2D pos) { return this.remove(pos.x, pos.y); }
|
||||
public T remove(Pos2D pos) { return this.remove(pos.getX(), pos.getY()); }
|
||||
/** remove and return the item at x,y; returns null if the x,y are outside the grid */
|
||||
public T remove(int x, int y) { return this.swap(x, y, null); }
|
||||
|
||||
@@ -230,7 +230,7 @@ public class MovableGridRingList<T> extends ArrayList<T> implements List<T>
|
||||
Pos2D cPos = this.minPosRef.get();
|
||||
int newMinX = newCenterX - this.halfWidth;
|
||||
int newMinY = newCenterY - this.halfWidth;
|
||||
if (cPos.x == newMinX && cPos.y == newMinY)
|
||||
if (cPos.getX() == newMinX && cPos.getY() == newMinY)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -239,8 +239,8 @@ public class MovableGridRingList<T> extends ArrayList<T> implements List<T>
|
||||
try
|
||||
{
|
||||
cPos = this.minPosRef.get();
|
||||
int deltaX = newMinX - cPos.x;
|
||||
int deltaY = newMinY - cPos.y;
|
||||
int deltaX = newMinX - cPos.getX();
|
||||
int deltaY = newMinY - cPos.getY();
|
||||
if (deltaX == 0 && deltaY == 0)
|
||||
{
|
||||
return false;
|
||||
@@ -259,14 +259,14 @@ public class MovableGridRingList<T> extends ArrayList<T> implements List<T>
|
||||
{
|
||||
for (int y = 0; y < this.width; y++)
|
||||
{
|
||||
Pos2D itemPos = new Pos2D(x + cPos.x, y + cPos.y);
|
||||
Pos2D itemPos = new Pos2D(x + cPos.getX(), y + cPos.getY());
|
||||
|
||||
if (x - deltaX < 0
|
||||
|| y - deltaY < 0
|
||||
|| x - deltaX >= this.width
|
||||
|| y - deltaY >= this.width)
|
||||
{
|
||||
T item = this._swapUnsafe(itemPos.x, itemPos.y, null);
|
||||
T item = this._swapUnsafe(itemPos.getX(), itemPos.getY(), null);
|
||||
if (item != null && removedItemConsumer != null)
|
||||
{
|
||||
removedItemConsumer.accept(item);
|
||||
@@ -300,10 +300,10 @@ public class MovableGridRingList<T> extends ArrayList<T> implements List<T>
|
||||
// position getters //
|
||||
//==================//
|
||||
|
||||
public Pos2D getCenter() { return new Pos2D(this.minPosRef.get().x + this.halfWidth, this.minPosRef.get().y + this.halfWidth); }
|
||||
public Pos2D getCenter() { return new Pos2D(this.minPosRef.get().getX() + this.halfWidth, this.minPosRef.get().getY() + this.halfWidth); }
|
||||
|
||||
public Pos2D getMinPosInRange() { return this.minPosRef.get(); }
|
||||
public Pos2D getMaxPosInRange() { return new Pos2D(this.minPosRef.get().x + this.width - 1, this.minPosRef.get().y + this.width - 1); }
|
||||
public Pos2D getMaxPosInRange() { return new Pos2D(this.minPosRef.get().getX() + this.width - 1, this.minPosRef.get().getY() + this.width - 1); }
|
||||
|
||||
public int getWidth() { return this.width; }
|
||||
public int getHalfWidth() { return this.halfWidth; }
|
||||
@@ -321,18 +321,18 @@ public class MovableGridRingList<T> extends ArrayList<T> implements List<T>
|
||||
public boolean inRange(int x, int y)
|
||||
{
|
||||
Pos2D minPos = this.minPosRef.get();
|
||||
return (x >= minPos.x
|
||||
&& x < minPos.x + this.width
|
||||
&& y >= minPos.y
|
||||
&& y < minPos.y + this.width);
|
||||
return (x >= minPos.getX()
|
||||
&& x < minPos.getX() + this.width
|
||||
&& y >= minPos.getY()
|
||||
&& y < minPos.getY() + this.width);
|
||||
}
|
||||
|
||||
private boolean _inRangeAcquired(int x, int y, Pos2D min)
|
||||
{
|
||||
return (x >= min.x
|
||||
&& x < min.x + this.width
|
||||
&& y >= min.y
|
||||
&& y < min.y + this.width);
|
||||
return (x >= min.getX()
|
||||
&& x < min.getX() + this.width
|
||||
&& y >= min.getY()
|
||||
&& y < min.getY() + this.width);
|
||||
}
|
||||
|
||||
private T _getUnsafe(int x, int y) { return super.get(Math.floorMod(x, this.width) + Math.floorMod(y, this.width) * this.width); }
|
||||
@@ -379,9 +379,9 @@ public class MovableGridRingList<T> extends ArrayList<T> implements List<T>
|
||||
try
|
||||
{
|
||||
Pos2D min = this.minPosRef.get();
|
||||
for (int x = min.x; x < min.x + this.width; x++)
|
||||
for (int x = min.getX(); x < min.getX() + this.width; x++)
|
||||
{
|
||||
for (int y = min.y; y < min.y + this.width; y++)
|
||||
for (int y = min.getY(); y < min.getY() + this.width; y++)
|
||||
{
|
||||
T t = this._getUnsafe(x, y);
|
||||
consumer.accept(t, new Pos2D(x, y));
|
||||
@@ -412,7 +412,7 @@ public class MovableGridRingList<T> extends ArrayList<T> implements List<T>
|
||||
Pos2D min = this.minPosRef.get();
|
||||
for (Pos2D offset : this.ringPositionIteratorArray)
|
||||
{
|
||||
T item = this._getUnsafe(min.x + offset.x, min.y + offset.y);
|
||||
T item = this._getUnsafe(min.getX() + offset.getX(), min.getY() + offset.getY());
|
||||
if (item != null)
|
||||
{
|
||||
consumer.accept(item);
|
||||
@@ -443,9 +443,9 @@ public class MovableGridRingList<T> extends ArrayList<T> implements List<T>
|
||||
Pos2D min = this.minPosRef.get();
|
||||
for (Pos2D offset : this.ringPositionIteratorArray)
|
||||
{
|
||||
LodUtil.assertTrue(this._inRangeAcquired(min.x + offset.x, min.y + offset.y, min));
|
||||
T item = this._getUnsafe(min.x + offset.x, min.y + offset.y);
|
||||
consumer.accept(item, new Pos2D(min.x + offset.x, min.y + offset.y));
|
||||
LodUtil.assertTrue(this._inRangeAcquired(min.getX() + offset.getX(), min.getY() + offset.getY(), min));
|
||||
T item = this._getUnsafe(min.getX() + offset.getX(), min.getY() + offset.getY());
|
||||
consumer.accept(item, new Pos2D(min.getX() + offset.getX(), min.getY() + offset.getY()));
|
||||
}
|
||||
}
|
||||
finally
|
||||
@@ -479,8 +479,8 @@ public class MovableGridRingList<T> extends ArrayList<T> implements List<T>
|
||||
// sort the positions from nearest to farthest from the world origin
|
||||
Arrays.sort(posArray, (a, b) ->
|
||||
{
|
||||
long disSqrA = (long) a.x * a.x + (long) a.y * a.y;
|
||||
long disSqrB = (long) b.x * b.x + (long) b.y * b.y;
|
||||
long disSqrA = (long) a.getX() * a.getX() + (long) a.getY() * a.getY();
|
||||
long disSqrB = (long) b.getX() * b.getX() + (long) b.getY() * b.getY();
|
||||
return Double.compare(disSqrA, disSqrB);
|
||||
});
|
||||
|
||||
@@ -490,8 +490,8 @@ public class MovableGridRingList<T> extends ArrayList<T> implements List<T>
|
||||
}
|
||||
for (Pos2D pos2D : posArray)
|
||||
{
|
||||
LodUtil.assertTrue(pos2D.x >= 0 && pos2D.x < this.width);
|
||||
LodUtil.assertTrue(pos2D.y >= 0 && pos2D.y < this.width);
|
||||
LodUtil.assertTrue(pos2D.getX() >= 0 && pos2D.getX() < this.width);
|
||||
LodUtil.assertTrue(pos2D.getY() >= 0 && pos2D.getY() < this.width);
|
||||
}
|
||||
|
||||
this.ringPositionIteratorArray = posArray;
|
||||
@@ -508,7 +508,7 @@ public class MovableGridRingList<T> extends ArrayList<T> implements List<T>
|
||||
public String toString()
|
||||
{
|
||||
Pos2D p = this.minPosRef.get();
|
||||
return this.getClass().getSimpleName() + "[" + (p.x + this.halfWidth) + "," + (p.y + this.halfWidth) + "] " + this.width + "*" + this.width + "[" + this.size() + "]";
|
||||
return this.getClass().getSimpleName() + "[" + (p.getX() + this.halfWidth) + "," + (p.getY() + this.halfWidth) + "] " + this.width + "*" + this.width + "[" + this.size() + "]";
|
||||
}
|
||||
|
||||
public String toDetailString()
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
package com.seibel.distanthorizons.core.util.math;
|
||||
|
||||
import com.seibel.distanthorizons.api.objects.math.DhApiVec3f;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.coreapi.util.MathUtil;
|
||||
|
||||
/**
|
||||
|
||||
+4
-4
@@ -20,7 +20,7 @@
|
||||
package com.seibel.distanthorizons.core.util.objects.quadTree;
|
||||
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.pos.DhLodPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.core.pos.Pos2D;
|
||||
@@ -85,7 +85,7 @@ public class QuadTree<T>
|
||||
Pos2D ringListCenterPos = new Pos2D(
|
||||
BitShiftUtil.divideByPowerOfTwo(this.centerBlockPos.x, this.treeMinDetailLevel),
|
||||
BitShiftUtil.divideByPowerOfTwo(this.centerBlockPos.z, this.treeMinDetailLevel));
|
||||
this.topRingList = new MovableGridRingList<>(halfSizeInRootNodes, ringListCenterPos.x, ringListCenterPos.y);
|
||||
this.topRingList = new MovableGridRingList<>(halfSizeInRootNodes, ringListCenterPos.getX(), ringListCenterPos.getY());
|
||||
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ public class QuadTree<T>
|
||||
|
||||
|
||||
// remove out of bounds root nodes
|
||||
this.topRingList.moveTo(expectedCenterPos.x, expectedCenterPos.y, (quadNode) ->
|
||||
this.topRingList.moveTo(expectedCenterPos.getX(), expectedCenterPos.getY(), (quadNode) ->
|
||||
{
|
||||
if (quadNode != null && removedItemConsumer != null)
|
||||
{
|
||||
@@ -409,7 +409,7 @@ public class QuadTree<T>
|
||||
{
|
||||
if (node != null || includeNullNodes)
|
||||
{
|
||||
long rootPos = DhSectionPos.encode(QuadTree.this.treeMinDetailLevel, pos2D.x, pos2D.y);
|
||||
long rootPos = DhSectionPos.encode(QuadTree.this.treeMinDetailLevel, pos2D.getX(), pos2D.getY());
|
||||
if (QuadTree.this.isSectionPosInBounds(rootPos))
|
||||
{
|
||||
this.iteratorPosQueue.enqueue(rootPos);
|
||||
|
||||
+3
-3
@@ -20,9 +20,9 @@
|
||||
package com.seibel.distanthorizons.core.wrapperInterfaces.chunk;
|
||||
|
||||
import com.seibel.distanthorizons.core.generation.AdjacentChunkHolder;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPosMutable;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPosMutable;
|
||||
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||
import com.seibel.distanthorizons.core.sql.dto.BeaconBeamDTO;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper;
|
||||
|
||||
+1
-2
@@ -19,12 +19,11 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.wrapperInterfaces.minecraft;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.seibel.distanthorizons.core.enums.EDhDirection;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||
|
||||
-9
@@ -20,20 +20,11 @@
|
||||
package com.seibel.distanthorizons.core.wrapperInterfaces.minecraft;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.HashSet;
|
||||
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.ILightMapWrapper;
|
||||
import com.seibel.distanthorizons.coreapi.interfaces.dependencyInjection.IBindable;
|
||||
import com.seibel.distanthorizons.core.util.math.Mat4f;
|
||||
import com.seibel.distanthorizons.core.util.math.Vec3d;
|
||||
import com.seibel.distanthorizons.core.util.math.Vec3f;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.IVersionConstants;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.IWrapperFactory;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.ISodiumAccessor;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.wrapperInterfaces.world;
|
||||
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
||||
+1
-2
@@ -19,10 +19,9 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.wrapperInterfaces.world;
|
||||
|
||||
import com.seibel.distanthorizons.api.interfaces.world.IDhApiDimensionTypeWrapper;
|
||||
import com.seibel.distanthorizons.api.interfaces.world.IDhApiLevelWrapper;
|
||||
import com.seibel.distanthorizons.core.level.IDhLevel;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.IChunkWrapper;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
package testItems.lightingEngine;
|
||||
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||
import com.seibel.distanthorizons.core.util.objects.DataCorruptedException;
|
||||
|
||||
@@ -52,7 +52,7 @@ public class TestCompoundKeyRepo extends AbstractDhRepo<DhChunkPos, TestCompound
|
||||
@Override
|
||||
public String getTableName() { return "TestCompound"; }
|
||||
@Override
|
||||
public String createWhereStatement(DhChunkPos key) { return "XPos = '"+key.x+"' AND ZPos = '"+key.z+"'"; }
|
||||
public String createWhereStatement(DhChunkPos key) { return "XPos = '"+key.getX()+"' AND ZPos = '"+key.getZ()+"'"; }
|
||||
|
||||
|
||||
@Override
|
||||
@@ -75,8 +75,8 @@ public class TestCompoundKeyRepo extends AbstractDhRepo<DhChunkPos, TestCompound
|
||||
PreparedStatement statement = this.createPreparedStatement(sql);
|
||||
|
||||
int i = 1; // post-increment for the win!
|
||||
statement.setObject(i++, dto.id.x);
|
||||
statement.setObject(i++, dto.id.z);
|
||||
statement.setObject(i++, dto.id.getX());
|
||||
statement.setObject(i++, dto.id.getZ());
|
||||
|
||||
statement.setObject(i++, dto.value);
|
||||
|
||||
@@ -96,8 +96,8 @@ public class TestCompoundKeyRepo extends AbstractDhRepo<DhChunkPos, TestCompound
|
||||
int i = 1;
|
||||
statement.setObject(i++, dto.value);
|
||||
|
||||
statement.setObject(i++, dto.id.x);
|
||||
statement.setObject(i++, dto.id.z);
|
||||
statement.setObject(i++, dto.id.getX());
|
||||
statement.setObject(i++, dto.id.getZ());
|
||||
|
||||
return statement;
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ package tests;
|
||||
import com.seibel.distanthorizons.core.enums.EDhDirection;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos2D;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
package tests;
|
||||
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.coreapi.util.BitShiftUtil;
|
||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||
|
||||
Reference in New Issue
Block a user