mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
wip generatebiome
will finish later
This commit is contained in:
parent
4f34d1b5d1
commit
ee54dcd809
@ -238,7 +238,7 @@ public interface BukkitImplAdapter<T> extends IBukkitAdapter {
|
|||||||
throw new UnsupportedOperationException("Cannot send fake chunks");
|
throw new UnsupportedOperationException("Cannot send fake chunks");
|
||||||
}
|
}
|
||||||
|
|
||||||
default boolean regenerate(org.bukkit.World world, Region region, EditSession editSession) {
|
default boolean regenerate(org.bukkit.World world, Region region, @Nullable Long seed, @Nullable BiomeType biome, EditSession editSession) {
|
||||||
return editSession.regenerate(region);
|
return editSession.regenerate(region);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@ import com.sk89q.worldedit.math.BlockVector3;
|
|||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.registry.state.Property;
|
import com.sk89q.worldedit.registry.state.Property;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
|
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
@ -92,6 +93,7 @@ import org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer;
|
|||||||
import org.bukkit.craftbukkit.v1_13_R2.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_13_R2.inventory.CraftItemStack;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -383,7 +385,7 @@ public final class FAWE_Spigot_v1_13_R2 extends CachedBukkitAdapter implements I
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean regenerate(org.bukkit.World world, Region region, EditSession editSession) {
|
public boolean regenerate(org.bukkit.World world, Region region, @Nullable Long seed, @Nullable BiomeType biome, EditSession editSession) {
|
||||||
WorldServer originalWorld = ((CraftWorld) world).getHandle();
|
WorldServer originalWorld = ((CraftWorld) world).getHandle();
|
||||||
ChunkProviderServer provider = originalWorld.getChunkProvider();
|
ChunkProviderServer provider = originalWorld.getChunkProvider();
|
||||||
if (!(provider instanceof ChunkProviderServer)) {
|
if (!(provider instanceof ChunkProviderServer)) {
|
||||||
@ -398,18 +400,27 @@ public final class FAWE_Spigot_v1_13_R2 extends CachedBukkitAdapter implements I
|
|||||||
CraftServer server = originalWorld.getServer();
|
CraftServer server = originalWorld.getServer();
|
||||||
IDataManager originalDataManager = originalWorld.getDataManager();
|
IDataManager originalDataManager = originalWorld.getDataManager();
|
||||||
WorldNBTStorage saveHandler = new WorldNBTStorage(saveFolder, originalDataManager.getDirectory().getName(), server.getServer(), originalDataManager.i());
|
WorldNBTStorage saveHandler = new WorldNBTStorage(saveFolder, originalDataManager.getDirectory().getName(), server.getServer(), originalDataManager.i());
|
||||||
ChunkGenerator originalGen = world.getGenerator();
|
|
||||||
|
|
||||||
|
ChunkGenerator generator = world.getGenerator();
|
||||||
|
org.bukkit.World.Environment environment = world.getEnvironment();
|
||||||
|
if (seed != null) {
|
||||||
|
if (biome == BiomeTypes.NETHER) {
|
||||||
|
environment = org.bukkit.World.Environment.NETHER;
|
||||||
|
} else if (biome == BiomeTypes.THE_END) {
|
||||||
|
environment = org.bukkit.World.Environment.THE_END;
|
||||||
|
} else {
|
||||||
|
environment = org.bukkit.World.Environment.NORMAL;
|
||||||
|
}
|
||||||
|
generator = null;
|
||||||
|
}
|
||||||
try (WorldServer freshWorld = new WorldServer(server.getServer(),
|
try (WorldServer freshWorld = new WorldServer(server.getServer(),
|
||||||
saveHandler,
|
saveHandler,
|
||||||
originalWorld.worldMaps,
|
originalWorld.worldMaps,
|
||||||
originalWorld.worldData,
|
originalWorld.worldData,
|
||||||
originalWorld.worldProvider.getDimensionManager(),
|
originalWorld.worldProvider.getDimensionManager(),
|
||||||
originalWorld.methodProfiler,
|
originalWorld.methodProfiler,
|
||||||
world.getEnvironment(),
|
environment,
|
||||||
originalGen
|
generator)) {
|
||||||
)
|
|
||||||
) {
|
|
||||||
SingleThreadQueueExtent extent = new SingleThreadQueueExtent();
|
SingleThreadQueueExtent extent = new SingleThreadQueueExtent();
|
||||||
extent.init(null, (x, z) -> new BukkitGetBlocks_1_13(freshWorld, x, z) {
|
extent.init(null, (x, z) -> new BukkitGetBlocks_1_13(freshWorld, x, z) {
|
||||||
@Override
|
@Override
|
||||||
|
@ -54,6 +54,7 @@ import com.sk89q.worldedit.regions.CuboidRegion;
|
|||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.registry.state.Property;
|
import com.sk89q.worldedit.registry.state.Property;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
|
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
@ -387,7 +388,7 @@ public final class FAWE_Spigot_v1_14_R4 extends CachedBukkitAdapter implements I
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean regenerate(org.bukkit.World world, Region region, EditSession editSession) {
|
public boolean regenerate(org.bukkit.World world, Region region, @Nullable Long seed, @Nullable BiomeType biome, EditSession editSession) {
|
||||||
WorldServer originalWorld = ((CraftWorld) world).getHandle();
|
WorldServer originalWorld = ((CraftWorld) world).getHandle();
|
||||||
ChunkProviderServer provider = originalWorld.getChunkProvider();
|
ChunkProviderServer provider = originalWorld.getChunkProvider();
|
||||||
if (!(provider instanceof ChunkProviderServer)) {
|
if (!(provider instanceof ChunkProviderServer)) {
|
||||||
@ -404,14 +405,26 @@ public final class FAWE_Spigot_v1_14_R4 extends CachedBukkitAdapter implements I
|
|||||||
WorldNBTStorage saveHandler = new WorldNBTStorage(saveFolder, originalDataManager.getDirectory().getName(), server.getServer(), originalDataManager.getDataFixer());
|
WorldNBTStorage saveHandler = new WorldNBTStorage(saveFolder, originalDataManager.getDirectory().getName(), server.getServer(), originalDataManager.getDataFixer());
|
||||||
ChunkGenerator originalGen = world.getGenerator();
|
ChunkGenerator originalGen = world.getGenerator();
|
||||||
|
|
||||||
|
ChunkGenerator generator = world.getGenerator();
|
||||||
|
org.bukkit.World.Environment environment = world.getEnvironment();
|
||||||
|
if (seed != null) {
|
||||||
|
if (biome == BiomeTypes.NETHER) {
|
||||||
|
environment = org.bukkit.World.Environment.NETHER;
|
||||||
|
} else if (biome == BiomeTypes.THE_END) {
|
||||||
|
environment = org.bukkit.World.Environment.THE_END;
|
||||||
|
} else {
|
||||||
|
environment = org.bukkit.World.Environment.NORMAL;
|
||||||
|
}
|
||||||
|
generator = null;
|
||||||
|
}
|
||||||
try (WorldServer freshWorld = new WorldServer(server.getServer(),
|
try (WorldServer freshWorld = new WorldServer(server.getServer(),
|
||||||
server.getServer().executorService, saveHandler,
|
server.getServer().executorService, saveHandler,
|
||||||
originalWorld.worldData,
|
originalWorld.worldData,
|
||||||
originalWorld.worldProvider.getDimensionManager(),
|
originalWorld.worldProvider.getDimensionManager(),
|
||||||
originalWorld.getMethodProfiler(),
|
originalWorld.getMethodProfiler(),
|
||||||
server.getServer().worldLoadListenerFactory.create(11),
|
server.getServer().worldLoadListenerFactory.create(11),
|
||||||
world.getEnvironment(),
|
environment,
|
||||||
originalGen)) {
|
generator)) {
|
||||||
|
|
||||||
// Pre-gen all the chunks
|
// Pre-gen all the chunks
|
||||||
// We need to also pull one more chunk in every direction
|
// We need to also pull one more chunk in every direction
|
||||||
|
Loading…
Reference in New Issue
Block a user