Tested on 1.21.4, confirmed to work on 1.21.4.
Commands changed on 1.21.5, will require a different setup for 1.21.5+ sorry, eventually I will get around to supporting it. While some of it works still, certain changes prevent things from working correctly, the custom texture yes, but the enchant no...so made for servers who's base is 1.21.4.
Use custom models and textures from your resource pack on items!
Ok so, this is just the start and does require a bit of work on your end to setup. Implementing the plugin (Not ready for live servers yet) just drop it in. Done.
I'm not making this fancy right now sorry, I will do my best to explain this early use case.
This is a working command, simplifying the process of entering more complicated native commands.
The simplest use case of the command:
Code (Text):
/igive playername enchanted_book aqua_affinity_1
What this will do is give you the enchanted_book but it also tells it to present the custom_model_data string model version aqua_affinity_1.
So lets say you have a resource pack
assets/minecraft
in that you need a few things:
so first off for the example enchanted_book command to work
/assets/minecraft/items/enchanted_book.json
which would contain
Code (Text):
{
"model": {
"type": "select",
"property": "custom_model_data",
"fallback": {
"type": "model",
"model": "item/enchanted_book"
},
"cases": [
{
"when": "aqua_affinity_1",
"model": {
"type": "model",
"model": "item/enchanted_books/aqua_affinity_1"
}
}
]
}
}
Perfect.
Now you would also need the json it targets which is
/assets/minecraft/models/item/enchanted_books/aqua_affinity_1.json
the code being:
Code (Text):
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "minecraft:item/enchanted_books/aqua_affinity_1"
}
}
Perfect!
Now this targets the custom texture which is in
/assets/minecraft/textures/item/enchanted_books/aqua_affinity_1.png
If you have all of those setup correctly the command should give you an enchanted_book with the custom texture that the custom json is targeting.
Now the first thing I did was ensure you could also add lore lines via the /igive command.
The valid colors being:
Code (Text):
Set<String> validColors = Set.of(
"black", "dark_blue", "dark_green", "dark_aqua", "dark_red", "dark_purple",
"gold", "gray", "dark_gray", "blue", "green", "aqua", "red", "light_purple",
"yellow", "white"
);
So you would enter:
Code (Text):
/igive playername enchanted_book aqua_affinity_1 "Extended Breath|blue" "AnotherLoreLine|red"
Then that enchanted book cannot be used at an anvil (no enchantment) so I added a way to do that.
Code (Text):
/igive playername enchanted_book aqua_affinity_1 enchant.level.aqua_affinity.1 "LoreLine|gold"
That will give you the enchanted book with the custom model and texture and the enchantment on it.
I will improve the clarity of this plugins use-case later on as I solidify it more. That is it for now, which should allow pretty much any custom model/texture to be used at least.
Really it's all adjustable so let's say you had a custom mace setup instead
Code (Text):
/igive playername mace defined_custom_model_from_mace_json "LoreLine|dark_blue" enchant.level.breach.1
Then serve the custom resource-pack as you normally would and bam should work.
Target and test was on 1.21.4, you will have to test for others, not set to allow less than 1.21 but may be 1.21.4 specific.
Note: I do plan to update this a bunch and add a config/etc to make things easier eventually.