mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-17 14:21:08 +00:00
clean up ChunkGenerator
This commit is contained in:
+3
-1
@@ -93,7 +93,9 @@ public class BukkitChunkGeneratorWrapper extends org.bukkit.generator.ChunkGener
|
||||
}
|
||||
com.dfsek.terra.api.world.World bukkitWorld = BukkitAdapter.adapt(world);
|
||||
if(needsLoad) load(bukkitWorld); // Load population data for world.
|
||||
return (ChunkData) delegate.generateChunkData(bukkitWorld, random, x, z, new BukkitChunkData(createChunkData(world))).getHandle();
|
||||
ChunkData data = createChunkData(world);
|
||||
delegate.generateChunkData(bukkitWorld, random, x, z, new BukkitProtoChunk(data));
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+3
-3
@@ -21,15 +21,15 @@ import org.bukkit.generator.ChunkGenerator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.dfsek.terra.api.block.state.BlockState;
|
||||
import com.dfsek.terra.api.world.generator.ChunkData;
|
||||
import com.dfsek.terra.api.world.generator.ProtoChunk;
|
||||
import com.dfsek.terra.bukkit.world.block.data.BukkitBlockState;
|
||||
|
||||
|
||||
public class BukkitChunkData implements ChunkData {
|
||||
public class BukkitProtoChunk implements ProtoChunk {
|
||||
|
||||
private final ChunkGenerator.ChunkData delegate;
|
||||
|
||||
public BukkitChunkData(ChunkGenerator.ChunkData delegate) {
|
||||
public BukkitProtoChunk(ChunkGenerator.ChunkData delegate) {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
+2
-2
@@ -55,7 +55,7 @@ import java.util.concurrent.Executor;
|
||||
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
import com.dfsek.terra.api.world.World;
|
||||
import com.dfsek.terra.api.world.generator.ChunkData;
|
||||
import com.dfsek.terra.api.world.generator.ProtoChunk;
|
||||
import com.dfsek.terra.api.world.generator.ChunkGenerator;
|
||||
import com.dfsek.terra.api.world.generator.Chunkified;
|
||||
import com.dfsek.terra.api.world.generator.GeneratorWrapper;
|
||||
@@ -193,7 +193,7 @@ public class FabricChunkGeneratorWrapper extends net.minecraft.world.gen.chunk.C
|
||||
public CompletableFuture<Chunk> populateNoise(Executor executor, Blender arg, StructureAccessor structureAccessor, Chunk chunk) {
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
World world = (World) ((StructureAccessorAccessor) structureAccessor).getWorld();
|
||||
delegate.generateChunkData(world, new FastRandom(), chunk.getPos().x, chunk.getPos().z, (ChunkData) chunk);
|
||||
delegate.generateChunkData(world, new FastRandom(), chunk.getPos().x, chunk.getPos().z, (ProtoChunk) chunk);
|
||||
delegate.getGenerationStages().forEach(populator -> {
|
||||
if(populator instanceof Chunkified) {
|
||||
populator.populate(world, (com.dfsek.terra.api.world.Chunk) world);
|
||||
|
||||
+3
-4
@@ -18,7 +18,6 @@
|
||||
package com.dfsek.terra.fabric.mixin.implementations.chunk.data;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.chunk.ProtoChunk;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.spongepowered.asm.mixin.Implements;
|
||||
import org.spongepowered.asm.mixin.Interface;
|
||||
@@ -27,12 +26,12 @@ import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import com.dfsek.terra.api.block.state.BlockState;
|
||||
import com.dfsek.terra.api.world.generator.ChunkData;
|
||||
import com.dfsek.terra.api.world.generator.ProtoChunk;
|
||||
import com.dfsek.terra.fabric.block.FabricBlockState;
|
||||
|
||||
|
||||
@Mixin(ProtoChunk.class)
|
||||
@Implements(@Interface(iface = ChunkData.class, prefix = "terra$", remap = Interface.Remap.NONE))
|
||||
@Mixin(net.minecraft.world.chunk.ProtoChunk.class)
|
||||
@Implements(@Interface(iface = ProtoChunk.class, prefix = "terra$", remap = Interface.Remap.NONE))
|
||||
public abstract class ProtoChunkMixin {
|
||||
@Shadow
|
||||
public abstract net.minecraft.block.BlockState getBlockState(BlockPos pos);
|
||||
|
||||
Reference in New Issue
Block a user