Procedure to detect when an item is enchanted

Started by Teapot5000 on

Topic category: Help with modding (Java Edition)

Last seen on 23:02, 25. Jul 2024
Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Procedure to detect when an item is enchanted

Since Mcreator does not have any global trigger when an item is enchanted, does anyone know a way procedure to do this? I just want to make another sharpness enchantment without using potion effects or modifiying the damage when an entity is attacked./damaged. 
 

Last seen on 20:37, 26. Jul 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I vaguely remember there's a…
Sun, 12/31/2023 - 01:38

I vaguely remember there's a plugin that adds some additional triggers for enchanting, using an anvil, etc; but I don't recall the name. If you wanted to brute force it, you can also check every item in the player's inventory for an enchanted item using an itemstack iterator.

Last seen on 23:03, 26. Jan 2024
Joined Jan 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
yea its built in omg I found…
Thu, 01/18/2024 - 17:33

yea its built in omg I found the image button lmaooo! ok so basically make a procedure like this:

Last seen on 23:03, 26. Jan 2024
Joined Jan 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
you could also measure this…
Thu, 01/18/2024 - 17:38

you could also measure this and make sure its above level zero like this:
idk what the a thing is about when I uploaded this but just have this run inside a for each item in inventory thing or if your item is custom you can do it on item tick!

Last seen on 23:02, 25. Jul 2024
Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
yeah I think an entity tick…
Thu, 01/18/2024 - 17:39

yeah I think an entity tick iterator will fix it but at the same time will lag a lot since a lot of enchantments are being checked every time and for every item
isnt there a way to get this done by any other way? 

Last seen on 23:03, 26. Jan 2024
Joined Jan 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
also because you asked and I…
Thu, 01/18/2024 - 17:40

also because you asked and I dont wanna spam that other thread more here is how I do attributes:
you gatta make sure the spacing is right and stuff if you are unsure just run the command in a send message to player or print until you get it right, spacings really matter! gl!

Last seen on 23:03, 26. Jan 2024
Joined Jan 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
you would be surprised how…
Thu, 01/18/2024 - 17:44

you would be surprised how much minecraft can do but you can also make it run on "player xp level changes" which would work perfectly and good call on looking for optimizations

Last seen on 20:37, 26. Jul 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yeah, xp level changes might…
Sat, 01/20/2024 - 15:49

Yeah, xp level changes might work, but just keep in mind it might also trigger on death, or from any other mods that drain XP for one reason or another. (And, uh, also that xp level changes includes gaining XP, so you might need a separate player variable to track the player's last xp level so you only trigger when their xp has gone down, not up.)