当前位置: 首页>>代码示例>>Java>>正文


Java GeneratorTypes类代码示例

本文整理汇总了Java中org.spongepowered.api.world.GeneratorTypes的典型用法代码示例。如果您正苦于以下问题:Java GeneratorTypes类的具体用法?Java GeneratorTypes怎么用?Java GeneratorTypes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GeneratorTypes类属于org.spongepowered.api.world包,在下文中一共展示了GeneratorTypes类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: reset

import org.spongepowered.api.world.GeneratorTypes; //导入依赖的package包/类
@Override
public WorldCreationSettings.Builder reset() {
    this.dimensionType = DimensionTypes.OVERWORLD;
    this.generatorType = GeneratorTypes.DEFAULT;
    this.gameMode = GameModes.SURVIVAL;
    this.serializationBehavior = SerializationBehaviors.AUTOMATIC;
    this.isEnabled = true;
    this.loadOnStartup = true;
    this.doesKeepSpawnLoaded = true;
    this.generateSpawnOnLoad = true;
    this.usesMapFeatures = true;
    this.isHardcore = false;
    this.commandsAllowed = true;
    this.doesGenerateBonusChest = false;
    this.isPvpEnabled = true;
    this.seed = SpongeGame.instance.getConfiguration().getSeed();
    return this;
}
 
开发者ID:InspireNXE,项目名称:Pulse,代码行数:19,代码来源:ServerWorldCreationSettings.java

示例2: createGenerator

import org.spongepowered.api.world.GeneratorTypes; //导入依赖的package包/类
@Override
public WorldGenerator createGenerator(World world) {
    // Just generate a base WorldGenerator that we can modify, we want an
    // actual generator type so no WorldGeneratorModifier
    final WorldGenerator generator = GeneratorTypes.FLAT.createGenerator(world);
    applyToGenerator(generator);
    return generator;
}
 
开发者ID:LanternPowered,项目名称:Porygen,代码行数:9,代码来源:PorygenGeneratorType.java

示例3: execute

import org.spongepowered.api.world.GeneratorTypes; //导入依赖的package包/类
@Override
public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
    if (src instanceof Player) {
        Player player = (Player) src;
        player.getWorld().getProperties().setGeneratorType(GeneratorTypes.AMPLIFIED);
        player.getWorld().getProperties().setThundering(true);
    }
    return CommandResult.success();
}
 
开发者ID:vorburger,项目名称:ch.vorburger.minecraft.osgi,代码行数:10,代码来源:SetWorldGenerator.java

示例4: registerDefaults

import org.spongepowered.api.world.GeneratorTypes; //导入依赖的package包/类
@Override
public void registerDefaults() {
    final WorldArchetype overworld = WorldArchetype.builder()
            .enabled(true)
            .loadsOnStartup(true)
            .keepsSpawnLoaded(true)
            .generateSpawnOnLoad(true)
            .commandsAllowed(true)
            .gameMode(GameModes.SURVIVAL)
            .generator(GeneratorTypes.DEFAULT)
            .dimension(DimensionTypes.OVERWORLD)
            .difficulty(Difficulties.NORMAL)
            .usesMapFeatures(true)
            .hardcore(false)
            .pvp(true)
            .generateBonusChest(false)
            .serializationBehavior(SerializationBehaviors.AUTOMATIC)
            .build("minecraft:overworld", "Overworld");
    register(overworld);
    register(WorldArchetype.builder()
            .from(overworld)
            .generator(GeneratorTypes.NETHER)
            .dimension(DimensionTypes.NETHER)
            .build("minecraft:the_nether", "The Nether"));
    register(WorldArchetype.builder()
            .from(overworld)
            .generator(GeneratorTypes.THE_END)
            .dimension(DimensionTypes.THE_END)
            .build("minecraft:the_end", "The End"));
    register(WorldArchetype.builder()
            .from(overworld)
            .generatorModifiers(WorldGeneratorModifiers.VOID)
            .build("sponge:the_void", "The Void"));
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:35,代码来源:WorldArchetypeRegistryModule.java

示例5: registerDefaults

import org.spongepowered.api.world.GeneratorTypes; //导入依赖的package包/类
@Override
public void registerDefaults() {
    register(new LanternDimensionType<>("minecraft", "nether", -1, LanternDimensionNether.class, GeneratorTypes.NETHER, true, true,
            false, false, LanternDimensionNether::new));
    register(new LanternDimensionType<>("minecraft", "overworld", 0, LanternDimensionOverworld.class, GeneratorTypes.OVERWORLD, true, false,
            true, true, LanternDimensionOverworld::new));
    register(new LanternDimensionType<>("minecraft", "the_end", 1, LanternDimensionEnd.class, GeneratorTypes.THE_END, true, false,
            false, false, LanternDimensionEnd::new));
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:10,代码来源:DimensionTypeRegistryModule.java

示例6: GeneratorTypeRegistryModule

import org.spongepowered.api.world.GeneratorTypes; //导入依赖的package包/类
public GeneratorTypeRegistryModule() {
    super(GeneratorTypes.class);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:4,代码来源:GeneratorTypeRegistryModule.java

示例7: execute

import org.spongepowered.api.world.GeneratorTypes; //导入依赖的package包/类
@Override
public CommandResult execute(CommandSource src, CommandContext ctx) throws CommandException
{
	String name = ctx.<String> getOne("name").get();
	Optional<String> dimensionInput = ctx.<String> getOne("dimension");
	Optional<String> generatorInput = ctx.<String> getOne("generator");
	Optional<String> difficultyInput = ctx.<String> getOne("difficulty");
	Optional<GameMode> gamemode = ctx.<GameMode> getOne("gamemode");
	Difficulty difficulty = Difficulties.NORMAL;
	DimensionType dimension = DimensionTypes.OVERWORLD;
	GeneratorType generator = GeneratorTypes.OVERWORLD;

	if (dimensionInput.isPresent() && Sponge.getRegistry().getType(DimensionType.class, dimensionInput.get()).isPresent())
	{
		dimension = Sponge.getRegistry().getType(DimensionType.class, dimensionInput.get()).get();
	}
	else if (dimensionInput.isPresent())
	{
		src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "Dimension type specified not found."));
	}

	if (generatorInput.isPresent() && Sponge.getRegistry().getType(GeneratorType.class, generatorInput.get()).isPresent())
	{
		generator = Sponge.getRegistry().getType(GeneratorType.class, generatorInput.get()).get();
	}
	else if (generatorInput.isPresent())
	{
		src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "Generator type specified not found."));
	}

	if (difficultyInput.isPresent() && Sponge.getRegistry().getType(Difficulty.class, difficultyInput.get()).isPresent())
	{
		difficulty = Sponge.getRegistry().getType(Difficulty.class, difficultyInput.get()).get();
	}
	else if (difficultyInput.isPresent())
	{
		src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "Difficulty specified not found."));
	}

	src.sendMessage(Text.of(TextColors.GREEN, "Success! ", TextColors.YELLOW, "Beginning loading of world."));

	WorldArchetype worldSettings = WorldArchetype.builder()
		.enabled(true)
		.loadsOnStartup(true)
		.keepsSpawnLoaded(true)
		.dimension(dimension)
		.generator(generator)
		.gameMode(gamemode.orElse(GameModes.SURVIVAL))
		.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 loaded."));
		}
		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,代码行数:73,代码来源:WorldsBase.java


注:本文中的org.spongepowered.api.world.GeneratorTypes类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。