本文整理汇总了Java中net.minecraftforge.event.terraingen.DecorateBiomeEvent类的典型用法代码示例。如果您正苦于以下问题:Java DecorateBiomeEvent类的具体用法?Java DecorateBiomeEvent怎么用?Java DecorateBiomeEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DecorateBiomeEvent类属于net.minecraftforge.event.terraingen包,在下文中一共展示了DecorateBiomeEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decorate
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOWEST)
public void decorate(DecorateBiomeEvent.Decorate event) {
World world = event.getWorld();
Biome biome = world.getBiomeGenForCoords(event.getPos());
Random rand = event.getRand();
if ((biome == Biomes.PLAINS || biome == Biomes.ICE_PLAINS || biome == Biomes.MUTATED_PLAINS || biome == Biomes.EXTREME_HILLS_WITH_TREES || biome == Biomes.MUTATED_EXTREME_HILLS_WITH_TREES) && event.getType() == DecorateBiomeEvent.Decorate.EventType.TREE) {
if (rand.nextDouble() > 0.1) return;
int x = rand.nextInt(16) + 8;
int y = rand.nextInt(16) + 8;
TintedTreeGenerator gen = new TintedTreeGenerator();
gen.generateTree(rand, world, world.getHeight(event.getPos().add(x, 0, y)));
event.setResult(Event.Result.DENY);
}
}
示例2: onWorldDecoration
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onWorldDecoration(DecorateBiomeEvent.Decorate event)
{
if ((event.getResult() == Result.ALLOW || event.getResult() == Result.DEFAULT) && event.type == EventType.FLOWERS)
{
for(int i = 0; i < 2; i++)
{
int x = event.chunkX + event.rand.nextInt(16) + 8;
int z = event.chunkZ + event.rand.nextInt(16) + 8;
int y = event.world.getTopSolidOrLiquidBlock(x, z);
if(event.world.isAirBlock(x, y, z) && Blocks.flower_pot.canBlockStay(event.world, x, y, z) && ConfigPrimitiveCraft.genrocks)
{
event.world.setBlock(x, y, z, ModBlocks.rock);
}
else if(event.world.getBlock(x, y, z) == Blocks.water && ConfigPrimitiveCraft.genshale)
{
event.world.setBlock(x, y-1, z, ModBlocks.shale);
}
}
}
}
示例3: decorate
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入依赖的package包/类
@SubscribeEvent
public boolean decorate(DecorateBiomeEvent.Decorate evt) {
if (evt.type == DecorateBiomeEvent.Decorate.EventType.TREE) {
int chunkX = evt.chunkX;
int chunkZ = evt.chunkZ;
BiomeGenBase biome = evt.world.getBiomeGenForCoords(chunkX, chunkZ);
int dimensionId = evt.world.provider.dimensionId;
if (!KTreeCfg.isValidDimension(dimensionId)) {
return true;
}
return KTreeDecorate.decorate(evt.world, evt.rand, chunkX, chunkZ,
biome);
}
return false;
}
示例4: onBiomeDecoration
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入依赖的package包/类
@SubscribeEvent
public void onBiomeDecoration(DecorateBiomeEvent.Decorate event)
{
if(ConfigValues.SPAWN_WORLD_CRATER)
{
if(event.getWorld().provider.getDimension() == 0)
{
int x = event.getPos().getX();
int z = event.getPos().getZ();
if(Math.sqrt((x*x) + (z*z)) < 378)
{
event.setResult(Event.Result.DENY);
}
}
}
}
示例5: onBiomeDecoration
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onBiomeDecoration(DecorateBiomeEvent.Decorate event)
{
if (event.type == DecorateBiomeEvent.Decorate.EventType.FLOWERS && (event.getResult() == Event.Result.ALLOW || event.getResult() == Event.Result.DEFAULT))
{
for (int i = 0; i < Settings.FLOWER_QUANTITY; i++)
{
int x = event.chunkX + event.rand.nextInt(16) + 8;
int z = event.chunkZ + event.rand.nextInt(16) + 8;
int y = event.world.getTopSolidOrLiquidBlock(x, z);
Block randomPlant = ModBlocks.plants[event.rand.nextInt(ModBlocks.plants.length)];
if (event.world.isAirBlock(x, y, z) && (!event.world.provider.hasNoSky || y < 255) && randomPlant.canBlockStay(event.world, x, y, z))
{
event.world.setBlock(x, y, z, randomPlant, 0, 2);
}
}
}
}
示例6: onWorldDecoration
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onWorldDecoration(DecorateBiomeEvent.Decorate event) {
BiomeGenBase biome = event.world.getBiomeGenForCoords(event.chunkX, event.chunkZ);
if (biome != null && isValidBiomeType(biome)) {
if ((event.getResult() == Event.Result.ALLOW || event.getResult() == Event.Result.DEFAULT) && event.type == DecorateBiomeEvent.Decorate.EventType.FLOWERS) {
for (int i = 0; i < ModLibs.manaFlowerQuantity; i++) {
int x = event.chunkX + event.rand.nextInt(16) + 8;
int z = event.chunkZ + event.rand.nextInt(16) + 8;
int y = event.world.getTopSolidOrLiquidBlock(x, z);
for (int j = 0; j < ModLibs.manaFlowerDensity; j++) {
int x1 = x + event.rand.nextInt(8) - event.rand.nextInt(8);
int y1 = y + event.rand.nextInt(4) - event.rand.nextInt(4);
int z1 = z + event.rand.nextInt(8) - event.rand.nextInt(8);
if (event.world.isAirBlock(x1, y1, z1) && (!event.world.provider.hasNoSky || y1 < 127) && ModBlocks.manaFlower.canBlockStay(event.world, x1, y1, z1))
event.world.setBlock(x1, y1, z1, ModBlocks.manaFlower, event.rand.nextInt(3), 2);
}
}
}
}
}
示例7: decorate
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入依赖的package包/类
/**
* The method that does the work of actually decorating chunks
*/
protected void decorate()
{
super.decorate();
MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(currentWorld, randomGenerator, chunk_X, chunk_Z));
int i;
int j;
int k;
for (int n = 0; n < 5; n++)
{
i = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
j = 32;
k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
while(currentWorld.getBlockId(i, j, k) != AquatanBlocks.aquatanWater.blockID && currentWorld.getBlockId(i, j, k) != AquatanBlocks.aquatanFlowingWater.blockID)
{
j++;
}
this.kelpForest.generate(currentWorld, randomGenerator, i, j, k);
}
MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(currentWorld, randomGenerator, chunk_X, chunk_Z));
}
示例8: decorate
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入依赖的package包/类
/**
* The method that does the work of actually decorating chunks
*/
protected void decorate()
{
MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(currentWorld, randomGenerator, chunk_X, chunk_Z));
int i;
int j;
int k;
if (this.randomGenerator.nextInt(5) == 0)
{
i = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
j = this.currentWorld.getTopSolidOrLiquidBlock(i, k);
this.deadTrees.generate(currentWorld, randomGenerator, i, j, k);
}
MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(currentWorld, randomGenerator, chunk_X, chunk_Z));
}
示例9: decorate
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入依赖的package包/类
/**
* The method that does the work of actually decorating chunks
*/
protected void decorate()
{
MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(currentWorld, randomGenerator, chunk_X, chunk_Z));
int i;
int j;
int k;
if (randomGenerator.nextInt(5) == 0)
{
i = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
j = currentWorld.getTopSolidOrLiquidBlock(i, k);
this.mushroomsBigGen.generate(currentWorld, randomGenerator, i, j, k);
}
else
{
i = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
j = currentWorld.getTopSolidOrLiquidBlock(i, k);
this.mushroomsGen.generate(currentWorld, randomGenerator, i, j, k);
}
MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(currentWorld, randomGenerator, chunk_X, chunk_Z));
}
示例10: genDecorations
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入依赖的package包/类
@Override
protected void genDecorations(BiomeGenBase biome) {
MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(currentWorld, randomGenerator, chunk_X, chunk_Z));
//TODO will need to update most, if not all, randomly-generated coordinates once I make the new terrain gen
int i; //the for-loop iterator (counter); declared here for re-usability on subsequent world-gen loops
int x; //the randomly-generated x-Coord; declared here for re-usability on subsequent world-gen loops
int y; //the randomly-generated y-Coord; declared here for re-usability on subsequent world-gen loops
int z; //the randomly-generated z-Coord; declared here for re-usability on subsequent world-gen loops
//the event firing is here just for completeness though it may never be used
boolean doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, CUSTOM);
for (i = 0; doGen && i < wightBulbPerChunk; ++i)
{
x = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
y = this.randomGenerator.nextInt(128);
z = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
this.wightBulbGen.generate(this.currentWorld, this.randomGenerator, x, y, z);
}
MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(currentWorld, randomGenerator, chunk_X, chunk_Z));
}
示例11: genDecorations
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入依赖的package包/类
@Override
protected void genDecorations(BiomeGenBase biome)
{
MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(this.currentWorld, this.randomGenerator, this.chunk_X, this.chunk_Z));
MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(this.currentWorld, this.randomGenerator, this.chunk_X, this.chunk_Z));
}
示例12: generateFruitTree
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入依赖的package包/类
@SubscribeEvent
public void generateFruitTree(DecorateBiomeEvent.Decorate event) {
if (event.getType() == DecorateBiomeEvent.Decorate.EventType.TREE) {
BaseTreeGenerator[] generatorBasicTrees = generatorTreeMap.values().toArray(new BaseTreeGenerator[0]);
BaseTreeGenerator generator = generatorBasicTrees[MathHelper.getInt(event.getRand(),0, generatorBasicTrees.length - 1)];
if (generator.generate(event.getWorld(), event.getRand(), event.getPos())) {
FoodCraftReloaded.getLogger().info("Generated fruit tree at " + event.getPos());
event.setResult(Event.Result.DENY);
}
}
}
示例13: decorateBiome
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入依赖的package包/类
/** Alters vanilla chunk decorating. */
@SubscribeEvent
public void decorateBiome(DecorateBiomeEvent.Decorate event) {
// Cancel vanilla pumpkin and melon generation
if (event.getType() == DecorateBiomeEvent.Decorate.EventType.PUMPKIN) {
event.setResult(Result.DENY);
}
}
示例14: genDecorations
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入依赖的package包/类
protected void genDecorations(BiomeGenBase biomes) {
super.genDecorations(biomes);
if (this.randomGenerator.nextInt(8) == 0) {
int x = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
int y = 100;
int z = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
new WorldGenTreasure().generate(this.currentWorld, this.randomGenerator, x, y, z);
}
MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(this.currentWorld, this.randomGenerator, this.chunk_X, this.chunk_Z));
}
示例15: onDecorateBiome
import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入依赖的package包/类
@SubscribeEvent
public void onDecorateBiome(DecorateBiomeEvent.Decorate event)
{
if (Configs.get(event.getWorld()).decorationIsDisabled(event.getType()))
{
event.setResult(Event.Result.DENY);
}
}