Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hello,

 

I have a block called the fluid tank. This block is... as the name suggests... a fluid tank. The issue though is that i want it to have two FluidTank inside. One of those tanks being like normal but the other tank can only be filled using a machine but can be drained like normal(but has priority). Is that possible? And if so, how can i do that? Thank you! :D

Edited by Skelyvelocirap
solved

Yes. Just create another fluid handler.

Then, in getCapability, determine which tank to return based on the given information and the current data in the tile entity.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

  • Author

Why do i need to create a new Fluid handler? Can i not do this with the normal one?
 

28 minutes ago, DavidM said:

 

Then, in getCapability, determine which tank to return based on the given information and the current data in the tile entity.

And so i can simply choose what tank using getCapability? Ohhhh, thats what that means...

return CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.cast(tank);

The tank is the tank that is actually being used. I thought that that line simply meant that the tank has the fluid handler capability. Ok, Thank you for your help! I will try this immediately!

Hmmm.. although, how do i check if the person is filling or draining?

Edited by Skelyvelocirap

2 hours ago, Skelyvelocirap said:

Hmmm.. although, how do i check if the person is filling or draining?

I don’t think it is possible to tell so from the tile entity with the vanilla fluid handler.

However you could create your own fluid handler implementation that handles 2 different tanks and their insertion/extraction.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

  • Author
6 hours ago, diesieben07 said:

I mean... IFluidHandler has a method for filling (helpfully called fill) and two for draining (helpfully called drain). What more do you need?

I thought that those two were used to actually drain/fill or check it is possible to do so. How should i use those to solve my issue?

  • Author

Success! It works! I am not sure if it is exactly(i think someone might have told me that actually) but what i did was use drain from the i fluid handler but simulated it and checked if it wasn't null. If it isn't null then i just return the second tank. I will post the code just so anyone who needs help can use it and so that if its not very efficiently done than you can tell me.

https://github.com/Skelyvelocirap/Thebalance/blob/master/java/skely/mod/objects/block/TBFluidTank.java

https://github.com/Skelyvelocirap/Thebalance/blob/master/java/skely/mod/objects/block/tileentity/TileEntityTank.java

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...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.