oddlama / vane

Immersive and lore friendly enhancements for vanilla Minecraft
MIT License
270 stars 32 forks source link

Feature: Add the ability to add enchantments via command. #13

Closed jacklollz2 closed 3 years ago

jacklollz2 commented 3 years ago

Let administrators create custom items using vane-enchantments by using a command.

oddlama commented 3 years ago

Nothing prevents you from using /give to give you an item with the correct NBT tag. The only thing vane might do is to check if the enchantment is on a matching tool type. Is this what you want to have changed?

oddlama commented 3 years ago

Not directly in written form, but they all follow the same schema. I am internally using the same enchantment tag as minecraft, just with different IDs. So instead of e.g. minecraft:damage_all you would use vane_enchantments:angel. The naming for the enchantments all follow the same conventions, so lowercase with underscores to separate words. If in doubt, just look at the respective java implementation file.

Example: For HellBent.java you can see the relevant part after the imports: @VaneEnchantment(name = "hell_bent", ...), so the tag would be vane_enchantments:hell_bent.

But as stated in my previous comment, things will probably cease to work if you try to apply these enchantments to vastly different items. Meaning that e.g. soulbound will probably work on any item you put it on, but the hoe-specific enchantments like "Rake" will certainly not work when applied to a stick.

EDIT: Oh and there's the issue that the client doesn't support showing custom enchantments in the normal blue-color form automatically, so vane manually sets the display lore of the item to indicate the presence of a custom enchanment. I.e. you will only see the enchantment name if you either manually set the lore when creating the item, or by letting vane modify the lore (Put the item in an anvil and rename it)

oddlama commented 3 years ago

I've looked into it and made sure that all enchantments only require the correct item when enchanting in-game, and not check this when the enchantment is being used. So technically you could now apply elytra enchantments to any chestplate, but this still won't help because then you can't get into gliding mode. Nonetheless, the restrictions are now as loose as possible.

akb5566 commented 3 years ago

Hi, I have a similar question to this issue.

I installed this wonderful mods in my paperMC server. Now I need to teach my friends the features added by Vane like sickle, file, XP Bottles, Portal Scrolls, etc. But before that, I first need to test them myself.

I would like to know how to use the /give command to give myself the items added by Vane? (sickle, file, XP Bottles, Portal Scrolls, etc) For example, it would be great if I can use /give @a minecraft:iron_ingot to give myself a Vane item.

I tried searching for items started with vane_ but couldn't find anything. I tried to go through the implementation Java files to find the NBT tag but unfortunately I'm no programmer and couldn't find the answer. Any help will be really appreciated.

Sorry to reply to a close issue, but I think its better than creating a new issue. Thanks in advance!

oddlama commented 3 years ago

The items themselves cannot be registered to minecraft directly at this point in time without breaking the client in various ways, therefore you will not find the items via in minecraft's /give command.

Beginning with minecraft 1.17, you can use the /customitem give item command to give yourself a customitem. Here, item can be something like vane_trifles:diamond_file (Just press tab like /customitem give <TAB> to get a list of all items).

If you want to use the vanilla give command, you can do that too, but the NBT tag is more complicated. To view the correct tag, simply give yourself an item and use data get entity @p SelectedItem to see the full NBT tag of the item. Then you can give that using the vanilla give command.

To enchant an item with vane enchantments, you can use /enchant as an admin in-game. Hold the item in your hand and use tab completion like /enchant <TAB> to view all possible enchantments and select one.

akb5566 commented 3 years ago

Yes, the command /customitem give [vane_item] works great! Thanks you!

Here are some in-game images for future googler

minecraft-vane-customitem1 螢幕截圖 2021-06-27 12 31 06