jtsfour Posted March 12, 2017 Share Posted March 12, 2017 (edited) 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 March 12, 2017 by jtsfour Quote Link to comment Share on other sites More sharing options...
Draco18s Posted March 12, 2017 Share Posted March 12, 2017 (edited) 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 March 12, 2017 by Draco18s Quote 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 More sharing options...
jtsfour Posted March 13, 2017 Author Share Posted March 13, 2017 Well is there any way that I could override the swimming code of EntityPlayer or maybe interface with it? Could I use events? Quote Link to comment Share on other sites More sharing options...
Draco18s Posted March 13, 2017 Share Posted March 13, 2017 You would have to use the LivingUpdateEvent. And you'd have to write the swimming mechanics yourself. Quote 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 More sharing options...
Recommended Posts
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.