Posted March 22, 20205 yr Hello, I have run into another small problem. I tried programming my own custom model for my armor (currently only for a helmet), but it gets render bad. It just takes the whole texture defined and "glues" it onto the model, even though I have defined texture offsets and boundaries. Plz help. The code for the model: package com.dpaul.mod.item.armor.model; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import net.minecraft.client.renderer.entity.model.BipedModel; import net.minecraft.client.renderer.model.ModelRenderer; import net.minecraft.entity.LivingEntity; /** * ModelCopperHelmet - DPaulModz Created using Tabula 7.1.0 */ public class CopperHelmetModel extends BipedModel<LivingEntity> { public ModelRenderer shape15; public ModelRenderer shape16; public ModelRenderer shape17; public ModelRenderer shape18; public ModelRenderer shape19; public CopperHelmetModel(float size) { super(size); this.textureWidth = 128; this.textureHeight = 128; this.shape18 = new ModelRenderer(this, 68, 32); this.shape18.setRotationPoint(-4.0F, -8.0F, 4.0F); this.shape18.addBox(-4F, -8F, 4F, 8, 8, 0.5F, size); this.shape16 = new ModelRenderer(this, 18, 32); this.shape16.setRotationPoint(4.0F, -8.0F, -4.0F); this.shape16.addBox(4F, -8F, -4F, 0.5F, 8, 8, size); this.shape15 = new ModelRenderer(this, 0, 32); this.shape15.setRotationPoint(-4.5F, -8.0F, -4.0F); this.shape15.addBox(-4.5F, -8F, -4F, 0.5F, 8, 8, size); this.shape17 = new ModelRenderer(this, 36, 32); this.shape17.setRotationPoint(-4.0F, -8.5F, -4.0F); this.shape17.addBox(-4F, -8.5F, -4F, 8, 0.5F, 8, size); this.shape19 = new ModelRenderer(this, 86, 32); this.shape19.setRotationPoint(-4.0F, -8.0F, -4.5F); this.shape19.addBox(-4F, -8F, -4.5F, 8, 8, 0.5F, size); this.bipedHead.addChild(shape15); this.bipedHead.addChild(shape16); this.bipedHead.addChild(shape17); this.bipedHead.addChild(shape18); this.bipedHead.addChild(shape19); } @Override public void render(MatrixStack matrixStackIn, IVertexBuilder bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) { super.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha); } /** * This is a helper function from Tabula to set the rotation of model parts */ public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { modelRenderer.rotateAngleX = x; modelRenderer.rotateAngleY = y; modelRenderer.rotateAngleZ = z; } } The code for the helmet: package com.dpaul.mod.item.armor; import javax.annotation.Nullable; import com.dpaul.mod.Main; import com.dpaul.mod.item.armor.model.CopperHelmetModel; import net.minecraft.client.renderer.entity.model.BipedModel; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public class CopperHelmet extends ArmorItemBase { public CopperHelmet() { super("copper_helmet", ArmorMaterial.COPPER, EquipmentSlotType.HEAD, new Item.Properties().group(Main.tutorial_item_group)); } @SuppressWarnings("unchecked") @Nullable @Override public <A extends BipedModel<?>> A getArmorModel(LivingEntity entityLiving, ItemStack itemStack, EquipmentSlotType armorSlot, A _default) { CopperHelmetModel model = new CopperHelmetModel(1F); model.bipedHeadwear.showModel = armorSlot == EquipmentSlotType.HEAD; model.isChild = _default.isChild; model.isSneak = _default.isSneak; model.isSitting = _default.isSitting; model.rightArmPose = _default.rightArmPose; model.leftArmPose = _default.leftArmPose; return (A) model; } @Override public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlotType slot, String type) { return "tutorialmod:textures/models/armor/copper_helmet_overlay.png"; } } Image of the rendered model attached.
March 22, 20205 yr That's probably because you didn't align anything relative to the head. When you add something as a child model, everything becomes relative to the that specific renderer and not the entire model. So you have reorient everything in terms of the specific renderer.
July 6, 20205 yr On 3/22/2020 at 2:08 PM, ChampionAsh5357 said: That's probably because you didn't align anything relative to the head. When you add something as a child model, everything becomes relative to the that specific renderer and not the entire model. So you have reorient everything in terms of the specific renderer. I think I am having the same problem with textures but I do not understand how to do this, could you elaborate please?
July 6, 20205 yr 3 hours ago, clearcut said: I think I am having the same problem with textures but I do not understand how to do this, could you elaborate please? Please create your own post with your code, error logs (if any), and examples if you need more to explain your point.
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.