mirror of
https://github.com/BentoBoxWorld/BSkyBlock.git
synced 2024-09-25 03:43:53 +02:00
Performs chunk regeneration.
This commit is contained in:
parent
8a350b16c3
commit
8f0fc67ce0
2
pom.xml
2
pom.xml
@ -91,7 +91,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>world.bentobox</groupId>
|
<groupId>world.bentobox</groupId>
|
||||||
<artifactId>bentobox</artifactId>
|
<artifactId>bentobox</artifactId>
|
||||||
<version>1.4.0</version>
|
<version>1.5.0-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package world.bentobox.bskyblock;
|
package world.bentobox.bskyblock;
|
||||||
|
|
||||||
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.World.Environment;
|
import org.bukkit.World.Environment;
|
||||||
import org.bukkit.WorldCreator;
|
import org.bukkit.WorldCreator;
|
||||||
@ -130,4 +131,10 @@ public class BSkyBlock extends GameModeAddon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void regerateChunk(Chunk chunk) {
|
||||||
|
if (chunkGenerator != null) chunkGenerator.regenerateChunk(chunk);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.World.Environment;
|
import org.bukkit.World.Environment;
|
||||||
@ -46,7 +47,7 @@ public class ChunkGeneratorWorld extends ChunkGenerator {
|
|||||||
int seaHeight = addon.getSettings().getSeaHeight();
|
int seaHeight = addon.getSettings().getSeaHeight();
|
||||||
for (int x = 0; x < 16; x++) {
|
for (int x = 0; x < 16; x++) {
|
||||||
for (int z = 0; z < 16; z++) {
|
for (int z = 0; z < 16; z++) {
|
||||||
biomeGrid.setBiome(x, z, bio);
|
if (biomeGrid != null) biomeGrid.setBiome(x, z, bio);
|
||||||
if (seaHeight != 0) {
|
if (seaHeight != 0) {
|
||||||
for (int y = 0; y <= seaHeight; y++) {
|
for (int y = 0; y <= seaHeight; y++) {
|
||||||
result.setBlock(x, y, z, Material.WATER);
|
result.setBlock(x, y, z, Material.WATER);
|
||||||
@ -157,4 +158,21 @@ public class ChunkGeneratorWorld extends ChunkGenerator {
|
|||||||
result.setBlock(x + 1, y, z + 2, Material.GLOWSTONE);
|
result.setBlock(x + 1, y, z + 2, Material.GLOWSTONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Regenerate a chunk
|
||||||
|
* @param chunk - chunk to regenerate
|
||||||
|
*/
|
||||||
|
public void regenerateChunk(Chunk chunk) {
|
||||||
|
ChunkData cd = generateChunkData(chunk.getWorld(), new Random(), chunk.getX(), chunk.getZ(), null);
|
||||||
|
for (int x = 0; x < 16; x++) {
|
||||||
|
for (int z = 0; z < 16; z++) {
|
||||||
|
chunk.getBlock(x, 0, z).setBiome(addon.getSettings().getDefaultBiome());
|
||||||
|
for (int y = 0; y < chunk.getWorld().getMaxHeight(); y++) {
|
||||||
|
chunk.getBlock(x, y, z).setBlockData(cd.getBlockData(x, y, z));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user