Posted July 15, 20187 yr 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) } }
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.