Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I'm trying to render a custom [chestplate] but it won't work properly. I made the code using Tabula mod, but what happens is that the rendered parts connected to the arms won't move, they just stay static.

Anything I miss?

 

Model class:

import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.client.renderer.GlStateManager;

public class ModelMSapphireArmor extends ModelBiped {

    public ModelRenderer Chestplate;
    public ModelRenderer ShoulderRight;
    public ModelRenderer MegaRight;
    public ModelRenderer MegaRight_1;
    public ModelRenderer MegaRight_2;

    public ModelMSapphireArmor() {
        this.textureWidth = 128;
        this.textureHeight = 128;
        this.MegaRight = new ModelRenderer(this, 110, 32);
        this.MegaRight.setRotationPoint(-3.0F, -2.0F, -2.0F);
        this.MegaRight.addBox(-9.0F, -4.8F, 0.9F, 2, 3, 2, 0.0F);
        this.MegaRight_1 = new ModelRenderer(this, 92, 32);
        this.MegaRight_1.setRotationPoint(-3.0F, -2.0F, -2.0F);
        this.MegaRight_1.addBox(-7.0F, -0.1F, 0.1F, 3, 3, 4, 0.0F);
        this.ShoulderRight = new ModelRenderer(this, 74, 42);
        this.ShoulderRight.setRotationPoint(-3.0F, -2.0F, -2.0F);
        this.ShoulderRight.addBox(-8.5F, 3.6F, -1.0F, 8, 10, 8, 0.0F);
        this.Chestplate = new ModelRenderer(this, 73, -4);
        this.Chestplate.setRotationPoint(-4.0F, 0.0F, -2.0F);
        this.Chestplate.addBox(-1.7F, 0.0F, -1.0F, 16, 22, 8, 0.0F);
        this.MegaRight_2 = new ModelRenderer(this, 76, 32);
        this.MegaRight_2.setRotationPoint(-3.0F, -2.0F, -2.0F);
        this.MegaRight_2.addBox(-8.5F, -2.5F, 0.5F, 3, 3, 3, 0.0F);

        this.bipedBody.addChild(Chestplate);
        this.bipedRightArm.addChild(ShoulderRight);
        this.bipedRightArm.addChild(MegaRight);
        this.bipedRightArm.addChild(MegaRight_1);
        this.bipedRightArm.addChild(MegaRight_2);
    }

    @Override
    public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
        this.MegaRight.render(f5);
        this.MegaRight_1.render(f5);
        GlStateManager.pushMatrix();
        GlStateManager.translate(this.ShoulderRight.offsetX, this.ShoulderRight.offsetY, this.ShoulderRight.offsetZ);
        GlStateManager.translate(this.ShoulderRight.rotationPointX * f5, this.ShoulderRight.rotationPointY * f5, this.ShoulderRight.rotationPointZ * f5);
        GlStateManager.scale(0.65D, 0.55D, 0.7D);
        GlStateManager.translate(-this.ShoulderRight.offsetX, -this.ShoulderRight.offsetY, -this.ShoulderRight.offsetZ);
        GlStateManager.translate(-this.ShoulderRight.rotationPointX * f5, -this.ShoulderRight.rotationPointY * f5, -this.ShoulderRight.rotationPointZ * f5);
        this.ShoulderRight.render(f5);
        GlStateManager.popMatrix();
        GlStateManager.pushMatrix();
        GlStateManager.translate(this.Chestplate.offsetX, this.Chestplate.offsetY, this.Chestplate.offsetZ);
        GlStateManager.translate(this.Chestplate.rotationPointX * f5, this.Chestplate.rotationPointY * f5, this.Chestplate.rotationPointZ * f5);
        GlStateManager.scale(0.65D, 0.55D, 0.7D);
        GlStateManager.translate(-this.Chestplate.offsetX, -this.Chestplate.offsetY, -this.Chestplate.offsetZ);
        GlStateManager.translate(-this.Chestplate.rotationPointX * f5, -this.Chestplate.rotationPointY * f5, -this.Chestplate.rotationPointZ * f5);
        this.Chestplate.render(f5);
        GlStateManager.popMatrix();
        this.MegaRight_2.render(f5);
    }

    public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
        modelRenderer.rotateAngleX = x;
        modelRenderer.rotateAngleY = y;
        modelRenderer.rotateAngleZ = z;
    }
}

 

Armor Render class:

import net.minecraft.client.model.ModelBiped;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import tutuicraft3.sapphirecraft.Main;
import tutuicraft3.sapphirecraft.init.ItemInit;
import tutuicraft3.sapphirecraft.util.interfaces.IHasModel;

public class ArmorModel extends ItemArmor implements IHasModel
{
    public ArmorModel(String name, CreativeTabs tab, ArmorMaterial materialIn, EntityEquipmentSlot equipmentSlotIn)
    {
        super(materialIn, 1, equipmentSlotIn);
        setUnlocalizedName(name);
        setRegistryName(name);
        setCreativeTab(tab);
        setMaxStackSize(1);

        ItemInit.ITEMS.add(this);
    }

    @Override
    public boolean hasEffect(ItemStack stack) {
        return true;
    }

    @Override
    public void registerModels()
    {
        Main.proxy.registerModel(this, 0);
    }

    @Override
    public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default)
    {
        if(itemStack != ItemStack.EMPTY)
        {
            if(itemStack.getItem() instanceof ItemArmor)
            {
                ModelMSapphireArmor model = new ModelMSapphireArmor();

                model.bipedHead.showModel = armorSlot == EntityEquipmentSlot.HEAD;

                model.isChild = _default.isChild;
                model.isRiding = _default.isRiding;
                model.isSneak = _default.isSneak;
                model.rightArmPose = _default.rightArmPose;
                model.leftArmPose = _default.leftArmPose;

                return model;
            }
        }

        return null;
    }

}

 

 

VIDEO

Edited by Arthur Wesley
More info.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.