Jump to content

[1.8.9]Entity does not move when ridden by player


Spyeedy

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 2 weeks later...

Does aiControlledByPlayer every get initialized?

 

Do I need to? Looking at the EntityPig class, aiControlledByPlayer does not get initialized.

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

Link to comment
Share on other sites

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

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

What version of minecraft are you using as it should exist in Entity in 1.10.2

 

Ah sorry, for not stating in the title, I'm using 1.8.9.

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

Link to comment
Share on other sites

Try basing it off EntityHorse because AIControlledByPlayer seems to be used for EntityPig and the Carrot On A Stick item.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

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.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.