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;
}
}
}