Rideable and Steerable mob with no AI

Started by DragonOfAsparas on

Topic category: Advanced modding

Joined Apr 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Rideable and Steerable mob with no AI

I am trying to figure out how to make a mob rideable and steerable without having it an AI. Usually i based it on the horse AI but now i dont want to have an AI. I tried looking in the horse code and changed some things without luck. If anyone knows how to do this it would be a great help. Current Code to ride: 

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 (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;

                }

                this.prevLimbSwingAmount = this.limbSwingAmount;
                double d1 = this.posX - this.prevPosX;
                double d0 = this.posZ - this.prevPosZ;
                float f1 = MathHelper.sqrt(d1 * d1 + d0 * d0) * 4.0F;

                if (f1 > 1.0F) {
                    f1 = 1.0F;
                }

                this.limbSwingAmount += (f1 - this.limbSwingAmount) * 0.4F;
                this.limbSwing += this.limbSwingAmount;
            } else {
                this.stepHeight = 0.5F;
                this.jumpMovementFactor = 0.02F;
                super.travel(strafe, vertical, forward);

Joined Feb 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
"Rideable and Steerable mob…
Fri, 03/16/2018 - 13:31

"Rideable and Steerable mob with no AI" Why?

Please use AI tasks.

You should be delete in your custom code this: "onrightclicked(process interactevent)".

 

Joined Apr 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
why? because i dont want a…
Fri, 03/16/2018 - 13:47

why? because i dont want a cart that needs to be tamed before i can mount it or a cart that shoots fireballs. Also you do realise that removing "onrightclicked(process interactevent)" will mean that you can not interact with the mob when right clicked? in order to mount a entity you need to right click it so why would you remove it? that wouldnt make any sense. without an AI i can mount the mob but not steer it that is the whole issue here even with or without the AI tasks.

Joined Feb 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yes by the way there is a…
Sat, 03/17/2018 - 06:21

Yes by the way there is a small bug with the "onrightclicked (Process interactevent)" for Example, with "onrightclicked (Process interactevent) you can not shoot a mob from a bow at close range and you may not be able to ride the mob. I do not advise to use this event.

Joined Apr 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
That isn't a bug in Mcreator…
Sat, 03/17/2018 - 09:10

That isn't a bug in Mcreator that is in Vanilla Minecraft aswell... Unless you are already aiming and then you get bugged out it means that thats a bug for you. If you rightclick a bow near a rideable entity its only logic that you ride it. You can only approach a rideable entity with right click if you were already aiming with the bow. You should only remove this event if you dont want to interact with it at all. But that isnt the case here because i want a rideable mob and i cant ride it without having an interaction event. Besides I recommend using this event since you can customize it easily. You can make a mob tameable with a custom item for example with this event.