Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Manu
Empty World Generator
Commits
9b9a7d27
Commit
9b9a7d27
authored
Aug 13, 2022
by
Manu
🏅
Browse files
Version 1.2: Use new BiomeProvider instead of deprecated Grid
parent
9c932c8c
Changes
4
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
9b9a7d27
...
...
@@ -5,14 +5,24 @@ This Minecraft (Spigot) plugin generates an empty world with the given name.
A small start island will be created where the spawn is.
## Usage
### Create empty world with island
To create a new empty world with a floating island as start point:
`/create-empty-world <world name>`
To import it into Multiverse:
`/mv import <world name> normal VoidGenerator`
`/mv import <world name> normal -g EmptyWorldGenerator`
### Create completely empty world
With the Multiverse plugin you can also create a completely empty world:
`/mv create <world name> normal -g EmptyWorldGenerator`
Note, that the world name should not contain whitespace characters.
## Issues
When the generator could not be found by multiverse, you can also try to use this command to import a world into Multiverse:
`/mv import <world name> normal VoidGenerator`
But this command does not register the generator in Multiverse, which can lead to worlds with mixed chunks.
## Download
https://gitlab.full-stack.ninja/Manu/empty-world-generator/-/tree/main/releases
...
...
@@ -20,4 +30,4 @@ https://gitlab.full-stack.ninja/Manu/empty-world-generator/-/tree/main/releases
https://www.spigotmc.org/resources/emptyworldgenerator.103221/
## Disclaimer
This plugin is provided "as-is" and there is no support provided for it.
\ No newline at end of file
This plugin is provided "as-is" and there is no support provided for it.
emptyworldgenerator/src/amonbune/emptyworldgenerator/EmptyWorldGenerator.kt
View file @
9b9a7d27
package
amonbune.emptyworldgenerator
import
com.google.common.collect.Lists
import
org.bukkit.*
import
org.bukkit.block.Biome
import
org.bukkit.block.BlockFace
...
...
@@ -8,7 +9,9 @@ import org.bukkit.command.Command
import
org.bukkit.command.CommandExecutor
import
org.bukkit.command.CommandSender
import
org.bukkit.entity.Player
import
org.bukkit.generator.BiomeProvider
import
org.bukkit.generator.ChunkGenerator
import
org.bukkit.generator.WorldInfo
import
org.bukkit.plugin.java.JavaPlugin
import
java.util.*
...
...
@@ -21,6 +24,14 @@ class EmptyWorldGenerator : JavaPlugin() {
override
fun
onDisable
()
{
}
override
fun
getDefaultWorldGenerator
(
worldName
:
String
,
id
:
String
?):
ChunkGenerator
{
return
VoidGenerator
()
}
override
fun
getDefaultBiomeProvider
(
worldName
:
String
,
id
:
String
?):
BiomeProvider
{
return
VoidBiomeProvider
()
}
}
class
CommandCreateEmptyWorld
:
CommandExecutor
{
...
...
@@ -39,6 +50,7 @@ class CommandCreateEmptyWorld : CommandExecutor {
// Generate new empty world
val
wc
=
WorldCreator
(
worldName
)
wc
.
generator
(
VoidGenerator
())
wc
.
biomeProvider
(
VoidBiomeProvider
())
wc
.
createWorld
()
// Create a start platform
...
...
@@ -148,29 +160,18 @@ class CommandCreateEmptyWorld : CommandExecutor {
}
class
VoidGenerator
:
ChunkGenerator
()
{
override
fun
generateChunkData
(
world
:
World
,
random
:
Random
,
chunkX
:
Int
,
chunkZ
:
Int
,
biome
:
BiomeGrid
):
ChunkData
{
val
chunkData
=
super
.
createChunkData
(
world
)
// For every block in the chunk set the biome to plains
for
(
x
in
0
..
15
)
{
for
(
z
in
0
..
15
)
{
for
(
y
in
world
.
minHeight
..
world
.
maxHeight
)
biome
.
setBiome
(
x
,
y
,
z
,
Biome
.
PLAINS
)
}
}
return
chunkData
}
override
fun
getFixedSpawnLocation
(
world
:
World
,
random
:
Random
):
Location
{
val
yMiddleOfWorld
:
Double
=
(
world
.
maxHeight
.
toDouble
()
+
world
.
minHeight
.
toDouble
())
/
2
return
Location
(
world
,
0.0
,
yMiddleOfWorld
+
1
,
0.0
)
}
}
class
VoidBiomeProvider
:
BiomeProvider
()
{
override
fun
getBiome
(
worldInfo
:
WorldInfo
,
x
:
Int
,
y
:
Int
,
z
:
Int
):
Biome
{
return
Biome
.
PLAINS
}
override
fun
getBiomes
(
worldInfo
:
WorldInfo
):
List
<
Biome
>
{
return
Lists
.
newArrayList
(
Biome
.
PLAINS
)
}
}
\ No newline at end of file
emptyworldgenerator/src/plugin.yml
View file @
9b9a7d27
name
:
EmptyWorldGenerator
version
:
1.
0
.0
version
:
1.
2
.0
author
:
Amon Bune
main
:
amonbune.emptyworldgenerator.EmptyWorldGenerator
api-version
:
1.19
...
...
releases/emptyworldgenerator-1.2.jar
0 → 100644
View file @
9b9a7d27
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment