Disable Enchantment While In Custom Dimension?

Started by StarlightIntermezzo on

Topic category: Help with Minecraft modding (Java Edition)

Joined Dec 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Disable Enchantment While In Custom Dimension?

I'm looking to completely disable magic while in a custom dimension of mine (pardoning armor if it's already equipped most likely), is there a way to stop players from being able to use the enchanting table or use enchanted tools?

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You could pretty easily set…
Fri, 12/29/2023 - 14:18

You could pretty easily set it up to disenchant everything in the player's inventory when entering a custom dimension, but then they'd be disenchanted permanently. I'm not sure if there's a good way to straight up disable enchantments, just because there's so many of them, all of them are hard coded, and each one is a very specific case. (Disabling silk touch is very different and much more complicated than disabling mending.) It's not impossible, but I wouldn't know where to start.

A simpler method might be to just give the player special debuffs for using enchanted equipment. (Mining fatigue if they're using an enchanted tool, weakness if they're using an enchanted weapon, slowness if they're using enchanted armor, etc.) This would just require checking the main hand/off hand/armor slots of the player for enchanted items, and applying the corresponding status effects.