Jump to content

Item Won't Damage


cmchenry

Recommended Posts

My item damages for ONE SECOND and then goes right back to being damaged. You'd think it has something to do with client server syncing but it isn't as it is called on both sides.

 

object ItemWateringCan extends Item {

  setRegistryName(DrugMod.modid, "watering_can")
  setUnlocalizedName(DrugMod.modid + ":watering_can")
  setCreativeTab(CreativeTabs.TOOLS)
  setMaxDamage(20)

  override def onItemUse(player: EntityPlayer, world: World, pos: BlockPos, hand: EnumHand, facing: EnumFacing, hitX: Float, hitY: Float, hitZ: Float): EnumActionResult = {
//    if(!world.isRemote) {
//      val blockState = world.getBlockState(pos)
//      if(blockState.getBlock == Blocks.WATER) {
//      } else if (blockState.getBlock == BlockCropPot) {
//        world.setBlockState(pos, BlockCropPot.getDefaultState.withProperty(BlockFarmland.MOISTURE, 7:java.lang.Integer))
//      }
//    }
    println(player.getHeldItem(hand).isItemStackDamageable)
    if(!world.isRemote) {
      player.getHeldItem(hand).damageItem(1, player)
    }
      super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ)
  }

}
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.