How do you make mobs not move

Started by Dreek on

Topic category: Help with modding (Java Edition)

Last seen on 14:23, 22. Dec 2019
Joined Jul 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do you make mobs not move

 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!

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 14:23, 22. Dec 2019
Joined Jul 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
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 14:23, 22. Dec 2019
Joined Jul 2019
Points:

User statistics:

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

yes, but you cant control it.

Last seen on 17:30, 18. Apr 2024
Joined Dec 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
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 14:23, 22. Dec 2019
Joined Jul 2019
Points:

User statistics:

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

 Where do you put all that code into