Jump to content

[1.7.2] how to disable mob water jumping? [Solved]


thomassu

Recommended Posts

hello, i am creating a mod with a mob,

I want the mob does not floats if he is on the water.

 

i thought lets look in the EntityLiving class

i found this part of code

 

        boolean flag1 = this.isInWater();

        boolean flag = this.handleLavaMovement();

 

        if (flag1 || flag)

        {

            this.isJumping = this.rand.nextFloat() < 0.8F;

        }

 

i tried to use this for my code:

 

protected void updateEntityActionState()

    {

        boolean flag1 = this.isInWater();

        boolean flag = this.handleLavaMovement();

 

        if (flag1 || flag)

        {

            this.isJumping = false;

        }

    }

 

but it doesnt work, does anyone know how to do this??

thanks for reading

Link to comment
Share on other sites

hmm...

ok, i tried this:

   

    protected void updateEntityActionState()

    {

    if(this.isInWater() && this.isJumping)

    {

    this.isJumping = false;

    }

    }

 

so when is it in the water and when it is jumping, set jumping to false

but it doenst work ):

Link to comment
Share on other sites

whatever people i fixed it :)

 

public boolean isInWater()

    {

        return this.worldObj.handleMaterialAcceleration(this.boundingBox.expand(0.0D, -0.6D, 0.0D), Material.water, this);

    }

 

ive found this in EntitySquid

and changed it to

 

public boolean isInWater()

    {

        return this.worldObj.handleMaterialAcceleration(this.boundingBox.expand(0.0D, -0.6D, 0.0D), Material.water, this) && (this.isJumping = false);

    }

 

it works perfectly, thanks for help

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.



×
×
  • Create New...

Important Information

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