I have tried using the method from the other mob classes like skeleton/zombiepig/witherskeleton and none of them seem to work.
Here's the code i have been using
protected void setEquipmentBasedOnDifficulty(DifficultyInstance difficulty)
{
this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(ModItems.BARBARIAN_SWORD));
}
Which i don't know if your suppose to make any renders in entitybarbarianmodel/render but if you have a solution for this please let me know, Also if you know what to do please post the code for it and don't tell me how to do it because i will most likely mess it up because i'm still kinda new to coding mobs and just started 3 days ago.
I had a problem similar to this, and I was able to fix it, and as a matter of fact simplify the entire code by just extending both the render class and model classes of my mob to ModelBiped
after that I just stole the model code from ModelZombie, and put that in my own model, and then the same thing for my entity's render class, just copy and pasted RenderZombie. Of course you would have to change certain bits of code to your own entity's name, but thats more or less it
after that you can just go into your main Entity class and then add this bit of code;
protected void setEquipmentBasedOnDifficulty(DifficultyInstance difficulty)
{
this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(ModItems.SWORD));
this.setItemStackToSlot(EntityEquipmentSlot.CHEST, new ItemStack(ModItems.CHESTPLATE));
this.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(ModItems.HELMET));
this.setItemStackToSlot(EntityEquipmentSlot.LEGS, new ItemStack(ModItems.LEGGINGS));
this.setItemStackToSlot(EntityEquipmentSlot.FEET, new ItemStack(ModItems.BOOTS));
}
Just replace the Items with whatever you want and it should work just fine.
This is all if your custom entity has the exact same render/model as a zombie, however, im sure you can get this to work with other similar bipedal models. (instead of copy+pasting from zombie classes, use the render and model classes for skeleton, zombie pig, wither skeleton, etc.).
If you have a custom model, then just try to figure out through the biped render and model classes what renders in the weapon.
I have tried using the method from the other mob classes like skeleton/zombiepig/witherskeleton and none of them seem to work.
Here's the code i have been using
protected void setEquipmentBasedOnDifficulty(DifficultyInstance difficulty)
{
this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(ModItems.BARBARIAN_SWORD));
}
Which i don't know if your suppose to make any renders in entitybarbarianmodel/render but if you have a solution for this please let me know, Also if you know what to do please post the code for it and don't tell me how to do it because i will most likely mess it up because i'm still kinda new to coding mobs and just started 3 days ago.
I had a problem similar to this, and I was able to fix it, and as a matter of fact simplify the entire code by just extending both the render class and model classes of my mob to ModelBiped
so basically;
after that I just stole the model code from ModelZombie, and put that in my own model, and then the same thing for my entity's render class, just copy and pasted RenderZombie. Of course you would have to change certain bits of code to your own entity's name, but thats more or less it
after that you can just go into your main Entity class and then add this bit of code;
Just replace the Items with whatever you want and it should work just fine.
This is all if your custom entity has the exact same render/model as a zombie, however, im sure you can get this to work with other similar bipedal models. (instead of copy+pasting from zombie classes, use the render and model classes for skeleton, zombie pig, wither skeleton, etc.).
If you have a custom model, then just try to figure out through the biped render and model classes what renders in the weapon.