Advertisement
Guest User

Untitled

a guest
Aug 31st, 2021
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. ItemRegister class:
  2. public static final RegistryObject<Item> ARMOR = ITEMS.register("armor", () -> new ArmorModel(ArmorMaterial.DIAMOND, EquipmentSlotType.HEAD, (new Item.Properties())));
  3.  
  4. ArmorItem class:
  5. public class ArmorModel extends ArmorItem{
  6.  
  7. public ArmorModel(IArmorMaterial p_i48534_1_, EquipmentSlotType p_i48534_2_, Properties p_i48534_3_) {
  8. super(p_i48534_1_, p_i48534_2_, p_i48534_3_);
  9. }
  10.  
  11. public BipedModel getArmorModel(LivingEntity entity, ItemStack stack, EquipmentSlotType slot, BipedModel defaultModel) {
  12. custom_model model = new custom_model(1.0F);
  13. return model;
  14. }
  15.  
  16. public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlotType slot, String type) {
  17. return "mymod:textures/entity/magic_hat.png";
  18. }
  19. }
  20.  
  21. custom_model class:
  22. public class custom_model extends BipedModel{
  23.  
  24. private ModelRenderer bb_main;
  25.  
  26. public custom_model(float size) {
  27. super(size, 0, 64, 64);
  28. texWidth = 64;
  29. texHeight = 64;
  30.  
  31. bb_main = new ModelRenderer(this);
  32. bb_main.setPos(0.0F, 0.0F, 0.0F);
  33. bb_main.texOffs(0, 0).addBox(1F, 1.0F, 1.0F, 4.0F, 9.0F, 3.0F, 0.0F);
  34.  
  35. this.head.addChild(bb_main);
  36.  
  37. }
  38.  
  39. public void setupAnim(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch){
  40. //previously the render function, render code was moved to a method below
  41. }
  42.  
  43. public void renderToBuffer(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){
  44. super.renderToBuffer(matrixStack, buffer, packedLight, packedOverlay, red, green, blue, alpha);
  45.  
  46. }
  47.  
  48. public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
  49. modelRenderer.xRot = x;
  50. modelRenderer.yRot = y;
  51. modelRenderer.zRot = z;
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement