This commit is contained in:
dfsek
2021-07-22 18:25:53 -07:00
parent ad9cc1afcb
commit 6ea11de2fd
7 changed files with 25 additions and 20 deletions

View File

@@ -51,15 +51,9 @@ public abstract class ChunkRegionMixin {
@Final
private long seed;
@Shadow
public abstract boolean setBlockState(BlockPos pos, net.minecraft.block.BlockState state, int flags, int maxUpdateDepth);
@Shadow
public abstract TickScheduler<Fluid> getFluidTickScheduler();
@Shadow
public abstract ChunkManager getChunkManager();
public int terraWorld$getMaxHeight() {
return (((ChunkRegion) (Object) this).getBottomY()) + ((ChunkRegion) (Object) this).getHeight();
}
@@ -69,11 +63,6 @@ public abstract class ChunkRegionMixin {
this.config = ((World) world).getConfig();
}
@SuppressWarnings("deprecation")
public ChunkGenerator terraWorld$getGenerator() {
return (ChunkGenerator) ((ChunkRegion) (Object) this).toServerWorld().getChunkManager().getChunkGenerator();
}
public Chunk terraWorld$getChunkAt(int x, int z) {
return (Chunk) ((ChunkRegion) (Object) this).getChunk(x, z);
}
@@ -119,7 +108,7 @@ public abstract class ChunkRegionMixin {
return this;
}
public TerraChunkGenerator terraWorld$getTerraGenerator() {
public TerraChunkGenerator terraWorld$getGenerator() {
return ((FabricChunkGeneratorWrapper) world.getChunkManager().getChunkGenerator()).getHandle();
}

View File

@@ -18,6 +18,7 @@ import com.dfsek.terra.fabric.generation.TerraBiomeSource;
import com.dfsek.terra.fabric.util.FabricUtil;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.WorldGenerationProgressListener;
import net.minecraft.server.world.ServerChunkManager;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.RegistryKey;
@@ -28,6 +29,7 @@ import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.gen.Spawner;
import net.minecraft.world.level.ServerWorldProperties;
import net.minecraft.world.level.storage.LevelStorage;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Implements;
import org.spongepowered.asm.mixin.Interface;
import org.spongepowered.asm.mixin.Intrinsic;
@@ -47,6 +49,10 @@ public abstract class ServerWorldMixin {
@Shadow
public abstract long getSeed();
@Shadow
@Final
private ServerChunkManager chunkManager;
@Inject(at = @At("RETURN"), method = "<init>(Lnet/minecraft/server/MinecraftServer;Ljava/util/concurrent/Executor;Lnet/minecraft/world/level/storage/LevelStorage$Session;Lnet/minecraft/world/level/ServerWorldProperties;Lnet/minecraft/util/registry/RegistryKey;Lnet/minecraft/world/dimension/DimensionType;Lnet/minecraft/server/WorldGenerationProgressListener;Lnet/minecraft/world/gen/chunk/ChunkGenerator;ZJLjava/util/List;Z)V")
public void injectConstructor(MinecraftServer server, Executor workerExecutor, LevelStorage.Session session, ServerWorldProperties properties, RegistryKey<net.minecraft.world.World> worldKey, DimensionType dimensionType, WorldGenerationProgressListener worldGenerationProgressListener, net.minecraft.world.gen.chunk.ChunkGenerator chunkGenerator, boolean debugWorld, long seed, List<Spawner> spawners, boolean shouldTickTime, CallbackInfo ci) {
if(chunkGenerator instanceof FabricChunkGeneratorWrapper) {
@@ -58,10 +64,6 @@ public abstract class ServerWorldMixin {
return (((ServerWorld) (Object) this).getBottomY()) + ((ServerWorld) (Object) this).getHeight();
}
public ChunkGenerator terra$getGenerator() {
return (ChunkGenerator) ((ServerWorld) (Object) this).getChunkManager().getChunkGenerator();
}
public Chunk terra$getChunkAt(int x, int z) {
return (Chunk) ((ServerWorld) (Object) this).getChunk(x, z);
}
@@ -100,8 +102,8 @@ public abstract class ServerWorldMixin {
return this;
}
public TerraChunkGenerator terra$getTerraGenerator() {
return ((FabricChunkGeneratorWrapper) terra$getGenerator()).getHandle();
public TerraChunkGenerator terra$getGenerator() {
return ((FabricChunkGeneratorWrapper) chunkManager.getChunkGenerator()).getHandle();
}
public BiomeProvider terra$getBiomeProvider() {