Jump to content

Best way to create a simple flying cube entity


Recommended Posts

I tried to create a simple cube as entity.

The entity is not really "living", it has no health, can get no damage, and it is flying not walking.

How should I realize that?


1. Should I use Entity or EntityLiving as super class?

2. If not EntityLiving, how can I properly render it?

3. If EntityLiving, how can I properly render it?

4. How can I use the Minecraft Pathfinding for my entity?

5. Do you know a way to let the flying not look straight and linear?

Link to comment
Share on other sites

You should use super class depending your needs so do comparing between classes. Look tutorials for custom mob rendering, that should help you with rendering. And no, you cannot use MC pathfinding for flying entities because pathfinder is made for entities in the ground so it tries to create path that is on the ground. You can create your own pathfinder AI task or use something from EntityGhast. With trigonometry you can create lines that are more "natural" or again, check how EntityGhast changes its position.

Link to comment
Share on other sites

Making it move to the player is not difficult.

Look at this easy trick.


Put this in your onUpdate() method


EntityPlayer player = this.worldObj.getClosestPlayerToEntity(this, 200);


if(player.posX >= this.posX){

this.posX += 0.1;


if(player.posX <= this.posX){

this.posX -= 0.1;



Do the same with Y and Z and it will go right to a player.


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.