Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.