Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First attempt to update for 21w20a #699

Merged
merged 1 commit into from
Jun 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
fabric_version=0.34.5+1.17
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ChunkAccess> neighbors, ChunkAccess chunk,
private static void cubicChunksStructureReferences(ChunkStatus status, ServerLevel world, ChunkGenerator generator, List<ChunkAccess> neighbors, ChunkAccess chunk,
CallbackInfo ci) {

if (((CubicLevelHeightAccessor) world).generates2DChunks()) {
Expand All @@ -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<ChunkAccess> neighbors, ChunkAccess chunkAccess, CallbackInfo ci) {
private static void cubicChunksBiome(ChunkStatus status, ServerLevel world, ChunkGenerator chunkGenerator, List<ChunkAccess> neighbors, ChunkAccess chunkAccess, CallbackInfo ci) {
if (((CubicLevelHeightAccessor) world).generates2DChunks()) {
if (chunkAccess instanceof IBigCube) {
return;
Expand Down Expand Up @@ -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<ChunkAccess> neighbors, ChunkAccess chunk,
private static void cubicChunksSurface(ChunkStatus status, ServerLevel world, ChunkGenerator generator, List<ChunkAccess> neighbors, ChunkAccess chunk,
CallbackInfo ci) {

if (((CubicLevelHeightAccessor) world).generates2DChunks()) {
Expand All @@ -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<ChunkAccess> neighbors, ChunkAccess chunk,
private static void cubicChunksCarvers(ChunkStatus status, ServerLevel world, ChunkGenerator generator, List<ChunkAccess> neighbors, ChunkAccess chunk,
CallbackInfo ci) {

if (((CubicLevelHeightAccessor) world).generates2DChunks()) {
Expand Down Expand Up @@ -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<ChunkAccess> neighbors, ChunkAccess chunk,
private static void cubicChunksLiquidCarvers(ChunkStatus status, ServerLevel world, ChunkGenerator generator, List<ChunkAccess> neighbors, ChunkAccess chunk,
CallbackInfo ci) {

if (((CubicLevelHeightAccessor) world).generates2DChunks()) {
Expand Down Expand Up @@ -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<ChunkAccess> neighbors, ChunkAccess chunk,
private static void cubicChunksSpawnMobs(ChunkStatus status, ServerLevel world, ChunkGenerator generator, List<ChunkAccess> neighbors, ChunkAccess chunk,
CallbackInfo ci) {

if (!((CubicLevelHeightAccessor) world).isCubic()) {
Expand All @@ -476,4 +482,4 @@ private static void cubicChunksSpawnMobs(ServerLevel world, ChunkGenerator gener
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
@Mixin(targets = "net.minecraft.world.level.chunk.ChunkStatus$SimpleGenerationTask")
public interface MixinISelectiveWorker {

@Shadow void doWork(ServerLevel world, ChunkGenerator generator, List<ChunkAccess> neighbors, ChunkAccess chunk);
@Shadow void doWork(ChunkStatus status, ServerLevel world, ChunkGenerator generator, List<ChunkAccess> neighbors, ChunkAccess chunk);

/**
* @author Batrteks2x
Expand All @@ -38,7 +38,7 @@ default CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>>

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);
}
Expand All @@ -47,7 +47,7 @@ default CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>>
}

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) {
Expand All @@ -56,4 +56,4 @@ default CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>>
}
return CompletableFuture.completedFuture(Either.left(chunk));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -19,7 +20,7 @@ public class MixinWorldGenRegion implements CubicLevelHeightAccessor {
private WorldStyle worldStyle;

@Inject(method = "<init>", at = @At("RETURN"))
private void setCubic(ServerLevel serverLevel, List<ChunkAccess> list, CallbackInfo ci) {
private void setCubic(ServerLevel serverLevel, List<ChunkAccess> list, ChunkStatus status, int i, CallbackInfo ci) {
isCubic = ((CubicLevelHeightAccessor) serverLevel).isCubic();
generates2DChunks = ((CubicLevelHeightAccessor) serverLevel).generates2DChunks();
worldStyle = ((CubicLevelHeightAccessor) serverLevel).worldStyle();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public class CubeWorldGenRegion extends WorldGenRegion implements ICubicWorld {
private final TickList<Fluid> liquidTicks = new WorldGenTickList<>((pos) -> this.getCube(pos).getLiquidTicks());

public CubeWorldGenRegion(ServerLevel worldIn, List<IBigCube> 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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down