drastically simplify generator API

This commit is contained in:
dfsek
2021-12-02 19:45:22 -07:00
parent 71a39ba05b
commit e533555b52
26 changed files with 103 additions and 236 deletions

View File

@@ -17,6 +17,7 @@
package com.dfsek.terra.fabric.mixin.implementations.world;
import com.dfsek.terra.api.config.ConfigPack;
import com.dfsek.terra.api.world.chunk.generation.ProtoWorld;
import net.minecraft.block.FluidBlock;
@@ -59,7 +60,7 @@ import com.dfsek.terra.fabric.util.FabricUtil;
@Mixin(ChunkRegion.class)
@Implements(@Interface(iface = ProtoWorld.class, prefix = "terraWorld$", remap = Interface.Remap.NONE))
public abstract class ChunkRegionMixin {
private WorldConfig config;
private ConfigPack config;
@Shadow
@Final
@@ -80,7 +81,7 @@ public abstract class ChunkRegionMixin {
method = "<init>(Lnet/minecraft/server/world/ServerWorld;Ljava/util/List;Lnet/minecraft/world/chunk/ChunkStatus;I)V")
public void injectConstructor(net.minecraft.server.world.ServerWorld world, List<net.minecraft.world.chunk.Chunk> list, ChunkStatus chunkStatus, int i,
CallbackInfo ci) {
this.config = ((ServerWorld) world).getConfig();
this.config = ((ServerWorld) world).getPack();
}
@SuppressWarnings("deprecation")
@@ -149,7 +150,7 @@ public abstract class ChunkRegionMixin {
return (ServerWorld) world;
}
public WorldConfig terraWorld$getConfig() {
public ConfigPack terraWorld$getPack() {
return config;
}

View File

@@ -17,6 +17,8 @@
package com.dfsek.terra.fabric.mixin.implementations.world;
import com.dfsek.terra.api.config.ConfigPack;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.WorldGenerationProgressListener;
import net.minecraft.server.world.ServerChunkManager;
@@ -60,7 +62,7 @@ import com.dfsek.terra.fabric.util.FabricUtil;
@Mixin(net.minecraft.server.world.ServerWorld.class)
@Implements(@Interface(iface = ServerWorld.class, prefix = "terra$", remap = Interface.Remap.NONE))
public abstract class ServerWorldMixin {
private WorldConfig config;
private ConfigPack config;
@Shadow
@Final
private ServerChunkManager chunkManager;
@@ -80,7 +82,7 @@ public abstract class ServerWorldMixin {
net.minecraft.world.gen.chunk.ChunkGenerator chunkGenerator, boolean debugWorld, long seed,
List<Spawner> spawners, boolean shouldTickTime, CallbackInfo ci) {
if(chunkGenerator instanceof FabricChunkGeneratorWrapper) {
config = ((FabricChunkGeneratorWrapper) chunkGenerator).getPack().toWorldConfig((ServerWorld) this);
config = ((FabricChunkGeneratorWrapper) chunkGenerator).getPack();
}
}
@@ -129,7 +131,7 @@ public abstract class ServerWorldMixin {
return ((TerraBiomeSource) ((net.minecraft.server.world.ServerWorld) (Object) this).getChunkManager().getChunkGenerator().getBiomeSource()).getProvider();
}
public WorldConfig terra$getConfig() {
public ConfigPack terra$getPack() {
return config;
}