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


Java PopulateChunkEvent.Post方法代碼示例

本文整理匯總了Java中net.minecraftforge.event.terraingen.PopulateChunkEvent.Post方法的典型用法代碼示例。如果您正苦於以下問題:Java PopulateChunkEvent.Post方法的具體用法?Java PopulateChunkEvent.Post怎麽用?Java PopulateChunkEvent.Post使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraftforge.event.terraingen.PopulateChunkEvent的用法示例。


在下文中一共展示了PopulateChunkEvent.Post方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: postPopulate

import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority=EventPriority.LOWEST)
public void postPopulate(PopulateChunkEvent.Post event) {
	if (!Config.isGenEnabledAt(event.chunkX, event.chunkZ)) {
		return;
	}
	switch(event.world.provider.getDimensionId()) {
	case -1: // the Nether
		if (Config.getNetherAttemptsPerChunk() > 0) {
			netherRoomGen.generate(event.chunkProvider, event.world, event.rand, event.chunkX, event.chunkZ);
		}
		break;
	case 0: // the Overworld
		if (Config.getAttemptsPerChunk() > 0) {
			secretRoomGen.generate(event.chunkProvider, event.world, event.rand, event.chunkX, event.chunkZ);
		}
		if (Config.doPillarGen()) {
			pillarGen.generate(event.chunkProvider, event.world, event.rand, event.chunkX, event.chunkZ);
		}
		if (Config.doBombFlowerGen()) {
			bombGen.generate(event.world, event.rand, event.chunkX, event.chunkZ);
		}
		break;
	default: break;
	}
}
 
開發者ID:coolAlias,項目名稱:ZeldaSwordSkills,代碼行數:26,代碼來源:ZSSWorldGenEvent.java

示例2: onPopulateChunk

import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入方法依賴的package包/類
@ForgeSubscribe
public void onPopulateChunk(PopulateChunkEvent.Post event) {
	if (!event.world.isRemote && shopData != null && event.world.villageCollectionObj != null) {
		List<ChunkCoordinates> villageCoords = new ArrayList<ChunkCoordinates>();
		List<Village> villages = event.world.villageCollectionObj.getVillageList();
		for (Village village : villages) {
			ChunkCoordinates coords = village.getCenter();
			if (isVillageVisited(coords)) {
				continue;
			}
			spawnShop(event.world, coords.posX, coords.posZ);
			shopData.visitedVillageCoords.add(village.getCenter());
			shopData.setDirty(true);
		}
	}
}
 
開發者ID:Hunternif,項目名稱:Dota2Items,代碼行數:17,代碼來源:ShopSpawner.java

示例3: onChunkPopulated

import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onChunkPopulated(PopulateChunkEvent.Post event)
{
	EntityVillager villager = new EntityVillager(event.getWorld(), VillagerRegistry.getId(HarshenVillagers.VALOR));
	BlockPos pos = event.getWorld().getTopSolidOrLiquidBlock(new BlockPos(event.getChunkX() * 16 + event.getRand().nextInt(16), 0, event.getChunkZ() * 16 + event.getRand().nextInt(16)));
	villager.setLocationAndAngles(pos.getX(), pos.getY(), pos.getZ(), villager.rotationYaw, villager.rotationPitch);
	if(event.isHasVillageGenerated())
		if(event.getRand().nextFloat() < 0.1f)
			event.getWorld().spawnEntity(villager);
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:11,代碼來源:HandlerVillagerSpawn.java

示例4: populate

import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void populate(PopulateChunkEvent.Post event)
{
    final boolean doGen = TerrainGen.populate(event.chunkProvider, event.world, event.rand, event.chunkX, event.chunkZ, event.hasVillageGenerated, PopulateChunkEvent.Populate.EventType.CUSTOM);
    
    if (!doGen) return;
    
    final int worldX = event.chunkX << 4;
    final int worldZ = event.chunkZ << 4;

    EventHandlerGC.generateOil(event.world, event.rand, worldX + event.rand.nextInt(16), worldZ + event.rand.nextInt(16), false);
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:13,代碼來源:EventHandlerGC.java

示例5: 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

示例6: populate

import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void populate( PopulateChunkEvent.Post event )
{
  try
  {
    if( _mBuildCraftOilBlock == null ) {
        return;
    }

    int tMinDist = MainRegistry.CoreConfig.OilFixConfig.OilDepostMinDistance;
    if (tMinDist > 1)
    {
      if (event.chunkX % tMinDist != 0 || event.chunkZ % tMinDist != 0) {
          return;
      }
    }
    
    boolean doGen = TerrainGen.populate( event.chunkProvider, event.world, event.rand, event.chunkX, event.chunkZ, event.hasVillageGenerated, PopulateChunkEvent.Populate.EventType.CUSTOM );

    if( !doGen ) {
        return;
    }

    int worldX = event.chunkX << 4;
    int worldZ = event.chunkZ << 4;

    generateOil( event.world, event.rand, worldX + event.rand.nextInt( 16 ), worldZ + event.rand.nextInt( 16 ), false );
  }
  catch( Exception e )
  {
    e.printStackTrace();
  }
}
 
開發者ID:GTNewHorizons,項目名稱:NewHorizonsCoreMod,代碼行數:34,代碼來源:OilGeneratorFix.java

示例7: chunkLoadEvent

import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void chunkLoadEvent(PopulateChunkEvent.Post event) {
	if(zmaster587.advancedRocketry.api.Configuration.allowTerraforming && event.world.provider.getClass() == WorldProviderPlanet.class) {

		if(DimensionManager.getInstance().getDimensionProperties(event.world.provider.dimensionId).isTerraformed()) {
			Chunk chunk = event.world.getChunkFromChunkCoords(event.chunkX, event.chunkZ);
			modifyChunk(event.world, (WorldProviderPlanet) event.world.provider, chunk);
		}
	}
}
 
開發者ID:zmaster587,項目名稱:AdvancedRocketry,代碼行數:11,代碼來源:PlanetEventHandler.java

示例8: onPostPopulateChunk

import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onPostPopulateChunk(PopulateChunkEvent.Post event) {
	if (!event.world.provider.isSurfaceWorld()) {
		return;
	}
	if (!Config.isGenEnabledAt(event.chunkX, event.chunkZ)) {
		return;
	}
	if (event.rand.nextFloat() < Config.getGossipStoneRate()) {
		int i = (event.chunkX << 4) + event.rand.nextInt(16);
		int k = (event.chunkZ << 4) + event.rand.nextInt(16);
		int j = event.world.getHeight(new BlockPos(i, 64, k)).getY();
		generate(event.world, event.rand, new BlockPos(i, j, k));
	}
}
 
開發者ID:coolAlias,項目名稱:ZeldaSwordSkills,代碼行數:16,代碼來源:WorldGenGossipStones.java

示例9: postPopulate

import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority=EventPriority.LOWEST)
public void postPopulate(PopulateChunkEvent.Post event) {
	if (!Config.isGenEnabledAt(event.chunkX, event.chunkZ)) {
		return;
	}
	switch (event.world.provider.getDimensionId()) {
	case -1: // the Nether
		netherBossGen.generate(event.chunkProvider, event.world, event.rand, event.chunkX, event.chunkZ);
		break;
	case 0: // the Overworld
		bossRoomGen.generate(event.chunkProvider, event.world, event.rand, event.chunkX, event.chunkZ);
		break;
	}
}
 
開發者ID:coolAlias,項目名稱:ZeldaSwordSkills,代碼行數:15,代碼來源:ZSSBossDungeonGen.java

示例10: registerNewCiviliationBorder

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

示例11: onPopulateChunkEvent

import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入方法依賴的package包/類
@SubscribeEvent
@SuppressWarnings("unused")
public void onPopulateChunkEvent(PopulateChunkEvent.Post event) {
	
}
 
開發者ID:Team-Antimatter-Mod,項目名稱:AntiMatterMod,代碼行數:6,代碼來源:AMMStructureEventHandler.java

示例12: onChunkGenDone

import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority=EventPriority.HIGHEST)
public void onChunkGenDone(PopulateChunkEvent.Post evt){
	if(FMLCommonHandler.instance().getEffectiveSide()==Side.SERVER)
		ODTGen.repopulateOres((WorldServer)evt.world, evt.chunkX, evt.chunkZ);
}
 
開發者ID:planetguy32,項目名稱:Enterprise,代碼行數:6,代碼來源:OreDistributionTool.java

示例13: populateChunkPostEvent

import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void populateChunkPostEvent(PopulateChunkEvent.Post event) {
	World worldIn = event.world;
	BlockPosition position = new BlockPosition(16*event.chunkX + 3,0, 16*event.chunkZ + 11);

	if(DimensionManager.getInstance().getDimensionProperties(worldIn.provider.dimensionId).getName().equals("Luna") && position.x == 67 && position.z == 2347) {

		position.y = (short) (worldIn.getTopSolidOrLiquidBlock(position.x, position.z) - 1);
		
		worldIn.setBlock(position.x, position.y, position.z + 3, Blocks.stone_slab,8, 2);
		worldIn.setBlock(position.x, position.y, position.z - 3, Blocks.stone_slab,8, 2);
		worldIn.setBlock(position.x + 3, position.y, position.z, Blocks.stone_slab,8, 2);
		worldIn.setBlock(position.x - 3, position.y, position.z, Blocks.stone_slab,8, 2);
		
		position.y++;

		worldIn.setBlock(position.x, position.y, position.z, AdvancedRocketryBlocks.blockEngine);
		worldIn.setBlock(position.x, position.y, position.z + 3, Blocks.iron_bars);
		worldIn.setBlock(position.x, position.y, position.z - 3, Blocks.iron_bars);
		worldIn.setBlock(position.x + 3, position.y, position.z, Blocks.iron_bars);
		worldIn.setBlock(position.x - 3, position.y, position.z, Blocks.iron_bars);

		position.y++;
		
		worldIn.setBlock(position.x, position.y, position.z + 3, Blocks.iron_bars);
		worldIn.setBlock(position.x, position.y, position.z - 3, Blocks.iron_bars);
		worldIn.setBlock(position.x + 3, position.y, position.z, Blocks.iron_bars);
		worldIn.setBlock(position.x - 3, position.y, position.z, Blocks.iron_bars);

		for(int x = -1; x <= 1; x++ ) {
			worldIn.setBlock(position.x - 2, position.y, position.z + x, Blocks.gold_block);
			worldIn.setBlock(position.x + 2, position.y, position.z + x, Blocks.gold_block);
			worldIn.setBlock(position.x + x, position.y, position.z + 2, Blocks.gold_block);
			worldIn.setBlock(position.x + x, position.y, position.z - 2, Blocks.gold_block);
			for(int z = -1; z <= 1; z++) {
				worldIn.setBlock(position.x + x, position.y, position.z + z, Blocks.iron_block);
			}
		}

		position.y++;
		worldIn.setBlock(position.x, position.y, position.z + 3, Blocks.iron_bars);
		worldIn.setBlock(position.x, position.y, position.z - 3, Blocks.iron_bars);
		worldIn.setBlock(position.x + 3, position.y, position.z, Blocks.iron_bars);
		worldIn.setBlock(position.x - 3, position.y, position.z, Blocks.iron_bars);

		for(int x = -1; x <= 1; x++ ) {
			worldIn.setBlock(position.x - 2, position.y, position.z + x, Blocks.gold_block);
			worldIn.setBlock(position.x + 2, position.y, position.z + x, Blocks.gold_block);
			worldIn.setBlock(position.x + x, position.y, position.z + 2, Blocks.gold_block);
			worldIn.setBlock(position.x + x, position.y, position.z - 2, Blocks.gold_block);
		}

		worldIn.setBlock(position.x, position.y, position.z + 1, Blocks.iron_block);
		worldIn.setBlock(position.x, position.y, position.z - 1, Blocks.iron_block);
		worldIn.setBlock(position.x + 1, position.y, position.z, Blocks.iron_block);
		worldIn.setBlock(position.x - 1, position.y, position.z, Blocks.iron_block);

		position.x += 10;
		position.z += 15;
		position.y = (short) worldIn.getTopSolidOrLiquidBlock(position.x, position.z);

		for(int x = 0; x <= 4; x++ ) 
			worldIn.setBlock(position.x, position.y + x, position.z, Blocks.iron_bars);
		
		worldIn.setBlock(position.x + 1, position.y + 4, position.z, Blocks.iron_bars);
		worldIn.setBlock(position.x + 2, position.y + 4, position.z, Blocks.iron_bars);
	}
}
 
開發者ID:zmaster587,項目名稱:AdvancedRocketry,代碼行數:69,代碼來源:MapGenLander.java

示例14: populate

import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入方法依賴的package包/類
@ForgeSubscribe
public void populate(PopulateChunkEvent.Post event) {

	boolean doGen = TerrainGen.populate(event.chunkProvider, event.world, event.rand, event.chunkX, event.chunkX, event.hasVillageGenerated, PopulateChunkEvent.Populate.EventType.CUSTOM);

	if (!doGen) return;

	// shift to world coordinates
	int worldX = event.chunkX << 4;
	int worldZ = event.chunkZ << 4;

	doPopulate(event.world, event.rand, worldX, worldZ);
}
 
開發者ID:DrDew2,項目名稱:Amitcraft,代碼行數:14,代碼來源:SlagBucketHandler.java


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