本文整理匯總了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;
}
}
示例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);
}
}
}
示例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);
}
示例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);
}
示例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);
}
}
示例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();
}
}
示例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);
}
}
}
示例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));
}
}
示例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;
}
}
示例10: registerNewCiviliationBorder
import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void registerNewCiviliationBorder(PopulateChunkEvent.Post event) {
registerCiv(event);
}
示例11: onPopulateChunkEvent
import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入方法依賴的package包/類
@SubscribeEvent
@SuppressWarnings("unused")
public void onPopulateChunkEvent(PopulateChunkEvent.Post event) {
}
示例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);
}
示例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);
}
}
示例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);
}