Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Item Won't Damage
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 1
cmchenry

Item Won't Damage

By cmchenry, July 15, 2018 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

cmchenry    0

cmchenry

cmchenry    0

  • Tree Puncher
  • cmchenry
  • Members
  • 0
  • 48 posts
Posted July 15, 2018

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)
  }

}
  • Quote

Share this post


Link to post
Share on other sites

cmchenry    0

cmchenry

cmchenry    0

  • Tree Puncher
  • cmchenry
  • Members
  • 0
  • 48 posts
Posted July 15, 2018

On the post I tried just server to see if it would help and it did not.

  • Quote

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • cadbane86140
      Minecraft: Hunger Games Game #36- Shear FIGHT!

      By cadbane86140 · Posted 55 minutes ago

      Hello There! Today we are back on Hunger Games after a little break but we are finally back! In this episode we are on the good ol' map Survival Games 4 and it ACTUALLY went well for once. Also we have so many great battles on rooftops, small rooms and just out in the open! We also use shears to fight at one point and that was pretty crazy! There are so many hilarious moments in this episode that I know you guys are gonna love! I hope you all enjoy this video and if you did don't forget to like and sub for more Hunger Games in the future!  
    • Sad Whale
      Game crashes whenever I try to increase the RAM

      By Sad Whale · Posted 1 hour ago

      latest.log
    • diesieben07
      Game crashes whenever I try to increase the RAM

      By diesieben07 · Posted 1 hour ago

      In the logs folder of your game directory.
    • Unusualty
      GUI'S and player editing

      By Unusualty · Posted 1 hour ago

      So I'm trying to make a mod that is inspired by Origin's because this mod isn't for forge I was wondering if anyone can help me do something like this where you get a GUI when you join the world where you can select a race that has abilities and down sides to them, I also want to have classes but first I want these race's done so if anyone can help this would be appreciated.
    • Sad Whale
      Game crashes whenever I try to increase the RAM

      By Sad Whale · Posted 1 hour ago

      Would you mind explaining where I can find the debug.log
  • Topics

    • cadbane86140
      0
      Minecraft: Hunger Games Game #36- Shear FIGHT!

      By cadbane86140
      Started 56 minutes ago

    • Sad Whale
      6
      Game crashes whenever I try to increase the RAM

      By Sad Whale
      Started 2 hours ago

    • Unusualty
      0
      GUI'S and player editing

      By Unusualty
      Started 1 hour ago

    • fluiX
      1
      server wont start

      By fluiX
      Started 2 hours ago

    • Luis_ST
      6
      [1.16.5] Help with custom Event

      By Luis_ST
      Started 7 hours ago

  • Who's Online (See full list)

    • CookieLukas
    • LexManos
    • anteos
    • fluiX
    • brok4d
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Item Won't Damage
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community