Class WorldTemplate
java.lang.Object
org.bukkit.generator.ChunkGenerator
ua.mcchickenstudio.opencreative.utils.world.generators.WorldGenerator
ua.mcchickenstudio.opencreative.utils.world.generators.WorldTemplate
- All Implemented Interfaces:
ExtensionContent
WorldTemplate
This class represents a world template, that can be used for creating a new worlds. Template folders are located in /plugins/OpenCreative/templates/ directory.Template folder must be Minecraft world folder.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.generator.ChunkGenerator
org.bukkit.generator.ChunkGenerator.BiomeGrid, org.bukkit.generator.ChunkGenerator.ChunkData -
Constructor Summary
ConstructorsConstructorDescriptionWorldTemplate(@NotNull String id, @NotNull org.bukkit.inventory.ItemStack displayIcon, @NotNull String folderName) Constructor of world template. -
Method Summary
Modifier and TypeMethodDescriptionvoidafterCreation(@NotNull org.bukkit.World world) Executes world operations, when it's created or loaded.booleancanSpawn(@NotNull org.bukkit.World world, int x, int z) voidchangeLocation(@Nullable org.bukkit.Location newLocation) Changes prepared spawn location.voidgenerateSurface(@NotNull org.bukkit.generator.WorldInfo worldInfo, @NotNull Random random, int chunkX, int chunkZ, @NotNull org.bukkit.generator.ChunkGenerator.ChunkData chunkData) @NotNull StringReturns description of extension content.@NotNull StringReturns lower-cased simple id of extension.@NotNull org.bukkit.LocationgetFixedSpawnLocation(@NotNull org.bukkit.World world, @NotNull Random random) @NotNull StringReturns name of world folder, located in /plugins/OpenCreative/templates directory.voidmodifyWorldCreator(@NotNull org.bukkit.WorldCreator creator, @NotNull String biome) Changes world creator before creating or loading world.Methods inherited from class WorldGenerator
getDisplayIcon, getID, getLocaleName, getNameModifier and TypeMethodDescriptionorg.bukkit.inventory.ItemStackReturns an icon that will be used in world generation menu.final @NotNull StringgetID()Returns id of world generator, that will be used to find it in registry.@NotNull StringReturns localized name for displaying.@NotNull StringgetName()Returns name of world generator for displaying in registry by converting id.Methods inherited from class org.bukkit.generator.ChunkGenerator
createChunkData, generateBedrock, generateCaves, generateChunkData, generateNoise, getBaseHeight, getDefaultBiomeProvider, getDefaultPopulators, isParallelCapable, shouldGenerateBedrock, shouldGenerateCaves, shouldGenerateCaves, shouldGenerateDecorations, shouldGenerateDecorations, shouldGenerateMobs, shouldGenerateMobs, shouldGenerateNoise, shouldGenerateNoise, shouldGenerateStructures, shouldGenerateStructures, shouldGenerateSurface, shouldGenerateSurface
-
Constructor Details
-
WorldTemplate
public WorldTemplate(@NotNull @NotNull String id, @NotNull @NotNull org.bukkit.inventory.ItemStack displayIcon, @NotNull @NotNull String folderName) Constructor of world template.- Parameters:
id- short id of world generator that will be used in world generation menu.It must be lower-snake-cased, for example: "flat", "nostalgia_world". If some of registered generators has same ID as new, it will be not added.
displayIcon- icon of world generator that will be displayed in world generation menu.folderName- name of folder from /plugins/OpenCreative/templates/.
-
-
Method Details
-
getFixedSpawnLocation
@NotNull public @NotNull org.bukkit.Location getFixedSpawnLocation(@NotNull @NotNull org.bukkit.World world, @NotNull @NotNull Random random) - Overrides:
getFixedSpawnLocationin classorg.bukkit.generator.ChunkGenerator
-
canSpawn
public boolean canSpawn(@NotNull @NotNull org.bukkit.World world, int x, int z) - Overrides:
canSpawnin classorg.bukkit.generator.ChunkGenerator
-
changeLocation
public void changeLocation(@Nullable @Nullable org.bukkit.Location newLocation) Changes prepared spawn location.- Parameters:
newLocation- location to set.
-
getExtensionId
Description copied from interface:ExtensionContentReturns lower-cased simple id of extension. Will be used to identify author of content.ID "default" is reserved for OpenCreative+ developers.
- Returns:
- id of extension.
-
getDescription
Description copied from interface:ExtensionContentReturns description of extension content. Describes purpose of new additional content.- Returns:
- description of content.
-
getFolderName
Returns name of world folder, located in /plugins/OpenCreative/templates directory.- Returns:
- name of world folder for copying and pasting.
-
generateSurface
public void generateSurface(@NotNull @NotNull org.bukkit.generator.WorldInfo worldInfo, @NotNull @NotNull Random random, int chunkX, int chunkZ, @NotNull @NotNull org.bukkit.generator.ChunkGenerator.ChunkData chunkData) - Overrides:
generateSurfacein classorg.bukkit.generator.ChunkGenerator
-
modifyWorldCreator
public void modifyWorldCreator(@NotNull @NotNull org.bukkit.WorldCreator creator, @NotNull @NotNull String biome) Description copied from class:WorldGeneratorChanges world creator before creating or loading world. Useful to set generator as itself, if it overridesgenerateSurfacemethod.- Specified by:
modifyWorldCreatorin classWorldGenerator- Parameters:
creator- creator to change.biome- selected biome.
-
afterCreation
public void afterCreation(@NotNull @NotNull org.bukkit.World world) Description copied from class:WorldGeneratorExecutes world operations, when it's created or loaded.- Specified by:
afterCreationin classWorldGenerator- Parameters:
world- world to execute code in it.
-