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


Java Blocks.obsidian方法代碼示例

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


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

示例1: func_180120_a

import net.minecraft.init.Blocks; //導入方法依賴的package包/類
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;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:18,代碼來源:BlockPortal.java

示例2: onItemUse

import net.minecraft.init.Blocks; //導入方法依賴的package包/類
@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;
}
 
開發者ID:jm-organization,項目名稱:connor41-etfuturum2,代碼行數:23,代碼來源:EndCrystal.java

示例3: doMining

import net.minecraft.init.Blocks; //導入方法依賴的package包/類
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);
}
 
開發者ID:Domochevsky,項目名稱:minecraft-quiverbow,代碼行數:49,代碼來源:PowderKnuckle_Mod.java

示例4: 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

示例5: onImpact

import net.minecraft.init.Blocks; //導入方法依賴的package包/類
@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
}
 
開發者ID:Domochevsky,項目名稱:minecraft-quiverbow,代碼行數:78,代碼來源:RedLight.java

示例6: func_150858_a

import net.minecraft.init.Blocks; //導入方法依賴的package包/類
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;
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:64,代碼來源:BlockPortal.java

示例7: canPush

import net.minecraft.init.Blocks; //導入方法依賴的package包/類
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;
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:54,代碼來源:BlockPistonBase.java

示例8: onImpact

import net.minecraft.init.Blocks; //導入方法依賴的package包/類
@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.
}
 
開發者ID:Domochevsky,項目名稱:minecraft-quiverbow,代碼行數:54,代碼來源:FlintDust.java

示例9: canHarvestBlock

import net.minecraft.init.Blocks; //導入方法依賴的package包/類
/**
 * 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);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:8,代碼來源:ItemPickaxe.java


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