mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-09 17:26:07 +00:00
remove world instance from BukkitChunkGeneratorWrapper
This commit is contained in:
@@ -53,10 +53,10 @@ public class NoiseChunkGenerator3D implements ChunkGenerator {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("try")
|
||||
public void generateChunkData(@NotNull ProtoChunk chunk, @NotNull WritableWorld world,
|
||||
public void generateChunkData(@NotNull ProtoChunk chunk, @NotNull WorldProperties world,
|
||||
int chunkX, int chunkZ) {
|
||||
try(ProfileFrame ignore = platform.getProfiler().profile("chunk_base_3d")) {
|
||||
BiomeProvider grid = world.getBiomeProvider();
|
||||
BiomeProvider grid = configPack.getBiomeProvider();
|
||||
|
||||
int xOrig = (chunkX << 4);
|
||||
int zOrig = (chunkZ << 4);
|
||||
@@ -65,7 +65,7 @@ public class NoiseChunkGenerator3D implements ChunkGenerator {
|
||||
|
||||
long seed = world.getSeed();
|
||||
|
||||
LazilyEvaluatedInterpolator carver = new LazilyEvaluatedInterpolator(world.getBiomeProvider(),
|
||||
LazilyEvaluatedInterpolator carver = new LazilyEvaluatedInterpolator(configPack.getBiomeProvider(),
|
||||
chunkX,
|
||||
chunkZ,
|
||||
world.getMaxHeight(),
|
||||
|
||||
@@ -18,7 +18,7 @@ import com.dfsek.terra.api.world.WritableWorld;
|
||||
|
||||
|
||||
public interface ChunkGenerator {
|
||||
void generateChunkData(@NotNull ProtoChunk chunk, @NotNull WritableWorld world,
|
||||
void generateChunkData(@NotNull ProtoChunk chunk, @NotNull WorldProperties world,
|
||||
int chunkX, int chunkZ);
|
||||
|
||||
BlockState getBlock(WorldProperties world, int x, int y, int z);
|
||||
|
||||
@@ -19,6 +19,8 @@ package com.dfsek.terra.bukkit.generator;
|
||||
|
||||
import com.dfsek.terra.api.block.state.BlockState;
|
||||
|
||||
import com.dfsek.terra.bukkit.world.BukkitWorldProperties;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.generator.BiomeProvider;
|
||||
@@ -44,8 +46,6 @@ public class BukkitChunkGeneratorWrapper extends org.bukkit.generator.ChunkGener
|
||||
private final ChunkGenerator delegate;
|
||||
private final ConfigPack pack;
|
||||
private final BlockState air;
|
||||
private World world;
|
||||
private ServerWorld terraWorld;
|
||||
|
||||
public BukkitChunkGeneratorWrapper(ChunkGenerator delegate, ConfigPack pack, BlockState air) {
|
||||
this.delegate = delegate;
|
||||
@@ -60,11 +60,7 @@ public class BukkitChunkGeneratorWrapper extends org.bukkit.generator.ChunkGener
|
||||
|
||||
@Override
|
||||
public void generateNoise(@NotNull WorldInfo worldInfo, @NotNull Random random, int x, int z, @NotNull ChunkData chunkData) {
|
||||
if(this.world == null) {
|
||||
this.world = Bukkit.getWorld(worldInfo.getUID());
|
||||
this.terraWorld = new BukkitServerWorld(world);
|
||||
}
|
||||
delegate.generateChunkData(new BukkitProtoChunk(chunkData), terraWorld, x, z);
|
||||
delegate.generateChunkData(new BukkitProtoChunk(chunkData), new BukkitWorldProperties(worldInfo), x, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -105,11 +101,6 @@ public class BukkitChunkGeneratorWrapper extends org.bukkit.generator.ChunkGener
|
||||
//return pack.vanillaStructures();
|
||||
}
|
||||
|
||||
|
||||
public World getWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
public ConfigPack getPack() {
|
||||
return pack;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.dfsek.terra.bukkit.world;
|
||||
|
||||
import com.dfsek.terra.api.world.info.WorldProperties;
|
||||
|
||||
import org.bukkit.generator.WorldInfo;
|
||||
|
||||
|
||||
public class BukkitWorldProperties implements WorldProperties {
|
||||
private final WorldInfo delegate;
|
||||
|
||||
public BukkitWorldProperties(WorldInfo delegate) {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getHandle() {
|
||||
return delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSeed() {
|
||||
return delegate.getSeed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxHeight() {
|
||||
return delegate.getMaxHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinHeight() {
|
||||
return delegate.getMinHeight();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user