Jump to content

Controllable entity


Tonygue

Recommended Posts

Hello I would like to create a kart, so I made one entity everything works, I added the code to get into it and direct it.

 

everything is set apart a bug .... when I move I returned to the same place after a second or more, as a lag

 

 

here is the code of the entity if anyone has had is the problem:

 

 

 

package minecraftkart.common;

 

 

import net.minecraft.entity.Entity;

import net.minecraft.entity.EntityLiving;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.world.World;

 

 

 

public  class EntityKart extends EntityLiving

{

 

private int i;

 

public EntityKart(World model) {

super(model);

stationary = false;

 

// TODO Auto-generated constructor stub

}

 

public boolean interact(EntityPlayer entityplayer)

    {

        if(riddenByEntity == null || riddenByEntity == entityplayer)

        {

            entityplayer.mountEntity(this);

            return true;

        } else

        {

            return false;

        }

 

    }

 

public boolean stationary;

 

protected boolean isMovementCeased()

    {

        return stationary;

    }

public void moveEntity(double d, double d1, double d2)

    {

    if(riddenByEntity != null)

    {

    stationary = true;

            motionX += riddenByEntity.motionX*5; // * 0.20000000000000001D;

            motionZ += riddenByEntity.motionZ*5; // * 0.20000000000000001D;

            if(isCollidedHorizontally)

            {

                isJumping = true;

            }

            super.moveEntity(motionX, motionY, motionZ);

    }else

    {

    super.moveEntity(d, d1, d2);

    stationary = true;

    }

    }

 

public double getMountedYOffset() {

return 0.2D;

}

 

 

 

 

    }

}

 

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.