本文整理匯總了Java中net.minecraftforge.event.terraingen.PopulateChunkEvent.Pre方法的典型用法代碼示例。如果您正苦於以下問題:Java PopulateChunkEvent.Pre方法的具體用法?Java PopulateChunkEvent.Pre怎麽用?Java PopulateChunkEvent.Pre使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraftforge.event.terraingen.PopulateChunkEvent
的用法示例。
在下文中一共展示了PopulateChunkEvent.Pre方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: pre
import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入方法依賴的package包/類
@SubscribeEvent
public static void pre(PopulateChunkEvent event) {
final World world = event.getWorld();
final int chunkX = event.getChunkX();
final int chunkZ = event.getChunkZ();
if (!isValidSpawnLocation(world, chunkX, chunkZ)) {
return;
}
Random rand = makeChunkRand(world, chunkX, chunkZ);
if (event instanceof PopulateChunkEvent.Post && Config.generateTree.getBoolean()) {
randomizeSapling(rand);
}
IBlockState[] states = mkBlockStates(EnderIOAdapter.getGlass(rand));
BlockPos startpos;
if (event instanceof PopulateChunkEvent.Pre) {
startpos = findInitialSpawnLocation(world, chunkX, chunkZ, rand);
lastChunkX = chunkX;
lastChunkZ = chunkZ;
lastStartY = startpos.getY();
} else if ((event instanceof PopulateChunkEvent.Post) && lastChunkX == chunkX && lastChunkZ == chunkZ) {
int i = chunkX * 16 + 8;
int j = chunkZ * 16 + 8;
startpos = new BlockPos(i, lastStartY, j);
} else {
return;
}
placeHut(world, startpos, data, states, rand);
if (event instanceof PopulateChunkEvent.Post && Config.generateTree.getBoolean()) {
placeHut(world, startpos.up(), tree, states, rand);
}
}
示例2: onPopulateChunkEvent
import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入方法依賴的package包/類
@SubscribeEvent
@SuppressWarnings("unused")
public void onPopulateChunkEvent(PopulateChunkEvent.Pre event){
// 通常世界(Overworld)にサンプルダンジョンを生成したいのでディメンションIDで通常世界かどうか判斷する
if(event.world.provider.dimensionId == 0){
// 8チャンク以內に追加構造物生成に適したチャンクがあるかを調べ、ある場合は生成する追加構造物の構成パーツを決定する
this.tiamatMapGen.func_151539_a(event.chunkProvider, event.world, event.chunkX, event.chunkZ, null);
//追加構造物の一部が このチャンク範囲に重複するかどうかを調べ、重複する場合は追加構造物のブロックをチャンク內に設置する
this.tiamatMapGen.generateStructuresInChunk(event.world,event.rand,event.chunkX,event.chunkZ);
}
}
示例3: onEvent
import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = true)
public void onEvent(final PopulateChunkEvent.Pre event) {
final Chunk chunk = event.world.getChunkFromChunkCoords(event.chunkX, event.chunkZ);
final Block fromBlock = Blocks.redstone_ore;
final Block toBlock = BlockManager.energeticRedstone;
for (final ExtendedBlockStorage storage : chunk.getBlockStorageArray()) {
if (storage != null) {
for (int x = 0; x < 16; ++x) {
for (int y = 0; y < 16; ++y) {
for (int z = 0; z < 16; ++z) {
final Block theBlock = storage.getBlockByExtId(x, y, z);
if (theBlock == fromBlock) {
if(event.rand.nextInt(REPLACE_CHANCE) == 0) {
storage.func_150818_a(x, y, z, toBlock);
storage.setExtBlocklightValue(x, y, z, toBlock.getLightValue());
}
}
}
}
}
}
}
chunk.setChunkModified();
}
示例4: populateChunk
import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void populateChunk(PopulateChunkEvent.Pre event) {
Chunk chunk = event.getWorld().getChunkFromChunkCoords(event.getChunkX(), event.getChunkZ());
for (ExtendedBlockStorage storage : chunk.getBlockStorageArray())
if (storage != null && storage.getYLocation() >= 60)
for (int x = 0; x < 16; ++x)
for (int y = 0; y < 16; ++y)
for (int z = 0; z < 16; ++z)
if(chunk.getBiome(new BlockPos(x, y, z), event.getWorld().getBiomeProvider()) == ACBiomes.darklands_mountains)
if (storage.get(x, y, z).getBlock() == Blocks.STONE)
storage.set(x, y, z, ACBlocks.stone.getDefaultState());
}
示例5: registerNewCiviliationBorder
import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void registerNewCiviliationBorder(PopulateChunkEvent.Pre event) {
registerCiv(event);
}
示例6: onEvent
import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onEvent(PopulateChunkEvent.Pre event) {
WorldGenUtil.modifySeed(event.rand, event.chunkX, event.chunkZ, event.world);
}
示例7: prePopulate
import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void prePopulate(PopulateChunkEvent.Pre event) {
BlockSand.fallInstantly = false;
}
示例8: generate
import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void generate(PopulateChunkEvent.Pre event) {
if(TerrainGen.populate(event.chunkProvider, event.world, event.rand, event.chunkX, event.chunkZ, event.hasVillageGenerated, EVENT_TYPE)) {
generateQuarry(event.world, event.rand, event.chunkX, event.chunkZ);
}
}
示例9: generate
import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void generate(PopulateChunkEvent.Pre event) {
if(TerrainGen.populate(event.chunkProvider, event.world, event.rand, event.chunkX, event.chunkZ, event.hasVillageGenerated, EVENT_TYPE)) {
generateGeode(event.world, event.rand, event.chunkX, event.chunkZ);
}
}
示例10: onPrePopulate
import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onPrePopulate(PopulateChunkEvent.Pre event) {
for(Entry<String, StructureGenerator> e : StructureGenerator.generators.entrySet()) {
e.getValue().generateStructuresInChunk(event.world, event.rand, event.chunkX, event.chunkZ);
}
}