當前位置: 首頁>>代碼示例>>Java>>正文


Java PopulateChunkEvent.Pre方法代碼示例

本文整理匯總了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);
  }
}
 
開發者ID:HenryLoenwind,項目名稱:TravelHut,代碼行數:38,代碼來源:WorldGenHandler.java

示例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);
	}
}
 
開發者ID:Team-Antimatter-Mod,項目名稱:AntiMatterMod,代碼行數:13,代碼來源:AMMStructureEventHandler.java

示例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();
}
 
開發者ID:OreCruncher,項目名稱:ThermalRecycling,代碼行數:28,代碼來源:EnergeticRedstoneOreHandler.java

示例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());
}
 
開發者ID:Shinoow,項目名稱:AbyssalCraft,代碼行數:13,代碼來源:AbyssalCraftEventHooks.java

示例5: registerNewCiviliationBorder

import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void registerNewCiviliationBorder(PopulateChunkEvent.Pre event) {
	registerCiv(event);
}
 
開發者ID:ToroCraft,項目名稱:ToroQuest,代碼行數:5,代碼來源:CivilizationGeneratorHandlers.java

示例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);
}
 
開發者ID:Barteks2x,項目名稱:McWorldGenLoop,代碼行數:5,代碼來源:EventListener.java

示例7: prePopulate

import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void prePopulate(PopulateChunkEvent.Pre event) {
	BlockSand.fallInstantly = false;
}
 
開發者ID:TeNNoX-Mods,項目名稱:Planetoids,代碼行數:5,代碼來源:Planetoid.java

示例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);
    }
}
 
開發者ID:GTNewHorizons,項目名稱:NewHorizonsCoreMod,代碼行數:7,代碼來源:NH_QuarryPopulator.java

示例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);
    }
}
 
開發者ID:GTNewHorizons,項目名稱:NewHorizonsCoreMod,代碼行數:7,代碼來源:NH_GeodePopulator.java

示例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);
	}
}
 
開發者ID:TTFTCUTS,項目名稱:ShadowsOfPhysis,代碼行數:7,代碼來源:StructureHandler.java


注:本文中的net.minecraftforge.event.terraingen.PopulateChunkEvent.Pre方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。