Nozzomi Posted June 19, 2020 Posted June 19, 2020 I'm trying to render a custom helmet and the helmet rotates fine horizontally but it seems that it rotates on the x/z as well when I look vertically. Here's a picture of what's happening: https://imgur.com/a/TOYUDqb Item class: public class MythusArmorVar2 extends ArmorItem { public MythusArmorVar2(IArmorMaterial mat, EquipmentSlotType slot) { super(mat, slot, new Properties().group(Mythus.MYTHUS_TAB)); } @Nullable @Override public <A extends BipedModel<?>> A getArmorModel(LivingEntity ent, ItemStack stack, EquipmentSlotType slot, A _default) { if(!stack.isEmpty()) { if(stack.getItem() instanceof ArmorItem) { KabutoHelmModel helm_model = new KabutoHelmModel(1); helm_model.bipedHead.showModel = slot == EquipmentSlotType.HEAD; helm_model.isChild = _default.isChild; helm_model.isSneak = _default.isSneak; helm_model.isSitting = _default.isSitting; helm_model.rightArmPose = _default.rightArmPose; helm_model.leftArmPose = _default.leftArmPose; return (A) helm_model; } } return null; } } Model Class: public class KabutoHelmModel extends BipedModel<LivingEntity> { private final ModelRenderer basehelm; public KabutoHelmModel(float scale) { super(scale,0, 64, 64); textureWidth = 64; textureHeight = 64; basehelm = new ModelRenderer(this); basehelm.setRotationPoint(0.0F, 24.0F, 0.0F); basehelm.setTextureOffset(34, 0).addBox(-4.0F, -32.0F, -5.0F, 8.0F, 4.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(26, 16).addBox(4.0F, -32.0F, -4.0F, 1.0F, 4.0F, 8.0F, 0.0F, false); basehelm.setTextureOffset(23, 0).addBox(5.0F, -28.0F, -4.0F, 1.0F, 2.0F, 9.0F, 0.0F, false); basehelm.setTextureOffset(5, 25).addBox(4.0F, -30.0F, -5.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(60, 0).addBox(2.0F, -28.0F, -5.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(36, 16).addBox(-3.0F, -28.0F, -5.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(52, 4).addBox(-1.0F, -28.0F, -5.0F, 2.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(36, 21).addBox(-2.0F, -26.0F, -5.0F, 4.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(48, 9).addBox(1.0F, -27.0F, -5.0F, 1.0F, 1.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(53, 0).addBox(-2.0F, -27.0F, -5.0F, 1.0F, 1.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(24, 19).addBox(-5.0F, -30.0F, -5.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(0, 21).addBox(5.0F, -30.0F, -5.0F, 2.0F, 4.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(12, 12).addBox(-7.0F, -30.0F, -5.0F, 2.0F, 4.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(0, 9).addBox(7.0F, -30.0F, -4.0F, 1.0F, 4.0F, 3.0F, 0.0F, false); basehelm.setTextureOffset(0, 0).addBox(-8.0F, -30.0F, -4.0F, 1.0F, 4.0F, 3.0F, 0.0F, false); basehelm.setTextureOffset(0, 21).addBox(-6.0F, -28.0F, -4.0F, 1.0F, 2.0F, 9.0F, 0.0F, false); basehelm.setTextureOffset(0, 9).addBox(-7.0F, -26.0F, -4.0F, 1.0F, 2.0F, 10.0F, 0.0F, false); basehelm.setTextureOffset(28, 16).addBox(-6.0F, -26.0F, 5.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(0, 26).addBox(5.0F, -26.0F, 5.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(28, 3).addBox(-5.0F, -28.0F, 4.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(28, 0).addBox(4.0F, -28.0F, 4.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(12, 12).addBox(6.0F, -26.0F, -4.0F, 1.0F, 2.0F, 10.0F, 0.0F, false); basehelm.setTextureOffset(12, 24).addBox(-5.0F, -32.0F, -4.0F, 1.0F, 4.0F, 8.0F, 0.0F, false); basehelm.setTextureOffset(30, 31).addBox(-4.0F, -32.0F, 4.0F, 8.0F, 4.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(22, 28).addBox(-5.0F, -28.0F, 5.0F, 10.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(24, 11).addBox(-6.0F, -26.0F, 6.0F, 12.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(24, 14).addBox(-3.0F, -29.0F, -6.0F, 6.0F, 1.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(34, 5).addBox(-3.0F, -31.0F, -6.0F, 6.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(24, 0).addBox(-4.0F, -33.0F, -6.0F, 1.0F, 3.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(18, 13).addBox(-5.0F, -35.0F, -6.0F, 1.0F, 3.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(17, 9).addBox(-6.0F, -37.0F, -6.0F, 1.0F, 3.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(22, 24).addBox(3.0F, -33.0F, -6.0F, 1.0F, 3.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(24, 16).addBox(2.0F, -33.0F, -6.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(12, 9).addBox(3.0F, -35.0F, -6.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(5, 9).addBox(4.0F, -37.0F, -6.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(24, 4).addBox(-3.0F, -33.0F, -6.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(4, 16).addBox(-4.0F, -35.0F, -6.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(0, 16).addBox(-5.0F, -37.0F, -6.0F, 1.0F, 2.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(15, 24).addBox(4.0F, -35.0F, -6.0F, 1.0F, 3.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(11, 24).addBox(5.0F, -37.0F, -6.0F, 1.0F, 3.0F, 1.0F, 0.0F, false); basehelm.setTextureOffset(0, 0).addBox(-4.0F, -33.0F, -4.0F, 8.0F, 1.0F, 8.0F, 0.0F, false); basehelm.setTextureOffset(0, 33).addBox(-1.0F, -34.0F, 0.0F, 2.0F, 1.0F, 2.0F, 0.0F, false); this.bipedHead.addChild(basehelm); } @Override public void render(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){ basehelm.setRotationPoint(0.0F, 24.0F, 0.0F); basehelm.render(matrixStack, buffer, packedLight, packedOverlay); } //TODO figure out why it isn't working @Override public void setRotationAngles(LivingEntity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { super.setRotationAngles(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); this.basehelm.copyModelAngles(this.bipedHead); } } Quote
TheGreyGhost Posted June 20, 2020 Posted June 20, 2020 Howdy You might find this link useful - it is a working example of how model rotations work, including an 'interactive' tool for adjusting your model parameters by typing commands- makes it a lot easier to tweak the render translations and rotations. https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe80_model_renderer Off the cuff- the rotation point is probably not correct. i.e. when your head tilts back, the y origin of rotation in your model doesn't correspond to the centre of rotation of the head. -TGG Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.