How to break item or playsound.item.break

Started by Fresfries on

Topic category: Help with Minecraft modding (Java Edition)

Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to break item or playsound.item.break

I created an item that gets damaged every time you interact with a slot of a open gui.

Im stuck on making the item break.

I got it so far that every time you interact with a slot it damages the item by 1 and if it reaches max. damage it just disappears, no sound, no particles.

Is there a way to just break the item after 1 durability because the playsound also doesn't work for me.

(this playsound block doesn't play the sound & also makes the code stop working, not matter if I leave it at x, y, z or not).

screenshot

Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I don't think you need…
Mon, 11/15/2021 - 22:29

I don't think you need Position of event target entity

with X Y Z you should be good

Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I've tried that first, still…
Mon, 11/15/2021 - 22:31

I've tried that first, still it breaks the code & doesn't play the sound.
Can I not just make the item break, that would make things easier?

Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This is the full code, if it…
Mon, 11/15/2021 - 22:33

This is the full code, if it helps.

screenshot

Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
yeah by dealing the whole…
Mon, 11/15/2021 - 22:34

yeah by dealing the whole damage of the item. it should play the sound automatically when it breaks if it's a tool

Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
oh wait it can be any item?
Mon, 11/15/2021 - 22:35

oh wait it can be any item?

Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
if yes,  deal 1 damage to…
Mon, 11/15/2021 - 22:38

if yes,

 deal 1 damage to item in main hand of event target entity

  if get damage from item in main hand of event target entity = max possible damage of item in main hand of event target entity

    do play at x y z sound: Item.Break

 

Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Maybe it's a bug because I'm…
Mon, 11/15/2021 - 23:18

Maybe it's a bug because I'm using version 2021.3
I found a work-around by playing a sound by executing a command, not the cleanest way but it'll have to do for now.