本文整理汇总了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;
}
示例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;
}
示例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();
}
示例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"));
}
示例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));
}
示例6: GeneratorTypeRegistryModule
import org.spongepowered.api.world.GeneratorTypes; //导入依赖的package包/类
public GeneratorTypeRegistryModule() {
super(GeneratorTypes.class);
}
示例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();
}