Jump to content

[SOLVED] [1.18.2] How to properly pre-enchant an Item in Creative Inventory?


JimiIT92

Recommended Posts

I made a custom Sword Item that should be always pre-enchanted with a specific enchant set via code.
Right now I am using the Item#inventoryTick method to show the enchantment (kinda how Enchanted Books does). However this means that every tick the Word tries to get enchanted (of course it fails after the first tick where is actually enchanted), so I guess is not ideal.

So what would it be an optimal way to have an enchanted Item in the Creative Inventory where the enchant is not applied every tick?

Edited by JimiIT92
solved

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

11 minutes ago, diesieben07 said:

If allowdedIn (SIC) returns true for the given tab, fill it with whatever stacks you want.

This will make me add "manually" the item stack to the appropriate tab. But if the Item already has a tab set, won't this duplicate it inside the tab?

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

48 minutes ago, diesieben07 said:

That is what allowdedIn checks for.

Didn't know that, I never tried something similar in the past :) Thanks for the explanation :D

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

  • JimiIT92 changed the title to [SOLVED] [1.18.2] How to properly pre-enchant an Item in Creative Inventory?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.