Jump to content

Interfacing With EntityPlayer to render effects when swimming


jtsfour

Recommended Posts

Ok i am making a mod that overhauls the fluid system.  I have figured out how to make a block 'swimmable' the only problem is that when swimming in said block it spawns water particles and if you are submerged under it it renders an underwater overlay this will not work if i want fluids besides water. is there a way to interface with EntityPlayer in a way i can manipulate the ability to swim and what particles spawn/ overlays rendered? 

 

Here is how i make a block 'swimmable'

@Override
	public Boolean isEntityInsideMaterial(IBlockAccess world, BlockPos pos, IBlockState state, Entity entity, double y, Material material, boolean testingHead){
		if(material.equals(Material.WATER)){
			return true;
		}
		return false;
	}

 

Edited by jtsfour
Link to comment
Share on other sites

3 hours ago, jtsfour said:

Here is how i make a block 'swimmable'


@Override
	public Boolean isEntityInsideMaterial(IBlockAccess world, BlockPos pos, IBlockState state, Entity entity, double y, Material material, boolean testingHead){
		if(material.equals(Material.WATER)){
			return true;
		}
		return false;
	}

 

That's not a good solution. What if there's some block....say....molten iron that when entities are inside it it sets them on fire?

Your block would say "nope, not inside!"

 

And besides, all the swimming code is inside the Entity class (for players, EntityPlayer) and explicitly checks for Material.WATER so again, your code double-fails because if someone wants to have a material other than water this code doesn't make the block swimmable.

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

You would have to use the LivingUpdateEvent.  And you'd have to write the swimming mechanics yourself.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.