Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move from LDLib's FluidStack implementation to Forge's FluidStack #1975

Open
wants to merge 11 commits into
base: 1.20.1
Choose a base branch
from

Conversation

krossgg
Copy link
Contributor

@krossgg krossgg commented Sep 18, 2024

What

This PR moves the codebase off of LDLib's FluidStack implementation and onto Forge's native FluidStack implementation.
This includes switching from LDLib's IFluidTransfer to Forge's IFluidHandler. The behavior between the two is extremely similar, and this change will allow for better maintainability and better understanding of the depended-upon implementation, as Forge is very well documented.

Implementation Details

I have added a couple new methods to GTUtils which I use sporadically, please see them here so you don't have to go flopping around trying to find what a certain utility method will do.
I also make very good use of Forge's FluidUtil class, which has many helper methods similar to LDLib's. See the docs for those here or check the implementation in your own IDE at net.minecraftforge.fluids.FluidUtil.java

Potential Compatibility Issues

Forge's FluidStacks are limited to integer amounts, rather than the long-based FluidStacks from LDLib. This could potentially cause issues in certain cases, specifically during interactions with AE2.
Further testing is required for this, however. From what I can tell, it would only affect people who attempt to use more than 2.147 million buckets in an ME hatch or an ME Pattern Buffer.
If this is a cause for concern, please let me know.

If I have missed ANYTHING or if there are ANY questions please let me know.

The first commit 4ef64c9 are fairly simple switches and don't necessarily need the most attention. Please look over the other four commits well. Thanks.

@krossgg krossgg added the Do Not Merge DO NOT MERGE THIS PR YET! label Sep 18, 2024
@krossgg krossgg self-assigned this Sep 18, 2024
@krossgg krossgg requested a review from a team as a code owner September 18, 2024 05:11
@krossgg krossgg removed their assignment Sep 18, 2024
Copy link
Member

@screret screret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm gonna do the rest in intellij github's UI isn't happy rn

@screret
Copy link
Member

screret commented Sep 20, 2024

conflicts

Adds classes in /api/misc/lib/ which are Forge FluidStack compatible stand-ins for LDLib's versions
Creates a Payload for Forge FluidStacks and registers them with LDLib
Adds a mixin for LDLib to allow for FluidStack syncing
Rewrites these classes to use Forge's native IFLuidHandler rather than LDLib's IFluidTransfer
Switches from hardcoded logic to using Forge's FluidUtil to add cleanliness
Now passes the interaction for drums and tanks if the held item isn't a fluidhandler
Also cleaned up the CreativeTankMachine to more properly make use of being a subclass
Implemented CreativeTankMachine right-click behavior
Removed any unnecessary BUCKET_VOLUME uses
Moved new classes to appropriate packages
Renamed Fluid classes to use Handler rather than Transfer
Also clean up some lingering references
@krossgg
Copy link
Contributor Author

krossgg commented Sep 22, 2024

Last commit is the only new content. Rebased and resolved conflicts because things were getting a little out of hand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Do Not Merge DO NOT MERGE THIS PR YET!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants