From 838e2970b3b7d3102e235fb601d674015eeb4d06 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Fri, 21 May 2021 22:41:43 +0000 Subject: [PATCH] First attempt to update for 21w20a --- gradle.properties | 6 ++-- .../cubicchunks/chunk/CubicAquifer.java | 1 + .../heightmap/SurfaceTrackerWrapper.java | 2 +- .../cubicchunks/debug/DebugVisualization.java | 1 + .../core/common/chunk/MixinChunkManager.java | 1 + .../core/common/chunk/MixinChunkStatus.java | 32 +++++++++++-------- .../common/chunk/MixinISelectiveWorker.java | 8 ++--- .../common/world/MixinWorldGenRegion.java | 3 +- .../cubicchunks/world/CubeWorldGenRegion.java | 2 +- .../cubicchunks/world/DummyHeightmap.java | 2 +- .../world/storage/RegionCubeIO.java | 1 + 11 files changed, 35 insertions(+), 24 deletions(-) diff --git a/gradle.properties b/gradle.properties index 4b2c28665..ece9c5163 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,12 +4,12 @@ modid=cubicchunks # Fabric Properties # check these on https://fabricmc.net/use -minecraft_version=21w19a +minecraft_version=21w20a loader_version=0.11.3 #https://modmuss50.me/fabric.html?&version=21w10a -yarn_version=21w19a+build.1 +yarn_version=21w20a+build.7 # Dependencies # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api -fabric_version=0.34.4+1.17 \ No newline at end of file +fabric_version=0.34.5+1.17 diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/chunk/CubicAquifer.java b/src/main/java/io/github/opencubicchunks/cubicchunks/chunk/CubicAquifer.java index deee58447..91dacc94a 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/chunk/CubicAquifer.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/chunk/CubicAquifer.java @@ -3,6 +3,7 @@ import java.util.Arrays; import io.github.opencubicchunks.cubicchunks.CubicChunks; +import io.github.opencubicchunks.cubicchunks.chunk.CubicAquifer.Sample; import net.minecraft.core.BlockPos; import net.minecraft.util.Mth; import net.minecraft.world.level.ChunkPos; diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/chunk/heightmap/SurfaceTrackerWrapper.java b/src/main/java/io/github/opencubicchunks/cubicchunks/chunk/heightmap/SurfaceTrackerWrapper.java index df6072083..0f0a5cd79 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/chunk/heightmap/SurfaceTrackerWrapper.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/chunk/heightmap/SurfaceTrackerWrapper.java @@ -37,7 +37,7 @@ public int getFirstAvailable(int x, int z) { // TODO not sure what to do about these methods @Override - public void setRawData(long[] ls) { + public void setRawData(ChunkAccess clv, Types a, long[] ls) { throw new UnsupportedOperationException(); } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/debug/DebugVisualization.java b/src/main/java/io/github/opencubicchunks/cubicchunks/debug/DebugVisualization.java index 3b0690c32..18039f11d 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/debug/DebugVisualization.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/debug/DebugVisualization.java @@ -89,6 +89,7 @@ import com.mojang.math.Vector4f; import io.github.opencubicchunks.cubicchunks.chunk.ICubeHolder; import io.github.opencubicchunks.cubicchunks.chunk.util.CubePos; +import io.github.opencubicchunks.cubicchunks.debug.DebugVisualization.Vertex; import io.github.opencubicchunks.cubicchunks.utils.Coords; import io.github.opencubicchunks.cubicchunks.utils.MathUtil; import it.unimi.dsi.fastutil.longs.Long2ByteLinkedOpenHashMap; diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/chunk/MixinChunkManager.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/chunk/MixinChunkManager.java index d8b94fcf4..9ef894f6f 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/chunk/MixinChunkManager.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/chunk/MixinChunkManager.java @@ -93,6 +93,7 @@ import net.minecraft.network.protocol.game.ClientboundSetPassengersPacket; import net.minecraft.server.level.ChunkHolder; import net.minecraft.server.level.ChunkMap; +import net.minecraft.server.level.ChunkMap.DistanceManager; import net.minecraft.server.level.PlayerMap; import net.minecraft.server.level.ServerChunkCache; import net.minecraft.server.level.ServerLevel; diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/chunk/MixinChunkStatus.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/chunk/MixinChunkStatus.java index b525f195f..eee3345ed 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/chunk/MixinChunkStatus.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/chunk/MixinChunkStatus.java @@ -137,10 +137,11 @@ private static void generateStructureStatus( @SuppressWarnings({ "UnresolvedMixinReference", "target" }) @Inject( - method = "lambda$static$3(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/chunk/ChunkGenerator;Ljava/util/List;Lnet/minecraft/world/level/chunk/ChunkAccess;)V", + method = "lambda$static$3(Lnet/minecraft/world/level/chunk/ChunkStatus;Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/chunk/ChunkGenerator;Ljava/util/List;" ++ "Lnet/minecraft/world/level/chunk/ChunkAccess;)V", at = @At("HEAD"), cancellable = true ) - private static void cubicChunksStructureReferences(ServerLevel world, ChunkGenerator generator, List neighbors, ChunkAccess chunk, + private static void cubicChunksStructureReferences(ChunkStatus status, ServerLevel world, ChunkGenerator generator, List neighbors, ChunkAccess chunk, CallbackInfo ci) { if (((CubicLevelHeightAccessor) world).generates2DChunks()) { @@ -155,10 +156,11 @@ private static void cubicChunksStructureReferences(ServerLevel world, ChunkGener @SuppressWarnings({ "UnresolvedMixinReference", "target" }) @Inject( - method = "lambda$static$4(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/chunk/ChunkGenerator;Ljava/util/List;Lnet/minecraft/world/level/chunk/ChunkAccess;)V", + method = "lambda$static$4(Lnet/minecraft/world/level/chunk/ChunkStatus;Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/chunk/ChunkGenerator;Ljava/util/List;" ++ "Lnet/minecraft/world/level/chunk/ChunkAccess;)V", at = @At("HEAD"), cancellable = true ) - private static void cubicChunksBiome(ServerLevel world, ChunkGenerator chunkGenerator, List neighbors, ChunkAccess chunkAccess, CallbackInfo ci) { + private static void cubicChunksBiome(ChunkStatus status, ServerLevel world, ChunkGenerator chunkGenerator, List neighbors, ChunkAccess chunkAccess, CallbackInfo ci) { if (((CubicLevelHeightAccessor) world).generates2DChunks()) { if (chunkAccess instanceof IBigCube) { return; @@ -284,10 +286,11 @@ private static boolean areSectionsEmpty(int cubeY, ChunkPos pos, IBigCube cube) @SuppressWarnings({ "UnresolvedMixinReference", "target" }) @Inject( - method = "lambda$static$7(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/chunk/ChunkGenerator;Ljava/util/List;Lnet/minecraft/world/level/chunk/ChunkAccess;)V", + method = "lambda$static$7(Lnet/minecraft/world/level/chunk/ChunkStatus;Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/chunk/ChunkGenerator;" ++ "Ljava/util/List;Lnet/minecraft/world/level/chunk/ChunkAccess;)V", at = @At("HEAD"), cancellable = true ) - private static void cubicChunksSurface(ServerLevel world, ChunkGenerator generator, List neighbors, ChunkAccess chunk, + private static void cubicChunksSurface(ChunkStatus status, ServerLevel world, ChunkGenerator generator, List neighbors, ChunkAccess chunk, CallbackInfo ci) { if (((CubicLevelHeightAccessor) world).generates2DChunks()) { @@ -301,10 +304,11 @@ private static void cubicChunksSurface(ServerLevel world, ChunkGenerator generat @SuppressWarnings({ "UnresolvedMixinReference", "target" }) @Inject( - method = "lambda$static$8(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/chunk/ChunkGenerator;Ljava/util/List;Lnet/minecraft/world/level/chunk/ChunkAccess;)V", + method = "lambda$static$8(Lnet/minecraft/world/level/chunk/ChunkStatus;Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/chunk/ChunkGenerator;Ljava/util/List;" ++ "Lnet/minecraft/world/level/chunk/ChunkAccess;)V", at = @At("HEAD"), cancellable = true ) - private static void cubicChunksCarvers(ServerLevel world, ChunkGenerator generator, List neighbors, ChunkAccess chunk, + private static void cubicChunksCarvers(ChunkStatus status, ServerLevel world, ChunkGenerator generator, List neighbors, ChunkAccess chunk, CallbackInfo ci) { if (((CubicLevelHeightAccessor) world).generates2DChunks()) { @@ -335,10 +339,11 @@ private static void cubicChunksCarvers(ServerLevel world, ChunkGenerator generat @SuppressWarnings({ "UnresolvedMixinReference", "target" }) @Inject( - method = "lambda$static$9(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/chunk/ChunkGenerator;Ljava/util/List;Lnet/minecraft/world/level/chunk/ChunkAccess;)V", + method = "lambda$static$9(Lnet/minecraft/world/level/chunk/ChunkStatus;Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/chunk/ChunkGenerator;Ljava/util/List;" ++ "Lnet/minecraft/world/level/chunk/ChunkAccess;)V", at = @At("HEAD"), cancellable = true ) - private static void cubicChunksLiquidCarvers(ServerLevel world, ChunkGenerator generator, List neighbors, ChunkAccess chunk, + private static void cubicChunksLiquidCarvers(ChunkStatus status, ServerLevel world, ChunkGenerator generator, List neighbors, ChunkAccess chunk, CallbackInfo ci) { if (((CubicLevelHeightAccessor) world).generates2DChunks()) { @@ -447,11 +452,12 @@ private static void lightChunkCC(ChunkStatus status, ThreadedLevelLightEngine li //lambda$static$12 @SuppressWarnings({ "UnresolvedMixinReference", "target" }) @Inject( - method = "lambda$static$13(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/chunk/ChunkGenerator;Ljava/util/List;Lnet/minecraft/world/level/chunk/ChunkAccess;)V", + method = "lambda$static$13(Lnet/minecraft/world/level/chunk/ChunkStatus;Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/chunk/ChunkGenerator;Ljava/util/List;" ++ "Lnet/minecraft/world/level/chunk/ChunkAccess;)V", at = @At("HEAD"), cancellable = true ) //TODO: Expose the above and bottom cubes via neighbors or thing else. Check if chunk generator overrides "spawnOriginalMobs" and redirect to our spawner instead. - private static void cubicChunksSpawnMobs(ServerLevel world, ChunkGenerator generator, List neighbors, ChunkAccess chunk, + private static void cubicChunksSpawnMobs(ChunkStatus status, ServerLevel world, ChunkGenerator generator, List neighbors, ChunkAccess chunk, CallbackInfo ci) { if (!((CubicLevelHeightAccessor) world).isCubic()) { @@ -476,4 +482,4 @@ private static void cubicChunksSpawnMobs(ServerLevel world, ChunkGenerator gener } } } -} \ No newline at end of file +} diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/chunk/MixinISelectiveWorker.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/chunk/MixinISelectiveWorker.java index 7083d207c..478c5b208 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/chunk/MixinISelectiveWorker.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/chunk/MixinISelectiveWorker.java @@ -23,7 +23,7 @@ @Mixin(targets = "net.minecraft.world.level.chunk.ChunkStatus$SimpleGenerationTask") public interface MixinISelectiveWorker { - @Shadow void doWork(ServerLevel world, ChunkGenerator generator, List neighbors, ChunkAccess chunk); + @Shadow void doWork(ChunkStatus status, ServerLevel world, ChunkGenerator generator, List neighbors, ChunkAccess chunk); /** * @author Batrteks2x @@ -38,7 +38,7 @@ default CompletableFuture> if (!((CubicLevelHeightAccessor) chunk).isCubic()) { if (!chunk.getStatus().isOrAfter(status)) { - this.doWork(world, generator, neighbors, chunk); + this.doWork(status, world, generator, neighbors, chunk); if (chunk instanceof ProtoChunk) { ((ProtoChunk) chunk).setStatus(status); } @@ -47,7 +47,7 @@ default CompletableFuture> } if (!chunk.getStatus().isOrAfter(status)) { - this.doWork(world, generator, neighbors, chunk); + this.doWork(status, world, generator, neighbors, chunk); if (chunk instanceof ProtoChunk) { ((ProtoChunk) chunk).setStatus(status); } else if (chunk instanceof CubePrimer) { @@ -56,4 +56,4 @@ default CompletableFuture> } return CompletableFuture.completedFuture(Either.left(chunk)); } -} \ No newline at end of file +} diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/MixinWorldGenRegion.java b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/MixinWorldGenRegion.java index 0952284a1..6ad03d8ba 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/MixinWorldGenRegion.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/mixin/core/common/world/MixinWorldGenRegion.java @@ -6,6 +6,7 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.WorldGenRegion; import net.minecraft.world.level.chunk.ChunkAccess; +import net.minecraft.world.level.chunk.ChunkStatus; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -19,7 +20,7 @@ public class MixinWorldGenRegion implements CubicLevelHeightAccessor { private WorldStyle worldStyle; @Inject(method = "", at = @At("RETURN")) - private void setCubic(ServerLevel serverLevel, List list, CallbackInfo ci) { + private void setCubic(ServerLevel serverLevel, List list, ChunkStatus status, int i, CallbackInfo ci) { isCubic = ((CubicLevelHeightAccessor) serverLevel).isCubic(); generates2DChunks = ((CubicLevelHeightAccessor) serverLevel).generates2DChunks(); worldStyle = ((CubicLevelHeightAccessor) serverLevel).worldStyle(); diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/world/CubeWorldGenRegion.java b/src/main/java/io/github/opencubicchunks/cubicchunks/world/CubeWorldGenRegion.java index 373882647..210c8c672 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/world/CubeWorldGenRegion.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/world/CubeWorldGenRegion.java @@ -103,7 +103,7 @@ public class CubeWorldGenRegion extends WorldGenRegion implements ICubicWorld { private final TickList liquidTicks = new WorldGenTickList<>((pos) -> this.getCube(pos).getLiquidTicks()); public CubeWorldGenRegion(ServerLevel worldIn, List cubesIn, ChunkAccess access) { - super(worldIn, Collections.singletonList(new DummyChunkAccess())); + super(worldIn, Collections.singletonList(new DummyChunkAccess()), null, 0); int cubeRoot = Mth.floor(Math.cbrt(cubesIn.size())); if (cubeRoot * cubeRoot * cubeRoot != cubesIn.size()) { diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/world/DummyHeightmap.java b/src/main/java/io/github/opencubicchunks/cubicchunks/world/DummyHeightmap.java index ebf25267a..4d2f987f4 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/world/DummyHeightmap.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/world/DummyHeightmap.java @@ -18,7 +18,7 @@ public DummyHeightmap(ChunkAccess chunkAccess, Types types) { return 0; } - @Override public void setRawData(long[] heightmap) { + @Override public void setRawData(ChunkAccess clv, Types a, long[] heightmap) { } diff --git a/src/main/java/io/github/opencubicchunks/cubicchunks/world/storage/RegionCubeIO.java b/src/main/java/io/github/opencubicchunks/cubicchunks/world/storage/RegionCubeIO.java index 18375cba2..80d6d64f7 100644 --- a/src/main/java/io/github/opencubicchunks/cubicchunks/world/storage/RegionCubeIO.java +++ b/src/main/java/io/github/opencubicchunks/cubicchunks/world/storage/RegionCubeIO.java @@ -30,6 +30,7 @@ import cubicchunks.regionlib.impl.SaveCubeColumns; import io.github.opencubicchunks.cubicchunks.CubicChunks; import io.github.opencubicchunks.cubicchunks.chunk.util.CubePos; +import io.github.opencubicchunks.cubicchunks.world.storage.RegionCubeIO.SaveEntry; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtIo; import net.minecraft.util.thread.ProcessorMailbox;