Jump to content

EntityCow disable all movement


chris140989

Recommended Posts

Hi there,

 

I am trying to create my own CowEntity and I want it to do nothing. The reason is, that I want to control it by remote. My Problem is, that the Cow is moving his Head and because of that it moves into the wrong direction. Is there a possibility, to deactivate all movement of an Entity? Like just freezing it.

 

My Class right now:

public class Animal extends EntityCow {

public Animal(World worldIn) {
	super(worldIn);
	this.tasks.taskEntries.clear();
}

protected boolean isAIEnabled() {
	return false;
}	
}

 

I cleared the Tasklist, to not make it wander around and stuff like that and disabled the AI.

Link to comment
Share on other sites

The rotation is controlled the the EntityLookHelper associated with the EntityLiving. So you can @Override the getEntityLookHelper() method in your cow to return a custom class that extends EntityLookHelper. In that custom EntityLookHelper you would @Override the onUpdateLook() method to do nothing in the cases where you want the cow to be frozen, otherwise let it act normally.

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

Link to comment
Share on other sites

I have a SuperPig that has a lobotomy so it doesn't wander off and do unwanted things, no doubt for a similar reason to yourself.

 

To achieve this I kill the AI post creation with the following, I should really add it into the Entities constructor.

 

// kill the entities AI

entity.tasks.taskEntries.clear();

entity.targetTasks.taskEntries.clear();

Link to comment
Share on other sites

The rotation is controlled the the EntityLookHelper associated with the EntityLiving. So you can @Override the getEntityLookHelper() method in your cow to return a custom class that extends EntityLookHelper. In that custom EntityLookHelper you would @Override the onUpdateLook() method to do nothing in the cases where you want the cow to be frozen, otherwise let it act normally.

 

Thanks for your answere. I have followed the steps you did describe, but it seems like my customCow is still moving it's head from time to time. Thus it doesn't do what I want it to do..

It seems like the body and head aren't in sync, because sometimes the cow is moving into a direction, where it's head is not facing to.

 

My classes are:

 

customCow:

public class Animal extends EntityCow {

public Animal(World worldIn) {
	super(worldIn);
	this.tasks.taskEntries.clear();
	this.targetTasks.taskEntries.clear();
}

protected boolean isAIEnabled() {
	return false;
}

protected MyEntityLookHelper getEntityLookHelper() {
	return new MyEntityLookHelper(this);
}

protected MyEntityBodyHelper getEntityBodyHelper() {
	return new MyEntityBodyHelper(this);
}
}

 

customEntityBodyHelper:

public class MyEntityBodyHelper extends EntityBodyHelper {

public MyEntityBodyHelper(EntityLivingBase p_i1611_1_) {
	super(p_i1611_1_);
}

@Override
public void updateRenderAngles() {

}
}

 

customEntityLookHelper

public class MyEntityLookHelper extends EntityLookHelper {

public MyEntityLookHelper(EntityLiving p_i1613_1_) {
	super(p_i1613_1_);
}

@Override
public void onUpdateLook() {

}
}

 

It didn't worked with just the EntityLookHelper, so I created a EntityBodyHelper aswell, because I've read somewhere that it is associated with it too. Any advice?

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.