Use AW models for tool/item textures in other mods
Opened this issue ยท 21 comments
It'd be neat if there was a way (if there isn't already) to use AW models (with AW installed as well) in a mod instead of using standard item textures.
I'm working on a drill mod atm and a user posted a model of a drill they made, and I thought it'd be quite neat if this could be used in place of the item texture by default.
Not sure if this is what you had in mind. Messing about with the idea of adding a drill skin as the API allows it! https://github.com/RiskyKen/Drillify
EDIT
It should allow for the drill head to rotate.
It should allow for the drill head to rotate.
That sounds really cool. It seems like it's pretty much what I want. Would it use that model by default?
Should I go and pull this in as is or should I write it? I compiled it (after fixing line 34 in the drill skin class and removing api. from the Point/Vector3D imports). There was an entry in the equipment library dropdown but no models and the tools had no changes. What do I need to do to get it working? I'll look into it some tomorrow if I'm asking too much - Thanks for trying this for me!
It's not finished yet, just messing around with my API so I know what needs added for it to work. Just waiting for the model so I can see what size the skin needs to be.
You can use that code if you want, it's a bit messy! Will need to wait for a new AW build for the updated API.
Alright, thanks a lot! I'll probably be able to get it for you tomorrow. I've left a post on my thread. He lives in New Zealand and I live in UK, so times don't always exactly line up haha. I'll post it here asap though.
On 1 Aug 2015 11:53 pm, RiskyKen [email protected] wrote:
It's not finished yet, just messing around with my API so I know what needs added for it to work. Just waiting for the model so I can see what size the skin needs to be.
You can use that code if you want, it's a bit messy! Will need to wait for a new AW build for the updated API.
Reply to this email directly or view it on GitHub:
#57 (comment)
Drill skin: http://www.mediafire.com/?rfwm7eacupu7406
Well I have been messing about with this a little today and seems to be working for the most part. Last thing I need to do is finish bow skins, the drills should be able to use the same code bows use to position the arrow for their drill heads.
Am guessing your going to control the speed of the drill head somehow? I just made it spin for a test render.
http://puu.sh/junHL/15b8276b8d.png
http://puu.sh/junIJ/348829a71d.png
Uploaded what I done to my fork.
Damn that is so neat. Drill rotation speed isn't a big deal. It's not like higher tier pickaxes swing faster, it's all about the material, but would be a cool thing. Does it swing when mining?
Thanks for this BTW, I really appreciate it and it looks so cool!
On 8 Aug 2015 11:28 pm, RiskyKen [email protected] wrote:
Well I have been messing about with this a little today and seems to be working for the most part. Last thing I need to do is finish bow skins, the drills should be able to use the same code bows use to position the arrow for their drill heads.
Am guessing your going to control the speed of the drill head somehow? I just made it spin for a test render.
http://puu.sh/junHL/15b8276b8d.png
http://puu.sh/junIJ/348829a71d.png
Uploaded what I done to my fork.
Reply to this email directly or view it on GitHub:
#57 (comment)
Yeah it still swings when mining, not sure how to stop that. Maybe best looking at how other mods stop it.
Thanks for your help. I've got it working pretty much how I want it. When should I load the skins though? You left a comment saying "// TODO Move this into a server side world load event." - Should I do this on an FMLServerStartingEvent to load the skins or did you have something else in mind? The loading of the skins is causing a crash on the server, which I guess is why.
Yes that's the event. AW keeps a skin database for each world, so just now the drill skins only work in the first world the player loads until they restart their client. Using the FMLServerStartingEvent should fix that.
Crash on the server not sure what that's about, maybe need to send me the crash log.
If you don't want normal users making drill skin, you can set isHidden to true in the DrillSkin class.
It should now be posable to access the marker blocks with the API the code here https://github.com/Nentify/Drillify/blob/master/src/main/java/me/nentify/drillify/client/RenderItemDrill.java#L103 manually shifts the drill head into position, you will probably want to replace it with marker block locations also because of Minecraft's backwards rendering the x and y axis on the marker bocks will likely be flipped. I am not sure if the files I put in the resources folder have marker blocks so you will maybe want to check that.
You may also want to add the code I have to render the normal item icon if the model is still loading https://github.com/RiskyKen/Armourers-Workshop/blob/master/src/main/java/riskyken/armourersWorkshop/client/render/item/RenderItemSwordSkin.java#L146-L166 the API should have a way to check if the model is in the cache.
Oh could maybe make an item renderer for the drill head item too and just render the 2nd part of the model for it. Random idea.
That's all I can think of just now. Poke me if you have any issues.
Should I be running loadSkin on both the client and the server? I'm currently doing it in the FMLServerStartingEvent. The skins load correctly in SP and on the server's side (as far as I can tell), but when you log straight into a server, the skins don't show on the client. Going SP > MP fixes this though.
Thanks for your advice though, I'll probably implement the rest.
How would you suggest doing it for now?
I've put this in postInit(Side side), and it seems to work, but it doesn't feel nice.. :P
if (side == Side.CLIENT) {
drillSkinIron = loadSkin("Drill Iron.armour");
drillSkinDiamond = loadSkin("Drill Diamond.armour");
drillSkinObsidian = loadSkin("Drill Obsidian.armour");
}
Ahhhhh yeah that, calling it on both the client and the server should fixed it, but stuff and things... I will need to look and see if their is a better way to fix that.
I would put it in the client proxy. The ISkinPointer's that are returned from the skin loads in the FMLServerStartingEvent don't need to be stored btw. Only the ones on the client need to be stored.
EDIT: I believe there was a vanilla way to send an NBT tag compound from the server to the client, if you can work out what it is or add your own packet manager you can cut away all that hacky code.
What would you put in the client proxy? Is this stupid? :P
ArmourersCommonManager.instance.clientPostInit();
public void serverStarting() {
loadSkin("Drill Iron.armour");
loadSkin("Drill Diamond.armour");
loadSkin("Drill Obsidian.armour");
}
public void clientPostInit() {
drillSkinIron = loadSkin("Drill Iron.armour");
drillSkinDiamond = loadSkin("Drill Diamond.armour");
drillSkinObsidian = loadSkin("Drill Obsidian.armour");
}
Yeah that should work, wish I could think of a better way of doing this, will maybe try and get the API to behave better in the future.
Looks like it's almost done, can't wait to see it in action.