Jump to content

[1.7.10] Child Parts Of Model Unable To Rotate


Recommended Posts

The body part goes back to being horizontal instead of rotated 12.



package com.blocklings.model;

import com.blocklings.entity.EntityBlockling;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;

public class Blockling extends ModelBase {

ModelRenderer blocklingbody;
ModelRenderer blocklingleftleg;
ModelRenderer blocklingrightleg;
ModelRenderer blocklingrightarm;
ModelRenderer blocklingleftarm;
ModelRenderer blocklinglefteye;
ModelRenderer blocklingrighteye;
ModelRenderer blocklingrightboot;
ModelRenderer blocklingleftboot;

public Blockling() {

	textureWidth = 64;
	textureHeight = 32;

	blocklingbody = new ModelRenderer(this, 0, 0);
	blocklingbody.addBox(0F, 0F, 0F, 8, 8, ;
	blocklingbody.setRotationPoint(-4F, 15.5F, -5F);
	blocklingbody.setTextureSize(64, 32);
	blocklingbody.mirror = true;
	setRotation(blocklingbody, 0.2094395F, 0F, 0F);
	blocklingleftleg = new ModelRenderer(this, 33, 0);
	blocklingleftleg.addBox(0F, 0F, 0F, 3, 2, 3);
	blocklingleftleg.setRotationPoint(0.7F, 22F, -1.5F);
	blocklingleftleg.setTextureSize(64, 32);
	blocklingleftleg.mirror = true;
	setRotation(blocklingleftleg, 0.2094395F, 0F, 0F);
	blocklingrightleg = new ModelRenderer(this, 47, 0);
	blocklingrightleg.addBox(0F, 0F, 0F, 3, 2, 3);
	blocklingrightleg.setRotationPoint(-3.7F, 22F, -1.5F);
	blocklingrightleg.setTextureSize(64, 32);
	blocklingrightleg.mirror = true;
	setRotation(blocklingrightleg, 0.2094395F, 0F, 0F);
	blocklingrightarm = new ModelRenderer(this, 33, 6);
	blocklingrightarm.addBox(-1F, 0F, 0F, 1, 3, 3);
	blocklingrightarm.setRotationPoint(-4F, 18F, -0.5F);
	blocklingrightarm.setTextureSize(64, 32);
	blocklingrightarm.mirror = true;
	setRotation(blocklingrightarm, -0.8726646F, 0F, 0F);
	blocklingleftarm = new ModelRenderer(this, 49, 6);
	blocklingleftarm.addBox(0F, 0F, 0F, 1, 3, 3);
	blocklingleftarm.setRotationPoint(4F, 18F, -0.5F);
	blocklingleftarm.setTextureSize(64, 32);
	blocklingleftarm.mirror = true;
	setRotation(blocklingleftarm, -0.6981317F, 0F, 0F);
	blocklinglefteye = new ModelRenderer(this, 44, 6);
	blocklinglefteye.addBox(0F, 0F, 0F, 1, 2, 1);
	blocklinglefteye.setRotationPoint(1F, 19F, -4.7F);
	blocklinglefteye.setTextureSize(64, 32);
	blocklinglefteye.mirror = true;
	setRotation(blocklinglefteye, 0.2094395F, 0F, 0F);
	blocklingrighteye = new ModelRenderer(this, 44, 10);
	blocklingrighteye.addBox(0F, 0F, 0F, 1, 2, 1);
	blocklingrighteye.setRotationPoint(-2F, 19F, -4.7F);
	blocklingrighteye.setTextureSize(64, 32);
	blocklingrighteye.mirror = true;
	setRotation(blocklingrighteye, 0.2094395F, 0F, 0F);
	blocklingleftboot = new ModelRenderer(this, 47, 14);
	blocklingleftboot.addBox(0F, 0F, 0F, 3, 1, 3);
	blocklingleftboot.setRotationPoint(0.7F, 23F, -1.1F);
	blocklingleftboot.setTextureSize(64, 32);
	blocklingleftboot.mirror = true;
	setRotation(blocklingleftboot, 0F, 0F, 0F);
	blocklingrightboot = new ModelRenderer(this, 33, 14);
	blocklingrightboot.addBox(0F, 0F, 0F, 3, 1, 3);
	blocklingrightboot.setRotationPoint(-3.7F, 23F, -1.1F);
	blocklingrightboot.setTextureSize(64, 32);
	blocklingrightboot.mirror = true;
	setRotation(blocklingrightboot, 0F, 0F, 0F);


public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {

	super.render(entity, f, f1, f2, f3, f4, f5);

	setRotationAngles(f, f1, f2, f3, f4, f5, entity);



private void setRotation(ModelRenderer model, float x, float y, float z) {

	model.rotateAngleX = x;
	model.rotateAngleY = y;
	model.rotateAngleZ = z;


public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) {

	super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);


public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4) {

	EntityBlockling blockling = (EntityBlockling)par1EntityLivingBase;

	int level = blockling.getLevel();

	float moveTimer = blockling.getMoveTimer();

	if(!blockling.isSitting()) {

		this.blocklingbody.rotateAngleX = moveTimer * par3;



private float func_78172_a(float par1, float par2) {

        return (Math.abs(par1 % par2 - par2 * 0.5F) - par2 * 0.25F) / (par2 * 0.25F);



Link to comment
Share on other sites

I don't know about the error, but what's this line supposed to do?


Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.


1.12 -> 1.13 primer by williewillus.


1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.



Link to comment
Share on other sites

To bug this sort of thing, you just need to trace your code.  At each important point in the code add your own console debug statement.


For example, in your code the rotation of the body seems to be set by the moveTimer.  But what is the value of the moveTimer?  Are you sure it isn't 0?  To check, just put System.out.println("moveTimer ="+moveTimer)  inside the check for sitting.  Also, are you sure you want par3?  And what is its value at that point?


Beyond that, you aren't really overriding the setRotationAngles() function.  It looks like you're just calling the default super function.  Are you sure that will give you the effect you want?  And are you sure it isn't overriding your control of the rotationX?


Anyway, you need to learn to debug this sort of problem yourself.  Just put console statements at each important part of the code and see if the values are what you expect.  You will quickly find a place where it isn't what you expect and then the answer is usually pretty clear to see how to fix.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

Also curious about your call to the animation function.  When that is occuring and how.


If you are successfully moving it and then it goes back to zero, Jabelar's line of questions is probably more on track though.

Long time Bukkit & Forge Programmer

Happy to try and help

Link to comment
Share on other sites

Just so you can visualize what I mean. You can't rotate that part of the model if it is a child or the parent, but you can if it isn't.


In Java you can rotate both parent and child.  But the child rotation is "relative" meaning it adds to the parent.  So if parent is rotated 60 degrees and child is rotated 10 degrees the child will actually render as rotated by 70 degrees.  This is a good thing because it means that you can move the children while also ensuring they move with the parent.


Anyway, your code only shows rotation of the body part which doesn't seem to even be the child, plus youd didn't answer our other questions.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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.

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.


  • Create New...

Important Information

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