How do you make mobs not move

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

Topic category: Help with modding

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

User statistics:

  • Modifications:
  • Mods of the week:
  • Forum topics:
  • Comments:
  • Wiki pages:
  • Tracker tickets:
  • Invalid tickets:
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!

0Upvote this forum topic
Last seen on 19:25, 27. Feb 2020
Joined Apr 2010
User points:

User statistics:

  • Modifications:
  • Mods of the week:
  • Forum topics:
  • Comments:
  • Wiki pages:
  • Tracker tickets:
  • Invalid tickets:
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.

0Upvote this forum topic
Last seen on 14:23, 22. Dec 2019
Joined Jul 2019
User points:

User statistics:

  • Modifications:
  • Mods of the week:
  • Forum topics:
  • Comments:
  • Wiki pages:
  • Tracker tickets:
  • Invalid tickets:
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!

0Upvote this forum topic
Last seen on 19:25, 27. Feb 2020
Joined Apr 2010
User points:

User statistics:

  • Modifications:
  • Mods of the week:
  • Forum topics:
  • Comments:
  • Wiki pages:
  • Tracker tickets:
  • Invalid tickets:
Did you make it ridable?
Fri, 08/09/2019 - 07:13

Did you make it ridable?

0Upvote this forum topic
Last seen on 14:23, 22. Dec 2019
Joined Jul 2019
User points:

User statistics:

  • Modifications:
  • Mods of the week:
  • Forum topics:
  • Comments:
  • Wiki pages:
  • Tracker tickets:
  • Invalid tickets:
yes, but you cant control it.
Fri, 08/09/2019 - 22:25

yes, but you cant control it.

0Upvote this forum topic
Last seen on 13:07, 9. Feb 2020
Joined Dec 2016
User points:

User statistics:

  • Modifications:
  • Mods of the week:
  • Forum topics:
  • Comments:
  • Wiki pages:
  • Tracker tickets:
  • Invalid tickets:
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);
    }

0Upvote this forum topic
Last seen on 14:23, 22. Dec 2019
Joined Jul 2019
User points:

User statistics:

  • Modifications:
  • Mods of the week:
  • Forum topics:
  • Comments:
  • Wiki pages:
  • Tracker tickets:
  • Invalid tickets:
 Where do you put all that…
Sun, 08/11/2019 - 14:16

 Where do you put all that code into

0Upvote this forum topic