mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-12-27 17:28:28 +01:00
Tweaks to the world generator
This commit is contained in:
parent
1516edbeca
commit
f79f2ac29e
@ -129,7 +129,10 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
||||
if (result.getChunkData() != null) {
|
||||
for (int chunkX = 0; chunkX < 16; chunkX++) {
|
||||
for (int chunkZ = 0; chunkZ < 16; chunkZ++) {
|
||||
biome.setBiome(chunkX, chunkZ, Biome.PLAINS);
|
||||
for (int y = 0; y < world.getMaxHeight(); y++) {
|
||||
biome.setBiome(chunkX, y, chunkZ, Biome.PLAINS);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.getChunkData();
|
||||
@ -178,18 +181,31 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
||||
ChunkManager.postProcessChunk(loc, result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow spawning everywhere.
|
||||
*
|
||||
* @param world Ignored
|
||||
* @param x Ignored
|
||||
* @param z Ignored
|
||||
* @return always true
|
||||
*/
|
||||
@Override public boolean canSpawn(@NotNull final World world, final int x, final int z) {
|
||||
@Override
|
||||
public boolean canSpawn(@NotNull final World world, final int x, final int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean shouldGenerateCaves() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean shouldGenerateDecorations() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isParallelCapable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean shouldGenerateMobs() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean shouldGenerateStructures() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public String toString() {
|
||||
if (this.platformGenerator == this) {
|
||||
return this.plotGenerator.getName();
|
||||
|
@ -9,7 +9,7 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import java.util.Random;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
@ -17,13 +17,16 @@ import org.bukkit.generator.ChunkGenerator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Range;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@RequiredArgsConstructor final class DelegatePlotGenerator extends IndependentPlotGenerator {
|
||||
final class DelegatePlotGenerator extends IndependentPlotGenerator {
|
||||
|
||||
private final ChunkGenerator chunkGenerator;
|
||||
private final String world;
|
||||
|
||||
public DelegatePlotGenerator(ChunkGenerator chunkGenerator, String world) {
|
||||
this.chunkGenerator = chunkGenerator;
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
@Override public void initialize(PlotArea area) {
|
||||
}
|
||||
|
||||
@ -44,13 +47,24 @@ import java.util.Random;
|
||||
try {
|
||||
ChunkGenerator.BiomeGrid grid = new ChunkGenerator.BiomeGrid() {
|
||||
@Override public void setBiome(@Range(from = 0, to = 15) int x,
|
||||
@Range(from = 0, to = 15) int z, Biome biome) {
|
||||
@Range(from = 0, to = 15) int z, @NotNull Biome biome) {
|
||||
result.setBiome(x, z, BukkitAdapter.adapt(biome));
|
||||
}
|
||||
|
||||
//do not annotate with Override until we discontinue support for 1.4.4
|
||||
public void setBiome(int x, int y, int z, @NotNull Biome biome) {
|
||||
result.setBiome(x, z, BukkitAdapter.adapt(biome));
|
||||
|
||||
}
|
||||
|
||||
@Override @NotNull public Biome getBiome(int x, int z) {
|
||||
return Biome.FOREST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Biome getBiome(int x, int y, int z) {
|
||||
return Biome.FOREST;
|
||||
}
|
||||
};
|
||||
chunkGenerator.generateChunkData(world, random, chunkX, chunkZ, grid);
|
||||
return;
|
||||
|
@ -7,19 +7,21 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import java.util.Random;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@RequiredArgsConstructor final class BlockStatePopulator extends BlockPopulator {
|
||||
final class BlockStatePopulator extends BlockPopulator {
|
||||
|
||||
private final IndependentPlotGenerator plotGenerator;
|
||||
private LocalBlockQueue queue;
|
||||
|
||||
public BlockStatePopulator(IndependentPlotGenerator plotGenerator) {
|
||||
this.plotGenerator = plotGenerator;
|
||||
}
|
||||
|
||||
@Override public void populate(@NotNull final World world, @NotNull final Random random,
|
||||
@NotNull final Chunk source) {
|
||||
if (this.queue == null) {
|
||||
|
@ -417,10 +417,16 @@ import java.util.Set;
|
||||
public void setBiomes(@NonNull final String worldName, @NonNull final CuboidRegion region,
|
||||
@NonNull final BiomeType biomeType) {
|
||||
final World world = getWorld(worldName);
|
||||
if (world == null) {
|
||||
PlotSquared.log("An error occurred setting the biome because the world was null.");
|
||||
return;
|
||||
}
|
||||
final Biome biome = BukkitAdapter.adapt(biomeType);
|
||||
for (int x = region.getMinimumPoint().getX(); x <= region.getMaximumPoint().getX(); x++) {
|
||||
for (int z = region.getMinimumPoint().getZ(); z <= region.getMaximumPoint().getZ(); z++) {
|
||||
world.setBiome(x, z, biome);
|
||||
for (int y = 0; y < world.getMaxHeight(); y++) {
|
||||
world.setBiome(x, y, z, biome);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class WorldUtil {
|
||||
public static WorldUtil IMP;
|
||||
@ -65,10 +66,7 @@ public abstract class WorldUtil {
|
||||
|
||||
public abstract com.sk89q.worldedit.world.World getWeWorld(String world);
|
||||
|
||||
public void upload(final Plot plot, UUID uuid, String file, RunnableVal<URL> whenDone) {
|
||||
if (plot == null) {
|
||||
throw new IllegalArgumentException("Plot may not be null!");
|
||||
}
|
||||
public void upload(@NotNull final Plot plot, UUID uuid, String file, RunnableVal<URL> whenDone) {
|
||||
final Location home = plot.getHome();
|
||||
MainUtil.upload(uuid, file, "zip", new RunnableVal<OutputStream>() {
|
||||
@Override public void run(OutputStream output) {
|
||||
|
Loading…
Reference in New Issue
Block a user