From dda3c7636b6b573860cac6d482a6a6ae8a442c28 Mon Sep 17 00:00:00 2001 From: tom lee Date: Sat, 5 Feb 2022 16:24:24 +0800 Subject: [PATCH] Update core + Moved ChunkLoader to be in line with other versions --- .../BatchGenerationEnvironment.java | 90 +------------------ .../{ => mimicObject}/ChunkLoader.java | 2 +- .../worldGeneration/step/StepFeatures.java | 2 +- .../worldGeneration/step/StepLight.java | 2 +- core | 2 +- 5 files changed, 6 insertions(+), 92 deletions(-) rename common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/{ => mimicObject}/ChunkLoader.java (99%) diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/BatchGenerationEnvironment.java b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/BatchGenerationEnvironment.java index ec25a70ad..9f375eff2 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/BatchGenerationEnvironment.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/BatchGenerationEnvironment.java @@ -25,6 +25,7 @@ import com.seibel.lod.core.builders.lodBuilding.LodBuilderConfig; import com.seibel.lod.core.enums.config.DistanceGenerationMode; import com.seibel.lod.core.enums.config.LightGenerationMode; import com.seibel.lod.core.objects.lod.LodDimension; +import com.seibel.lod.core.util.GridList; import com.seibel.lod.core.util.LodThreadFactory; import com.seibel.lod.core.util.SingletonHandler; import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton; @@ -44,6 +45,7 @@ import java.util.concurrent.TimeUnit; import com.seibel.lod.common.wrappers.chunk.ChunkWrapper; import com.seibel.lod.common.wrappers.world.WorldWrapper; +import com.seibel.lod.common.wrappers.worldGeneration.mimicObject.ChunkLoader; import com.seibel.lod.common.wrappers.worldGeneration.mimicObject.LightGetterAdaptor; import com.seibel.lod.common.wrappers.worldGeneration.mimicObject.LightedWorldGenRegion; import com.seibel.lod.common.wrappers.worldGeneration.mimicObject.WorldGenLevelLightEngine; @@ -207,94 +209,6 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv public static final int TIMEOUT_SECONDS = 30; - //FIXME: Remove this and use the Utils one - public static final class GridList extends ArrayList implements List - { - - public static class Pos - { - public int x; - public int y; - - public Pos(int xx, int yy) - { - x = xx; - y = yy; - } - } - - private static final long serialVersionUID = 1585978374811888116L; - public final int gridCentreToEdge; - public final int gridSize; - - public GridList(int gridCentreToEdge) - { - super((gridCentreToEdge * 2 + 1) * (gridCentreToEdge * 2 + 1)); - gridSize = gridCentreToEdge * 2 + 1; - this.gridCentreToEdge = gridCentreToEdge; - } - - public T getOffsetOf(int index, int x, int y) - { - return get(index + x + y * gridSize); - } - - public int offsetOf(int index, int x, int y) - { - return index + x + y * gridSize; - } - - public Pos posOf(int index) - { - return new Pos(index % gridSize, index / gridSize); - } - - public int calculateOffset(int x, int y) - { - return x + y * gridSize; - } - - public GridList subGrid(int gridCentreToEdge) - { - int centreIndex = size() / 2; - GridList subGrid = new GridList(gridCentreToEdge); - for (int oy = -gridCentreToEdge; oy <= gridCentreToEdge; oy++) - { - int begin = offsetOf(centreIndex, -gridCentreToEdge, oy); - int end = offsetOf(centreIndex, gridCentreToEdge, oy); - subGrid.addAll(this.subList(begin, end + 1)); - } - // System.out.println("========================================\n"+ - // this.toDetailString() + "\nTOOOOOOOOOOOOO\n"+subGrid.toDetailString()+ - // "==========================================\n"); - return subGrid; - } - - @Override - public String toString() - { - return "GridList " + gridSize + "*" + gridSize + "[" + size() + "]"; - } - - public String toDetailString() - { - StringBuilder str = new StringBuilder("\n"); - int i = 0; - for (T t : this) - { - str.append(t.toString()); - str.append(", "); - i++; - if (i % gridSize == 0) - { - str.append("\n"); - } - } - return str.toString(); - } - } - - //=================Generation Step=================== public final LinkedList events = new LinkedList(); diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/ChunkLoader.java b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java similarity index 99% rename from common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/ChunkLoader.java rename to common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java index 1443cb671..eba2ee9e1 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/ChunkLoader.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java @@ -1,5 +1,5 @@ -package com.seibel.lod.common.wrappers.worldGeneration; +package com.seibel.lod.common.wrappers.worldGeneration.mimicObject; import com.google.common.collect.Maps; import com.mojang.serialization.Codec; diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/step/StepFeatures.java b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/step/StepFeatures.java index 0a65788cd..ee14b5ee5 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/step/StepFeatures.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/step/StepFeatures.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import com.seibel.lod.common.wrappers.worldGeneration.BatchGenerationEnvironment; import com.seibel.lod.common.wrappers.worldGeneration.ThreadedParameters; -import com.seibel.lod.common.wrappers.worldGeneration.BatchGenerationEnvironment.GridList; +import com.seibel.lod.core.util.GridList; import net.minecraft.ReportedException; import net.minecraft.server.level.WorldGenRegion; diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/step/StepLight.java b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/step/StepLight.java index dddb2ed4a..13728799b 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/step/StepLight.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/step/StepLight.java @@ -1,8 +1,8 @@ package com.seibel.lod.common.wrappers.worldGeneration.step; import com.seibel.lod.common.wrappers.worldGeneration.BatchGenerationEnvironment; -import com.seibel.lod.common.wrappers.worldGeneration.BatchGenerationEnvironment.GridList; import com.seibel.lod.common.wrappers.worldGeneration.mimicObject.WorldGenLevelLightEngine; +import com.seibel.lod.core.util.GridList; import net.minecraft.server.level.ThreadedLevelLightEngine; import net.minecraft.world.level.chunk.ChunkAccess; diff --git a/core b/core index aff7e90e3..069978ee1 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit aff7e90e37560a7f270ea444f1e08f35b729e540 +Subproject commit 069978ee1d2c3096afef34c3bb9b9b7429ecf6f2