Jump to content

[1.8.x] Riding Flying mobs help


Darkflame

Recommended Posts

Hi!

 

This is like, the 10th post in this "Help with flying mobs" thing where I end up removing them.  :-\

But I think I know what to ask this time!  :D

 

So, I was using some code from the horse class to make the mobs rideable and while messing around I found this line of code, where the strafe, forward, and friction values need to be modified:

this.posY = ((EntityLivingBase)this.riddenByEntity).moveFlying(strafe, forward, friction);

I assume that the strafe value should be  p_70612_1_ and the forward value should be  p_70612_2_, but I don't know what to put for friction.

 

***Side question that doesn't really need to be answered:

Once the above question is answered, it would be awesome if I could get this info too-

What else in my class do I need to change, if anything, to make the [this.posY=etc] line do something? here's the class:

 

package com.darkflame.entity;

import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;

public class RedCarMob extends EntityMob {

public RedCarMob(World worldIn) {
	super(worldIn);

}

public boolean interact(EntityPlayer entityplayer)
  {
    if (riddenByEntity == null || riddenByEntity == entityplayer)
    {
      entityplayer.mountEntity(this);
      return true;
    }
    else
    {
      return false;
    }
  }

public void moveEntityWithHeading(float p_70612_1_, float p_70612_2_)
{
    if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityLivingBase)
    {
        this.prevRotationYaw = this.rotationYaw = this.riddenByEntity.rotationYaw;
        this.rotationPitch = this.riddenByEntity.rotationPitch * 0.5F;
        this.setRotation(this.rotationYaw, this.rotationPitch);
        this.rotationYawHead = this.renderYawOffset = this.rotationYaw;
        p_70612_1_ = ((EntityLivingBase)this.riddenByEntity).moveStrafing * 0.5F;
        p_70612_2_ = ((EntityLivingBase)this.riddenByEntity).moveForward;
        
        if (p_70612_2_ <= 0.0F)
        {
            p_70612_2_ *= 0.25F;
        }

        this.stepHeight = 1.0F;
        this.jumpMovementFactor = this.getAIMoveSpeed() * 0.1F;

        if (!this.worldObj.isRemote)
        {
            this.setAIMoveSpeed((float)this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue());
            super.moveEntityWithHeading(p_70612_1_, p_70612_2_);
        }

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

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

        this.limbSwingAmount += (f4 - this.limbSwingAmount) * 0.4F;
        this.limbSwing += this.limbSwingAmount;
    }
    else
    {
        this.stepHeight = 0.5F;
        this.jumpMovementFactor = 0.02F;
        super.moveEntityWithHeading(p_70612_1_, p_70612_2_);
    }
}
}

Thank you so much!

I. Am. A. Noob.

Noobs. :P

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.

Announcements



×
×
  • Create New...

Important Information

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