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


Java World.getBiome方法代码示例

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


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

示例1: updateTick

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
    super.updateTick(worldIn, pos, state, rand);
    if (!worldIn.isRemote) {
        if (state.getValue(AGE) == 2) {
            EntityFaerie faerie = new EntityFaerie(worldIn, 4.0D, 0, 0.1F, 1);
            faerie.setPosition((double) pos.getX(), (double) pos.up().getY(), (double) pos.getZ());
            worldIn.spawnEntity(faerie);
        }
        if (!(worldIn.getBiome(pos) == Biomes.FOREST ||
                worldIn.getBiome(pos) == Biomes.FOREST_HILLS ||
                worldIn.getBiome(pos) == Biomes.TAIGA ||
                worldIn.getBiome(pos) == Biomes.TAIGA_HILLS) && state.getValue(AGE) >= 1) {
            worldIn.setBlockState(pos, state.withProperty(AGE, 0));
        }
    }

}
 
开发者ID:BenjaminSutter,项目名称:genera,代码行数:19,代码来源:BlockNightshadeCrop.java

示例2: generate

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
		IChunkProvider chunkProvider) {
	if (random.nextInt(20) == 0){
		int x = chunkX * 16 + 2 + random.nextInt(12);
		int z = chunkZ * 16 + 2 + random.nextInt(12);
		BlockPos p = new BlockPos(x,0,z);
		p = world.getHeight(p);
		Biome b = world.getBiome(p);
		if (BiomeDictionary.hasType(b, BiomeDictionary.Type.FOREST) || b == Biomes.FOREST || b == Biomes.FOREST_HILLS){
			if (world.getBlockState(p.down()).getBlock() instanceof BlockGrass && world.isAirBlock(p)){
				BlockTeaSapling.generateTree(world, p, Blocks.AIR.getDefaultState(), random);
			}
		}
	}
}
 
开发者ID:elucent,项目名称:SimplyTea,代码行数:17,代码来源:SimplyTea.java

示例3: generate

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void generate (Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    int x = chunkX * 16 + 8;
    int z = chunkZ * 16 + 8;

    Biome biome = world.getBiome(new BlockPos(x, 0, z));
    if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.COLD ))
    if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.COLD)
        || BiomeDictionary.hasType(biome, BiomeDictionary.Type.NETHER)
        || BiomeDictionary.hasType(biome, BiomeDictionary.Type.WET)
        || BiomeDictionary.hasType(biome, BiomeDictionary.Type.WASTELAND)
        || BiomeDictionary.hasType(biome, BiomeDictionary.Type.SNOWY))
        return;

    if (!BiomeDictionary.hasType(biome, BiomeDictionary.Type.SANDY))
        return;

    if (random.nextInt(15) > 0)
        return;

    generate(world, random, new BlockPos(x, world.getSeaLevel(), z));
}
 
开发者ID:jaquadro,项目名称:GardenStuff,代码行数:23,代码来源:WorldGenCandelilla.java

示例4: invoke

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
    if (method.equals(this.abstractGetColorAtPos)) {
        Biome biome = (Biome)args[0];
        BlockPos pos = (BlockPos)args[1];

        World world = Minecraft.getMinecraft().world;

        if (world != null && GeneralUtil.isWorldATG(world)) {
            // probe the current world biomes to eliminate most cases of it being the wrong one (I hope)
            Biome probe = world.getBiome(pos);
            if (probe == biome) {
                return getGrassColour(world, biome, pos);
            }
        }

        if (wrappedResolver != null) {
            return wrappedGetColorAtPos.invoke(this.wrappedResolver, biome, pos);
        }

        return 0xFF00FF;
    }
    return method.invoke(this.wrappedResolver, args);
}
 
开发者ID:stuebz88,项目名称:modName,代码行数:25,代码来源:GrassColours.java

示例5: getNeighborCities

import net.minecraft.world.World; //导入方法依赖的package包/类
public Chunk[] getNeighborCities(World world, int chunkX, int chunkZ) {
	ArrayList<Chunk> neighborCities = new ArrayList<Chunk>();
	Chunk[] neighbors = new Chunk[] {
		world.getChunkProvider().getLoadedChunk(chunkX + 1, chunkZ),
		world.getChunkProvider().getLoadedChunk(chunkX + 2, chunkZ),
		world.getChunkProvider().getLoadedChunk(chunkX - 1, chunkZ),
		world.getChunkProvider().getLoadedChunk(chunkX - 2, chunkZ),
		world.getChunkProvider().getLoadedChunk(chunkX, chunkZ + 1),
		world.getChunkProvider().getLoadedChunk(chunkX, chunkZ + 2),
		world.getChunkProvider().getLoadedChunk(chunkX, chunkZ - 1),
		world.getChunkProvider().getLoadedChunk(chunkX, chunkZ - 2),
		world.getChunkProvider().getLoadedChunk(chunkX + 1, chunkZ + 1),
		world.getChunkProvider().getLoadedChunk(chunkX + 2, chunkZ + 2),
		world.getChunkProvider().getLoadedChunk(chunkX - 1, chunkZ - 1),
		world.getChunkProvider().getLoadedChunk(chunkX - 2, chunkZ - 2),
		world.getChunkProvider().getLoadedChunk(chunkX + 1, chunkZ - 1),
		world.getChunkProvider().getLoadedChunk(chunkX + 2, chunkZ - 2),
		world.getChunkProvider().getLoadedChunk(chunkX - 1, chunkZ + 1),
		world.getChunkProvider().getLoadedChunk(chunkX - 2, chunkZ + 2),
	};
	
	for (Chunk neighbor : neighbors) {
		if (neighbor == null)
			continue;
		
		Biome biome = world.getBiome(new BlockPos(neighbor.xPosition * 16 + 8, 128, neighbor.zPosition * 16 + 8));
		if (biome == RezolveMod.CITY_BIOME)
			neighborCities.add(neighbor);
	}
	
	return neighborCities.toArray(new Chunk[neighborCities.size()]);
}
 
开发者ID:astronautlabs,项目名称:rezolve,代码行数:33,代码来源:CityGenerator.java

示例6: isLevelAcceptable

import net.minecraft.world.World; //导入方法依赖的package包/类
public static boolean isLevelAcceptable(World world, BlockPos pos, EntityPlayer player)
{
	return !(world.getBiome(pos) instanceof BasePontusResourceBiome) || 
			((BasePontusResourceBiome) world.getBiome(pos)).getLevel() <= 0 ||
			((BasePontusResourceBiome)world.getBiome(pos)).getLevel() <= HandlerPontusAllowed.getAllowed(player);
	
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:8,代码来源:HarshenUtils.java

示例7: canSnowAt

import net.minecraft.world.World; //导入方法依赖的package包/类
public boolean canSnowAt(World world, BlockPos pos, boolean checkLight) {
    Biome biome = world.getBiome(pos);
    float f = this.getFloatTemperature(biome, pos);

    if (f > 0.15F)
    {
        return false;
    }
    else if (!checkLight)
    {
        return true;
    }
    else
    {
        if (pos.getY() >= 0 && pos.getY() < 256 && world.getLightFor(EnumSkyBlock.BLOCK, pos) < 10)
        {
            IBlockState iblockstate = world.getBlockState(pos);

            if (iblockstate.getBlock().isAir(iblockstate, world, pos) && Blocks.SNOW_LAYER.canPlaceBlockAt(world, pos))
            {
                return true;
            }
        }

        return false;
    }
}
 
开发者ID:stuebz88,项目名称:modName,代码行数:28,代码来源:ChunkProviderBasic.java

示例8: entityLoaded

import net.minecraft.world.World; //导入方法依赖的package包/类
public static void entityLoaded(Entity p_entityLoaded_0_, World p_entityLoaded_1_)
{
    if (p_entityLoaded_0_ instanceof EntityLiving)
    {
        if (p_entityLoaded_1_ != null)
        {
            EntityLiving entityliving = (EntityLiving)p_entityLoaded_0_;
            entityliving.spawnPosition = entityliving.getPosition();
            entityliving.spawnBiome = p_entityLoaded_1_.getBiome(entityliving.spawnPosition);
            WorldServer worldserver = Config.getWorldServer();

            if (worldserver != null)
            {
                Entity entity = worldserver.getEntityByID(p_entityLoaded_0_.getEntityId());

                if (entity instanceof EntityLiving)
                {
                    EntityLiving entityliving1 = (EntityLiving)entity;
                    UUID uuid = entityliving1.getUniqueID();
                    long i = uuid.getLeastSignificantBits();
                    int j = (int)(i & 2147483647L);
                    entityliving.randomMobsId = j;
                }
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:28,代码来源:RandomMobs.java

示例9: getTemperatureAt

import net.minecraft.world.World; //导入方法依赖的package包/类
public static float getTemperatureAt(World w, BlockPos pos)
{
	float tempBase = IExPWorld.of(w).getOverhaulTemperature();
	Biome b = w.getBiome(pos);
	if (b instanceof IBiome)
	{
		tempBase *= ((IBiome)b).getTemperatureMultiplier();
		tempBase += ((IBiome)b).getTemperatureBaseModifier();
	}
	return tempBase;
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:12,代码来源:Helpers.java

示例10: generate

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
	if (world.provider.getDimension() == 0) {

		WorldGenAbstractTree apple = new WorldGenApple(false);
		WorldGenAbstractTree maple = new WorldGenMaple(false);
		WorldGenAbstractTree ebony = new WorldGenEbony(false);
		WorldGenAbstractTree fir = new WorldGenFir(false);
		WorldGenAbstractTree pine = new WorldGenPine(false);
		WorldGenAbstractTree willow = new WorldGenWillow();
		WorldGenAbstractTree yew = new WorldGenYew();

		// get the biome
		Biome biome = world.getBiome(new BlockPos(chunkX * 16, 64, chunkZ * 16));

		if (biome instanceof BiomeDesert) {
			makeTree(ebony, chunkX, chunkZ, random, world, 0, 1);
		}

		if (biome instanceof BiomeForest || biome instanceof BiomeForestMutated) {
			if (random.nextInt(4) == 0) {
				makeTree(maple, chunkX, chunkZ, random, world, 0, 3);
			}

			if (random.nextInt(12) == 0) {
				makeTree(apple, chunkX, chunkZ, random, world, 1, 2);
			}

			makeTree(pine, chunkX, chunkZ, random, world, 0, 3);
		}

		if (biome instanceof BiomeHills) {
			makeTree(maple, chunkX, chunkZ, random, world, 0, 3);
			makeTree(fir, chunkX, chunkZ, random, world, 0, 3);
		}

		if (biome instanceof BiomeMesa && random.nextBoolean()) {
			makeTree(ebony, chunkX, chunkZ, random, world, 1, 3);
		}

		if (biome instanceof BiomePlains) {
			makeTree(apple, chunkX, chunkZ, random, world, 0, 1);
		}

		if (biome instanceof BiomeRiver && random.nextInt(3) == 0) {
			makeTree(yew, chunkX, chunkZ, random, world, 0, 3);
		}

		if (biome instanceof BiomeSavanna) {
			makeTree(ebony, chunkX, chunkZ, random, world, 0, 3);
		}

		if (biome instanceof BiomeSwamp) {
			if (random.nextInt(2) == 0) {
				makeTree(willow, chunkX, chunkZ, random, world, 0, 3);
			}
			if (random.nextInt(1) == 0) {
				makeTree(yew, chunkX, chunkZ, random, world, 0, 3);
			}
		}

		if (biome instanceof BiomeTaiga) {
			makeTree(pine, chunkX, chunkZ, random, world, 0, 3);
			makeTree(fir, chunkX, chunkZ, random, world, 1, 4);
		}
		if (biome instanceof BiomeJungle) {
			makeTree(rubber, chunkX, chunkZ, random, world, 0, 3);
		}
	}
}
 
开发者ID:MinecraftModDevelopmentMods,项目名称:Got-Wood,代码行数:71,代码来源:WorldGenerator.java

示例11: Start

import net.minecraft.world.World; //导入方法依赖的package包/类
public Start(World worldIn, Random random, int chunkX, int chunkZ)
{
    this(worldIn, random, chunkX, chunkZ, worldIn.getBiome(new BlockPos(chunkX * 16 + 8, 0, chunkZ * 16 + 8)));
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:MapGenScatteredFeature.java

示例12: onBlockActivated

import net.minecraft.world.World; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing heldItem, float side, float hitX, float hitY)
{
    if (worldIn.isRemote)
    {
        return true;
    }
    else
    {
        if (state.getValue(PART) != BlockBed.EnumPartType.HEAD)
        {
            pos = pos.offset((EnumFacing)state.getValue(FACING));
            state = worldIn.getBlockState(pos);

            if (state.getBlock() != this)
            {
                return true;
            }
        }

        if (worldIn.provider.canRespawnHere() && worldIn.getBiome(pos) != Biomes.HELL)
        {
            if (((Boolean)state.getValue(OCCUPIED)).booleanValue())
            {
                EntityPlayer entityplayer = this.getPlayerInBed(worldIn, pos);

                if (entityplayer != null)
                {
                    playerIn.addChatComponentMessage(new TextComponentTranslation("tile.bed.occupied", new Object[0]), true);
                    return true;
                }

                state = state.withProperty(OCCUPIED, Boolean.valueOf(false));
                worldIn.setBlockState(pos, state, 4);
            }

            EntityPlayer.SleepResult entityplayer$sleepresult = playerIn.trySleep(pos);

            if (entityplayer$sleepresult == EntityPlayer.SleepResult.OK)
            {
                state = state.withProperty(OCCUPIED, Boolean.valueOf(true));
                worldIn.setBlockState(pos, state, 4);
                return true;
            }
            else
            {
                if (entityplayer$sleepresult == EntityPlayer.SleepResult.NOT_POSSIBLE_NOW)
                {
                    playerIn.addChatComponentMessage(new TextComponentTranslation("tile.bed.noSleep", new Object[0]), true);
                }
                else if (entityplayer$sleepresult == EntityPlayer.SleepResult.NOT_SAFE)
                {
                    playerIn.addChatComponentMessage(new TextComponentTranslation("tile.bed.notSafe", new Object[0]), true);
                }
                else if (entityplayer$sleepresult == EntityPlayer.SleepResult.TOO_FAR_AWAY)
                {
                    playerIn.addChatComponentMessage(new TextComponentTranslation("tile.bed.tooFarAway", new Object[0]), true);
                }

                return true;
            }
        }
        else
        {
            worldIn.setBlockToAir(pos);
            BlockPos blockpos = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite());

            if (worldIn.getBlockState(blockpos).getBlock() == this)
            {
                worldIn.setBlockToAir(blockpos);
            }

            worldIn.newExplosion((Entity)null, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 5.0F, true, true);
            return true;
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:77,代码来源:BlockBed.java

示例13: getSkyBlendColour

import net.minecraft.world.World; //导入方法依赖的package包/类
public static int getSkyBlendColour(World world, BlockPos center)
{
    if (center.getX() == skyX && center.getZ() == skyZ && skyInit)
    {
        return skyRGBMultiplier;
    }
    skyInit = true;

    GameSettings settings = Minecraft.getMinecraft().gameSettings;
    int[] ranges = ForgeModContainer.blendRanges;
    int distance = 0;
    if (settings.fancyGraphics && settings.renderDistanceChunks >= 0 && settings.renderDistanceChunks < ranges.length)
    {
        distance = ranges[settings.renderDistanceChunks];
    }

    int r = 0;
    int g = 0;
    int b = 0;

    int divider = 0;
    for (int x = -distance; x <= distance; ++x)
    {
        for (int z = -distance; z <= distance; ++z)
        {
            BlockPos pos = center.add(x, 0, z);
            Biome biome = world.getBiome(pos);
            int colour = biome.getSkyColorByTemp(biome.getFloatTemperature(pos));
            r += (colour & 0xFF0000) >> 16;
            g += (colour & 0x00FF00) >> 8;
            b += colour & 0x0000FF;
            divider++;
        }
    }

    int multiplier = (r / divider & 255) << 16 | (g / divider & 255) << 8 | b / divider & 255;

    skyX = center.getX();
    skyZ = center.getZ();
    skyRGBMultiplier = multiplier;
    return skyRGBMultiplier;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:43,代码来源:ForgeHooksClient.java

示例14: onBlockActivated

import net.minecraft.world.World; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
{
    if (worldIn.isRemote)
    {
        return true;
    }
    else
    {
        if (state.getValue(PART) != BlockBed.EnumPartType.HEAD)
        {
            pos = pos.offset((EnumFacing)state.getValue(FACING));
            state = worldIn.getBlockState(pos);

            if (state.getBlock() != this)
            {
                return true;
            }
        }

        if (worldIn.provider.canRespawnHere() && worldIn.getBiome(pos) != Biomes.HELL)
        {
            if (((Boolean)state.getValue(OCCUPIED)).booleanValue())
            {
                EntityPlayer entityplayer = this.getPlayerInBed(worldIn, pos);

                if (entityplayer != null)
                {
                    playerIn.addChatComponentMessage(new TextComponentTranslation("tile.bed.occupied", new Object[0]));
                    return true;
                }

                state = state.withProperty(OCCUPIED, Boolean.valueOf(false));
                worldIn.setBlockState(pos, state, 4);
            }

            EntityPlayer.SleepResult entityplayer$sleepresult = playerIn.trySleep(pos);

            if (entityplayer$sleepresult == EntityPlayer.SleepResult.OK)
            {
                state = state.withProperty(OCCUPIED, Boolean.valueOf(true));
                worldIn.setBlockState(pos, state, 4);
                return true;
            }
            else
            {
                if (entityplayer$sleepresult == EntityPlayer.SleepResult.NOT_POSSIBLE_NOW)
                {
                    playerIn.addChatComponentMessage(new TextComponentTranslation("tile.bed.noSleep", new Object[0]));
                }
                else if (entityplayer$sleepresult == EntityPlayer.SleepResult.NOT_SAFE)
                {
                    playerIn.addChatComponentMessage(new TextComponentTranslation("tile.bed.notSafe", new Object[0]));
                }

                return true;
            }
        }
        else
        {
            worldIn.setBlockToAir(pos);
            BlockPos blockpos = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite());

            if (worldIn.getBlockState(blockpos).getBlock() == this)
            {
                worldIn.setBlockToAir(blockpos);
            }

            worldIn.newExplosion((Entity)null, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 5.0F, true, true);
            return true;
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:73,代码来源:BlockBed.java


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