Jump to content

Walking on water issue


Asweez

Recommended Posts

So I made the player able to walk on water

 

(Runs every tick)

if(world.getBlockState(player.getPosition().down()).getBlock() == Blocks.water){
		if(player.motionY < 0){
			player.posY += -player.motionY;
			player.motionY = 0.09;
			player.fallDistance = 0;
			((EntityPlayerMP)player ).playerNetServerHandler.sendPacket(new S12PacketEntityVelocity(player));
		}

	}

 

But the player is very slow and can't jump. How do I fix this?

Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.

Link to comment
Share on other sites

Ok the player is now sinking about halfway into the water, but is moving a little faster. Any more solutions?

 

if(world.getBlockState(player.getPosition().down()).getBlock() == Blocks.water){
		if(!world.isRemote){
			if(player.motionY < 0){
				player.onGround = true;
				player.posY += -player.motionY;
				player.motionY = 0.09;
				player.fallDistance = 0;
				((EntityPlayerMP)player ).playerNetServerHandler.sendPacket(new S12PacketEntityVelocity(player));

			}
		}

	}

Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.

Link to comment
Share on other sites

Since there is no easy support from minecraft to walk over water, I would suggest to either detect a jump/movement or use keybindings, and apply the correct speed, rotation, velocity, positions to the player.

 

To make it 'smooth' you could use a flying mechanism (e.g. fly at the same level as water). Though think carefully about what should happen if a player hits for example a water fall (a non horizontal waterline)

Projects:

Discontinued:

- N2ConfigAPI

- Meachanical Crafting Table

 

Latest:

- CollectionUtils

 

Coöperations:

- InGameConfigManager

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.