Jump to content

Liquids, Gasses, Rendering, And Others?


Draco18s

Recommended Posts

Alright, so I've create a custom liquid.  All is fine and dandy except for a few things:

 

Material.water has a lot of side effects, as does Material.lava.  None of these side effects are controllable and I want to not-have some of them and have others.

 

Using water means that entities can swim "up" in it (and I'd like my custom 'liquid' to be a gas and not have that property).  It also causes the player to drown (and I do want that) and any material other than water resets the air meter.  For lava, this sets the player on fire and I don't want that.

 

Not using Material.water (or lava) and still letting vanilla code handling (render id 4) rendering causes it to crash, due to getFlowDirection being a static method inf BlockLiquid that checks for only water and lava materials.  Not using Material.water and letting the Forge renderer take over causes there to not be a "you are underwater" overlay and turn fog on, likely because it's handled by vanilla.

 

Anyone have solutions to this problem?  Registering an ISBRH and doing the rendering myself is fine, but I'd still like to cause the drowning effect.

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

For rendering, I'd use the forge fluid system. Idk about vanilla drowning, but since it's a gas it might be best to have your own "drowning" effect (without bubbles).

 

Has its own problem, of not showing the "you are underwater" overlay.

 

Also, apparently the forge renderer doesn't render backfaces.  WTF.

 

By taking a look at the code, couldn't you handle drowning by using an event handler using entityLivingEvent(Forgot name, not sure if it)?  Then create your own MaterialLiquid?

 

Nope, because of how air is handled.

 

if (this.isEntityAlive() && this.isInsideOfMaterial(Material.water))
        {
            if (!this.canBreatheUnderwater() && !this.isPotionActive(Potion.waterBreathing.id) && !flag)
            {
                this.setAir(this.decreaseAirSupply(this.getAir()));
                //snipped
             }
        }
        else
        {
            this.setAir(300);
        }

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

I don't think the drowning effect is possible unless you can cause the check for block.getMaterial at isInsideOfMaterial in Entity to return true.  The alternative is program a "drowning" effect.  I think Galaticraft has a "drowning" effect in space, best to check, https://github.com/micdoodle8/Galacticraft.  If I find anything in there for you, I'll just edit this post.

 

EDIT: One thing that may peak your interest is https://github.com/micdoodle8/Galacticraft/blob/master/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java at the entityLivingEvent.

width=320 height=64http://www.slothygaming.com/img/ota.png[/img]

If your grammar is shit and you blatantly don't know what you're doing, I will not help you.

Link to comment
Share on other sites

I'll dig around in there.

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.