当前位置: 首页>>代码示例>>Java>>正文


Java DecorateBiomeEvent类代码示例

本文整理汇总了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);
	}
}
 
开发者ID:yolp900,项目名称:ItsJustaCharm1.10.2Dead,代码行数:19,代码来源:EventTintedTreeGenerator.java

示例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);
			}
		}
	}
}
 
开发者ID:gigabit101,项目名称:PrimitiveCraft,代码行数:23,代码来源:WorldGenStones.java

示例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;
}
 
开发者ID:vidaj,项目名称:BigTrees,代码行数:19,代码来源:BigTrees.java

示例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);
            }
        }
    }
}
 
开发者ID:Lumaceon,项目名称:ClockworkPhase2,代码行数:17,代码来源:WorldGenHandler.java

示例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);
            }
        }
    }
}
 
开发者ID:Dynious,项目名称:Biota,代码行数:20,代码来源:TerrainEventHandler.java

示例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);
                }
            }
        }
    }
}
 
开发者ID:Lomeli12,项目名称:MagicalRings,代码行数:23,代码来源:BiomeDecorHandler.java

示例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));
}
 
开发者ID:Hologuardian,项目名称:Sojourn,代码行数:29,代码来源:AquatanBiomeDecorator.java

示例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));
}
 
开发者ID:Hologuardian,项目名称:Sojourn,代码行数:22,代码来源:MoltarBiomeDecorator.java

示例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));
}
 
开发者ID:Hologuardian,项目名称:Sojourn,代码行数:29,代码来源:FungalMarshBiomeDecorator.java

示例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));
}
 
开发者ID:Aurilux,项目名称:Xth-uoth,代码行数:23,代码来源:BiomeDecoratorXthuoth.java

示例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));
}
 
开发者ID:BlesseNtumble,项目名称:TRAPPIST-1,代码行数:8,代码来源:TPBiomeDecorator.java

示例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);
        }
    }
}
 
开发者ID:LasmGratel,项目名称:FoodCraft-Reloaded,代码行数:12,代码来源:FruitTreeGenerator.java

示例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);
    }
}
 
开发者ID:JayAvery,项目名称:geomastery,代码行数:11,代码来源:WorldGenerator.java

示例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));
}
 
开发者ID:kormic911,项目名称:EvilOcean,代码行数:13,代码来源:BiomeDecoratorOcean.java

示例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);
    }
}
 
开发者ID:maruohon,项目名称:orecontrol,代码行数:9,代码来源:OreControlEventHandler.java


注:本文中的net.minecraftforge.event.terraingen.DecorateBiomeEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。