Jump to content

Recommended Posts

Posted (edited)

I have managed to create a new liquid just fine, it works as expected. The problem is that I'd like for it to be translucent just like water. 

 

I'm learning by looking at the code for water, and my attempt at making the liquid translucent can be seen below:

public static final Map<Fluid, RenderType> TYPES_BY_FLUID = Util.make(Maps.newHashMap(), (map) -> {
  final RenderType translucent = RenderType.getTranslucent();
  map.put(FluidRegistry.FLOWING_ACID.get(), translucent);
  map.put(FluidRegistry.ACID.get(), translucent);
});
@Mod.EventBusSubscriber(modid = Mod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public class ClientSetup {
  @SubscribeEvent
  public static void clientSetup(final FMLClientSetupEvent event) {
    TYPES_BY_FLUID.forEach(RenderTypeLookup::setRenderLayer);
  }
}

 

With this code the liquid however becomes invisible instead. I haven't been able to find anything else about how water is rendered so I'm feeling a bit stuck.

Edited by OneHotEncoder
marked post as solved
Posted

Solution:

Apparently there was nothing wrong with how I tried to render the fluid. The poblem was my FluidAttributes.Builder

 

I had naively though that it would be enough to specify the rgb values of the fluid, but you also have to specify the alpha value (specifically set it to 0xff).

 

Chaning my code from .color(0xa0e67a) to .color(0xffa0e67a) fixed the problem. Holy hell this took hours to find.

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.