本文整理汇总了Java中org.spongepowered.api.world.GeneratorType类的典型用法代码示例。如果您正苦于以下问题:Java GeneratorType类的具体用法?Java GeneratorType怎么用?Java GeneratorType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GeneratorType类属于org.spongepowered.api.world包,在下文中一共展示了GeneratorType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onGamePreInit
import org.spongepowered.api.world.GeneratorType; //导入依赖的package包/类
@Listener
public void onGamePreInit(GamePreInitializationEvent event) {
// Register the generator types
this.game.getRegistry().register(GeneratorType.class, new OverworldGeneratorType(
this.container.getId(), "overworld", "Porygen Overworld"));
this.game.getRegistry().register(GeneratorType.class, new NetherGeneratorType(
this.container.getId(), "nether", "Porygen Nether"));
this.game.getRegistry().register(GeneratorType.class, new TheEndGeneratorType(
this.container.getId(), "the_end", "Porygen The End"));
// TODO
// These will just be the same as overworld, but with some custom settings
this.game.getRegistry().register(GeneratorType.class, new OverworldGeneratorType(
this.container.getId(), "amplified", "Porygen Amplified Overworld"));
this.game.getRegistry().register(GeneratorType.class, new OverworldGeneratorType(
this.container.getId(), "large_biomes", "Porygen Large Biomes Overworld"));
// The default-world-gen.json is lantern related, a way to register the porygen
// generator types as the default ones. The lantern default ones are flat generator,
// this plugin is required for awesomeness.
}
开发者ID:LanternPowered,项目名称:Porygen,代码行数:22,代码来源:PorygenPlugin.java
示例2: getWorldType
import org.spongepowered.api.world.GeneratorType; //导入依赖的package包/类
@Override
public String getWorldType() {
if (!Sponge.isServerAvailable()) {
return "NORMAL";
}
Optional<WorldProperties> properties = Sponge.getServer().getDefaultWorld();
return properties.map(WorldProperties::getGeneratorType).map(GeneratorType::getName).orElse("NORMAL");
}
开发者ID:Proximyst,项目名称:Bukkit2Sponge,代码行数:9,代码来源:FakeServer.java
示例3: CachedGeneratorType
import org.spongepowered.api.world.GeneratorType; //导入依赖的package包/类
public CachedGeneratorType(GeneratorType generatorType) {
super(generatorType);
for (DataQuery query : generatorType.getGeneratorSettings().getKeys(true)) {
Optional val = generatorType.getGeneratorSettings().get(query);
if (!val.isPresent())
continue;
this.settings.put(query.asString("."), WebAPI.getCacheService().asCachedObject(val.get()));
}
}
开发者ID:Valandur,项目名称:Web-API,代码行数:12,代码来源:CachedGeneratorType.java
示例4: LanternWorldArchetype
import org.spongepowered.api.world.GeneratorType; //导入依赖的package包/类
LanternWorldArchetype(String id, String name, GameMode gameMode, LanternDimensionType<?> dimensionType, @Nullable GeneratorType generatorType,
Collection<WorldGeneratorModifier> generatorModifiers, @Nullable DataContainer generatorSettings, Difficulty difficulty,
SerializationBehavior serializationBehavior, LanternPortalAgentType portalAgentType, boolean hardcore, boolean enabled,
boolean loadsOnStartup, @Nullable Boolean keepsSpawnLoaded, boolean usesMapFeatures, boolean pvpEnabled, boolean generateBonusChest,
boolean commandsAllowed, @Nullable Boolean waterEvaporates, @Nullable Boolean allowPlayerRespawns, boolean generateSpawnOnLoad,
boolean isSeedRandomized, long seed, int buildHeight) {
this.serializationBehavior = serializationBehavior;
this.generateSpawnOnLoad = generateSpawnOnLoad;
this.allowPlayerRespawns = allowPlayerRespawns;
this.generatorModifiers = generatorModifiers;
this.generatorSettings = generatorSettings;
this.generateBonusChest = generateBonusChest;
this.keepsSpawnLoaded = keepsSpawnLoaded;
this.usesMapFeatures = usesMapFeatures;
this.portalAgentType = portalAgentType;
this.commandsAllowed = commandsAllowed;
this.waterEvaporates = waterEvaporates;
this.loadsOnStartup = loadsOnStartup;
this.dimensionType = dimensionType;
this.generatorType = generatorType;
this.isSeedRandomized = isSeedRandomized;
this.buildHeight = buildHeight;
this.pvpEnabled = pvpEnabled;
this.difficulty = difficulty;
this.hardcore = hardcore;
this.gameMode = gameMode;
this.enabled = enabled;
this.name = name;
this.seed = seed;
this.id = id;
}
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:32,代码来源:LanternWorldArchetype.java
示例5: setGeneratorType
import org.spongepowered.api.world.GeneratorType; //导入依赖的package包/类
/**
* Sets the actual {@link GeneratorType}.
*
* @param generatorType The generator type
*/
public void setGeneratorType(GeneratorType generatorType) {
checkNotNull(generatorType, "generatorType");
this.generatorType = generatorType;
this.minimalSpawnHeight = Integer.MAX_VALUE;
this.generatorHeight = Integer.MAX_VALUE;
}
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:12,代码来源:DelegateGeneratorType.java
示例6: LanternDimensionType
import org.spongepowered.api.world.GeneratorType; //导入依赖的package包/类
public LanternDimensionType(String pluginId, String name, int internalId, Class<T> dimensionClass,
GeneratorType defaultGeneratorType, boolean keepSpawnLoaded, boolean waterEvaporates,
boolean hasSky, boolean allowsPlayerRespawns, BiFunction<LanternWorld, LanternDimensionType<T>, T> supplier) {
super(pluginId, name, internalId);
this.dimContext = new Context(Context.DIMENSION_KEY, this.getId());
this.defaultGeneratorType = defaultGeneratorType;
this.allowsPlayerRespawns = allowsPlayerRespawns;
this.keepSpawnLoaded = keepSpawnLoaded;
this.waterEvaporates = waterEvaporates;
this.dimensionClass = dimensionClass;
this.supplier = supplier;
this.hasSky = hasSky;
}
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:14,代码来源:LanternDimensionType.java
示例7: getGeneratorType
import org.spongepowered.api.world.GeneratorType; //导入依赖的package包/类
public Optional<GeneratorType> getGeneratorType() {
Collection<GeneratorType> types = Sponge.getRegistry().getAllOf(GeneratorType.class);
return types.stream().filter(g -> g.getId().equalsIgnoreCase(generator) || g.getName().equalsIgnoreCase(generator)).findAny();
}
开发者ID:Valandur,项目名称:Web-API,代码行数:5,代码来源:BaseWorldRequest.java
示例8: getGeneratorType
import org.spongepowered.api.world.GeneratorType; //导入依赖的package包/类
@Override
public GeneratorType getGeneratorType() {
return this.generatorType == null ? this.dimensionType.getDefaultGeneratorType() : this.generatorType;
}
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:5,代码来源:LanternWorldArchetype.java
示例9: generator
import org.spongepowered.api.world.GeneratorType; //导入依赖的package包/类
@Override
public LanternWorldArchetypeBuilder generator(GeneratorType type) {
this.generatorType = checkNotNull(type, "type");
return this;
}
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:6,代码来源:LanternWorldArchetypeBuilder.java
示例10: getGeneratorType
import org.spongepowered.api.world.GeneratorType; //导入依赖的package包/类
@Override
public GeneratorType getGeneratorType() {
return this.worldConfig.getGeneration().getGeneratorType();
}
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:5,代码来源:LanternWorldProperties.java
示例11: setGeneratorType
import org.spongepowered.api.world.GeneratorType; //导入依赖的package包/类
@Override
public void setGeneratorType(GeneratorType generatorType) {
this.worldConfig.getGeneration().setGeneratorType(generatorType);
}
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:5,代码来源:LanternWorldProperties.java
示例12: DelegateGeneratorType
import org.spongepowered.api.world.GeneratorType; //导入依赖的package包/类
public DelegateGeneratorType(String pluginId, String id, GeneratorType generatorType) {
super(pluginId, id);
setGeneratorType(generatorType);
}
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:5,代码来源:DelegateGeneratorType.java
示例13: getGeneratorType
import org.spongepowered.api.world.GeneratorType; //导入依赖的package包/类
@Override
public GeneratorType getGeneratorType() {
return this.world.getProperties().getGeneratorType();
}
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:5,代码来源:LanternDimension.java
示例14: getGeneratorType
import org.spongepowered.api.world.GeneratorType; //导入依赖的package包/类
public GeneratorType getGeneratorType() {
return this.generatorType;
}
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:4,代码来源:WorldGeneration.java
示例15: setGeneratorType
import org.spongepowered.api.world.GeneratorType; //导入依赖的package包/类
public void setGeneratorType(GeneratorType generatorType) {
this.generatorType = checkNotNull(generatorType, "generatorType");
}
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:4,代码来源:WorldGeneration.java
示例16: execute
import org.spongepowered.api.world.GeneratorType; //导入依赖的package包/类
public CommandResult execute(CommandSource src, CommandContext ctx) throws CommandException
{
String name = ctx.<String> getOne("name").get();
String dimensionInput = ctx.<String> getOne("dimension").get();
String generatorInput = ctx.<String> getOne("generator").get();
String difficultyInput = ctx.<String> getOne("difficulty").get();
GameMode gamemode = ctx.<GameMode> getOne("gamemode").get();
Difficulty difficulty = null;
DimensionType dimension = null;
GeneratorType generator = null;
if (Sponge.getRegistry().getType(DimensionType.class, dimensionInput).isPresent())
{
dimension = Sponge.getRegistry().getType(DimensionType.class, dimensionInput).get();
}
else
{
src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "Dimension type specified not found."));
return CommandResult.success();
}
if (Sponge.getRegistry().getType(GeneratorType.class, generatorInput).isPresent())
{
generator = Sponge.getRegistry().getType(GeneratorType.class, generatorInput).get();
}
else
{
src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "Generator type specified not found."));
return CommandResult.success();
}
if (Sponge.getRegistry().getType(Difficulty.class, difficultyInput).isPresent())
{
difficulty = Sponge.getRegistry().getType(Difficulty.class, difficultyInput).get();
}
else
{
src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "Difficulty specified not found."));
return CommandResult.success();
}
src.sendMessage(Text.of(TextColors.GREEN, "Success! ", TextColors.YELLOW, "Beginning creation of world."));
WorldArchetype worldSettings = WorldArchetype.builder()
.enabled(true)
.loadsOnStartup(true)
.keepsSpawnLoaded(true)
.dimension(dimension)
.generator(generator)
.gameMode(gamemode)
.build(name.toLowerCase(), name);
try
{
WorldProperties worldProperties = Sponge.getGame().getServer().createWorldProperties(name, worldSettings);
Optional<World> world = Sponge.getGame().getServer().loadWorld(worldProperties);
if (world.isPresent())
{
world.get().getProperties().setDifficulty(difficulty);
src.sendMessage(Text.of(TextColors.GREEN, "Success! ", TextColors.GOLD, "World ", TextColors.GRAY, name, TextColors.GOLD, " has been created."));
}
else
{
src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "The world could not be created."));
}
}
catch (IOException e)
{
src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "The world properties could not be created."));
}
return CommandResult.success();
}
开发者ID:hsyyid,项目名称:EssentialCmds,代码行数:75,代码来源:WorldsBase.java
示例17: create
import org.spongepowered.api.world.GeneratorType; //导入依赖的package包/类
@Command(desc = "Creates a new world")
public void create(CommandSource context,
String name,
@Default @Named({"dimension", "dim"}) DimensionType dimension,
@Named("seed") String seed,
@Default @Named({"type"}) GeneratorType type,
@Default @Label("generate") @Named({"structure", "struct"}) boolean generateStructures,
@Default @Named({"gamemode", "mode"}) GameMode gamemode,
@Default @Named({"difficulty", "diff"}) Difficulty difficulty,
@org.cubeengine.butler.parametric.Optional @Label("name") @Named({"generator","gen"}) WorldGeneratorModifier generator,
@Flag boolean recreate,
@Flag boolean noload,
@Flag boolean spawnInMemory)
{
Optional<World> world = Sponge.getServer().getWorld(name);
if (world.isPresent())
{
if (recreate)
{
i18n.send(context, NEGATIVE, "You have to unload a world before recreating it!");
return;
}
i18n.send(context, NEGATIVE, "A world named {world} already exists and is loaded!", world.get());
return;
}
Optional<WorldProperties> worldProperties = Sponge.getServer().getWorldProperties(name);
if (worldProperties.isPresent())
{
if (!recreate)
{
i18n.send(context, NEGATIVE, "A world named {name#world} already exists but is not loaded!", name);
return;
}
worldProperties.get().setEnabled(false);
String newName = name + "_" + new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss").format(new Date());
Sponge.getServer().renameWorld(worldProperties.get(), newName);
i18n.send(context, POSITIVE, "Old world moved to {name#folder}", newName);
}
WorldArchetype.Builder builder = WorldArchetype.builder().from(WorldArchetypes.OVERWORLD);
builder.keepsSpawnLoaded(spawnInMemory);
builder.loadsOnStartup(!noload);
if (seed != null)
{
try
{
builder.seed(Long.parseLong(seed));
}
catch (NumberFormatException ignore)
{
builder.seed(seed.hashCode());
}
}
builder.generator(type);
builder.dimension(dimension);
builder.usesMapFeatures(generateStructures);
builder.gameMode(gamemode);
if (generator != null)
{
builder.generatorModifiers(generator);
}
builder.difficulty(difficulty);
try
{
WorldProperties properties = Sponge.getServer().createWorldProperties(name, builder.build("org.cubeengine.customworld:" + UUID.randomUUID().toString(), name));
i18n.send(context, POSITIVE, "World {name} successfully created!", name);
i18n.send(context, NEUTRAL, "This world is not yet loaded! Click {txt#here} to load.",
i18n.translate(context, TextFormat.NONE, "here").toBuilder().onClick(TextActions.runCommand("/worlds load " + name)).build());
}
catch (IOException e)
{
i18n.send(context, NEGATIVE, "Could not create world!");
throw new IllegalStateException(e); // TODO handle exception better
}
}
开发者ID:CubeEngine,项目名称:modules-main,代码行数:77,代码来源:WorldsCommands.java
示例18: getGeneratorType
import org.spongepowered.api.world.GeneratorType; //导入依赖的package包/类
@Override
public GeneratorType getGeneratorType() {
return this.generatorType;
}
开发者ID:InspireNXE,项目名称:Pulse,代码行数:5,代码来源:ServerWorldProperties.java
示例19: setGeneratorType
import org.spongepowered.api.world.GeneratorType; //导入依赖的package包/类
@Override
public void setGeneratorType(GeneratorType type) {
this.generatorType = type;
}
开发者ID:InspireNXE,项目名称:Pulse,代码行数:5,代码来源:ServerWorldProperties.java
示例20: generator
import org.spongepowered.api.world.GeneratorType; //导入依赖的package包/类
@Override
public WorldCreationSettings.Builder generator(GeneratorType type) {
this.generatorType = type;
return this;
}
开发者ID:InspireNXE,项目名称:Pulse,代码行数:6,代码来源:ServerWorldCreationSettings.java
注:本文中的org.spongepowered.api.world.GeneratorType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论