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


Java Items.FLINT_AND_STEEL属性代码示例

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


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

示例1: processInteract

@Override
protected boolean processInteract(EntityPlayer player, EnumHand hand)
{
	ItemStack stack = player.getHeldItem(hand);
	if (!stack.isEmpty() && stack.getItem() == Items.FLINT_AND_STEEL)
	{
		this.world.playSound(player, this.posX, this.posY, this.posZ, SoundEvents.ITEM_FLINTANDSTEEL_USE, this.getSoundCategory(), 1.0F, this.rand.nextFloat() * 0.4F + 0.8F);
		player.swingArm(hand);

		if (!this.world.isRemote)
		{
			this.ignite();
			stack.damageItem(1, player);
			return true;
		}
	}
	return super.processInteract(player, hand);
}
 
开发者ID:crazysnailboy,项目名称:Halloween,代码行数:18,代码来源:EntityCreeperween.java

示例2: processInteract

protected boolean processInteract(EntityPlayer player, EnumHand hand)
{
    ItemStack itemstack = player.getHeldItem(hand);

    if (itemstack.getItem() == Items.FLINT_AND_STEEL)
    {
        this.world.playSound(player, this.posX, this.posY, this.posZ, SoundEvents.ITEM_FLINTANDSTEEL_USE, this.getSoundCategory(), 1.0F, this.rand.nextFloat() * 0.4F + 0.8F);
        player.swingArm(hand);

        if (!this.world.isRemote)
        {
            this.ignite();
            itemstack.damageItem(1, player);
            return true;
        }
    }

    return super.processInteract(player, hand);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:19,代码来源:EntityCreeper.java

示例3: onBlockActivated

public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing heldItem, float side, float hitX, float hitY)
{
    ItemStack itemstack = playerIn.getHeldItem(hand);

    if (!itemstack.func_190926_b() && (itemstack.getItem() == Items.FLINT_AND_STEEL || itemstack.getItem() == Items.FIRE_CHARGE))
    {
        this.explode(worldIn, pos, state.withProperty(EXPLODE, Boolean.valueOf(true)), playerIn);
        worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 11);

        if (itemstack.getItem() == Items.FLINT_AND_STEEL)
        {
            itemstack.damageItem(1, playerIn);
        }
        else if (!playerIn.capabilities.isCreativeMode)
        {
            itemstack.func_190918_g(1);
        }

        return true;
    }
    else
    {
        return super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:25,代码来源:BlockTNT.java

示例4: processInteract

protected boolean processInteract(EntityPlayer player, EnumHand hand, @Nullable ItemStack stack)
{
    if (stack != null && stack.getItem() == Items.FLINT_AND_STEEL)
    {
        this.worldObj.playSound(player, this.posX, this.posY, this.posZ, SoundEvents.ITEM_FLINTANDSTEEL_USE, this.getSoundCategory(), 1.0F, this.rand.nextFloat() * 0.4F + 0.8F);
        player.swingArm(hand);

        if (!this.worldObj.isRemote)
        {
            this.ignite();
            stack.damageItem(1, player);
            return true;
        }
    }

    return super.processInteract(player, hand, stack);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:17,代码来源:EntityCreeper.java

示例5: onBlockActivated

public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
{
    if (heldItem != null && (heldItem.getItem() == Items.FLINT_AND_STEEL || heldItem.getItem() == Items.FIRE_CHARGE))
    {
        this.explode(worldIn, pos, state.withProperty(EXPLODE, Boolean.valueOf(true)), playerIn);
        worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 11);

        if (heldItem.getItem() == Items.FLINT_AND_STEEL)
        {
            heldItem.damageItem(1, playerIn);
        }
        else if (!playerIn.capabilities.isCreativeMode)
        {
            --heldItem.stackSize;
        }

        return true;
    }
    else
    {
        return super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:23,代码来源:BlockTNT.java

示例6: onBlockActivated

@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
	final TileCandle candle = (TileCandle) worldIn.getTileEntity(pos);
	if (candle != null) {
		ItemStack heldItem = playerIn.getHeldItem(hand);
		if (!heldItem.isEmpty() && heldItem.getItem() == Items.FLINT_AND_STEEL) {
			heldItem.damageItem(1, playerIn);
			candle.litCandle();
		} else {
			candle.unLitCandle();
		}
	}
	return true;
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:14,代码来源:BlockCandle.java

示例7: ItemRenderTorchGun

public ItemRenderTorchGun()
{
    torchGunModel = new ModelTorchGun();
    rand = new Random();
    flintSteel = new ItemStack(Items.FLINT_AND_STEEL);
    powder = new ItemStack(Items.BLAZE_POWDER);
    torch = new ItemStack(Blocks.TORCH);
}
 
开发者ID:iChun,项目名称:Torched,代码行数:8,代码来源:ItemRenderTorchGun.java

示例8: processInitialInteract

@Override
public boolean processInitialInteract(EntityPlayer player, EnumHand hand)
{
    if(!world.isRemote && !activating)
    {
        ItemStack is = player.getHeldItem(hand);
        if(is.getItem() == Item.getItemFromBlock(Blocks.TORCH) && getTorches() < 512)
        {
            addTorches(1);
            if(!player.capabilities.isCreativeMode)
            {
                is.shrink(1);
                if(is.isEmpty())
                {
                    player.inventory.mainInventory.set(player.inventory.currentItem, ItemStack.EMPTY);
                }
            }
            player.swingArm(hand);
            return true;
        }
        else if(is.getItem() == Items.GUNPOWDER && getGP() < 512)
        {
            addGP(1);
            if(!player.capabilities.isCreativeMode)
            {
                is.shrink(1);
                if(is.isEmpty())
                {
                    player.inventory.mainInventory.set(player.inventory.currentItem, ItemStack.EMPTY);
                }
            }
            player.swingArm(hand);
            return true;
        }
        else if(is.getItem() == Items.FLINT_AND_STEEL)
        {
            activating = true;
            if(!player.capabilities.isCreativeMode)
            {
                is.setItemDamage(is.getItemDamage() + 1);
            }
            initiator = player;
            player.swingArm(hand);
            return true;
        }
        else if(is.getItem() == Items.GOLD_NUGGET && getSplits() < 16)
        {
            addSplit();
            if(!player.capabilities.isCreativeMode)
            {
                is.shrink(1);
                if(is.isEmpty())
                {
                    player.inventory.mainInventory.set(player.inventory.currentItem, ItemStack.EMPTY);
                }
            }
            player.swingArm(hand);
            return true;
        }
    }
    if(world.isRemote && (player.getHeldItem(hand).getItem() == Item.getItemFromBlock(Blocks.TORCH) || player.getHeldItem(hand).getItem() == Items.GUNPOWDER || player.getHeldItem(hand).getItem() == Items.FLINT_AND_STEEL || player.getHeldItem(hand).getItem() == Items.GOLD_NUGGET))
    {
        player.swingArm(hand);
        return true;
    }
    return false;
}
 
开发者ID:iChun,项目名称:Torched,代码行数:67,代码来源:EntityTorchFirework.java


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