本文整理汇总了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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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;
}
示例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);
}
示例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;
}