本文整理汇总了Java中org.spongepowered.api.world.gen.WorldGenerator类的典型用法代码示例。如果您正苦于以下问题:Java WorldGenerator类的具体用法?Java WorldGenerator怎么用?Java WorldGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WorldGenerator类属于org.spongepowered.api.world.gen包,在下文中一共展示了WorldGenerator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: LanternChunkManager
import org.spongepowered.api.world.gen.WorldGenerator; //导入依赖的package包/类
@Inject
public LanternChunkManager(
@Named(InternalPluginsInfo.Minecraft.IDENTIFIER) PluginContainer minecraftPluginContainer,
LanternGame game, LanternWorld world, WorldConfig worldConfig,
LanternChunkTicketManager chunkLoadService, ChunkIOService chunkIOService,
WorldGenerator worldGenerator,
@Named(DirectoryKeys.WORLD) Path worldFolder) {
this.minecraftPluginContainer = minecraftPluginContainer;
this.chunkLoadService = chunkLoadService;
this.chunkIOService = chunkIOService;
this.worldGenerator = worldGenerator;
this.worldFolder = worldFolder;
this.worldConfig = worldConfig;
this.world = world;
this.game = game;
}
示例2: createGenerator
import org.spongepowered.api.world.gen.WorldGenerator; //导入依赖的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: createGenerator
import org.spongepowered.api.world.gen.WorldGenerator; //导入依赖的package包/类
@Override
public WorldGenerator createGenerator(World world) {
final DataContainer settings = world.getProperties().getGeneratorSettings();
final FlatGeneratorSettings flatGeneratorSettings = getFlatGeneratorSettings(settings);
final SingleBiomeGenerator biomeGenerator = new SingleBiomeGenerator(flatGeneratorSettings.getBiomeType());
final FlatGenerationPopulator populatorGenerator = new FlatGenerationPopulator(
flatGeneratorSettings, getGeneratorHeight(settings));
return new LanternWorldGenerator(world, biomeGenerator, populatorGenerator);
}
示例4: LanternWorld
import org.spongepowered.api.world.gen.WorldGenerator; //导入依赖的package包/类
public LanternWorld(LanternGame game, WorldConfig worldConfig, Path directory,
Scoreboard scoreboard, LanternWorldProperties properties) {
this.logger = LoggerFactory.getLogger("world/" + properties.getWorldName());
this.directory = directory;
this.worldConfig = worldConfig;
this.scoreboard = scoreboard;
this.properties = properties;
this.game = game;
// Create the chunk io service
final ChunkIOService chunkIOService = new AnvilChunkIOService(directory, this, this.logger, Lantern.getScheduler());
// Get the chunk load service
final LanternChunkTicketManager chunkLoadService = game.getChunkTicketManager();
// Get the dimension type
final LanternDimensionType<?> dimensionType = (LanternDimensionType<?>) properties.getDimensionType();
// Create the weather universe if needed
if (dimensionType.hasSky()) {
this.weatherUniverse = new LanternWeatherUniverse(this);
} else {
this.weatherUniverse = null;
}
this.timeUniverse = new TimeUniverse(this);
// Create the dimension
this.dimension = dimensionType.newDimension(this);
// Create the portal agent
this.portalAgent = properties.getPortalAgentType().newPortalAgent(this);
// Create a new world generator
final WorldGenerator worldGenerator = properties.getGeneratorType().createGenerator(this);
// Finally, create the chunk manager
this.chunkManager = new LanternChunkManager(Lantern.getMinecraftPlugin(), this.game, this, this.worldConfig, chunkLoadService,
chunkIOService, worldGenerator, directory);
this.worldContext = new Context(Context.WORLD_KEY, getName());
this.worldEventListener.add(this.observedChunkManager);
getWorldBorder().updateCurrentTime();
}
示例5: modifyWorldGenerator
import org.spongepowered.api.world.gen.WorldGenerator; //导入依赖的package包/类
@Override
public void modifyWorldGenerator(WorldProperties world, DataContainer settings, WorldGenerator worldGenerator) {
for (BiomeType biomeType : Sponge.getRegistry().getAllOf(BiomeType.class)) {
worldGenerator.getBiomeSettings(biomeType).getPopulators().clear();
}
worldGenerator.setBaseGenerationPopulator(new SolidWorldTerrainGenerator());
}
示例6: modifyWorldGenerator
import org.spongepowered.api.world.gen.WorldGenerator; //导入依赖的package包/类
@Override
public void modifyWorldGenerator(WorldProperties world, DataContainer settings, WorldGenerator worldGenerator) {
for (BiomeType biomeType : Sponge.getRegistry().getAllOf(BiomeType.class)) {
worldGenerator.getBiomeSettings(biomeType).getPopulators().clear();
}
worldGenerator.setBaseGenerationPopulator(new VoidTerrainGenerator());
}
示例7: modifyWorldGenerator
import org.spongepowered.api.world.gen.WorldGenerator; //导入依赖的package包/类
@Override
public void modifyWorldGenerator(WorldProperties world, DataContainer settings, WorldGenerator worldGenerator) {
for (BiomeType biomeType : Sponge.getRegistry().getAllOf(BiomeType.class)) {
BiomeGenerationSettings biomeData = worldGenerator.getBiomeSettings(biomeType);
List<Ore> populators = biomeData.getPopulators(Ore.class);
biomeData.getPopulators().removeAll(populators);
}
}
示例8: modifyWorldGenerator
import org.spongepowered.api.world.gen.WorldGenerator; //导入依赖的package包/类
@Override
public void modifyWorldGenerator(WorldProperties world, DataContainer settings, WorldGenerator worldGenerator) {
for (BiomeType biomeType : Sponge.getRegistry().getAllOf(BiomeType.class)) {
worldGenerator.getBiomeSettings(biomeType).getPopulators().clear();
}
worldGenerator.setBaseGenerationPopulator(new BarrierBlockTerrainGenerator());
}
示例9: modifyWorldGenerator
import org.spongepowered.api.world.gen.WorldGenerator; //导入依赖的package包/类
@Override
public void modifyWorldGenerator(WorldProperties world, DataContainer settings, WorldGenerator worldGenerator) {
String worldName = world.getWorldName();
worldGenerator.setBaseGenerationPopulator(new SpongeTerrainGen(this.plotGenerator));
worldGenerator.setBiomeGenerator(new BiomeGenerator() {
@Override
public void generateBiomes(MutableBiomeVolume buffer) {
PlotArea area = PS.get().getPlotArea(worldName, null);
if (area != null) {
BiomeType biome = SpongeUtil.getBiome(area.PLOT_BIOME);
Vector3i min = buffer.getBiomeMin();
Vector3i max = buffer.getBiomeMax();
for (int x = min.getX(); x <= max.getX(); x++) {
for (int z = min.getZ(); z <= max.getZ(); z++) {
buffer.setBiome(x, 0, z, biome);
}
}
}
}
});
for (BiomeType type : ReflectionUtils.<BiomeType> getStaticFields(BiomeTypes.class)) {
BiomeGenerationSettings biomeSettings = worldGenerator.getBiomeSettings(type);
biomeSettings.getGenerationPopulators().clear();
biomeSettings.getPopulators().clear();
biomeSettings.getGroundCoverLayers().clear();
}
worldGenerator.getGenerationPopulators().clear();
worldGenerator.getPopulators().clear();
PS.get().loadWorld(worldName, this);
}
示例10: get
import org.spongepowered.api.world.gen.WorldGenerator; //导入依赖的package包/类
public static SpongeAugmentedGenerator get(World world) {
WorldGenerator wg = world.getWorldGenerator();
List<GenerationPopulator> populators = wg.getGenerationPopulators();
for (GenerationPopulator populator : populators) {
if (populator instanceof SpongeAugmentedGenerator) {
return (SpongeAugmentedGenerator) populator;
}
}
if (generator == null) {
generator = new SpongeAugmentedGenerator();
}
populators.add(generator);
return generator;
}
示例11: onLoadWorld
import org.spongepowered.api.world.gen.WorldGenerator; //导入依赖的package包/类
@Listener
public void onLoadWorld(LoadWorldEvent event) {
final World world = event.getTargetWorld();
final String name = world.getName();
WorldGenerator generator = world.getWorldGenerator();
GenerationPopulator terrain = generator.getBaseGenerationPopulator();
if (terrain instanceof GeneratorWrapper) {
GeneratorWrapper stg = (GeneratorWrapper) terrain;
PS.get().loadWorld(name, stg);
}
else {
PS.get().loadWorld(name, null);
}
}
示例12: getGenerator
import org.spongepowered.api.world.gen.WorldGenerator; //导入依赖的package包/类
@Override
public String getGenerator(PlotArea plotArea) {
if (SetupUtils.generators.isEmpty()) {
updateGenerators();
}
World world = SpongeUtil.getWorld(plotArea.worldname);
if (world == null) {
return null;
}
WorldGenerator generator = world.getWorldGenerator();
throw new UnsupportedOperationException("NOT IMPLEMENTED YET");
}
示例13: setGenerator
import org.spongepowered.api.world.gen.WorldGenerator; //导入依赖的package包/类
@Override
public void setGenerator(String worldName) {
World world = SpongeUtil.getWorld(worldName);
if (world == null) {
// create world
ConfigurationSection worldConfig = PS.get().worlds.getConfigurationSection("worlds." + worldName);
String manager = worldConfig.getString("generator.plugin", "PlotSquared");
String generator = worldConfig.getString("generator.init", manager);
int type = worldConfig.getInt("generator.type");
int terrain = worldConfig.getInt("generator.terrain");
SetupObject setup = new SetupObject();
setup.plotManager = manager;
setup.setupGenerator = generator;
setup.type = type;
setup.terrain = terrain;
setup.step = new ConfigurationNode[0];
setup.world = worldName;
SetupUtils.manager.setupWorld(setup);
world = SpongeUtil.getWorld(worldName);
} else {
throw new IllegalArgumentException("World already loaded: " + worldName + "???");
}
WorldGenerator wg = world.getWorldGenerator();
GenerationPopulator gen = wg.getBaseGenerationPopulator();
if (gen instanceof GeneratorWrapper) {
PS.get().loadWorld(worldName, (GeneratorWrapper) gen);
} else {
throw new UnsupportedOperationException("NOT IMPLEMENTED YET2! " + worldName + " | " + gen);
}
}
示例14: applyToGenerator
import org.spongepowered.api.world.gen.WorldGenerator; //导入依赖的package包/类
@Override
protected void applyToGenerator(WorldGenerator worldGenerator) {
}
示例15: createGenerator
import org.spongepowered.api.world.gen.WorldGenerator; //导入依赖的package包/类
@Override
public WorldGenerator createGenerator(World world) {
return new LanternWorldGenerator(world, new SingleBiomeGenerator(BiomeTypes.PLAINS),
new DebugGenerationPopulator(Lantern.getGame().getRegistry()));
}