Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.16.5] How to make EnchantedBook go to Custom ItemGroup


Recommended Posts

I making some custom emchantment, and would like them to show up on an Custom ItemGroup, but i don't know where to start, i tried looking into some classes and did some google about it, but can't find anything usefull.

Link to post
Share on other sites

But how can i do that for an enchantment book, for normal items i was able to do that by calling the function "group" as you said, but with the enchantment seems to be different.

Link to post
Share on other sites
  • If you have a custom EnchantmentType, you can use ItemGroup#setRelevantEnchantmentTypes to set which enchanted books are shown there.
  • If you don't (or can't make) a custom EnchantmentType, override the fill method in your ItemGroup and add whatever ItemStacks you want to the list. This won't prevent the books from showing up in other ItemGroups though, which you cannot prevent.
  • Thanks 1
Link to post
Share on other sites
On 3/1/2021 at 5:07 AM, diesieben07 said:
  • If you have a custom EnchantmentType, you can use ItemGroup#setRelevantEnchantmentTypes to set which enchanted books are shown there.
  • If you don't (or can't make) a custom EnchantmentType, override the fill method in your ItemGroup and add whatever ItemStacks you want to the list. This won't prevent the books from showing up in other ItemGroups though, which you cannot prevent.

Thanks, it worked ... I tried the second way, but i'll create an custom EnchantmentType to organize things better.
One last thing ... how i can "rename" the enchantment in the lang file, tried several things and nothing works, the enchantment keeps showing it's registry name

 

Link to post
Share on other sites
2 hours ago, Beethoven92 said:

Show what you tried then. It should be "enchantment.your_mod_id.your_enchantment_id"

That's what i tried:

"enchantment.bunchofthings.grass_walker": "Grass Walker",
"enchantment.grass_walker": "Grass Walker",
"bunchofthings.grass_walker": "Grass Walker",

But when in an enchantment item GUI it shows "grass_walker I", "grass_walker II" and so on. 

Link to post
Share on other sites

Oh..yeah, the problem is here:

    protected GrassWalkerEnchament() {
        super(Enchantment.Rarity.VERY_RARE, EnchantmentType.ARMOR_FEET, new EquipmentSlotType[] {EquipmentSlotType.FEET});
        this.name = "grass_walker";
    }

You don't need to assign a name to your enchantment using the name field...you already registered your enchantment with your mod id and the enchantment id, thats all the game needs

  • Thanks 1

Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.