i need help with a code that changes a block

Started by matsieboy2005 on Mon, 04/20/2020 - 10:30

Topic category: Help with modding (Java Edition)

Last seen on 09:32, 23. Apr 2020
Joined Jan 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
i need help with a code that changes a block
Mon, 04/20/2020 - 10:31 (edited)

So i want to make a item that when i rightclick on a block the block changes and the item gets removed form my inventory. Can someone please help me with this? thanks :)

Edited by matsieboy2005 on Mon, 04/20/2020 - 10:31
Last seen on 21:15, 8. Jan 2021
Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Yeah, that's very easy; I…
Fri, 05/15/2020 - 20:51

Yeah, that's very easy; I now do not have my PC to send you, how it should look like, but I will try to explain with words; you even do not need any code, just use "create procedure";

The trigger should be "if player right clicks on block"

Inside you should test for the item, using "item in main hand of provided entity";

Also then set the item in slot of main hand decreased by one;

And finally, set the block to whatever you want using "set block on x y z";

Block, it's xyz and the player who right clicked will come together with the dependencies, so you don't need any special functions for this;

Hope this helps