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


Java DecorateBiomeEvent.Decorate方法代码示例

本文整理汇总了Java中net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate方法的典型用法代码示例。如果您正苦于以下问题:Java DecorateBiomeEvent.Decorate方法的具体用法?Java DecorateBiomeEvent.Decorate怎么用?Java DecorateBiomeEvent.Decorate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.event.terraingen.DecorateBiomeEvent的用法示例。


在下文中一共展示了DecorateBiomeEvent.Decorate方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

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

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

示例10: onWorldDecoration

import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOW)
public void onWorldDecoration(final DecorateBiomeEvent.Decorate event) {

	if (isGenerationAllowed(event)) {

		// Calculate the range and scaling based on
		// the world sea level. Normal sea level is assumed
		// to be 64, which is the Overworld sea level.
		final int groundLevel = event.world.provider.getAverageGroundLevel();
		final int attempts = (int) (ModOptions.getRubblePileDensity() * ((float) groundLevel / 64F));
		final int maxY = groundLevel - 4;
		final int spread = maxY - MIN_Y;

		// In case someone does something real funky with a
		// dimension.
		if (spread < 1 || attempts < 1)
			return;

		// Use our random routine, but seed with the provided
		// Random. The provided Random seed is deterministic
		// where map gen is concerned.
		final XorShiftRandom random = new XorShiftRandom(event.rand);

		for (int i = 0; i < attempts; i++) {

			final int x = event.chunkX + random.nextInt(16) + 8;
			final int z = event.chunkZ + random.nextInt(16) + 8;
			int y = random.nextInt(spread) + MIN_Y;

			for (int j = 0; j < PLACE_ATTEMPTS; j++) {
				if (event.world.isAirBlock(x, y, z)
						&& BlockManager.pileOfRubble.canBlockStay(event.world, x, y, z)) {
					event.world.setBlock(x, y, z, BlockManager.pileOfRubble);
					break;
				}
				y--;
			}
		}
	}
}
 
开发者ID:OreCruncher,项目名称:ThermalRecycling,代码行数:41,代码来源:BiomeDecorationHandler.java

示例11: preventDoubleDecor

import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void preventDoubleDecor(final DecorateBiomeEvent.Decorate decor) {
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:4,代码来源:EventHandlerUnderdark.java

示例12: onDecorateBiome_Decorate

import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.TOP)
public static void onDecorateBiome_Decorate(DecorateBiomeEvent.Decorate event) {
	if (event.getWorld().getBiome(event.getPos()) instanceof AlchemyBiome)
		AlchemyEventSystem.markEventIgnore(event, Result.DENY);
}
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:6,代码来源:AlchemyBiome.java

示例13: isGenerationAllowed

import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入方法依赖的package包/类
private static boolean isGenerationAllowed(final DecorateBiomeEvent.Decorate event) {
	return (event.getResult() == Result.ALLOW || event.getResult() == Result.DEFAULT)
			&& event.type == EventType.FLOWERS && isGenAllowedInDimension(event.world.provider.dimensionId);
}
 
开发者ID:OreCruncher,项目名称:ThermalRecycling,代码行数:5,代码来源:BiomeDecorationHandler.java

示例14: onDecorateBiome

import net.minecraftforge.event.terraingen.DecorateBiomeEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onDecorateBiome(DecorateBiomeEvent.Decorate ev)
{
    if (ev.getType() == DecorateBiomeEvent.Decorate.EventType.TREE)
    {

        BiomeGenBase gen = ev.getWorld().getBiomeGenForCoords(ev.getPos());
        BiomeDecorator decorator = gen.theBiomeDecorator;
        int i = decorator.treesPerChunk;

        if (ev.getRand().nextInt(10) == 0)
        {
            ++i;
        }


        TreeGeneratorBase treeGen = null;
        if (gen instanceof BiomeGenForest)
        {
            if (gen.getBiomeName().equals("Roofed Forest"))
                treeGen = generatorDarkOak;
            else
                treeGen = generatorOak.combineWith(generatorBirch, 0.1f);
        }
        else if (gen instanceof BiomeGenJungle)
        {
            treeGen = generatorJungle;
        }
        else if (gen instanceof BiomeGenPlains)
        {
            treeGen = generatorOak;
        }
        else if (gen instanceof BiomeGenSavanna)
        {
            treeGen = generatorAcacia;
        }
        else if (gen instanceof BiomeGenSnow)
        {
            treeGen = generatorOak;
        }
        else if (gen instanceof BiomeGenSwamp)
        {
            treeGen = generatorOak;
        }
        else if (gen instanceof BiomeGenTaiga)
        {
            treeGen = generatorSpruce;
        }

        if (treeGen != null)
        {
            ev.setResult(Event.Result.DENY);


            for (int j = 0; j < i; ++j)
            {
                int k = ev.getRand().nextInt(16) + 8;
                int l = ev.getRand().nextInt(16) + 8;

                BlockPos blockpos = ev.getWorld().getHeight(ev.getPos().add(k, 0, l));

                treeGen.generateTreeAt(ev.getWorld(), blockpos, ev.getRand());
            }
        }
    }
}
 
开发者ID:gigaherz,项目名称:NaturalTrees,代码行数:67,代码来源:NaturalTrees.java


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