Magic

Magic

190k Downloads

Custom Model Data for Wands

zaccieslak opened this issue ยท 14 comments

commented

Greetings again! I looked through all issues that had the word "custom" in it and didn't find the answer, so here I am.

I noticed that the items.yml supports custom model data, which is awesome! But I can't seem to figure out how to get custom model data onto a wand. I'm not even sure how your icons are being pulled from the resource pack, because it doesn't look like they should be haha.

I was wondering if there was a line or two that I could put in a wand .yml that would make the icon/item pull from my resource pack with custom model data (not damage).

Also if a wand's icon could just be taken from a magic item, that would work!

Edit - Just one more thing !! Is it possible to restrict a spell from being used unless they have a pnode set? Or restrict a spell to only be used with one kind of wand?

commented

yeah so this

CMDcommand

creates:

CMDsword14

  • it's super similar to damage, but it's streamlined for 1.14+ and will be the future of custom models in game, replacing the damage variable to items
commented

Like, I have different CMD for many different items. Here's a folder for paper.

You can name the .png's whatever you want, but I have just numbered them numerically and have a google sheet that shows what's what. Going to change it so that the .png files are named what they're supposed to reflect (teleport scrolls/cupcake/etc)

CMDPaper

commented

The .json is the same, it just replaces the oredicate of damage to CustomModelData and gets rid of the damage variable

thejson

So in-game, I would just have to type:

/minecraft:give @p minecraft:paper{CustomModelData:32}

and I would have a paper that looks like a chocolate cupcake.

I have another plugin that uses the re-skinned chocolate cupcake that makes it consumable with custom potion effects/cooldowns/particles/etc.

But yeah, I'll keep trying to see if I can get Magic to recognize CMD

commented

Well that is pretty interesting. I'll try to add a feature that will make use of that straightaway.

commented

Right, then you can have custom models (wands/swords/guns/etc) that have durability - since these items don't rely on damage done to them.

I'll let you know if I find a way to get CMD to work with Magic in the meantime:P

Cheers!

commented

Okay, I think I found out what could be causing it..

So:
Your spell icons are being pulled from the "diamond_axe" and "diamond_hoe" .jsons.
They have this line of code:
"parent" : "item/custom/icon"
^ I'm assuming that this line of code allows the textures to be used in the spell configuration for "icon:" and "icon_disabled:" right? If so, that means that I could make icons for spells in another folder, as long as I have that line of code and follow the same format.

Here's the problem:
"sword_icon:" and "wand_icon" - I see that these are being pulled from golden_sword.json and wooden_hoe.json. When I try to find a "parent" for "sword_icon" and "wand_icon", I can't find anything.

Are "sword_icon" and "wand_icon" only allowed to be used with golden_sword.json and wooden_hoe.json ?

commented

I honestly don't think this is a problem you can solve without code changes. Wand icons can't apply tags like CustomModelData (yet) so you just won't be able to use a resource pack that way.

That said, sorry for the confusion here. The "sword_icon" and "wand_icon" things are not real items nor do they appear in the resource pack. Those are names defined in items.yml as a way to let people quickly change all of the icons used for wands without having to edit every wand. It's just making an alias for wood_hoe so if you /mgive wand_icon you just get a wooden hoe, for instance.

The spell icons are all parented to "icon" which is just a flat square model. The icons then only differ by their texture.

I hope that clears some of this up! I'm working on a way for you to use custom data tags in items, and in the future I would like to switch the RP to use them. (Would have to drop backwards compatibility, so this would be for a future version of Magic 8).

commented

Ok please give this dev build a shot:

http://jenkins.elmakers.com/job/MagicPlugin/2918/com.elmakers.mine.bukkit.plugins$Magic/artifact/com.elmakers.mine.bukkit.plugins/Magic/7.7.7-SNAPSHOT/Magic-7.7.7-SNAPSHOT.jar

I think you should be able to specify icons like this now:
wooden_hoe{CustomModelData:1}

Let me know if that works for you!

commented

Or if you could just explain how you're getting "sword_icon:#"..

I am so lost as to how Magic is pulling icons for wands haha.

I've looked at the borealis default survival wand, and it pulls from the "wand_moon" texture in the custom folder, but in the wands.yml, it says that it's "wand_icon:10". I'm not seeing the correlation between wand_icon:10 and wand_moon that you have in the resource pack.

commented

It is using damage predicates in the resource pack, which lets you assign a different model/texture to a tool depending on that tool's damage level. If you want more info on this, I wrote a tutorial years ago:

https://www.spigotmc.org/wiki/custom-item-models-in-1-9-and-up/

With that in mind, take a look at the wooden hoe model from the RP, this is where all of the predicates are set up to point to the various wand models:

https://github.com/elBukkit/MagicPlugin/blob/master/Magic/src/resource-pack/default/assets/minecraft/models/item/wooden_hoe.json

commented

Is there a way to pull Custom Model Data for wands?

commented

It's all basically in that wooden_hoe.json file, though I may not be understanding what you mean.

commented

So Custom Model Data isn't a damage variable of an item.

1.14 allows us to set Custom Model Data for items so that we don't have to use the damage variable. So I was wondering if Magic wands could pull Custom Model Data instead of damage?**

commented

I don't think I know what custom model data means. Is there a way to create an item in-game that uses it? What do the NBT tags look like? Any documentation available?

I'd love to move away from using damage.