How do you make mobs not move

Started by Dreek on Wed, 08/07/2019 - 21:15

Topic category: Help with MCreator modding

Last seen on 02:48, 22. Sep 2019
Joined Jul 2019
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
How do you make mobs not move
Wed, 08/07/2019 - 21:15

 Hi! So I am trying to add cars to my mod, but I don't know how to make the entity not move.

There is no AI base for the armor stand, so I'm really stuck here... Also, can you make the 

mob so you can ride like a horse but it doesn't move when you're not controlling it, like

cars? Please help!

Last seen on 13:35, 23. Sep 2019
Joined Apr 2010
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
  • developer
Set its movement speed to 0,…
Thu, 08/08/2019 - 09:33

Set its movement speed to 0, enable AI and remove all AI tasks from the list.

Last seen on 02:48, 22. Sep 2019
Joined Jul 2019
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Ok, the car doesn't move…
Fri, 08/09/2019 - 03:18

Ok, the car doesn't move anymore (how I did it was I removed AI ; You can do higher movement speed because it won't move at all), But the thing is you can't ride it wherever you want, and I wanna be able to do that because who wants cars that you can't control? Help!

Last seen on 13:35, 23. Sep 2019
Joined Apr 2010
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
  • developer
Did you make it ridable?
Fri, 08/09/2019 - 07:13

Did you make it ridable?

Last seen on 02:48, 22. Sep 2019
Joined Jul 2019
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
yes, but you cant control it.
Fri, 08/09/2019 - 22:25

yes, but you cant control it.

Last seen on 13:35, 23. Sep 2019
Joined Apr 2010
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
  • developer
This is not possible yet,…
Sat, 08/10/2019 - 09:37

This is not possible yet, but planned for the future updates. Check this page for more info: https://mcreator.net/tracker/issue/51428

Last seen on 08:45, 21. Sep 2019
Joined Dec 2016
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
I looked it up a bit and I…
Sat, 08/10/2019 - 17:53

I looked it up a bit and I think there must be a piece of code looking similar like this. I ripped this from the AbstractHorse's code and edited it a bit but I don't know if it'll work:

 

public void travel(float strafe, float vertical, float forward)
    {
        if (this.isBeingRidden() && this.canBeSteered())
        {
            EntityLivingBase entitylivingbase = (EntityLivingBase)this.getControllingPassenger();
            this.rotationYaw = entitylivingbase.rotationYaw;
            this.prevRotationYaw = this.rotationYaw;
            this.rotationPitch = entitylivingbase.rotationPitch * 0.5F;
            this.setRotation(this.rotationYaw, this.rotationPitch);
            this.renderYawOffset = this.rotationYaw;
            this.rotationYawHead = this.renderYawOffset;
            strafe = entitylivingbase.moveStrafing * 0.5F;
            forward = entitylivingbase.moveForward;

           

            if (forward <= 0.0F)
            {
                forward *= 0.25F;
            }

            if (this.onGround && !this.allowStandSliding)
            {
                strafe = 0.0F;
                forward = 0.0F;
            }

            if (this.canPassengerSteer())
            {
                this.setAIMoveSpeed((float)this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getAttributeValue());
                super.travel(strafe, vertical, forward);
            }
            else if (entitylivingbase instanceof EntityPlayer)
            {
                this.motionX = 0.0D;
                this.motionY = 0.0D;
                this.motionZ = 0.0D;
            }

}
    public boolean canBeSteered()
    {
        return this.getControllingPassenger() instanceof EntityLivingBase;
    }

 

    @Nullable
    public Entity getControllingPassenger()
    {
        return this.getPassengers().isEmpty() ? null : (Entity)this.getPassengers().get(0);
    }

Last seen on 02:48, 22. Sep 2019
Joined Jul 2019
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
 Where do you put all that…
Sun, 08/11/2019 - 14:16

 Where do you put all that code into