mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-04 23:06:05 +00:00
Move BukkitChunkData out of BukkitChunkGenerator
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package com.dfsek.terra.bukkit.generator;
|
||||
|
||||
import com.dfsek.terra.api.block.state.BlockState;
|
||||
import com.dfsek.terra.api.world.generator.ChunkData;
|
||||
import com.dfsek.terra.bukkit.world.block.data.BukkitBlockState;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class BukkitChunkData implements ChunkData {
|
||||
|
||||
private final ChunkGenerator.ChunkData delegate;
|
||||
|
||||
public BukkitChunkData(ChunkGenerator.ChunkData delegate) {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkGenerator.ChunkData getHandle() {
|
||||
return delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxHeight() {
|
||||
return delegate.getMaxHeight();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setBlock(int x, int y, int z, @NotNull BlockState blockState) {
|
||||
delegate.setBlock(x, y, z, ((BukkitBlockState) blockState).getHandle());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public @NotNull BlockState getBlock(int x, int y, int z) {
|
||||
return BukkitBlockState.newInstance(delegate.getBlockData(x, y, z));
|
||||
}
|
||||
}
|
||||
@@ -18,34 +18,4 @@ public class BukkitChunkGenerator implements com.dfsek.terra.api.world.generator
|
||||
return delegate;
|
||||
}
|
||||
|
||||
public static class BukkitChunkData implements ChunkData {
|
||||
|
||||
private final ChunkGenerator.ChunkData delegate;
|
||||
|
||||
public BukkitChunkData(ChunkGenerator.ChunkData delegate) {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkGenerator.ChunkData getHandle() {
|
||||
return delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxHeight() {
|
||||
return delegate.getMaxHeight();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setBlock(int x, int y, int z, @NotNull BlockState blockState) {
|
||||
delegate.setBlock(x, y, z, ((BukkitBlockState) blockState).getHandle());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public @NotNull BlockState getBlock(int x, int y, int z) {
|
||||
return BukkitBlockState.newInstance(delegate.getBlockData(x, y, z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class BukkitChunkGeneratorWrapper extends ChunkGenerator implements Gener
|
||||
com.dfsek.terra.api.world.World bukkitWorld = BukkitAdapter.adapt(world);
|
||||
if(needsLoad) load(bukkitWorld); // Load population data for world.
|
||||
delegate.generateBiomes(bukkitWorld, random, x, z, new BukkitBiomeGrid(biome));
|
||||
return (ChunkData) delegate.generateChunkData(bukkitWorld, random, x, z, new BukkitChunkGenerator.BukkitChunkData(createChunkData(world))).getHandle();
|
||||
return (ChunkData) delegate.generateChunkData(bukkitWorld, random, x, z, new BukkitChunkData(createChunkData(world))).getHandle();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user