How do i make an item usable in my offhand

Started by Burnout23 on

Topic category: Help with modding (Java Edition)

Last seen on 17:51, 1. Feb 2024
Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do i make an item usable in my offhand
Tue, 01/23/2024 - 00:33 (edited)

Hi, i made an item that allows me to summon lightning at a location i can see when i right click with it but wanted to make it usable in my offhand as well but its not working and was hoping someone could me understand why   

 

i can expand the procedure in the do sections if needed but those should not be related to the problem

 

 

 

 

 

 

 

 

 

 

Edited by Burnout23 on Tue, 01/23/2024 - 00:33
Last seen on 04:16, 15. Jul 2024
Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm not quite sure why you…
Wed, 01/24/2024 - 05:13

I'm not quite sure why you needed variables to check the item, you could just use the in main/offhand block Instead of the local variable, also if the user has them in both hands it will not register for the second one since they are in an else if, breaking them into 2 if statements would fix that issue. quick tip, when using else if statements if a condition prior was satisfied then it will not continue checking the next else if statements down the chain, so if it is possible for 2 statements to be true at the same time (like in this case) make them both seperate if statements. 

Last seen on 17:51, 1. Feb 2024
Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you i appreciate the…
Wed, 01/24/2024 - 15:26

Thank you i appreciate the help. i didn't need the variable i just did it cause it easier for me to keep things sorted, your solution worked but for some reason the cooldown no longer works when the item is in myoffhand, do you have any ideas as to why that could be?(sorry this only like my 3rd or 4th day modding). and thank you for the tip, i appreciate it

Last seen on 17:51, 1. Feb 2024
Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
nvm think i figured it out,…
Wed, 01/24/2024 - 15:32

nvm think i figured it out, I'm just dumb lol