本文整理匯總了Java中net.minecraftforge.event.terraingen.PopulateChunkEvent類的典型用法代碼示例。如果您正苦於以下問題:Java PopulateChunkEvent類的具體用法?Java PopulateChunkEvent怎麽用?Java PopulateChunkEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PopulateChunkEvent類屬於net.minecraftforge.event.terraingen包,在下文中一共展示了PopulateChunkEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: populate
import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入依賴的package包/類
/** Alters vanilla chunk populating. */
@SubscribeEvent
public void populate(PopulateChunkEvent.Populate event) {
Random rand = event.getRand();
// Chance of generating rice lake
if (event.getType() == PopulateChunkEvent.Populate.EventType.LAKE &&
rand.nextFloat() <= 0.1) {
event.setResult(Result.DENY);
new PopulateChunkRicelake(event.getWorld(), rand)
.generateChunk(event.getChunkX(), event.getChunkZ());
return;
}
}
示例2: onBiomePopulate
import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入依賴的package包/類
@SubscribeEvent
public void onBiomePopulate(PopulateChunkEvent.Populate event)
{
if(ConfigValues.SPAWN_WORLD_CRATER)
{
if(event.getWorld().provider.getDimension() == 0)
{
int chunkX = event.getChunkX();
int chunkZ = event.getChunkZ();
if(Math.sqrt(((chunkX*16)*(chunkX*16)) + ((chunkZ*16)*(chunkZ*16))) < 378)
{
event.setResult(Event.Result.DENY);
}
}
}
}
示例3: populate
import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入依賴的package包/類
/**
* Populates chunk with ores etc etc
*/
public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_)
{
BlockFalling.fallInstantly = true;
MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, worldObj, worldObj.rand, p_73153_2_, p_73153_3_, false));
int k = p_73153_2_ * 16;
int l = p_73153_3_ * 16;
BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16);
biomegenbase.decorate(this.worldObj, this.worldObj.rand, k, l);
MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, worldObj, worldObj.rand, p_73153_2_, p_73153_3_, false));
BlockFalling.fallInstantly = false;
}
示例4: 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;
}
}
示例5: populate
import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入依賴的package包/類
/**
* Populates chunk with ores etc etc
*/
public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_)
{
BlockFalling.fallInstantly = true;
int k = p_73153_2_ * 16;
int l = p_73153_3_ * 16;
BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16);
this.rand.setSeed(this.worldObj.getSeed());
long i1 = this.rand.nextLong() / 2L * 2L + 1L;
long j1 = this.rand.nextLong() / 2L * 2L + 1L;
this.rand.setSeed((long)p_73153_2_ * i1 + (long)p_73153_3_ * j1 ^ this.worldObj.getSeed());
boolean flag = false;
MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag));
MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag));
BlockFalling.fallInstantly = false;
}
示例6: 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);
}
}
}
示例7: populate
import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入依賴的package包/類
/**
* Populates chunk with ores etc etc
*/
public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_)
{
BlockFalling.fallInstantly = true;
MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, world, world.rand, p_73153_2_, p_73153_3_, false));
int k = p_73153_2_ * 16;
int l = p_73153_3_ * 16;
BiomeGenBase biomegenbase = this.world.getBiomeGenForCoords(k + 16, l + 16);
biomegenbase.decorate(this.world, this.world.rand, k, l);
MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, world, world.rand, p_73153_2_, p_73153_3_, false));
BlockFalling.fallInstantly = false;
}
示例8: 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);
}
示例9: onPopulate
import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入依賴的package包/類
@SubscribeEvent
public void onPopulate(PopulateChunkEvent.Populate event)
{
if (event.getWorld().getWorldType() != ExPMisc.worldTypeExP)
{
return;
}
if (event.getType() == EventType.LAKE || event.getType() == EventType.LAVA)
{
event.setResult(Result.DENY);
}
}
示例10: 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);
}
示例11: populate
import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入依賴的package包/類
/**
* Populates chunk with ores etc etc
*/
public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_)
{
BlockFalling.fallInstantly = true;
int k = p_73153_2_ * 16;
int l = p_73153_3_ * 16;
BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16);
this.rand.setSeed(this.worldObj.getSeed());
long i1 = this.rand.nextLong() / 2L * 2L + 1L;
long j1 = this.rand.nextLong() / 2L * 2L + 1L;
this.rand.setSeed((long)p_73153_2_ * i1 + (long)p_73153_3_ * j1 ^ this.worldObj.getSeed());
MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, false));
int k1;
int l1;
int i2;
if (this.rand.nextInt(4) == 0)
{
k1 = k + this.rand.nextInt(16) + 8;
l1 = this.rand.nextInt(256);
i2 = l + this.rand.nextInt(16) + 8;
(new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, k1, l1, i2);
}
if (biomegenbase.theBiomeDecorator.currentWorld == null)
biomegenbase.decorate(this.worldObj, this.rand, k, l);
if (TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, false, ANIMALS))
{
SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand);
}
k += 8;
l += 8;
MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, false));
BlockFalling.fallInstantly = false;
}
示例12: 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);
}
}
示例13: onPopulateChunk_Populate
import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入依賴的package包/類
@SubscribeEvent(priority = EventPriority.TOP)
public static void onPopulateChunk_Populate(PopulateChunkEvent.Populate event) {
Biome biome = event.getWorld().getBiome(new BlockPos(event.getChunkX() * 16, 1, event.getChunkZ() * 16));
if (biome instanceof AlchemyBiome) {
if (event.getType() == PopulateChunkEvent.Populate.EventType.LAKE ||
event.getType() == PopulateChunkEvent.Populate.EventType.LAVA)
AlchemyEventSystem.markEventIgnore(event, Result.DENY);
}
}
示例14: cancelPopulations
import net.minecraftforge.event.terraingen.PopulateChunkEvent; //導入依賴的package包/類
@SubscribeEvent
public void cancelPopulations(PopulateChunkEvent.Populate event) {
if (!genOnWorld(event.world)) return;
final EventType type = event.type;
if (type == LAKE || type == LAVA || type == ANIMALS || type == CUSTOM) {
if (cancel(event.world, event.chunkX, event.chunkZ)) {
event.setResult(Result.DENY);
}
}
}
示例15: 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);
}
}