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

Not sure what's going on but my custom wolf seems to be spinning his tail forever. Any thought why this may happen? Seems like the tail is no longer controlled properly. Normally health condition controls it. 

Disclaimer:  I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.

  • Author

code is easy simply make a Fox extend Wolf  register a ModelWolf registry and register your entity.

 

The tail will keep on spinning. It should behave like a wolf identically but it doesn't.

 

https://github.com/trollworkout/technorcery/blob/master/src/main/java/com/technorcery/entity/living/Fox.java

Disclaimer:  I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.

  • Author

so this is my model  identical to vanilla wolf model

 

 

package com.technorcery.client.model;

import com.technorcery.entity.living.Fox;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class FoxModel extends ModelBase
{
    /** main box for the fox head */
    public ModelRenderer foxHeadMain;
    /** The fox's body */
    public ModelRenderer foxBody;
    /** Wolf'se first leg */
    public ModelRenderer foxLeg1;
    /** Wolf's second leg */
    public ModelRenderer foxLeg2;
    /** Wolf's third leg */
    public ModelRenderer foxLeg3;
    /** Wolf's fourth leg */
    public ModelRenderer foxLeg4;
    /** The fox's tail */
    ModelRenderer foxTail;
    /** The fox's mane */
    ModelRenderer foxMane;

    public FoxModel()
    {
        this.foxHeadMain = new ModelRenderer(this, 0, 0);
        this.foxHeadMain.addBox(-2.0F, -3.0F, -2.0F, 6, 6, 4, 0.0F);
        this.foxHeadMain.setRotationPoint(-1.0F, 13.5F, -7.0F);
        this.foxBody = new ModelRenderer(this, 18, 14);
        this.foxBody.addBox(-3.0F, -2.0F, -3.0F, 6, 9, 6, 0.0F);
        this.foxBody.setRotationPoint(0.0F, 14.0F, 2.0F);
        this.foxMane = new ModelRenderer(this, 21, 0);
        this.foxMane.addBox(-3.0F, -3.0F, -3.0F, 8, 6, 7, 0.0F);
        this.foxMane.setRotationPoint(-1.0F, 14.0F, 2.0F);
        this.foxLeg1 = new ModelRenderer(this, 0, 18);
        this.foxLeg1.addBox(0.0F, 0.0F, -1.0F, 2, 8, 2, 0.0F);
        this.foxLeg1.setRotationPoint(-2.5F, 16.0F, 7.0F);
        this.foxLeg2 = new ModelRenderer(this, 0, 18);
        this.foxLeg2.addBox(0.0F, 0.0F, -1.0F, 2, 8, 2, 0.0F);
        this.foxLeg2.setRotationPoint(0.5F, 16.0F, 7.0F);
        this.foxLeg3 = new ModelRenderer(this, 0, 18);
        this.foxLeg3.addBox(0.0F, 0.0F, -1.0F, 2, 8, 2, 0.0F);
        this.foxLeg3.setRotationPoint(-2.5F, 16.0F, -4.0F);
        this.foxLeg4 = new ModelRenderer(this, 0, 18);
        this.foxLeg4.addBox(0.0F, 0.0F, -1.0F, 2, 8, 2, 0.0F);
        this.foxLeg4.setRotationPoint(0.5F, 16.0F, -4.0F);
        this.foxTail = new ModelRenderer(this, 9, 18);
        this.foxTail.addBox(0.0F, 0.0F, -1.0F, 2, 8, 2, 0.0F);
        this.foxTail.setRotationPoint(-1.0F, 12.0F, 8.0F);
        this.foxHeadMain.setTextureOffset(16, 14).addBox(-2.0F, -5.0F, 0.0F, 2, 2, 1, 0.0F);
        this.foxHeadMain.setTextureOffset(16, 14).addBox(2.0F, -5.0F, 0.0F, 2, 2, 1, 0.0F);
        this.foxHeadMain.setTextureOffset(0, 10).addBox(-0.5F, 0.0F, -5.0F, 3, 3, 4, 0.0F);
    }

    /**
     * Sets the models various rotation angles then renders the model.
     */
    @Override
    public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale)
    {
        super.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
        this.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entityIn);

        if (this.isChild)
        {
            GlStateManager.pushMatrix();
            GlStateManager.translate(0.0F, 5.0F * scale, 2.0F * scale);
            this.foxHeadMain.renderWithRotation(scale);
            GlStateManager.popMatrix();
            GlStateManager.pushMatrix();
            GlStateManager.scale(0.5F, 0.5F, 0.5F);
            GlStateManager.translate(0.0F, 24.0F * scale, 0.0F);
            this.foxBody.render(scale);
            this.foxLeg1.render(scale);
            this.foxLeg2.render(scale);
            this.foxLeg3.render(scale);
            this.foxLeg4.render(scale);
            this.foxTail.renderWithRotation(scale);
            this.foxMane.render(scale);
            GlStateManager.popMatrix();
        }
        else
        {
            this.foxHeadMain.renderWithRotation(scale);
            this.foxBody.render(scale);
            this.foxLeg1.render(scale);
            this.foxLeg2.render(scale);
            this.foxLeg3.render(scale);
            this.foxLeg4.render(scale);
            this.foxTail.renderWithRotation(scale);
            this.foxMane.render(scale);
        }
    }

    /**
     * Used for easily adding entity-dependent animations. The second and third float params here are the same second
     * and third as in the setRotationAngles method.
     */
    @Override
    public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float limbSwingAmount, float ageInTicks, float partialTickTime)
    {
        Fox fox = (Fox)entitylivingbaseIn;

         if (fox.isAngry())
        {
            this.foxTail.rotateAngleY = 0.0F;
        }
        else
        {
            this.foxTail.rotateAngleY = MathHelper.cos(limbSwingAmount * 0.6662F) * 1.4F * ageInTicks;
        }   
        
        if (fox.isSitting())
        {
            this.foxMane.setRotationPoint(-1.0F, 16.0F, -3.0F);
            this.foxMane.rotateAngleX = ((float)Math.PI * 2F / 5F);
            this.foxMane.rotateAngleY = 0.0F;
            this.foxBody.setRotationPoint(0.0F, 18.0F, 0.0F);
            this.foxBody.rotateAngleX = ((float)Math.PI / 4F);
            this.foxTail.setRotationPoint(-1.0F, 21.0F, 6.0F);
            this.foxLeg1.setRotationPoint(-2.5F, 22.0F, 2.0F);
            this.foxLeg1.rotateAngleX = ((float)Math.PI * 3F / 2F);
            this.foxLeg2.setRotationPoint(0.5F, 22.0F, 2.0F);
            this.foxLeg2.rotateAngleX = ((float)Math.PI * 3F / 2F);
            this.foxLeg3.rotateAngleX = 5.811947F;
            this.foxLeg3.setRotationPoint(-2.49F, 17.0F, -4.0F);
            this.foxLeg4.rotateAngleX = 5.811947F;
            this.foxLeg4.setRotationPoint(0.51F, 17.0F, -4.0F);
        }
        else
        {
            this.foxBody.setRotationPoint(0.0F, 14.0F, 2.0F);
            this.foxBody.rotateAngleX = ((float)Math.PI / 2F);
            this.foxMane.setRotationPoint(-1.0F, 14.0F, -3.0F);
            this.foxMane.rotateAngleX = this.foxBody.rotateAngleX;
            this.foxTail.setRotationPoint(-1.0F, 12.0F, 8.0F);
            this.foxLeg1.setRotationPoint(-2.5F, 16.0F, 7.0F);
            this.foxLeg2.setRotationPoint(0.5F, 16.0F, 7.0F);
            this.foxLeg3.setRotationPoint(-2.5F, 16.0F, -4.0F);
            this.foxLeg4.setRotationPoint(0.5F, 16.0F, -4.0F);
            this.foxLeg1.rotateAngleX = MathHelper.cos(limbSwingAmount * 0.6662F) * 1.4F * ageInTicks;
            this.foxLeg2.rotateAngleX = MathHelper.cos(limbSwingAmount * 0.6662F + (float)Math.PI) * 1.4F * ageInTicks;
            this.foxLeg3.rotateAngleX = MathHelper.cos(limbSwingAmount * 0.6662F + (float)Math.PI) * 1.4F * ageInTicks;
            this.foxLeg4.rotateAngleX = MathHelper.cos(limbSwingAmount * 0.6662F) * 1.4F * ageInTicks;
        }

        this.foxHeadMain.rotateAngleZ = fox.getInterestedAngle(partialTickTime) + fox.getShakeAngle(partialTickTime, 0.0F);
        this.foxMane.rotateAngleZ = fox.getShakeAngle(partialTickTime, -0.08F);
        this.foxBody.rotateAngleZ = fox.getShakeAngle(partialTickTime, -0.16F);
        this.foxTail.rotateAngleZ = fox.getShakeAngle(partialTickTime, -0.2F);
    }

    /**
     * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
     * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
     * "far" arms and legs can swing at most.
     */
    @Override
    public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
    {
        super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
        this.foxHeadMain.rotateAngleX = headPitch * 0.017453292F;
        this.foxHeadMain.rotateAngleY = netHeadYaw * 0.017453292F;
        this.foxTail.rotateAngleX = ageInTicks;
    }
}

 

 

Somehow the fox.getTailRotation function is never called anywhere.

 

Seems to me like the tail rotation code is not exposed properly since it doesn't appear that function is used anywhere.

 

 

I narrowed down the problem to

        this.foxTail.rotateAngleX = ageInTicks;

 

seems without this line tail no longer moves at all

 

 

SEEMS like ageInTicks is being used to store tail rotation but is actually not working out properly when i duplicate the model. Maybe a bug in forge?

Disclaimer:  I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.

  • Author

guys I figured this out. I think forge is wrong about wolf model it actually sets tail rotation using entitywolf.getTailRotation() and NOT  ageInTicks.

Disclaimer:  I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.

Nice job figuring it out, and thanks for posting the solution. I wish more people would do that. It's very helpful to the community.

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.