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


Java Blocks.BEDROCK属性代码示例

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


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

示例1: onUpdate

@Override
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
	super.onUpdate(stack, worldIn, entityIn, itemSlot, isSelected);
	
	if (isSelected) {
		double x = entityIn.posX;
		double y = entityIn.posY;
		double z = entityIn.posZ;
		
		BlockPos pos = new BlockPos(x, --y, z);
		
		if (entityIn instanceof EntityPlayer 
				&& !worldIn.isAirBlock(pos) 
				&& worldIn.getBlockState(pos).getBlock() != Blocks.BEDROCK 
				&& worldIn.getBlockState(pos).getBlock() != Blocks.SNOW
				&& worldIn.getBlockState(pos).getBlock() != Blocks.LAVA
				&& worldIn.getBlockState(pos).getBlock() != Blocks.WATER
				&& worldIn.getBlockState(pos).isFullBlock()
				&& worldIn.getBlockState(pos).isFullCube()) {
			
			worldIn.setBlockState(pos, Blocks.SNOW.getDefaultState());
			
		}
	}
}
 
开发者ID:Herobone,项目名称:HeroUtils,代码行数:25,代码来源:SnowCepter.java

示例2: transformBedrock

private void transformBedrock(World world, BlockPos pos) {
	
	Iterable<BlockPos> poslist = BlockPos.getAllInBox(pos.add(-range, -range, -range), pos.add(range, 0, range));
	Iterator posit = poslist.iterator();
	while (posit.hasNext()) {
		BlockPos looppos = (BlockPos)posit.next();
		if (!world.isAirBlock(looppos) && world.getBlockState(looppos).getBlock() == Blocks.BEDROCK) {
			if (looppos.getY() <= 1) continue;
			if (world.rand.nextBoolean()) {
				world.setBlockState(looppos, UCBlocks.darkBlock.getDefaultState(), 2);
				UCPacketHandler.sendToNearbyPlayers(world, looppos, new PacketUCEffect(EnumParticleTypes.CLOUD, looppos.getX(), looppos.getY(), looppos.getZ(), 6));
				return;
			}
		}
	}
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:16,代码来源:Petramia.java

示例3: onItemUse

@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing,
		float hitX, float hitY, float hitZ)
{
	if (player.getHeldItem(hand).getItem().equals(ModRegistry.ANCIENT_PARCHMENT))
	{
		if (world.isRemote)
		{
			return EnumActionResult.PASS;
		}
		Block block = world.getBlockState(pos).getBlock();

		if (player.isSneaking() && block == Blocks.BEDROCK)
		{
			player.getCooldownTracker().setCooldown(player.getHeldItem(hand).getItem(), 150);

			player.getHeldItem(hand).shrink(1);
			world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), ArcaneMagicSoundHandler.spell,
					SoundCategory.MASTER, 1f, 1f);

			world.spawnEntity(new EntityMagicCircles(world, pos.getX(), pos.getY(), pos.getZ()));

			return EnumActionResult.SUCCESS;
		}

	}
	return EnumActionResult.PASS;
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:28,代码来源:ItemParchment.java

示例4: explodeBlock

public float explodeBlock(World world, BlockPos pos, float power) {
	if (world.isAirBlock(pos)) return power;
	
	IBlockState state = world.getBlockState(pos);
	Block block = state.getBlock();
	
	if (block==Blocks.BEDROCK) return 0;
	
	//Just delete fluids without examination or notification so their neighbors don't try to fill them in.
	if (isFluid(block)) {
		world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2 | 16);
		return power;
	}
	
	float resistance = block.getExplosionResistance(world, pos, null, dummyExplosion);
	if (resistance>power) return 0;
	
	boolean drop = state.getBlock().canDropFromExplosion(dummyExplosion);
	
	if (drop && world.rand.nextInt(1000)==5) {
		block.dropBlockAsItem(world, pos, state, 0);
	}
	//block.onBlockExploded(world, pos, dummyExplosion); //Also calls onBlockDestroyedByExplosion
	
	if (pos.getY()>4) {
		world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2 | 16); //Observers are blinded by explosions or something
	} else {
		world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2 | 16); //Don't know if the chest bug still exists, but if it does we'll be safe with this line.
		world.setBlockState(pos, Blocks.OBSIDIAN.getDefaultState(), 2 | 16); //If we're that strong, glass the crater floor.
	}
	return power - (int)(resistance*RESISTANCE_SCALE);
}
 
开发者ID:elytra,项目名称:Thermionics,代码行数:32,代码来源:BigExplosion.java

示例5: generatePortal

private void generatePortal(boolean active)
{
    WorldGenEndPodium worldgenendpodium = new WorldGenEndPodium(active);

    if (this.exitPortalLocation == null)
    {
        for (this.exitPortalLocation = this.world.getTopSolidOrLiquidBlock(WorldGenEndPodium.END_PODIUM_LOCATION).down(); this.world.getBlockState(this.exitPortalLocation).getBlock() == Blocks.BEDROCK && this.exitPortalLocation.getY() > this.world.getSeaLevel(); this.exitPortalLocation = this.exitPortalLocation.down())
        {
            ;
        }
    }

    worldgenendpodium.generate(this.world, new Random(), this.exitPortalLocation);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:14,代码来源:DragonFightManager.java

示例6: respawnDragon

private void respawnDragon(List<EntityEnderCrystal> crystalsIn)
{
    if (this.dragonKilled && this.respawnState == null)
    {
        for (BlockPattern.PatternHelper blockpattern$patternhelper = this.findExitPortal(); blockpattern$patternhelper != null; blockpattern$patternhelper = this.findExitPortal())
        {
            for (int i = 0; i < this.portalPattern.getPalmLength(); ++i)
            {
                for (int j = 0; j < this.portalPattern.getThumbLength(); ++j)
                {
                    for (int k = 0; k < this.portalPattern.getFingerLength(); ++k)
                    {
                        BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(i, j, k);

                        if (blockworldstate.getBlockState().getBlock() == Blocks.BEDROCK || blockworldstate.getBlockState().getBlock() == Blocks.END_PORTAL)
                        {
                            this.world.setBlockState(blockworldstate.getPos(), Blocks.END_STONE.getDefaultState());
                        }
                    }
                }
            }
        }

        this.respawnState = DragonSpawnManager.START;
        this.respawnStateTicks = 0;
        this.generatePortal(false);
        this.crystals = crystalsIn;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:29,代码来源:DragonFightManager.java

示例7: canCreatureTypeSpawnAtLocation

public static boolean canCreatureTypeSpawnAtLocation(EntityLiving.SpawnPlacementType spawnPlacementTypeIn, World worldIn, BlockPos pos)
{
    if (!worldIn.getWorldBorder().contains(pos))
    {
        return false;
    }
    else
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);

        if (spawnPlacementTypeIn == EntityLiving.SpawnPlacementType.IN_WATER)
        {
            return iblockstate.getMaterial() == Material.WATER && worldIn.getBlockState(pos.down()).getMaterial() == Material.WATER && !worldIn.getBlockState(pos.up()).isNormalCube();
        }
        else
        {
            BlockPos blockpos = pos.down();

            if (!worldIn.getBlockState(blockpos).isFullyOpaque())
            {
                return false;
            }
            else
            {
                Block block = worldIn.getBlockState(blockpos).getBlock();
                boolean flag = block != Blocks.BEDROCK && block != Blocks.BARRIER;
                return flag && isValidEmptySpawnBlock(iblockstate) && isValidEmptySpawnBlock(worldIn.getBlockState(pos.up()));
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:31,代码来源:WorldEntitySpawner.java

示例8: findHighestBlock

private static BlockPos findHighestBlock(World p_184308_0_, BlockPos p_184308_1_, int p_184308_2_, boolean p_184308_3_)
{
    BlockPos blockpos = null;

    for (int i = -p_184308_2_; i <= p_184308_2_; ++i)
    {
        for (int j = -p_184308_2_; j <= p_184308_2_; ++j)
        {
            if (i != 0 || j != 0 || p_184308_3_)
            {
                for (int k = 255; k > (blockpos == null ? 0 : blockpos.getY()); --k)
                {
                    BlockPos blockpos1 = new BlockPos(p_184308_1_.getX() + i, k, p_184308_1_.getZ() + j);
                    IBlockState iblockstate = p_184308_0_.getBlockState(blockpos1);

                    if (iblockstate.isBlockNormalCube() && (p_184308_3_ || iblockstate.getBlock() != Blocks.BEDROCK))
                    {
                        blockpos = blockpos1;
                        break;
                    }
                }
            }
        }
    }

    return blockpos == null ? p_184308_1_ : blockpos;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:27,代码来源:TileEntityEndGateway.java

示例9: canCreatureTypeSpawnAtLocation

public static boolean canCreatureTypeSpawnAtLocation(EntityLiving.SpawnPlacementType spawnPlacementTypeIn, World worldIn, BlockPos pos)
{
    if (!worldIn.getWorldBorder().contains(pos))
    {
        return false;
    }
    else
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);

        if (spawnPlacementTypeIn == EntityLiving.SpawnPlacementType.IN_WATER)
        {
            return iblockstate.getMaterial().isLiquid() && worldIn.getBlockState(pos.down()).getMaterial().isLiquid() && !worldIn.getBlockState(pos.up()).isNormalCube();
        }
        else
        {
            BlockPos blockpos = pos.down();
            IBlockState state = worldIn.getBlockState(blockpos);

            if (!state.getBlock().canCreatureSpawn(state, worldIn, blockpos, spawnPlacementTypeIn))
            {
                return false;
            }
            else
            {
                Block block = worldIn.getBlockState(blockpos).getBlock();
                boolean flag = block != Blocks.BEDROCK && block != Blocks.BARRIER;
                return flag && isValidEmptySpawnBlock(iblockstate) && isValidEmptySpawnBlock(worldIn.getBlockState(pos.up()));
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:32,代码来源:WorldEntitySpawner.java

示例10: canDestroyBlock

public static boolean canDestroyBlock(Block blockIn)
{
    return blockIn != Blocks.BEDROCK && blockIn != Blocks.END_PORTAL && blockIn != Blocks.END_PORTAL_FRAME && blockIn != Blocks.COMMAND_BLOCK && blockIn != Blocks.REPEATING_COMMAND_BLOCK && blockIn != Blocks.CHAIN_COMMAND_BLOCK && blockIn != Blocks.BARRIER && blockIn != Blocks.STRUCTURE_BLOCK && blockIn != Blocks.STRUCTURE_VOID;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:4,代码来源:EntityWither.java

示例11: destroyBlocksInAABB

/**
 * 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(p_70972_1_.minX);
    int j = MathHelper.floor(p_70972_1_.minY);
    int k = MathHelper.floor(p_70972_1_.minZ);
    int l = MathHelper.floor(p_70972_1_.maxX);
    int i1 = MathHelper.floor(p_70972_1_.maxY);
    int j1 = MathHelper.floor(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);
                IBlockState iblockstate = this.world.getBlockState(blockpos);
                Block block = iblockstate.getBlock();

                if (iblockstate.getMaterial() != Material.AIR && iblockstate.getMaterial() != Material.FIRE)
                {
                    if (!this.world.getGameRules().getBoolean("mobGriefing"))
                    {
                        flag = true;
                    }
                    else if (block != Blocks.BARRIER && block != Blocks.OBSIDIAN && block != Blocks.END_STONE && block != Blocks.BEDROCK && block != Blocks.END_PORTAL && block != Blocks.END_PORTAL_FRAME)
                    {
                        if (block != Blocks.COMMAND_BLOCK && block != Blocks.REPEATING_COMMAND_BLOCK && block != Blocks.CHAIN_COMMAND_BLOCK && block != Blocks.IRON_BARS && block != Blocks.END_GATEWAY)
                        {
                            flag1 = this.world.setBlockToAir(blockpos) || flag1;
                        }
                        else
                        {
                            flag = true;
                        }
                    }
                    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.world.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
    }

    return flag;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:60,代码来源:EntityDragon.java

示例12: onItemUse

/**
 * Called when a Block is right-clicked with this Item
 */
public EnumActionResult onItemUse(EntityPlayer stack, World playerIn, BlockPos worldIn, EnumHand pos, EnumFacing hand, float facing, float hitX, float hitY)
{
    IBlockState iblockstate = playerIn.getBlockState(worldIn);

    if (iblockstate.getBlock() != Blocks.OBSIDIAN && iblockstate.getBlock() != Blocks.BEDROCK)
    {
        return EnumActionResult.FAIL;
    }
    else
    {
        BlockPos blockpos = worldIn.up();
        ItemStack itemstack = stack.getHeldItem(pos);

        if (!stack.canPlayerEdit(blockpos, hand, itemstack))
        {
            return EnumActionResult.FAIL;
        }
        else
        {
            BlockPos blockpos1 = blockpos.up();
            boolean flag = !playerIn.isAirBlock(blockpos) && !playerIn.getBlockState(blockpos).getBlock().isReplaceable(playerIn, blockpos);
            flag = flag | (!playerIn.isAirBlock(blockpos1) && !playerIn.getBlockState(blockpos1).getBlock().isReplaceable(playerIn, blockpos1));

            if (flag)
            {
                return EnumActionResult.FAIL;
            }
            else
            {
                double d0 = (double)blockpos.getX();
                double d1 = (double)blockpos.getY();
                double d2 = (double)blockpos.getZ();
                List<Entity> list = playerIn.getEntitiesWithinAABBExcludingEntity((Entity)null, new AxisAlignedBB(d0, d1, d2, d0 + 1.0D, d1 + 2.0D, d2 + 1.0D));

                if (!list.isEmpty())
                {
                    return EnumActionResult.FAIL;
                }
                else
                {
                    if (!playerIn.isRemote)
                    {
                        EntityEnderCrystal entityendercrystal = new EntityEnderCrystal(playerIn, (double)((float)worldIn.getX() + 0.5F), (double)(worldIn.getY() + 1), (double)((float)worldIn.getZ() + 0.5F));
                        entityendercrystal.setShowBottom(false);
                        playerIn.spawnEntityInWorld(entityendercrystal);

                        if (playerIn.provider instanceof WorldProviderEnd)
                        {
                            DragonFightManager dragonfightmanager = ((WorldProviderEnd)playerIn.provider).getDragonFightManager();
                            dragonfightmanager.respawnDragon();
                        }
                    }

                    itemstack.func_190918_g(1);
                    return EnumActionResult.SUCCESS;
                }
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:63,代码来源:ItemEndCrystal.java

示例13: canDestroyBlock

public static boolean canDestroyBlock(Block blockIn)
{
    return blockIn != Blocks.BEDROCK && blockIn != Blocks.END_PORTAL && blockIn != Blocks.END_PORTAL_FRAME && blockIn != Blocks.COMMAND_BLOCK && blockIn != Blocks.REPEATING_COMMAND_BLOCK && blockIn != Blocks.CHAIN_COMMAND_BLOCK && blockIn != Blocks.BARRIER;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:4,代码来源:EntityWither.java

示例14: onItemUse

/**
 * Called when a Block is right-clicked with this Item
 */
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
    IBlockState iblockstate = worldIn.getBlockState(pos);

    if (iblockstate.getBlock() != Blocks.OBSIDIAN && iblockstate.getBlock() != Blocks.BEDROCK)
    {
        return EnumActionResult.FAIL;
    }
    else
    {
        BlockPos blockpos = pos.up();

        if (!playerIn.canPlayerEdit(blockpos, facing, stack))
        {
            return EnumActionResult.FAIL;
        }
        else
        {
            BlockPos blockpos1 = blockpos.up();
            boolean flag = !worldIn.isAirBlock(blockpos) && !worldIn.getBlockState(blockpos).getBlock().isReplaceable(worldIn, blockpos);
            flag = flag | (!worldIn.isAirBlock(blockpos1) && !worldIn.getBlockState(blockpos1).getBlock().isReplaceable(worldIn, blockpos1));

            if (flag)
            {
                return EnumActionResult.FAIL;
            }
            else
            {
                double d0 = (double)blockpos.getX();
                double d1 = (double)blockpos.getY();
                double d2 = (double)blockpos.getZ();
                List<Entity> list = worldIn.getEntitiesWithinAABBExcludingEntity((Entity)null, new AxisAlignedBB(d0, d1, d2, d0 + 1.0D, d1 + 2.0D, d2 + 1.0D));

                if (!list.isEmpty())
                {
                    return EnumActionResult.FAIL;
                }
                else
                {
                    if (!worldIn.isRemote)
                    {
                        EntityEnderCrystal entityendercrystal = new EntityEnderCrystal(worldIn, (double)((float)pos.getX() + 0.5F), (double)(pos.getY() + 1), (double)((float)pos.getZ() + 0.5F));
                        entityendercrystal.setShowBottom(false);
                        worldIn.spawnEntityInWorld(entityendercrystal);

                        if (worldIn.provider instanceof WorldProviderEnd)
                        {
                            DragonFightManager dragonfightmanager = ((WorldProviderEnd)worldIn.provider).getDragonFightManager();
                            dragonfightmanager.respawnDragon();
                        }
                    }

                    --stack.stackSize;
                    return EnumActionResult.SUCCESS;
                }
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:62,代码来源:ItemEndCrystal.java


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