Jump to content

Recommended Posts

Posted

My Entity for some reason I do not know does not move when the player is riding it.

 

Purpose of the Entity: A mode of transportation for the player, it can fly and no fall damage is to be received when mid-flight fall.

 

[spoiler=Entity Class]

public class EntityGreenGoblinGlider extends EntityCreature
{
    /** AI task for player control. */
    private final EntityAIControlledByPlayer aiControlledByPlayer;
    
    public EntityGreenGoblinGlider(World worldIn)
    {
        super(worldIn);
        this.tasks.addTask(0, this.aiControlledByPlayer = new EntityAIControlledByPlayer(this, 10.0F));
    }

    @Override
    protected void applyEntityAttributes()
    {
        super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D);
    }

    @Override
    public boolean canBeSteered()
    {
        return true;
    }

    @Override
    public boolean interact(EntityPlayer player)
    {
        if (super.interact(player))
        {
            return true;
        }
        else if (this.worldObj.isRemote || this.riddenByEntity != null && this.riddenByEntity != player)
        {
            return false;
        }
        else
        {
            player.mountEntity(this);
            return true;
        }
    }

    /**
     * Return the AI task for player control.
     */
    public EntityAIControlledByPlayer getAIControlledByPlayer()
    {
        return this.aiControlledByPlayer;
    }
}

 

 

 

Where did I go wrong?

width=620 height=260http://www.startrek.com/uploads/assets/articles/61c89a9d73c284bda486afaeaf01cdb27180359b.jpg[/img]

Till next time. Thank you for delivering funny scenes to Star Trek as Chekov :) . Will always remember you

Posted

Im sorry but i dont have the fix for it,

When an entity is ridden from what i know it cancels all

Ai stuff.. if i were you i would start by looking at the way of

Adding player control when its ridden... it seems that in this

time there arent any moderators online which is a bit sad

Because usally people come here as last way of help and in

Some timezones it could take the whole day if you are not working

Im something else meanwhile...

 

#phonekeyboard

Doing stuff n' things

  • 2 weeks later...
Posted

Actually you did initialize it i didnt seenit and of course it does otherwise you would pass in a null object. Try overriding getControllingPassenger

 

getControllingPassenger does not exists in EntityCreature, EntityLiving, EntityLivingBase and Entity.

width=620 height=260http://www.startrek.com/uploads/assets/articles/61c89a9d73c284bda486afaeaf01cdb27180359b.jpg[/img]

Till next time. Thank you for delivering funny scenes to Star Trek as Chekov :) . Will always remember you

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.