Re-supplying item problem.

Started by TheDuckKnight_Mc on Mon, 11/23/2020 - 07:51

Topic category: Help with modding (Java Edition)

Last seen on 14:37, 25. Jan 2021
Joined Feb 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Re-supplying item problem.
Mon, 11/23/2020 - 07:51

I tried to make an item that would be useful for building. It has 5 inventory slots and if held in off-hand, it would re-supply the block that was just placed by the player holding it, if there is at least one of that block in the inventory of the item. But thing is, everything somewhat works, but it supplies the player with more than wanted. 1 block is placed, 1 is removed from the item's inventory, but the player gets 2. I'm going to include a picture of the procedure I'm using, so people can help me catch errors and make a new one. If anyone is willing to help, please do so.

Picture of current procedure: https://imgur.com/a/Ld9H7R2

 

Thanks in advance!

Last seen on 10:06, 25. Jan 2021
Joined Jul 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
simple answer is some…
Mon, 11/23/2020 - 08:53

simple answer is some triggers are activated twice because they are done both on client and on server.

Last seen on 10:06, 25. Jan 2021
Joined Jul 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
the only fix i know of for…
Mon, 11/23/2020 - 09:16

the only fix i know of for now is in the procedure at the top put an if statement and put all the other procedures under it and have it do this. 
if get number of items in mainhand < 2 

do

"code here"

Last seen on 14:37, 25. Jan 2021
Joined Feb 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
That might work well for…
Mon, 11/23/2020 - 10:13

That might work well for what I had in mind, thanks!