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


Java World.getHeight方法代码示例

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


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

示例1: genDecorations

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
protected void genDecorations(Biome biomeIn, World worldIn, Random random) {
	 			 	
	 	int k1 = this.treesPerChunk;
        if (random.nextFloat() < this.extraTreeChance)
        {
            ++k1;
        }

        if(net.minecraftforge.event.terraingen.TerrainGen.decorate(worldIn, random, chunkPos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.TREE))
        for (int j2 = 0; j2 < k1; ++j2)
        {
            int k6 = random.nextInt(16) + 8;
            int l = random.nextInt(16) + 8;
            WorldGenAbstractTree worldgenabstracttree = biomeIn.getRandomTreeFeature(random);
            worldgenabstracttree.setDecorationDefaults();
            BlockPos blockpos = worldIn.getHeight(this.chunkPos.add(k6, 0, l));

            if (worldgenabstracttree.generate(worldIn, random, blockpos))
            {
                worldgenabstracttree.generateSaplings(worldIn, random, blockpos);
            }
        }
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:25,代码来源:PontusBiomeDecorator.java

示例2: seaweedPassGenerate

import net.minecraft.world.World; //导入方法依赖的package包/类
public void seaweedPassGenerate(World worldIn, Random rand, Biome biome, BlockPos pos)
{
	if (!(biome instanceof IBiome) || !((IBiome)biome).isWaterSalt())
	{
		return;
	}
	
	int x = rand.nextInt(16) + 8;
	int z = rand.nextInt(16) + 8;
	BlockPos at = worldIn.getHeight(pos.add(x, 0, z));
	EventGenVegetation event = new EventGenVegetation(worldIn, at, rand, genSeaweed, Type.SEAWEED);
	if (MinecraftForge.TERRAIN_GEN_BUS.post(event))
	{
		return;
	}
	
	event.generator.generate(worldIn, rand, at);
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:19,代码来源:ExPBiomeDecorator.java

示例3: cropsPassGenerate

import net.minecraft.world.World; //导入方法依赖的package包/类
public void cropsPassGenerate(World worldIn, Random rand, Biome biome, BlockPos pos)
{
	if (!(biome instanceof ExPBiome))
	{
		return;
	}
	
	int x = rand.nextInt(16) + 8;
	int z = rand.nextInt(16) + 8;
	BlockPos at = worldIn.getHeight(pos.add(x, 0, z));
	
	WorldGenerator cropsGen = new CropGenerator((ExPBiome) biome);
	EventGenVegetation event = new EventGenVegetation(worldIn, at, rand, cropsGen, Type.WILD_CROP);
	if (MinecraftForge.TERRAIN_GEN_BUS.post(event))
	{
		return;
	}
	
	event.generator.generate(worldIn, rand, at);
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:21,代码来源:ExPBiomeDecorator.java

示例4: renderRegion

import net.minecraft.world.World; //导入方法依赖的package包/类
public static void renderRegion(World world, CoordXZ coord)
{
    if (!enabled) return;

    int y = (world != null) ? world.getHeight() : 255;
    int x = CoordXZ.regionToBlock(coord.x);
    int z = CoordXZ.regionToBlock(coord.z);
    Gateway.api.triggerRenderOfVolume(Worlds.getWorldName(world), x, 0, z, x + 511, y, z + 511);
}
 
开发者ID:abused,项目名称:World-Border,代码行数:10,代码来源:DynMapFeatures.java

示例5: decorate

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void decorate(World worldIn, Random rand, BlockPos pos) {
    int boulders = rand.nextInt(3)-1;

    for (int i = 0; i < boulders; i++) {
        int x = rand.nextInt(16) + 8;
        int z = rand.nextInt(16) + 8;
        BlockPos blockpos = worldIn.getHeight(pos.add(x, 0, z));
        ATGBiomes.Features.BOULDER_COBBLE.generate(worldIn, rand, blockpos);
    }

    super.decorate(worldIn, rand, pos);
}
 
开发者ID:stuebz88,项目名称:modName,代码行数:14,代码来源:BiomeTundra.java

示例6: render

import net.minecraft.world.World; //导入方法依赖的package包/类
public void render(float p_190060_1_, long p_190060_2_)
{
    EntityPlayer entityplayer = this.minecraft.player;
    World world = this.minecraft.world;
    double d0 = entityplayer.lastTickPosX + (entityplayer.posX - entityplayer.lastTickPosX) * (double)p_190060_1_;
    double d1 = entityplayer.lastTickPosY + (entityplayer.posY - entityplayer.lastTickPosY) * (double)p_190060_1_;
    double d2 = entityplayer.lastTickPosZ + (entityplayer.posZ - entityplayer.lastTickPosZ) * (double)p_190060_1_;
    GlStateManager.pushMatrix();
    GlStateManager.enableBlend();
    GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
    GlStateManager.disableTexture2D();
    BlockPos blockpos = new BlockPos(entityplayer.posX, 0.0D, entityplayer.posZ);
    Iterable<BlockPos> iterable = BlockPos.getAllInBox(blockpos.add(-40, 0, -40), blockpos.add(40, 0, 40));
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    vertexbuffer.begin(5, DefaultVertexFormats.POSITION_COLOR);

    for (BlockPos blockpos1 : iterable)
    {
        int i = world.getHeight(blockpos1.getX(), blockpos1.getZ());

        if (world.getBlockState(blockpos1.add(0, i, 0).down()) == Blocks.AIR.getDefaultState())
        {
            RenderGlobal.addChainedFilledBoxVertices(vertexbuffer, (double)((float)blockpos1.getX() + 0.25F) - d0, (double)i - d1, (double)((float)blockpos1.getZ() + 0.25F) - d2, (double)((float)blockpos1.getX() + 0.75F) - d0, (double)i + 0.09375D - d1, (double)((float)blockpos1.getZ() + 0.75F) - d2, 0.0F, 0.0F, 1.0F, 0.5F);
        }
        else
        {
            RenderGlobal.addChainedFilledBoxVertices(vertexbuffer, (double)((float)blockpos1.getX() + 0.25F) - d0, (double)i - d1, (double)((float)blockpos1.getZ() + 0.25F) - d2, (double)((float)blockpos1.getX() + 0.75F) - d0, (double)i + 0.09375D - d1, (double)((float)blockpos1.getZ() + 0.75F) - d2, 0.0F, 1.0F, 0.0F, 0.5F);
        }
    }

    tessellator.draw();
    GlStateManager.enableTexture2D();
    GlStateManager.popMatrix();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:36,代码来源:DebugRendererHeightMap.java

示例7: isAreaClear

import net.minecraft.world.World; //导入方法依赖的package包/类
private boolean isAreaClear(World worldIn, BlockPos position, int treeheight) {
	boolean flag = false;
	for (int j = position.getY(); j <= position.getY() + 1 + treeheight; ++j) {
		int k = 1;

		if (j == position.getY()) {
			k = 0;
		}

		if (j >= position.getY() + 1 + treeheight - 2) {
			k = 1;
		}

		BlockPos.MutableBlockPos blockposmutableblockpos = new BlockPos.MutableBlockPos();

		for (int l = position.getX() - k; l <= position.getX() + k && flag; ++l) {
			for (int i1 = position.getZ() - k; i1 <= position.getZ() + k && flag; ++i1) {
				if (j >= 0 && j < worldIn.getHeight()) {
					if (!this.isReplaceable(worldIn, blockposmutableblockpos.setPos(l, j, i1))) {
						return false;
					}
				} else {
					return false;
				}
			}
		}
	}
	return true;
}
 
开发者ID:MinecraftModDevelopmentMods,项目名称:Got-Wood,代码行数:30,代码来源:WorldGenMaple.java

示例8: decorate

import net.minecraft.world.World; //导入方法依赖的package包/类
public void decorate(World worldIn, Random rand, BlockPos pos)
{
    if ((this.type == BiomeTaiga.Type.MEGA || this.type == BiomeTaiga.Type.MEGA_SPRUCE) && net.minecraftforge.event.terraingen.TerrainGen.decorate(worldIn, rand, pos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.ROCK))
    {
        int i = rand.nextInt(3);

        for (int j = 0; j < i; ++j)
        {
            int k = rand.nextInt(16) + 8;
            int l = rand.nextInt(16) + 8;
            BlockPos blockpos = worldIn.getHeight(pos.add(k, 0, l));
            FOREST_ROCK_GENERATOR.generate(worldIn, rand, blockpos);
        }
    }

    DOUBLE_PLANT_GENERATOR.setPlantType(BlockDoublePlant.EnumPlantType.FERN);

    if(net.minecraftforge.event.terraingen.TerrainGen.decorate(worldIn, rand, pos, net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.FLOWERS))
    for (int i1 = 0; i1 < 7; ++i1)
    {
        int j1 = rand.nextInt(16) + 8;
        int k1 = rand.nextInt(16) + 8;
        int l1 = rand.nextInt(worldIn.getHeight(pos.add(j1, 0, k1)).getY() + 32);
        DOUBLE_PLANT_GENERATOR.generate(worldIn, rand, pos.add(j1, l1, k1));
    }

    super.decorate(worldIn, rand, pos);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:29,代码来源:BiomeTaiga.java

示例9: generate

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider)
{
    if (dimList.contains(world.provider.getDimension()) == dimListMode)
    {
        if (random.nextFloat() <= chance)
        {
            int x = chunkX * 16 + 16;
            int z = chunkZ * 16 + 16;
            BlockPos pos = new BlockPos(x, world.getHeight(x, z) - 7, z);
            if (pos.getY() >= minY && pos.getY() <= maxY)
            {
                try
                {
                    NBTTagCompound tag = StructureApi.INSTANCE.getStructureNbt(Utils.gRL("lab_small"));
                    PurMag.INSTANCE.debug("WG START [lab_small]");
                    StructureApi.INSTANCE.spawnStructure(tag, pos, null, Rotation.values()[random.nextInt(Rotation.values().length)], (WorldServer) world, random);
                    PurMag.INSTANCE.debug("WG END AT " + pos);
                }
                catch (IOException e)
                {
                    PurMag.INSTANCE.log.error("An IOException occurred when spawning the small lab structure!", e);
                }
            }
        }
    }
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:28,代码来源:WGLabSmall.java

示例10: genDecorations

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
protected void genDecorations(Biome biomeIn, World worldIn, Random random) {
	for (int chance = 0; chance < rubberTreesPerChunk; ++chance) {
		BlockPos blockpos = worldIn.getHeight(this.chunkPos);
		treeGenerator.generate(worldIn, random, blockpos);
	}
	super.genDecorations(biomeIn, worldIn, random);
}
 
开发者ID:TechReborn,项目名称:TechReborn3,代码行数:9,代码来源:RubberPlantationDecorator.java

示例11: generate

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider)
{
    if (dimList.contains(world.provider.getDimension()) == dimListMode)
    {
        if (random.nextFloat() <= chance)
        {
            int x = chunkX * 16 + 16;
            int z = chunkZ * 16 + 16;
            BlockPos pos = new BlockPos(x, world.getHeight(x, z) - 1, z);
            if (pos.getY() >= minY && pos.getY() <= maxY)
            {
                try
                {
                    NBTTagCompound tag = StructureApi.INSTANCE.getStructureNbt(Utils.gRL("lab_medium"));
                    PurMag.INSTANCE.debug("WG START [lab_medium]");
                    StructureApi.INSTANCE.spawnStructure(tag, pos, null, Rotation.values()[random.nextInt(Rotation.values().length)], (WorldServer) world, random);
                    PurMag.INSTANCE.debug("WG END AT " + pos);
                }
                catch (IOException e)
                {
                    PurMag.INSTANCE.log.error("An IOException occurred when spawning the small lab structure!", e);
                }
            }
        }
    }
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:28,代码来源:WGLabMedium.java

示例12: generate

import net.minecraft.world.World; //导入方法依赖的package包/类
public boolean generate(World worldIn, Random rand, BlockPos position) {
	int i = 2 + rand.nextInt(1) + this.minTreeHeight;
	boolean flag = true;

	if (position.getY() >= 1 && position.getY() + i + 1 <= worldIn.getHeight()) {
		for (int j = position.getY(); j <= position.getY() + 1 + i; ++j) {
			int k = 1;

			if (j == position.getY()) {
				k = 0;
			}

			if (j >= position.getY() + 1 + i - 2) {
				k = 2;
			}

			BlockPos.MutableBlockPos blockposmutableblockpos = new BlockPos.MutableBlockPos();

			for (int l = position.getX() - k; l <= position.getX() + k && flag; ++l) {
				for (int i1 = position.getZ() - k; i1 <= position.getZ() + k && flag; ++i1) {
					if (j >= 0 && j < worldIn.getHeight()) {
						if (!this.isReplaceable(worldIn, blockposmutableblockpos.setPos(l, j, i1))) {
							flag = false;
						}
					} else {
						flag = false;
					}
				}
			}
		}

		if (!flag) {
			return false;
		} else {
			IBlockState state = worldIn.getBlockState(position.down());

			if (state.getBlock().canSustainPlant(state, worldIn, position.down(), net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling) net.minecraft.init.Blocks.SAPLING) && position.getY() < worldIn.getHeight() - i - 1) {
				this.setDirtAt(worldIn, position.down());

				for (int i3 = position.getY() - 3 + i; i3 <= position.getY() + i; ++i3) {
					int i4 = i3 - (position.getY() + i);
					int j1 = 1 - i4 / 2;

					for (int k1 = position.getX() - j1; k1 <= position.getX() + j1; ++k1) {
						int l1 = k1 - position.getX();

						for (int i2 = position.getZ() - j1; i2 <= position.getZ() + j1; ++i2) {
							int j2 = i2 - position.getZ();

							if (Math.abs(l1) != j1 || Math.abs(j2) != j1 || rand.nextInt(2) != 0 && i4 != 0) {
								BlockPos blockpos = new BlockPos(k1, i3, i2);
								state = worldIn.getBlockState(blockpos);

								if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos) || state.getMaterial() == Material.VINE) {
									this.setBlockAndNotifyAdequately(worldIn, blockpos, this.metaLeaves);
								}
							}
						}
					}
				}

				for (int j3 = 0; j3 < i; ++j3) {
					BlockPos upN = position.up(j3);
					state = worldIn.getBlockState(upN);

					if (state.getBlock().isAir(state, worldIn, upN) || state.getBlock().isLeaves(state, worldIn, upN) || state.getMaterial() == Material.VINE) {
						this.setBlockAndNotifyAdequately(worldIn, position.up(j3), this.metaWood);
					}
				}

				return true;
			} else {
				return false;
			}
		}
	} else {
		return false;
	}
}
 
开发者ID:MinecraftModDevelopmentMods,项目名称:Got-Wood,代码行数:80,代码来源:WorldGenRubber.java

示例13: generateNormal

import net.minecraft.world.World; //导入方法依赖的package包/类
private boolean generateNormal(World worldIn, Random rand, BlockPos position) {
	int i = rand.nextInt(3) + 5;
	boolean flag = true;

	if (position.getY() >= 1 && position.getY() + i + 1 <= worldIn.getHeight()) {

		flag = isAreaClear(worldIn, position, i);

		if (!flag) {
			return false;
		} else {
			IBlockState state = worldIn.getBlockState(position.down());

			if (state.getBlock().canSustainPlant(state, worldIn, position.down(), net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling) net.minecraft.init.Blocks.SAPLING) && position.getY() < worldIn.getHeight() - i - 1) {
				this.setDirtAt(worldIn, position.down());

				for (int i3 = position.getY() - 3 + i; i3 <= position.getY() + i; ++i3) {
					int i4 = i3 - (position.getY() + i);
					int j1 = 1 - i4 / 2;

					for (int k1 = position.getX() - j1; k1 <= position.getX() + j1; ++k1) {
						int l1 = k1 - position.getX();

						for (int i2 = position.getZ() - j1; i2 <= position.getZ() + j1; ++i2) {
							int j2 = i2 - position.getZ();

							if (Math.abs(l1) != j1 || Math.abs(j2) != j1 || rand.nextInt(2) != 0 && i4 != 0) {
								BlockPos blockpos = new BlockPos(k1, i3, i2);
								state = worldIn.getBlockState(blockpos);

								if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos) || state.getMaterial() == Material.VINE) {
									this.setBlockAndNotifyAdequately(worldIn, blockpos, this.metaLeaves);
								}
							}
						}
					}
				}

				for (int j3 = 0; j3 < i; ++j3) {
					BlockPos upN = position.up(j3);
					state = worldIn.getBlockState(upN);

					if (state.getBlock().isAir(state, worldIn, upN) || state.getBlock().isLeaves(state, worldIn, upN) || state.getMaterial() == Material.VINE) {
						this.setBlockAndNotifyAdequately(worldIn, position.up(j3), this.metaWood);
					}
				}

				return true;
			} else {
				return false;
			}
		}
	} else {
		return false;
	}
}
 
开发者ID:MinecraftModDevelopmentMods,项目名称:Got-Wood,代码行数:57,代码来源:WorldGenMaple.java

示例14: generateBig

import net.minecraft.world.World; //导入方法依赖的package包/类
private boolean generateBig(World worldIn, Random rand, BlockPos position) {
	int i = rand.nextInt(2) + 9;
	boolean flag = true;

	if (position.getY() >= 1 && position.getY() + i + 1 <= worldIn.getHeight()) {
		flag = isAreaClear(worldIn, position, i);

		if (!flag) {
			return false;
		}

		//If we can actually make the tree
		else {
			IBlockState state = worldIn.getBlockState(position.down());

			if (state.getBlock().canSustainPlant(state, worldIn, position.down(), net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling) net.minecraft.init.Blocks.SAPLING) && position.getY() < worldIn.getHeight() - i - 1) {
				this.setDirtAt(worldIn, position.down());

				//MAKE LEAVES
				final int[][] leafPos = new int[][] { { -1, 0, 0 }, { 0, 0, 1 }, { 0, 0, -1 }, { 1, 0, 0 }, { -1, 1, 1 }, { -1, 1, 0 }, { -1, 1, -1 }, { 0, 1, 1 }, { 0, 1, -1 }, { 1, 1, 1 }, { 1, 1, 0 }, { 1, 1, -1 }, { 2, 1, 1 }, { -2, 1, 1 }, { -2, 1, 0 }, { -2, 1, -1 }, { -1, 1, 2 }, { -1, 1, -2 }, { 0, 1, 2 }, { 0, 1, -2 }, { 2, 1, 0 }, { 2, 1, -1 }, { 1, 1, 2 }, { 1, 1, -2 }, { -3, 1, 0 }, { 3, 1, 0 }, { 0, 1, -3 }, { 0, 1, 3 }, { -2, 1, 2 }, { -2, 1, -2 }, { 2, 1, 2 }, { 2, 1, -2 }, { -1, 2, 1 }, { -1, 2, 0 }, { -1, 2, -1 }, { 0, 2, 1 }, { 0, 2, -1 }, { 1, 2, 1 }, { 1, 2, 0 }, { 1, 2, -1 }, { 2, 2, 1 }, { -2, 2, 1 }, { -2, 2, 0 }, { -2, 2, -1 }, { -1, 2, 2 }, { -1, 2, -2 }, { 0, 2, 2 }, { 0, 2, -2 }, { 2, 2, 0 }, { 2, 2, -1 }, { 1, 2, 2 }, { 1, 2, -2 }, { -3, 2, 0 }, { 3, 2, 0 },
					{ 0, 2, -3 }, { 0, 2, 3 }, { -2, 2, 2 }, { -2, 2, -2 }, { 2, 2, 2 }, { 2, 2, -2 }, { -3, 2, -1 }, { -3, 2, 1 }, { -1, 2, -3 }, { -1, 2, 3 }, { 1, 2, 3 }, { 3, 2, 1 }, { 1, 2, -3 }, { 3, 2, -1 }, { -1, 3, 1 }, { -1, 3, 0 }, { -1, 3, -1 }, { 0, 3, 1 }, { 0, 3, -1 }, { 1, 3, 1 }, { 1, 3, 0 }, { 1, 3, -1 }, { 2, 3, 1 }, { -2, 3, 1 }, { -2, 3, 0 }, { -2, 3, -1 }, { -1, 3, 2 }, { -1, 3, -2 }, { 0, 3, 2 }, { 0, 3, -2 }, { 2, 3, 0 }, { 2, 3, -1 }, { 1, 3, 2 }, { 1, 3, -2 }, { -3, 3, 0 }, { 3, 3, 0 }, { 0, 3, -3 }, { 0, 3, 3 }, { -2, 3, 2 }, { -2, 3, -2 }, { 2, 3, 2 }, { 2, 3, -2 }, { -3, 3, -1 }, { -3, 3, 1 }, { -1, 3, -3 }, { -1, 3, 3 }, { 1, 3, 3 }, { 3, 3, 1 }, { 1, 3, -3 }, { 3, 3, -1 }, { -1, 4, 1 }, { -1, 4, 0 }, { -1, 4, -1 }, { 0, 4, 1 }, { 0, 4, -1 }, { 1, 4, 1 },
					{ 1, 4, 0 }, { 1, 4, -1 }, { 2, 4, 1 }, { -2, 4, 1 }, { -2, 4, 0 }, { -2, 4, -1 }, { -1, 4, 2 }, { -1, 4, -2 }, { 0, 4, 2 }, { 0, 4, -2 }, { 2, 4, 0 }, { 2, 4, -1 }, { 1, 4, 2 }, { 1, 4, -2 }, { -3, 4, 0 }, { 3, 4, 0 }, { 0, 4, -3 }, { 0, 4, 3 }, { -1, 5, 1 }, { -1, 5, 0 }, { -1, 5, -1 }, { 0, 5, 1 }, { 0, 5, -1 }, { 1, 5, 1 }, { 1, 5, 0 }, { 1, 5, -1 }, { 2, 5, 1 }, { -2, 5, 1 }, { -2, 5, 0 }, { -2, 5, -1 }, { -1, 5, 2 }, { -1, 5, -2 }, { 0, 5, 2 }, { 0, 5, -2 }, { 2, 5, 0 }, { 2, 5, -1 }, { 1, 5, 2 }, { 1, 5, -2 }, { -1, 6, 0 }, { 0, 6, 1 }, { 0, 6, -1 }, { 1, 6, 0 }, { 0, 7, 0 } };

				for (int[] coord : leafPos) {
					BlockPos blockpos = position.add(coord[0], coord[1] + (i - 7), coord[2]);
					state = worldIn.getBlockState(blockpos);
					if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos) || state.getMaterial() == Material.VINE) {
						this.setBlockAndNotifyAdequately(worldIn, blockpos, this.metaLeaves);
					}
				}

				//MAKE TRUNK
				for (int j3 = 0; j3 < i; ++j3) {
					BlockPos upN = position.up(j3);
					state = worldIn.getBlockState(upN);

					if (state.getBlock().isAir(state, worldIn, upN) || state.getBlock().isLeaves(state, worldIn, upN) || state.getMaterial() == Material.VINE) {
						this.setBlockAndNotifyAdequately(worldIn, position.up(j3), this.metaWood);
						if (j3 == i - 4) {

							this.setBlockAndNotifyAdequately(worldIn, position.up(j3).north(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z));
							this.setBlockAndNotifyAdequately(worldIn, position.up(j3).south(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z));
							this.setBlockAndNotifyAdequately(worldIn, position.up(j3).north(2), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z));
							this.setBlockAndNotifyAdequately(worldIn, position.up(j3).south(2), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z));
							if (rand.nextBoolean()) {
								this.setBlockAndNotifyAdequately(worldIn, position.up(j3).east(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X));
								this.setBlockAndNotifyAdequately(worldIn, position.up(j3).west(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X));
								this.setBlockAndNotifyAdequately(worldIn, position.up(j3).east(2), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X));
								this.setBlockAndNotifyAdequately(worldIn, position.up(j3).west(2), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X));
							}

						} else if (j3 == i - 6) {
							this.setBlockAndNotifyAdequately(worldIn, position.up(j3).north(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z));
							this.setBlockAndNotifyAdequately(worldIn, position.up(j3).south(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z));
							if (rand.nextBoolean()) {
								this.setBlockAndNotifyAdequately(worldIn, position.up(j3).east(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X));
								this.setBlockAndNotifyAdequately(worldIn, position.up(j3).west(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X));
							}
						}
					}
				}

				return true;
			} else {
				return false;
			}
		}
	} else {
		return false;
	}
}
 
开发者ID:MinecraftModDevelopmentMods,项目名称:Got-Wood,代码行数:72,代码来源:WorldGenMaple.java

示例15: generateMini

import net.minecraft.world.World; //导入方法依赖的package包/类
private boolean generateMini(World worldIn, Random rand, BlockPos position) {
	int i = rand.nextInt(2) + 6;
	boolean flag = true;

	if (position.getY() >= 1 && position.getY() + i + 1 <= worldIn.getHeight()) {
		flag = isAreaClear(worldIn, position, i);

		if (!flag) {
			return false;
		}

		//If we can actually make the tree
		else {
			IBlockState state = worldIn.getBlockState(position.down());

			if (state.getBlock().canSustainPlant(state, worldIn, position.down(), net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling) net.minecraft.init.Blocks.SAPLING) && position.getY() < worldIn.getHeight() - i - 1) {
				this.setDirtAt(worldIn, position.down());

				//MAKE LEAVES
				final int[][] leafPos = new int[][] { { -1, 0, 1 }, { -1, 0, 0 }, { -1, 0, -1 }, { 0, 0, 1 }, { 0, 0, -1 }, { 1, 0, 1 }, { 1, 0, 0 }, { 1, 0, -1 }, { -1, 1, 1 }, { -1, 1, 0 }, { -1, 1, -1 }, { 0, 1, 1 }, { 0, 1, -1 }, { 0, 1, -2 }, { 1, 1, 1 }, { 1, 1, 0 }, { 1, 1, -1 }, { -1, 1, 0 }, { -1, 1, -1 }, { -2, 1, 1 }, { -2, 1, 0 }, { -2, 1, -1 }, { 2, 1, -1 }, { 2, 1, 0 }, { 2, 1, 1 }, { -1, 1, 2 }, { 0, 1, 2 }, { 1, 1, 2 }, { -1, 1, -2 }, { 1, 1, -2 }, { 1, 1, -2 }, { -1, 2, 1 }, { -1, 2, 0 }, { -1, 2, -1 }, { 0, 2, 1 }, { 0, 2, -1 }, { 1, 2, 1 }, { 1, 2, 0 }, { 1, 2, -1 }, { -2, 2, 0 }, { 2, 2, 0 }, { 0, 2, 2 }, { 0, 2, -2 }, { -1, 3, 1 }, { -1, 3, 0 }, { -1, 3, -1 }, { 0, 3, 1 }, { 0, 3, -1 }, { 1, 3, 1 }, { 1, 3, 0 }, { 1, 3, -1 }, { -1, 4, 0 }, { 0, 4, 1 },
					{ 0, 4, -1 }, { 1, 4, 0 }, { 0, 5, 0 } };

				for (int[] coord : leafPos) {
					BlockPos blockpos = position.add(coord[0], coord[1] + (i - 5), coord[2]);
					state = worldIn.getBlockState(blockpos);
					if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos) || state.getMaterial() == Material.VINE) {
						this.setBlockAndNotifyAdequately(worldIn, blockpos, this.metaLeaves);
					}
				}
				//MAKE TRUNK
				for (int j3 = 0; j3 < i; ++j3) {
					BlockPos upN = position.up(j3);
					state = worldIn.getBlockState(upN);

					if (state.getBlock().isAir(state, worldIn, upN) || state.getBlock().isLeaves(state, worldIn, upN) || state.getMaterial() == Material.VINE) {
						this.setBlockAndNotifyAdequately(worldIn, position.up(j3), this.metaWood);
						if (j3 == i - 4) {

							this.setBlockAndNotifyAdequately(worldIn, position.up(j3).north(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z));
							this.setBlockAndNotifyAdequately(worldIn, position.up(j3).south(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z));
							if (rand.nextBoolean()) {
								this.setBlockAndNotifyAdequately(worldIn, position.up(j3).east(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X));
								this.setBlockAndNotifyAdequately(worldIn, position.up(j3).west(), this.metaWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X));
							}

						}
					}
				}

				return true;
			} else {
				return false;
			}
		}
	} else {
		return false;
	}
}
 
开发者ID:MinecraftModDevelopmentMods,项目名称:Got-Wood,代码行数:59,代码来源:WorldGenPalm.java


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