Jump to content

[1.12] Fluid properties don't seem to be working


DarkMorford

Recommended Posts

I've been working on adding a custom fluid to my mod, using Choonster's TestMod3 as an example. It seems to be working for the most part: I can give myself a bucket of it in Creative mode, and it renders correctly when I place it in the world. The problem I'm having is that the in-world fluid blocks aren't affecting movement at all. I think I'm setting the viscosity and density correctly, but I'm not pushed around or slowed in any way when I stand in it. Is there something else I need to configure to make this work correctly?

 

Mod code is here.

Link to comment
Share on other sites

You haven't set the block's material to Material.WATER. Without that you don't get any of the standard water behaviors, as they aren't controlled by the block or fluid, but by the Entity class.

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

Hm, I think I get it. I changed new MaterialLiquid(MapColor.YELLOW) to MaterialLiquid.WATER in my registerBlocks() method, and I am getting the movement behavior I'm expecting.

However, it now renders as blue (water) on maps, and the particle effects when I land in a pool of the stuff are also blue. How would I go about making those yellow to match the fluid texture?

Link to comment
Share on other sites

27 minutes ago, DarkMorford said:

Hm, I think I get it. I changed new MaterialLiquid(MapColor.YELLOW) to MaterialLiquid.WATER in my registerBlocks() method, and I am getting the movement behavior I'm expecting.

However, it now renders as blue (water) on maps, and the particle effects when I land in a pool of the stuff are also blue. How would I go about making those yellow to match the fluid texture?

maybe try (new MaterialLiquid(MapColor.YELLOW)).setNoPushMobility(); and if it does not work then i think that it just checks if material is MaterialLiquid.WATER

Edited by lukas2005
Link to comment
Share on other sites

setNoPushMobility() prevents pistons from pushing it.

If you want your custom material to push players around like water, you need to replicate the behavior found in the Entity classes (it's kind of split) into an entity tick event handler.

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

Just now, Draco18s said:

setNoPushMobility() prevents pistons from pushing it.

If you want your custom material to push players around like water, you need to replicate the behavior found in the Entity classes (it's kind of split) into an entity tick event handler.

i think that it would be cool if forge had just some better way of doing this for example MaterialLiquid(MapColor color, boolean pushEntities) so that you don't need to replicate the code because mc expected to only have water and lava

Link to comment
Share on other sites

Make a pull request.

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

On 8/5/2017 at 10:42 AM, Draco18s said:

If you want your custom material to push players around like water, you need to replicate the behavior found in the Entity classes (it's kind of split) into an entity tick event handler.

I'm going to show how new I am to modding here... Conceptually, I think I get what an entity tick event handler would be and what would need to go into it, but I have no idea how to actually set one up in code or which Entity classes I'd need to look at. Any chance you could post (or link to) an example?

Link to comment
Share on other sites

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.