Java Code Examples for net.minecraft.init.Blocks.obsidian()

The following are Jave code examples for showing how to use obsidian() of the net.minecraft.init.Blocks class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: DecompiledMinecraft   File: BlockPortal.java   View Source Code Vote up 7 votes
protected int func_180120_a(BlockPos p_180120_1_, EnumFacing p_180120_2_)
{
    int i;

    for (i = 0; i < 22; ++i)
    {
        BlockPos blockpos = p_180120_1_.offset(p_180120_2_, i);

        if (!this.func_150857_a(this.world.getBlockState(blockpos).getBlock()) || this.world.getBlockState(blockpos.down()).getBlock() != Blocks.obsidian)
        {
            break;
        }
    }

    Block block = this.world.getBlockState(p_180120_1_.offset(p_180120_2_, i)).getBlock();
    return block == Blocks.obsidian ? i : 0;
}
 
Example 2
Project: connor41-etfuturum2   File: EndCrystal.java   View Source Code Vote up 6 votes
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
	if (side != 1)
		return false;

	Block block = world.getBlock(x, y, z);
	if (block == Blocks.obsidian || block == Blocks.bedrock)
		if (world.isAirBlock(x, y + 1, z)) {
			if (!world.isRemote) {
				EntityPlacedEndCrystal endCrystal = new EntityPlacedEndCrystal(world);
				endCrystal.setPosition(x + 0.5, y, z + 0.5);
				endCrystal.setBlockPos(x, y, z);

				world.spawnEntityInWorld(endCrystal);
				if (!player.capabilities.isCreativeMode)
					stack.stackSize--;
			}
			return true;
		}

	return false;
}
 
Example 3
Project: BaseClient   File: BlockPortal.java   View Source Code Vote up 6 votes
protected int func_180120_a(BlockPos p_180120_1_, EnumFacing p_180120_2_)
{
    int i;

    for (i = 0; i < 22; ++i)
    {
        BlockPos blockpos = p_180120_1_.offset(p_180120_2_, i);

        if (!this.func_150857_a(this.world.getBlockState(blockpos).getBlock()) || this.world.getBlockState(blockpos.down()).getBlock() != Blocks.obsidian)
        {
            break;
        }
    }

    Block block = this.world.getBlockState(p_180120_1_.offset(p_180120_2_, i)).getBlock();
    return block == Blocks.obsidian ? i : 0;
}
 
Example 4
Project: BaseClient   File: BlockPortal.java   View Source Code Vote up 6 votes
protected int func_180120_a(BlockPos p_180120_1_, EnumFacing p_180120_2_)
{
    int i;

    for (i = 0; i < 22; ++i)
    {
        BlockPos blockpos = p_180120_1_.offset(p_180120_2_, i);

        if (!this.func_150857_a(this.world.getBlockState(blockpos).getBlock()) || this.world.getBlockState(blockpos.down()).getBlock() != Blocks.obsidian)
        {
            break;
        }
    }

    Block block = this.world.getBlockState(p_180120_1_.offset(p_180120_2_, i)).getBlock();
    return block == Blocks.obsidian ? i : 0;
}
 
Example 5
Project: minecraft-quiverbow   File: PowderKnuckle_Mod.java   View Source Code Vote up 5 votes
void doMining(World world, EntityPlayerMP player, int x, int y, int z)	// Calling this 27 times, to blast mine a 3x3x3 area
{
	Block toBeBroken = world.getBlock(x, y, z);
	int meta = world.getBlockMetadata(x, y, z);

	if (toBeBroken.getBlockHardness(world, x, y, z) == -1) { return; }	// Unbreakable

	if (toBeBroken.getHarvestLevel(meta) > 1) { return; }
	if (toBeBroken.getMaterial() == Material.water) { return; }
	if (toBeBroken.getMaterial() == Material.lava) { return; }
	if (toBeBroken.getMaterial() == Material.air) { return; }
	if (toBeBroken.getMaterial() == Material.portal) { return; }

	// Need to do checks here against invalid blocks
	if (toBeBroken == Blocks.water) { return; }
	if (toBeBroken == Blocks.flowing_water) { return; }
	if (toBeBroken == Blocks.lava) { return; }
	if (toBeBroken == Blocks.flowing_lava) { return; }
	if (toBeBroken == Blocks.obsidian) { return; }
	if (toBeBroken == Blocks.mob_spawner) { return; }

	// Crashing blocks: Redstone Lamp, Extended Piston
	// They're likely trying to drop things that cannot be dropped (active states of themselves)

	//WorldSettings.GameType gametype = WorldSettings.GameType.getByName("survival");
	WorldSettings.GameType gametype = world.getWorldInfo().getGameType();
	BlockEvent.BreakEvent event = ForgeHooks.onBlockBreakEvent(world, gametype, player, x, y, z);

	if (event.isCanceled()) { return; }	// Not allowed to do this

	//toBeBroken.dropBlockAsItem(world, x, x, z, meta, 0);	// The last one is Fortune

	boolean removalSuccess = world.setBlockToAir(x, y, z);
	if (removalSuccess) { toBeBroken.onBlockDestroyedByPlayer(world, x, y, z, meta); }

	Item preBlockItem = toBeBroken.getItemDropped(meta, player.getRNG(), 0);

	if (preBlockItem == null) { return; }	// Item doesn't exist

	ItemStack blockItem = new ItemStack(preBlockItem);

	blockItem.setItemDamage(meta);

	EntityItem entityItem = new EntityItem(world, x, y + 0.5d, z, blockItem);
	entityItem.delayBeforeCanPickup = 10;

	world.spawnEntityInWorld(entityItem);
}
 
Example 6
Project: DecompiledMinecraft   File: EntityDragon.java   View Source Code Vote up 4 votes
/**
 * 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;
}
 
Example 7
Project: minecraft-quiverbow   File: RedLight.java   View Source Code Vote up 4 votes
@Override
public void onImpact(MovingObjectPosition target)
{
	if (target.entityHit != null) 		// We hit a living thing!
   	{		
		// Damage
		target.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.shootingEntity), (float)this.damage);
           target.entityHit.hurtResistantTime = 0;	// No immunity frames
           this.targetsHit += 1;					// Punched through one more entity
           
           // Bonus
           EntityLightningBolt bolt = new EntityLightningBolt(this.worldObj, target.entityHit.posX, target.entityHit.posY, target.entityHit.posZ);
           this.worldObj.addWeatherEffect(bolt);
       }
	else
	{
		// Let's blast through terrain on hit
		
		int x = target.blockX;
		int y = target.blockY;
		int z = target.blockZ;
		
		Block toBeBroken = this.worldObj.getBlock(x, y, z);
		int meta = this.worldObj.getBlockMetadata(x, y, z);
		
		boolean breakThis = true;
		
		if (toBeBroken.getHarvestLevel(meta) > 1) 
		{ 
			breakThis = false; 
			this.targetsHit += 1;	// Thicker materials
		}
		
		if (toBeBroken.getHarvestLevel(meta) > 2) 
		{ 
			breakThis = false; 
			this.targetsHit += 2;	// Even thicker materials
		}
		
		if (toBeBroken.getHarvestLevel(meta) > 3) 
		{ 
			breakThis = false; 
			this.targetsHit += 3;	// Super thick material
		}
		
    	if (toBeBroken.getMaterial() == Material.water) { breakThis = false; }
    	
    	if (toBeBroken == Blocks.water) { breakThis = false; }
    	if (toBeBroken == Blocks.flowing_water) { breakThis = false; }
    	
    	if (toBeBroken == Blocks.obsidian) 
    	{ 
    		breakThis = false; 
    		this.targetsHit += 2;	// Thicker materials
    	}
    	
    	if (toBeBroken == Blocks.iron_block) 
    	{ 
    		breakThis = false; 
    		this.targetsHit += 2;	// Thicker materials
    	}
    	
    	if (breakThis)	// Sorted out all blocks we don't want to break. Checking the rest now
    	{
    		// Glass breaking
        	Helper.tryBlockBreak(this.worldObj, this, target, 3);	// Very Strong
    	}
		
		this.targetsHit += 1;	// Punched through one more block, no matter if we managed to break it
	}
	
	// SFX
	NetHelper.sendParticleMessageToAllPlayers(this.worldObj, this.getEntityId(), (byte) 10, (byte) 2);
	this.worldObj.playSoundAtEntity(this, "ambient.weather.thunder", 0.7F, 0.5F);
	
	if (this.targetsHit > this.targetsHitMax) { this.setDead(); }	// Went through the maximum, so ending now
}
 
Example 8
Project: DecompiledMinecraft   File: BlockPortal.java   View Source Code Vote up 4 votes
protected int func_150858_a()
{
    label24:

    for (this.field_150862_g = 0; this.field_150862_g < 21; ++this.field_150862_g)
    {
        for (int i = 0; i < this.field_150868_h; ++i)
        {
            BlockPos blockpos = this.field_150861_f.offset(this.field_150866_c, i).up(this.field_150862_g);
            Block block = this.world.getBlockState(blockpos).getBlock();

            if (!this.func_150857_a(block))
            {
                break label24;
            }

            if (block == Blocks.portal)
            {
                ++this.field_150864_e;
            }

            if (i == 0)
            {
                block = this.world.getBlockState(blockpos.offset(this.field_150863_d)).getBlock();

                if (block != Blocks.obsidian)
                {
                    break label24;
                }
            }
            else if (i == this.field_150868_h - 1)
            {
                block = this.world.getBlockState(blockpos.offset(this.field_150866_c)).getBlock();

                if (block != Blocks.obsidian)
                {
                    break label24;
                }
            }
        }
    }

    for (int j = 0; j < this.field_150868_h; ++j)
    {
        if (this.world.getBlockState(this.field_150861_f.offset(this.field_150866_c, j).up(this.field_150862_g)).getBlock() != Blocks.obsidian)
        {
            this.field_150862_g = 0;
            break;
        }
    }

    if (this.field_150862_g <= 21 && this.field_150862_g >= 3)
    {
        return this.field_150862_g;
    }
    else
    {
        this.field_150861_f = null;
        this.field_150868_h = 0;
        this.field_150862_g = 0;
        return 0;
    }
}
 
Example 9
Project: DecompiledMinecraft   File: BlockPistonBase.java   View Source Code Vote up 4 votes
public static boolean canPush(Block blockIn, World worldIn, BlockPos pos, EnumFacing direction, boolean allowDestroy)
{
    if (blockIn == Blocks.obsidian)
    {
        return false;
    }
    else if (!worldIn.getWorldBorder().contains(pos))
    {
        return false;
    }
    else if (pos.getY() >= 0 && (direction != EnumFacing.DOWN || pos.getY() != 0))
    {
        if (pos.getY() <= worldIn.getHeight() - 1 && (direction != EnumFacing.UP || pos.getY() != worldIn.getHeight() - 1))
        {
            if (blockIn != Blocks.piston && blockIn != Blocks.sticky_piston)
            {
                if (blockIn.getBlockHardness(worldIn, pos) == -1.0F)
                {
                    return false;
                }

                if (blockIn.getMobilityFlag() == 2)
                {
                    return false;
                }

                if (blockIn.getMobilityFlag() == 1)
                {
                    if (!allowDestroy)
                    {
                        return false;
                    }

                    return true;
                }
            }
            else if (((Boolean)worldIn.getBlockState(pos).getValue(EXTENDED)).booleanValue())
            {
                return false;
            }

            return !(blockIn instanceof ITileEntityProvider);
        }
        else
        {
            return false;
        }
    }
    else
    {
        return false;
    }
}
 
Example 10
Project: DecompiledMinecraft   File: EntityDragon.java   View Source Code Vote up 4 votes
/**
 * 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;
}
 
Example 11
Project: minecraft-quiverbow   File: FlintDust.java   View Source Code Vote up 4 votes
@Override
public void onImpact(MovingObjectPosition target)
{
	if (target.entityHit != null) 		// We hit a living thing!
   	{		
		// Damage
		target.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.shootingEntity), (float)this.damage);
       }
	else	// Hit the terrain
   	{
   		Block block = this.worldObj.getBlock(target.blockX, target.blockY, target.blockZ);            
           int meta = this.worldObj.getBlockMetadata(target.blockX, target.blockY, target.blockZ);
           
           boolean breakThis = true;
           
           // Checking here against invalid blocks
       	if (block == Blocks.bedrock) { breakThis = false; }
       	else if (block == Blocks.water) { breakThis = false; }
       	else if (block == Blocks.flowing_water) { breakThis = false; }
       	else if (block == Blocks.lava) { breakThis = false; }
       	else if (block == Blocks.flowing_lava) { breakThis = false; }
       	else if (block == Blocks.obsidian) { breakThis = false; }
       	else if (block == Blocks.mob_spawner) { breakThis = false; }
       	
       	else if (block.getMaterial() == Material.water) { breakThis = false; }
       	else if (block.getMaterial() == Material.lava) { breakThis = false; }
       	else if (block.getMaterial() == Material.air) { breakThis = false; }
       	else if (block.getMaterial() == Material.portal) { breakThis = false; }
       	
       	else if (block.getHarvestLevel(meta) > 0) { breakThis = false; }
       	else if (block.getBlockHardness(this.worldObj, target.blockX, target.blockY, target.blockZ) > 3) { breakThis = false; }
       	
       	if (this.shootingEntity instanceof EntityPlayerMP)
       	{
       		WorldSettings.GameType gametype = this.worldObj.getWorldInfo().getGameType();
           	BlockEvent.BreakEvent event = ForgeHooks.onBlockBreakEvent(this.worldObj, gametype, (EntityPlayerMP) this.shootingEntity, target.blockX, target.blockY, target.blockZ);
              
           	if (event.isCanceled()) { breakThis = false; }	// Not allowed to do this
       	}
           
           if (breakThis)	// Nothing preventing us from breaking this block!
           {            	
           	this.worldObj.setBlockToAir(target.blockX, target.blockY, target.blockZ);
           	block.dropBlockAsItem(this.worldObj, target.blockX, target.blockY, target.blockZ, meta, 0);
           }
   	}
	
	// SFX
	for (int i = 0; i < 4; ++i) { this.worldObj.spawnParticle("smoke", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D); }
	this.worldObj.playSoundAtEntity(this, Block.soundTypeGravel.getBreakSound(), 1.0F, 1.0F);
	
	this.setDead();	// Hit something, so begone.
}
 
Example 12
Project: DecompiledMinecraft   File: BlockPortal.java   View Source Code Vote up 4 votes
protected int func_150858_a()
{
    label24:

    for (this.field_150862_g = 0; this.field_150862_g < 21; ++this.field_150862_g)
    {
        for (int i = 0; i < this.field_150868_h; ++i)
        {
            BlockPos blockpos = this.field_150861_f.offset(this.field_150866_c, i).up(this.field_150862_g);
            Block block = this.world.getBlockState(blockpos).getBlock();

            if (!this.func_150857_a(block))
            {
                break label24;
            }

            if (block == Blocks.portal)
            {
                ++this.field_150864_e;
            }

            if (i == 0)
            {
                block = this.world.getBlockState(blockpos.offset(this.field_150863_d)).getBlock();

                if (block != Blocks.obsidian)
                {
                    break label24;
                }
            }
            else if (i == this.field_150868_h - 1)
            {
                block = this.world.getBlockState(blockpos.offset(this.field_150866_c)).getBlock();

                if (block != Blocks.obsidian)
                {
                    break label24;
                }
            }
        }
    }

    for (int j = 0; j < this.field_150868_h; ++j)
    {
        if (this.world.getBlockState(this.field_150861_f.offset(this.field_150866_c, j).up(this.field_150862_g)).getBlock() != Blocks.obsidian)
        {
            this.field_150862_g = 0;
            break;
        }
    }

    if (this.field_150862_g <= 21 && this.field_150862_g >= 3)
    {
        return this.field_150862_g;
    }
    else
    {
        this.field_150861_f = null;
        this.field_150868_h = 0;
        this.field_150862_g = 0;
        return 0;
    }
}
 
Example 13
Project: DecompiledMinecraft   File: BlockPistonBase.java   View Source Code Vote up 4 votes
public static boolean canPush(Block blockIn, World worldIn, BlockPos pos, EnumFacing direction, boolean allowDestroy)
{
    if (blockIn == Blocks.obsidian)
    {
        return false;
    }
    else if (!worldIn.getWorldBorder().contains(pos))
    {
        return false;
    }
    else if (pos.getY() >= 0 && (direction != EnumFacing.DOWN || pos.getY() != 0))
    {
        if (pos.getY() <= worldIn.getHeight() - 1 && (direction != EnumFacing.UP || pos.getY() != worldIn.getHeight() - 1))
        {
            if (blockIn != Blocks.piston && blockIn != Blocks.sticky_piston)
            {
                if (blockIn.getBlockHardness(worldIn, pos) == -1.0F)
                {
                    return false;
                }

                if (blockIn.getMobilityFlag() == 2)
                {
                    return false;
                }

                if (blockIn.getMobilityFlag() == 1)
                {
                    if (!allowDestroy)
                    {
                        return false;
                    }

                    return true;
                }
            }
            else if (((Boolean)worldIn.getBlockState(pos).getValue(EXTENDED)).booleanValue())
            {
                return false;
            }

            return !(blockIn instanceof ITileEntityProvider);
        }
        else
        {
            return false;
        }
    }
    else
    {
        return false;
    }
}
 
Example 14
Project: BaseClient   File: EntityDragon.java   View Source Code Vote up 4 votes
/**
 * 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;
}
 
Example 15
Project: BaseClient   File: BlockPortal.java   View Source Code Vote up 4 votes
protected int func_150858_a()
{
    label24:

    for (this.field_150862_g = 0; this.field_150862_g < 21; ++this.field_150862_g)
    {
        for (int i = 0; i < this.field_150868_h; ++i)
        {
            BlockPos blockpos = this.field_150861_f.offset(this.field_150866_c, i).up(this.field_150862_g);
            Block block = this.world.getBlockState(blockpos).getBlock();

            if (!this.func_150857_a(block))
            {
                break label24;
            }

            if (block == Blocks.portal)
            {
                ++this.field_150864_e;
            }

            if (i == 0)
            {
                block = this.world.getBlockState(blockpos.offset(this.field_150863_d)).getBlock();

                if (block != Blocks.obsidian)
                {
                    break label24;
                }
            }
            else if (i == this.field_150868_h - 1)
            {
                block = this.world.getBlockState(blockpos.offset(this.field_150866_c)).getBlock();

                if (block != Blocks.obsidian)
                {
                    break label24;
                }
            }
        }
    }

    for (int j = 0; j < this.field_150868_h; ++j)
    {
        if (this.world.getBlockState(this.field_150861_f.offset(this.field_150866_c, j).up(this.field_150862_g)).getBlock() != Blocks.obsidian)
        {
            this.field_150862_g = 0;
            break;
        }
    }

    if (this.field_150862_g <= 21 && this.field_150862_g >= 3)
    {
        return this.field_150862_g;
    }
    else
    {
        this.field_150861_f = null;
        this.field_150868_h = 0;
        this.field_150862_g = 0;
        return 0;
    }
}
 
Example 16
Project: BaseClient   File: BlockPistonBase.java   View Source Code Vote up 4 votes
public static boolean canPush(Block blockIn, World worldIn, BlockPos pos, EnumFacing direction, boolean allowDestroy)
{
    if (blockIn == Blocks.obsidian)
    {
        return false;
    }
    else if (!worldIn.getWorldBorder().contains(pos))
    {
        return false;
    }
    else if (pos.getY() >= 0 && (direction != EnumFacing.DOWN || pos.getY() != 0))
    {
        if (pos.getY() <= worldIn.getHeight() - 1 && (direction != EnumFacing.UP || pos.getY() != worldIn.getHeight() - 1))
        {
            if (blockIn != Blocks.piston && blockIn != Blocks.sticky_piston)
            {
                if (blockIn.getBlockHardness(worldIn, pos) == -1.0F)
                {
                    return false;
                }

                if (blockIn.getMobilityFlag() == 2)
                {
                    return false;
                }

                if (blockIn.getMobilityFlag() == 1)
                {
                    if (!allowDestroy)
                    {
                        return false;
                    }

                    return true;
                }
            }
            else if (((Boolean)worldIn.getBlockState(pos).getValue(EXTENDED)).booleanValue())
            {
                return false;
            }

            return !(blockIn instanceof ITileEntityProvider);
        }
        else
        {
            return false;
        }
    }
    else
    {
        return false;
    }
}
 
Example 17
Project: BaseClient   File: EntityDragon.java   View Source Code Vote up 4 votes
/**
 * 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;
}
 
Example 18
Project: BaseClient   File: ItemPickaxe.java   View Source Code Vote up 4 votes
/**
 * Check whether this Item can harvest the given Block
 */
public boolean canHarvestBlock(Block blockIn)
{
    return blockIn == Blocks.obsidian ? this.toolMaterial.getHarvestLevel() == 3 : (blockIn != Blocks.diamond_block && blockIn != Blocks.diamond_ore ? (blockIn != Blocks.emerald_ore && blockIn != Blocks.emerald_block ? (blockIn != Blocks.gold_block && blockIn != Blocks.gold_ore ? (blockIn != Blocks.iron_block && blockIn != Blocks.iron_ore ? (blockIn != Blocks.lapis_block && blockIn != Blocks.lapis_ore ? (blockIn != Blocks.redstone_ore && blockIn != Blocks.lit_redstone_ore ? (blockIn.getMaterial() == Material.rock ? true : (blockIn.getMaterial() == Material.iron ? true : blockIn.getMaterial() == Material.anvil)) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2);
}
 
Example 19
Project: BaseClient   File: BlockPortal.java   View Source Code Vote up 4 votes
protected int func_150858_a()
{
    label24:

    for (this.field_150862_g = 0; this.field_150862_g < 21; ++this.field_150862_g)
    {
        for (int i = 0; i < this.field_150868_h; ++i)
        {
            BlockPos blockpos = this.field_150861_f.offset(this.field_150866_c, i).up(this.field_150862_g);
            Block block = this.world.getBlockState(blockpos).getBlock();

            if (!this.func_150857_a(block))
            {
                break label24;
            }

            if (block == Blocks.portal)
            {
                ++this.field_150864_e;
            }

            if (i == 0)
            {
                block = this.world.getBlockState(blockpos.offset(this.field_150863_d)).getBlock();

                if (block != Blocks.obsidian)
                {
                    break label24;
                }
            }
            else if (i == this.field_150868_h - 1)
            {
                block = this.world.getBlockState(blockpos.offset(this.field_150866_c)).getBlock();

                if (block != Blocks.obsidian)
                {
                    break label24;
                }
            }
        }
    }

    for (int j = 0; j < this.field_150868_h; ++j)
    {
        if (this.world.getBlockState(this.field_150861_f.offset(this.field_150866_c, j).up(this.field_150862_g)).getBlock() != Blocks.obsidian)
        {
            this.field_150862_g = 0;
            break;
        }
    }

    if (this.field_150862_g <= 21 && this.field_150862_g >= 3)
    {
        return this.field_150862_g;
    }
    else
    {
        this.field_150861_f = null;
        this.field_150868_h = 0;
        this.field_150862_g = 0;
        return 0;
    }
}
 
Example 20
Project: BaseClient   File: BlockPistonBase.java   View Source Code Vote up 4 votes
public static boolean canPush(Block blockIn, World worldIn, BlockPos pos, EnumFacing direction, boolean allowDestroy)
{
    if (blockIn == Blocks.obsidian)
    {
        return false;
    }
    else if (!worldIn.getWorldBorder().contains(pos))
    {
        return false;
    }
    else if (pos.getY() >= 0 && (direction != EnumFacing.DOWN || pos.getY() != 0))
    {
        if (pos.getY() <= worldIn.getHeight() - 1 && (direction != EnumFacing.UP || pos.getY() != worldIn.getHeight() - 1))
        {
            if (blockIn != Blocks.piston && blockIn != Blocks.sticky_piston)
            {
                if (blockIn.getBlockHardness(worldIn, pos) == -1.0F)
                {
                    return false;
                }

                if (blockIn.getMobilityFlag() == 2)
                {
                    return false;
                }

                if (blockIn.getMobilityFlag() == 1)
                {
                    if (!allowDestroy)
                    {
                        return false;
                    }

                    return true;
                }
            }
            else if (((Boolean)worldIn.getBlockState(pos).getValue(EXTENDED)).booleanValue())
            {
                return false;
            }

            return !(blockIn instanceof ITileEntityProvider);
        }
        else
        {
            return false;
        }
    }
    else
    {
        return false;
    }
}