Jump to content

Jump high when jumping on a block


joaopms

Recommended Posts

Hi

 

I made it like this:

public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4){
	return null;
}

The Player can collide with it.

 

 

The player is pushed up into the air.

public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity)
    {
	par5Entity.fallDistance = 0;
                if(par5Entity instanceof EntityPlayer && ((EntityPlayer)par5Entity).isJumping) //Check if the Entity is a player and is jumping
{
	par5Entity.motionY += 1; //High jump
}
    }

Link to comment
Share on other sites

Hi

 

I made it like this:

public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4){
	return null;
}

The Player can collide with it.

 

 

The player is pushed up into the air.

public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity)
    {
	par5Entity.fallDistance = 0;
                if(par5Entity instanceof EntityPlayer && ((EntityPlayer)par5Entity).isJumping) //Check if the Entity is a player and is jumping
{
	par5Entity.motionY += 1; //High jump
}
    }

 

It works! Thank you! <3

Link to comment
Share on other sites

  • 2 months later...

Sorry if this is late reply, but I'm looking into a similar block function.  The given code here doesn't quite do what I want.  I don't want the player pushed into the air when they collide with the block.  I want them to interact with the block normally, but if the player jumps, I want to be able to double (or more) their jump height. 

 

Anyone know of a way to do this?  I've looked at examples of "jump boots" and the like, but they're not quite working.

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.