Jump to content

Custom models


matthew123

Recommended Posts

Greetings! I am totally new to minecraft modding, but I am quite experienced with programming. I have heard that people use a program called BlockBench to create and animate custom models for use within their mod. I have created a model, but I am unsure of what to do in order to integrate it within my mod. 

I am using forge for Minecraft 1.16.5. I aim to have this model be used as a helmet. 

686h0sr.png

 

Any help would be greatly appreciated. 

Link to comment
Share on other sites

Hi!

First make a new "Java Block/Item" model in Blockbench. There you can make your helmet (without player). When you are done, go in the up left to "Paint" and paint your Model. Now go to "Display", select Reference Model "Player" and Slot "Head". Now scale your Model how you want it to look in-game and go in the up left corner to File>Export>Export Block/Item Model

 

Sorry if my Posts are weird sometimes, I just try to help and learn as much as I can :D

Also: PLEASE use SPOILERS for logs!

Link to comment
Share on other sites

20 hours ago, OutCraft said:

Hi!

First make a new "Java Block/Item" model in Blockbench. There you can make your helmet (without player). When you are done, go in the up left to "Paint" and paint your Model. Now go to "Display", select Reference Model "Player" and Slot "Head". Now scale your Model how you want it to look in-game and go in the up left corner to File>Export>Export Block/Item Model

 

Hi there! Unfortunately, that would only work for the model of the item. I have solved most issues, though, and I am getting closer to a working solution. The issue is that there are some extra faces rendering, and I do not know what is causing them to appear.

 

7O3tv7m.png

public class ModelTest extends EntityModel<Entity> {
    private final ModelRenderer Head;

    public ModelTest() {
        texWidth = 16;
        texHeight = 16;

        Head = new ModelRenderer(this);
        Head.setPos(0.0F, 0.0F, 0.0F);
        Head.texOffs(0, 1).addBox(-4.0F, -7.0F, -4.01F, 8.0F, 1.0F, 0.0F, 0.0F, false);
        Head.texOffs(0, 1).addBox(4.01F, -7.0F, -4.0F, 0.0F, 1.0F, 8.0F, 0.0F, false);
        Head.texOffs(0, 0).addBox(-4.0F, -7.0F, 4.01F, 8.0F, 1.0F, 0.0F, 0.0F, false);
        Head.texOffs(0, 0).addBox(-4.01F, -7.0F, -4.0F, 0.0F, 1.0F, 8.0F, 0.0F, false);
        Head.texOffs(0, 2).addBox(-1.0F, -7.0F, -4.3F, 2.0F, 1.0F, 1.0F, 0.0F, false);
    }
    @Override
    public void setupAnim(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
        // previously the render function, render code was moved to a method below
    }

    @Override
    public void renderToBuffer(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green,
                               float blue, float alpha) {
        Head.render(matrixStack, buffer, packedLight, packedOverlay);
    }

    public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
        modelRenderer.xRot = x;
        modelRenderer.yRot = y;
        modelRenderer.zRot = z;
    }

    public void setRotationAngles(Entity e, float f, float f1, float f2, float f3, float f4) {
        this.Head.yRot = f3 / (180F / (float) Math.PI);
        this.Head.yRot = f4 / (180F / (float) Math.PI);
    }

    public ModelRenderer GetHead() { return Head; }
}
public class ItemTest extends ArmorItem {
    public ItemTest(IArmorMaterial p_i48534_1_, EquipmentSlotType p_i48534_2_, Properties p_i48534_3_) {
        super(ArmorMaterial.IRON, EquipmentSlotType.HEAD, new Item.Properties());
    }

    @Override
    @OnlyIn(Dist.CLIENT)
    public BipedModel getArmorModel(LivingEntity living, ItemStack stack, EquipmentSlotType slot, BipedModel defaultModel) {
        BipedModel armorModel = new BipedModel(1);
        ModelTest modelTest = new ModelTest();
        armorModel.head = modelTest.GetHead();
        armorModel.crouching = living.isCrouching();
        armorModel.riding = defaultModel.riding;
        //armorModel.isChild = living.isChild(); ??
        return armorModel;
    }

    @Override
    public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlotType slot, String type) {
        return "modtest:textures/models/armor/tex.png";
    }
}

 

Link to comment
Share on other sites

4 hours ago, OutCraft said:

Hi!

Do you want to make a custom entity hat looks like this or a helmet that looks like the blue part on top of Steves head?

 686h0sr.png

The latter. I have been almost successful, but I am getting some artifacts.

7O3tv7m.png

Deleting part of the texture made them disappear:

WmNuREy.png

 

Do you know what could be causing this?

Link to comment
Share on other sites

How do You want it to look in-game?

Take this Model, go in the up right to "Display", select Slot "Head" and scale it until it looks how you want it in-game. Then send the link or a picture of how it should look

Sorry if my Posts are weird sometimes, I just try to help and learn as much as I can :D

Also: PLEASE use SPOILERS for logs!

Link to comment
Share on other sites

5 hours ago, OutCraft said:

How do You want it to look in-game?

Take this Model, go in the up right to "Display", select Slot "Head" and scale it until it looks how you want it in-game. Then send the link or a picture of how it should look

Greetings! The model was scaled correctly. This is how it should look like in-game:

EXHVuJU.png

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.