Jump to content

Recommended Posts

Posted

So I noticed that in the forge Fluid class that it has a getColor() method but no setColor() method. I'm not entirely certain what that color does but it seems to affect how a bucket is displayed? But it is weird that there is no setColor() method because it means you have to extend Fluid for your custom fluid when otherwise you could just call all the setters to make a custom fluid. Is that color important? Does that mean we need to extend Fluid rather than just instantiate it with setters if we want custom color? Where does the color for the overlay when you're submersed in the liquid get set (like when you're under water everything looks blue)? I know I can handle the overlay event but is it supposed to be set somewhere?

 

Also, it seems that the BlockFluid and the Fluid classes are a bit circular. The BlockFluid takes a Fluid as a constructor parameter but Fluid class also needs a setBlock() to be set. Am I missing something? So when you're instantiating your block and fluid I'm guessing you first instantiate the fluid, then you instantiate the block while passing the fluid instance, and then you set the resulting block instance back to the fluid? I guess you can also just create an instance of the fluid with new Fluid() for the block constructor, but seems a bit wasteful and also seems like potential for a bug if you have both classes pointing at each other...

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Okay, I just figured out the answer to my second question, but it is indeed a bit circular. The Fluid#setBlock() method is called by the BlockFluidBase constructor. So basically you create the fluid instance, pass it into the block constructor and it passes itself back to the fluid. It is a bit dangerous in my opinon to have a bunch of setters on Fluid that you expect people to invoke directly and have one that you shouldn't. Would have been better to have some sort of map, or the registry itself do the association...

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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.