當前位置: 首頁>>代碼示例>>Java>>正文


Java Blocks.end_stone方法代碼示例

本文整理匯總了Java中net.minecraft.init.Blocks.end_stone方法的典型用法代碼示例。如果您正苦於以下問題:Java Blocks.end_stone方法的具體用法?Java Blocks.end_stone怎麽用?Java Blocks.end_stone使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.init.Blocks的用法示例。


在下文中一共展示了Blocks.end_stone方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: canPlantStay

import net.minecraft.init.Blocks; //導入方法依賴的package包/類
public static boolean canPlantStay(World world, int x, int y, int z) {
	Block block = world.getBlock(x, y - 1, z);
	if (block != ModBlocks.chorus_plant && block != Blocks.end_stone) {
		if (block.isAir(world, x, y - 1, z)) {
			int adjecentCount = 0;
			for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
				Block adjecentBlock = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
				if (adjecentBlock == ModBlocks.chorus_plant)
					adjecentCount++;
				else if (!adjecentBlock.isAir(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ))
					return false;
			}
			return adjecentCount == 1;
		} else
			return false;
	} else
		return true;
}
 
開發者ID:jm-organization,項目名稱:connor41-etfuturum2,代碼行數:19,代碼來源:ChorusFlower.java

示例2: destroyBlocksInAABB

import net.minecraft.init.Blocks; //導入方法依賴的package包/類
/**
 * Destroys all blocks that aren't associated with 'The End' inside the given bounding box.
 */
private boolean destroyBlocksInAABB(AxisAlignedBB p_70972_1_)
{
    int i = MathHelper.floor_double(p_70972_1_.minX);
    int j = MathHelper.floor_double(p_70972_1_.minY);
    int k = MathHelper.floor_double(p_70972_1_.minZ);
    int l = MathHelper.floor_double(p_70972_1_.maxX);
    int i1 = MathHelper.floor_double(p_70972_1_.maxY);
    int j1 = MathHelper.floor_double(p_70972_1_.maxZ);
    boolean flag = false;
    boolean flag1 = false;

    for (int k1 = i; k1 <= l; ++k1)
    {
        for (int l1 = j; l1 <= i1; ++l1)
        {
            for (int i2 = k; i2 <= j1; ++i2)
            {
                BlockPos blockpos = new BlockPos(k1, l1, i2);
                Block block = this.worldObj.getBlockState(blockpos).getBlock();

                if (block.getMaterial() != Material.air)
                {
                    if (block != Blocks.barrier && block != Blocks.obsidian && block != Blocks.end_stone && block != Blocks.bedrock && block != Blocks.command_block && this.worldObj.getGameRules().getBoolean("mobGriefing"))
                    {
                        flag1 = this.worldObj.setBlockToAir(blockpos) || flag1;
                    }
                    else
                    {
                        flag = true;
                    }
                }
            }
        }
    }

    if (flag1)
    {
        double d0 = p_70972_1_.minX + (p_70972_1_.maxX - p_70972_1_.minX) * (double)this.rand.nextFloat();
        double d1 = p_70972_1_.minY + (p_70972_1_.maxY - p_70972_1_.minY) * (double)this.rand.nextFloat();
        double d2 = p_70972_1_.minZ + (p_70972_1_.maxZ - p_70972_1_.minZ) * (double)this.rand.nextFloat();
        this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
    }

    return flag;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:49,代碼來源:EntityDragon.java

示例3: updateTick

import net.minecraft.init.Blocks; //導入方法依賴的package包/類
@Override
public void updateTick(World world, int x, int y, int z, Random rand) {
	if (world.isRemote)
		return;
	int meta = world.getBlockMetadata(x, y, z);
	if (meta >= 5)
		return;

	if (!canBlockStay(world, x, y, z))
		world.func_147480_a(x, y, z, true);
	else if (world.isAirBlock(x, y + 1, z)) {
		boolean canGrowUp = false;
		boolean isSegmentOnEndstone = false;
		Block lowerBlock = world.getBlock(x, y - 1, z);
		if (lowerBlock == Blocks.end_stone)
			canGrowUp = true;
		else if (lowerBlock == ModBlocks.chorus_plant) {
			int par8 = 1;
			int height;
			for (height = 0; height < 4; height++) {
				Block b = world.getBlock(x, y - (par8 + 1), z);
				if (b != ModBlocks.chorus_plant) {
					if (b == Blocks.end_stone)
						isSegmentOnEndstone = true;
					break;
				}
				par8++;
			}

			height = 4;
			if (isSegmentOnEndstone)
				height++;

			if (par8 < 2 || rand.nextInt(height) >= par8)
				canGrowUp = true;
		} else if (lowerBlock.isAir(world, x, y - 1, z))
			canGrowUp = true;

		if (canGrowUp && isSpaceAroundFree(world, x, y + 1, z, ForgeDirection.DOWN) && world.isAirBlock(x, y + 2, z)) {
			world.setBlock(x, y, z, ModBlocks.chorus_plant);
			world.setBlock(x, y + 1, z, this, meta, 3);
		} else if (meta < 4) {
			int tries = rand.nextInt(4);
			boolean grew = false;
			if (isSegmentOnEndstone)
				tries++;
			for (int i = 0; i < tries; i++) {
				ForgeDirection dir = ForgeDirection.VALID_DIRECTIONS[rand.nextInt(ForgeDirection.VALID_DIRECTIONS.length)];
				int xx = x + dir.offsetX;
				int yy = y + dir.offsetY;
				int zz = z + dir.offsetZ;
				if (world.isAirBlock(xx, yy, zz) && isSpaceAroundFree(world, xx, yy, zz, dir.getOpposite())) {
					world.setBlock(xx, yy, zz, this, meta + 1, 3);
					grew = true;
				}
			}
			if (grew)
				world.setBlock(x, y, z, ModBlocks.chorus_plant, 0, 3);
			else
				world.setBlock(x, y, z, this, 5, 3);
		} else if (meta == 4)
			world.setBlock(x, y, z, this, 5, 3);
	}
}
 
開發者ID:jm-organization,項目名稱:connor41-etfuturum2,代碼行數:65,代碼來源:ChorusFlower.java


注:本文中的net.minecraft.init.Blocks.end_stone方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。