Started by
_Ness
on
Topic category: Advanced modding
Hi, I'm trying to allow my custom model mob to display the item in its hand, I know this was possible in previous versions, but I can't figure out what lines of the code I need to mess with in order for this to work, can anyone help me please ? Thanks in advance.
I don't think this is currently possible.
you can do it in a fake way by adding the sword or whatever you want in it's hand, however you need a different mob for each item it holds
oops. clarification: add the item in the hand while modeling.
I see what you mean, I'm gonna do it if it really doesn't work, but I was looking at this video https://youtu.be/IMvHFad8dsU , and thought it could be replicable in recent versions...
has a fix been found for custom entity holding a weapon been found?
if you could somehow rip the held item models from say the allay or zombie maybe you could append them to the entity? idk that probably requires typing out scripts instead of procedure blocks. I don't know java code so excuse my lack of knowledge.
I know how, but it requires code:
1. Make your model class implement the ArmedModel interface like so:
public class YourModel extends EntityModel<YourEntity> implements ArmedModel
2. Add these methods to the bottom of your class (make sure they’re still within the last closing brace and also not inside any other methods)
private ModelPart getArm(HumanoidArm arm) {
return (arm == HumanoidArm.LEFT) ? this.left_arm : this.right_arm;
}
@Override
public void translateToHand(HumanoidArm arm, PoseStack stack) {
getArm(arm).translateAndRotate(stack);
}
3. In the
getArm
method, replaceleft_arm
andright_arm
with the names of your arm variables (assuming that’s not what they are already)NOTE: I think this only works with human-ish models (things like zombies, skeletons, etc). If you have a model with arms sized/positioned very differently you’ll probably need custom positioning code, though I’m not sure as I’ve never tried with non human-isn models. No harm in trying yourself though
Feel free to ask me further questions :)
Shoot I forgot something:
4. Go into the entity’s renderer and add this to the constructor under the call to super:
this.addLayer(new ItemInHandLayer<>(this));
Could you make a video tutorial showing how to do this, or at least some images showing where to insert the code, seeing as how whenever I try to do this, the client always ends up with one error or another?
Gonna be honest: I’ve never used mcreator for anything other than a terrible ruby mod I made like 3 years ago lol.
I believe I’ve seen a video tutorial on this at some point but I can’t find it now unfortunately
@a_random_someone is there any way you can send images with the code highlighted? im having a lot of trouble with the placement