本文整理汇总了Java中cn.nukkit.level.generator.Generator.generateChunk方法的典型用法代码示例。如果您正苦于以下问题:Java Generator.generateChunk方法的具体用法?Java Generator.generateChunk怎么用?Java Generator.generateChunk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.nukkit.level.generator.Generator
的用法示例。
在下文中一共展示了Generator.generateChunk方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onRun
import cn.nukkit.level.generator.Generator; //导入方法依赖的package包/类
@Override
public void onRun() {
Generator generator = GeneratorPool.get(this.levelId);
if (generator == null) {
this.state = false;
return;
}
SimpleChunkManager manager = (SimpleChunkManager) generator.getChunkManager();
if (manager == null) {
this.state = false;
return;
}
synchronized (manager) {
BaseFullChunk chunk = this.chunk.clone();
if (chunk == null) {
return;
}
manager.setChunk(chunk.getX(), chunk.getZ(), chunk);
generator.generateChunk(chunk.getX(), chunk.getZ());
chunk = manager.getChunk(chunk.getX(), chunk.getZ());
chunk.setGenerated();
this.chunk = chunk.clone();
manager.setChunk(chunk.getX(), chunk.getZ(), null);
}
}
示例2: NukkitPlotGenerator
import cn.nukkit.level.generator.Generator; //导入方法依赖的package包/类
public NukkitPlotGenerator(Map<String, Object> map) {
if (map == null) {
throw new IllegalArgumentException("options may not be null!");
}
this.settings = map;
MainUtil.initCache();
this.world = map.get("world").toString();
if (map.containsKey("generator")) {
final Generator cg = (Generator) map.get("generator");
if (cg instanceof NukkitPlotGenerator) {
throw new IllegalArgumentException("Generator: " + cg.getClass().getName() + " is already a NukkitPlotGenerator!");
}
this.full = false;
PS.debug("NukkitPlotGenerator does not fully support: " + cg);
this.platformGenerator = cg;
this.plotGenerator = new IndependentPlotGenerator() {
@Override
public void processSetup(SetupObject setup) {}
@Override
public void initialize(PlotArea area) {}
@Override
public PlotManager getNewPlotManager() {
return PS.get().IMP.getDefaultGenerator().getNewPlotManager();
}
@Override
public String getName() {
return cg.getClass().getName();
}
@Override
public PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max) {
return PS.get().IMP.getDefaultGenerator().getNewPlotArea(world, id, min, max);
}
@Override
public void generateChunk(final ScopedLocalBlockQueue result, PlotArea settings, PseudoRandom random) {
Location min = result.getMin();
int cx = min.getX() >> 4;
int cz = min.getZ() >> 4;
cg.generateChunk(cx, cz);
cg.populateChunk(cx, cz);
}
};
chunkSetter = new NukkitWrappedChunk(world, null);
MainUtil.initCache();
} else {
this.plotGenerator = (IndependentPlotGenerator) map.get("plot-generator");
this.platformGenerator = this;
this.full = true;
chunkSetter = new NukkitWrappedChunk(world, null);
}
PS.get().loadWorld(world, this);
}