Jump to content

[SOLVED] [1.20] Fluids Transparency Setup


Recommended Posts

Posted

I've just been working on adding new fluids to the game, when I came across a problem.

The fluids have textures, models, buckets, and proper names and properties, however, I can't add transparency.

 

Is there a specific method I am missing in my setup for the fluids that allows transparency in the model itself? I want it to be transparent like water is.

The specific fluid that needs transparency is PurifyingWater.

Here is the FluidType class: https://pastebin.com/k9i3UBzB

Here is the Fluid class: https://pastebin.com/aUgkZz8E

Here is the Fluid Registry (the deferred registers aren't used in this class): https://pastebin.com/DpKNbthT

Here is the Block class for the fluid: https://pastebin.com/xWmje9CJ

 

Another issue that doesn't have to be addressed is: custom overlay textures for fluid underwater.

If anyone has the exact answer to add transparency to custom fluids, then thanks.

Posted (edited)

OK here is the solution:

In your FluidType definition, remember to add a getTintColor() method and return a hex value color formatted ARGB (alpha, red, green, blue).

Then, in your main mod class (or whatever is your 'rendering' class), set the ItemBlockRenderType layer for the fluids registered (flowing and still) to whatever valid layer (exactly like the old way of setting the layer for glass like blocks or other transparent textured blocks).

In the end, I got my transparent water-like block. Cool! Hope this solves other people's issues.

Edited by CreativeMasterBonin
  • Guest changed the title to [SOLVED] [1.20] Fluids Transparency Setup

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.