#[Solved][1.20.6]Unable to Enchant Custom Pickaxe Item with Vanilla Enchantments

15 messages · Page 1 of 1 (latest)

charred belfry
#

Hello,
I've just started developing Minecraft mods a few days ago, and I'm still trying to understand the basic rules of mod development. I'm afraid some parts of my implementation might be messy, but I would really appreciate your help!
Sorry if this is a basic problem that I just don't understand...

Current Context

I'm developing a mod using Minecraft 1.20.6 with Fabric API, and I'm trying to implement a custom item called AreaBreakerItem. This item behaves similarly to MineAll or tools that break blocks in a specific area, functioning like a pickaxe that breaks multiple blocks at once.
What I want to achieve is to make AreaBreakerItem enchantable just like a vanilla pickaxe, using both enchantment tables and commands.

Problem

Unable to Enchant via Enchantment Table or Commands:
When I attempt to enchant AreaBreakerItem using an enchantment table or the /enchant command, none of the usual vanilla enchantments (e.g., Silk Touch, Efficiency, etc.) are applied.
Strangely enough, I was able to apply a custom enchantment that I created, but vanilla enchantments still fail to work.

Question

How can I modify my AreaBreakerItem so that it can be enchanted with vanilla enchantments (like a standard pickaxe) using both enchantment tables and commands?

Thank you for taking the time to read and help me! Any guidance or suggestions would be greatly appreciated. 🙏

brisk bough
#

did you add it to the correct tags?

#

https://minecraft.wiki/w/Tag see the various "enchantable" tags about 1/4 the way down the list of tags

Minecraft Wiki
Tag

Tags in data packs‌ and behavior packs‌ allow players to group different game elements together.

charred belfry
#

Thank you for your response!

I apologize for my misunderstanding regarding the changes in Minecraft's behavior. I'm still learning the ins and outs of the current specifications. While this may not be a Fabric-specific issue and could be more related to Minecraft itself, I hope it's okay to ask here.

Currently, I've added the following tag setup:

In data/modid/tags/items/enchantable/mining.json
(also tried with mining_loot.json and durability.json):

{
  "replace": false,
  "values": [
    "modid:itemid"
  ]
}

However, it still seems that the enchantment is not being applied correctly.
I'm wondering if my way of defining the tags is appropriate or if there might be something I'm missing.
I apologize for the basic nature of my question, but I would greatly appreciate any guidance you could provide.

Thank you again for your help!

misty cedar
#

wait nvm

#

1.20.6

minor kiln
#

The mining tag is stored in data/minecraft/tags/items/enchantable/mining.json and not data/modid/tags/items/enchantable/mining.json
We're modifying minecraft's tag so that it knows how to enchant, and we're not creating our own tag

#

Ouch, my explanation is so bad lol

#

Hope this helps

charred belfry
#

Thank you!
So, if I understand correctly, it means that instead of creating a data/modid folder, I should be creating a data/minecraft folder and place my tag files there, effectively modifying Minecraft's default tag system rather than creating a completely new tag, right?

minor kiln
#

Basically

#

But you're only modifying one tag and not the system

#

And also, placing your tag in the data/modid directory doesn't actually create a new tag on its own, but rather defines the values of that tag if it is defined by code in the future

charred belfry
#

I understand it well now. Thank you so much!

And with that change, I was able to make the enchantment work.
Thank you so much for your kind explanation—it has been incredibly helpful.
As I'm still a beginner in mod development, I might ask more questions in the future, but I look forward to your support again...!

Thanks again, everyone🤝