Guest User

EntityModel

a guest
Aug 3rd, 2021
15
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package io.github.choiceisme.client.entity.model;
  2.  
  3. import com.mojang.blaze3d.matrix.MatrixStack;
  4. import com.mojang.blaze3d.vertex.IVertexBuilder;
  5. import io.github.choiceisme.common.entity.ExampleEntity;
  6. import net.minecraft.client.renderer.entity.model.EntityModel;
  7. import net.minecraft.client.renderer.model.ModelRenderer;
  8. import net.minecraft.entity.EntityType;
  9. import net.minecraft.world.World;
  10.  
  11. public class ExampleEntityModel <T extends ExampleEntity> extends EntityModel<T> {
  12. private final ModelRenderer body;
  13. private final ModelRenderer rotation;
  14. private final ModelRenderer penguin;
  15. private final ModelRenderer body_sub_2;
  16.  
  17. public ExampleEntityModel() {
  18. texWidth = 32;
  19. texHeight = 32;
  20.  
  21. body = new ModelRenderer(this);
  22. body.setPos(0.0F, 16.0F, 0.0F);
  23.  
  24.  
  25. rotation = new ModelRenderer(this);
  26. rotation.setPos(0.0F, 0.0F, 0.0F);
  27. body.addChild(rotation);
  28. setRotationAngle(rotation, 1.5708F, 0.0F, 0.0F);
  29.  
  30.  
  31. penguin = new ModelRenderer(this);
  32. penguin.setPos(0.0F, 0.0F, 0.0F);
  33. rotation.addChild(penguin);
  34. setRotationAngle(penguin, -1.5708F, 0.0F, 0.0F);
  35. penguin.setTexSize(0, 1).addBox(-3.0F, 8.0F, -3.0F, 1.0F, 0.0F, 1.0F, 0.0F, false);
  36. penguin.setTexSize(0, 0).addBox(0.0F, 8.0F, -3.0F, 1.0F, 0.0F, 1.0F, 0.0F, false);
  37. penguin.setTexSize(16, 8).addBox(-2.0F, 3.0F, -3.0F, 2.0F, 1.0F, 1.0F, 0.0F, false);
  38. penguin.setTexSize(0, 18).addBox(2.0F, 3.0F, -1.0F, 1.0F, 5.0F, 2.0F, 0.0F, true);
  39. penguin.setTexSize(0, 8).addBox(-4.0F, 1.0F, -2.0F, 6.0F, 3.0F, 4.0F, 0.0F, false);
  40. penguin.setTexSize(0, 15).addBox(-4.0F, 0.0F, -1.0F, 6.0F, 1.0F, 2.0F, 0.0F, false);
  41. penguin.setTexSize(16, 2).addBox(-3.0F, 0.0F, 1.0F, 4.0F, 1.0F, 1.0F, 0.0F, false);
  42. penguin.setTexSize(16, 0).addBox(-3.0F, 0.0F, -2.0F, 4.0F, 1.0F, 1.0F, 0.0F, false);
  43. penguin.setTexSize(0, 0).addBox(-4.0F, 4.0F, -2.0F, 6.0F, 4.0F, 4.0F, 0.0F, false);
  44.  
  45. body_sub_2 = new ModelRenderer(this);
  46. body_sub_2.setPos(0.0F, 0.0F, 0.0F);
  47. penguin.addChild(body_sub_2);
  48. body_sub_2.setTexSize(14, 16).addBox(-5.0F, 3.0F, -1.0F, 1.0F, 5.0F, 2.0F, 0.0F, false);
  49. }
  50.  
  51. public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
  52. modelRenderer.xRot = x;
  53. modelRenderer.yRot = y;
  54. modelRenderer.zRot = z;
  55. }
  56.  
  57.  
  58. @Override
  59. public void renderToBuffer(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay,
  60. float red, float green, float blue, float alpha) {
  61. penguin.render(matrixStack, buffer, packedLight, packedOverlay);
  62. body_sub_2.render(matrixStack, buffer, packedLight, packedOverlay);
  63. rotation.render(matrixStack, buffer, packedLight, packedOverlay);
  64. body.render(matrixStack, buffer, packedLight, packedOverlay);
  65.  
  66.  
  67. }
  68.  
  69. @Override
  70. public void setupAnim(T arg0, float arg1, float arg2, float arg3, float arg4,
  71. float arg5) {
  72.  
  73. }
  74.  
  75. }
RAW Paste Data