Fix compiling

This commit is contained in:
s809
2023-09-18 13:44:19 +05:00
parent 633b3f2033
commit 6f4e105542
5 changed files with 17 additions and 13 deletions
@@ -391,14 +391,14 @@ public class CompleteFullDataSource extends FullDataArrayAccessor implements IFu
public void splitIntoChunkSizedAccessors(Consumer<ChunkSizedFullDataAccessor> consumer)
{
LodUtil.assertTrue(sectionPos.sectionDetailLevel == DhSectionPos.SECTION_BLOCK_DETAIL_LEVEL, "Data source detail level must be at block detail level.");
LodUtil.assertTrue(sectionPos.getDetailLevel() == DhSectionPos.SECTION_BLOCK_DETAIL_LEVEL, "Data source detail level must be at block detail level.");
sectionPos.forEachChildAtLevel(LodUtil.CHUNK_DETAIL_LEVEL, childPos -> {
ChunkSizedFullDataAccessor accessor = new ChunkSizedFullDataAccessor(new DhChunkPos(childPos.sectionX, childPos.sectionZ));
ChunkSizedFullDataAccessor accessor = new ChunkSizedFullDataAccessor(new DhChunkPos(childPos.getX(), childPos.getZ()));
int detailLevelDifference = sectionPos.sectionDetailLevel - childPos.sectionDetailLevel;
int childRelativeX = childPos.sectionX - sectionPos.sectionX * BitShiftUtil.powerOfTwo(detailLevelDifference);
int childRelativeZ = childPos.sectionZ - sectionPos.sectionZ * BitShiftUtil.powerOfTwo(detailLevelDifference);
int detailLevelDifference = sectionPos.getDetailLevel() - childPos.getDetailLevel();
int childRelativeX = childPos.getX() - sectionPos.getX() * BitShiftUtil.powerOfTwo(detailLevelDifference);
int childRelativeZ = childPos.getZ() - sectionPos.getZ() * BitShiftUtil.powerOfTwo(detailLevelDifference);
subView(
LodUtil.CHUNK_WIDTH,
@@ -84,8 +84,8 @@ public class RemoteFullDataFileHandler extends GeneratedFullDataFileHandler
sectionsToUpdate.remove(pos);
Consumer<ChunkSizedFullDataAccessor> chunkDataConsumer = (ChunkSizedFullDataAccessor data) -> {
DhLodPos pos = data.getLodPos().convertToDetailLevel(CompleteFullDataSource.SECTION_SIZE_OFFSET);
this.writeChunkDataToFile(new DhSectionPos(pos.detailLevel, pos.x, pos.z), data);
DhSectionPos pos = data.getSectionPos().convertNewToDetailLevel(CompleteFullDataSource.SECTION_SIZE_OFFSET);
this.writeChunkDataToFile(new DhSectionPos(pos.getDetailLevel(), pos.getX(), pos.getZ()), data);
};
this.networkState.getClient().<FullDataChangeSummaryResponseMessage>sendRequest(new FullDataChangeSummaryRequestMessage(level.getLevelWrapper(), block))
@@ -102,7 +102,7 @@ public class RemoteFullDataFileHandler extends GeneratedFullDataFileHandler
for (DhSectionPos pos : response.changedPosList)
{
queue.submitGenTask(pos, pos.sectionDetailLevel, new IWorldGenTaskTracker() {
queue.submitGenTask(pos, pos.getDetailLevel(), new IWorldGenTaskTracker() {
@Override
public boolean isMemoryAddressValid()
{
@@ -144,6 +144,10 @@ public class RemoteFullDataFileHandler extends GeneratedFullDataFileHandler
@Override
public FullDataMetaFile getFileIfExist(DhSectionPos pos)
{
// This feature is broken - same data may produce different hashes, apparently
if (true)
return super.getFileIfExist(pos);
if (this.networkState == null || !this.isFileUnloaded(pos))
return super.getFileIfExist(pos);
@@ -65,7 +65,7 @@ public class WorldRemoteGenerationQueue implements IWorldGenerationQueue, IDebug
@Override
public CompletableFuture<WorldGenResult> submitGenTask(DhSectionPos sectionPos, byte requiredDataDetail, IWorldGenTaskTracker tracker)
{
LodUtil.assertTrue(sectionPos.sectionDetailLevel == DhSectionPos.SECTION_MINIMUM_DETAIL_LEVEL, "Only highest-detail sections are allowed.");
LodUtil.assertTrue(sectionPos.getDetailLevel() == DhSectionPos.SECTION_MINIMUM_DETAIL_LEVEL, "Only highest-detail sections are allowed.");
WorldGenQueueEntry entry = new WorldGenQueueEntry(new CompletableFuture<>(), tracker);
waitingTasks.put(sectionPos, entry);
@@ -74,7 +74,7 @@ public class WorldRemoteGenerationQueue implements IWorldGenerationQueue, IDebug
private int posDistanceSquared(DhBlockPos2D targetPos, DhSectionPos pos)
{
return (int) pos.getCenter().getCenterBlockPos().distSquared(targetPos);
return (int) pos.getCenterBlockPos().distSquared(targetPos);
}
@Override
@@ -110,7 +110,7 @@ public class DhServerLevel extends DhLevel implements IDhServerLevel
if (serverPlayerState.serverPlayer.getLevel() != this.serverLevelWrapper)
return;
LOGGER.debug("FullDataSourceRequestMessage received at pos ({}, {}) with detail level {}", msg.dhSectionPos.sectionX, msg.dhSectionPos.sectionZ, msg.dhSectionPos.sectionDetailLevel);
LOGGER.debug("FullDataSourceRequestMessage received at pos ({}, {}) with detail level {}", msg.dhSectionPos.getX(), msg.dhSectionPos.getZ(), msg.dhSectionPos.getDetailLevel());
if (serverPlayerState.pendingFullDataRequests.incrementAndGet() > rateLimitConfig.get())
{
@@ -63,8 +63,8 @@ public class FullDataPartialUpdateMessage extends FutureTrackableNetworkMessage
out.writeInt(levelHashCode);
out.writeInt(fullDataAccessor.pos.x);
out.writeInt(fullDataAccessor.pos.z);
out.writeInt(fullDataAccessor.chunkPos.x);
out.writeInt(fullDataAccessor.chunkPos.z);
out.writeInt(outputStream.size());
out.writeBytes(outputStream.toByteArray());