Improved fluid tanks. #111
No reviewers
Labels
No labels
Area-Assets
Area-Backend
Area-Conduits
Area-Datapacks
Area-Lang
Area-Mod Compat
Area-Parity
Area-Rendering
Good first issue
MC-1.19.2
MC-1.20.1
MC-1.20.4
MC-1.20.6
MC-1.21
MC-1.21.1
Modtoberfest
P-0-High
P-1-Medium
P-2-Low
Status-Awaiting Response
Status-Behind-Flag
Status-Blocked
Status-Cannot Reproduce
Status-Duplicate
Status-Help Wanted
Status-Incomplete Report
Status-Invalid
Status-Needs LTS Backport
Status-Needs Updating
Status-Stale
Status-To Implement
Status-Triage
Status-Wontfix
Status-Wontmerge
Type-Backport
Type-Bug
Type-Documentation
Type-Enhancement
Type-Question
Type-RFC
Type-Suggestion
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Team-EnderIO/EnderIO#111
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "machine-fluid-tank-update-branch"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Fluid tanks now behave more like they behaved in 1.12, They can be clicked on with buckets or other containers to transfer fluid, their item correspondence are now correctly fluid containing items with accessible fluid stacks. The item variant now renders fluid and displays tank content on the extended tooltip which you can access by holding shift.
NOTE: should be merged after the #110 yeta wrench updates since it needs some of the stuff from that commit.
Todo. I think it is ready to merge, and then this could be worked on after an alpha release.
Checklist:
don't use notnull annotation add the package.info file that contains the default
don't put this on one line
use UseOnly annotation for this
use pos from blockentity
use statehelper from blockentity
don't do blindcast, do instanceof check at the top if and remove comment
add a helper for this, there might be more callers (and maybe throw from the player like the SoulVial, so yeah, add that to the helper as well)
merge those lines
put text on new line
put text on new line
put text on new line
use pattern like this:
use pattern from above and please put a space between if and whitespace
put return on new line and don't use else as it's the only other path as it return early
don't use else
text on new line
fix spaces for other conditions as well
you can't fix stackable fluid containers, like just don't. dupe bugs everywhere because there is no common way to do this
not necessarily, just do the ifPresent thing and log warning
nullable on line above
maybe use multiple Optional.map chains or fix the early returns like above
use ItemStack#getOrCreateTag
follow java naming scheme beTag
why does this extend IForgeBlockEntity?
put return on new line and remove else
don't use else here and call super
Sorry, but I'm not really sure I understand what you mean since my understanding of the annotation system isn't good enough. Do you mean that I should remove the "@NotNull"? The reason that I inserted it was that befor I had it Intellij threw a warning at me saying that "Not annotated method overrides method annotated with @NotNull". It seems to be done that same way in the class "XPVacuumBlockEntity" line 88 in the method "getCapability". What's the difference between the two cases so I understand for next time?
I'll change it. But I'm wondering; since this is done in loads of other places in the code, even in the same class since before. What is the rule for when to do it and when not to?
Done.
Of course, just me not being used to the code base
Done!
Done!
basically: this doesn't happen in the code base (maybe one or two if they were missed). Some IDEs collapse one liner methods, but there are no methods that have the return in one line.
Only exception if the method does nothing and returns nothing, only then
void method() {}is allowed on one lineDone!
Those lines were accidentally pushed since they should be part of the vat. I have now moved them to that branch.
Done!
Done
Done
Done!
That pattern produces more branches that the branch predictor needs to navigate if the Java interpreter does not squash those into one. But it may be a price worth paying since it makes things clearer. I'll make the suggested change.
Done
Done
Done
Done
Done
Done
Done
What I meant was that the EnderIO fluidtanks in 1.12 were stackable, and the current implementation only supports fluidtanks that doesn't stack because of the code in [FluidTankEntity].internalDrain/fill. The same bug will be apparent for fluid cells from forestry for example. But I'll move this comment to those methods.
Or this was maybe what you meant? That we can't make them stack anymore?
Done
Done
Okay, so I don't understand how to do it, but chatGPT did apparently, so done now...
Done!
Done!
Done!
I think I used a method in a block entity related class at some point during one of the many iterations while trying to get everything to work. Probably mostly legacy, but pretty useful for indicating that you only should be able to use the wrench in the configuration other than wrenching on block entities and that was the most suitable interface that BlockEntity was implementing. But I could absolutely change this! Would you rather it extending nothing?
This is a valid point, yet something that really is regarding #110 since that should be merged first anyway. But I'll definitely change it!
Like above, but will fix also!
Sure, added it in a class called PlayerInteractionUtil in the core source folder since I didn't find any other good place for it. If you have another place in mind, let me know!
Done!
I've amended the commit. So now you should (hopefully) be able to see them.
Done!
Thx!
it is not wanted there either.
this file has the annotations for a whole package and that replaces the annotations on each field
https://github.com/SleepyTrousers/EnderIO-Rewrite/blob/dev/1.19.x/src/main/java/com/enderio/package-info.java
microoptimization like that are probably not worth it, if they make code less readable and I kinda doubt that fill is called often enough to be worth it
we technically can, but I've heard about a lot of weird interactions with stackable fluid containers over the years, it's probably not worth the bugs imo
extend nothing and add javadoc
I see, it however was one of my very favourite features of EnderIO, I'll see if I can get it to work later on...
Okay!
Fix conflicts
So what exactly is this class for? It does something like a fluid bar, and some things for in world interactions and fluidutil? I seemed to have glossed over this when I first looked, but is this all needed like this?
The MachineFluidTank is a class that does similar things to the FluidTank class that Forge provides, it holds data about what type of fluid is contained and how much. It has a capacity and an API for transferring into and out of the tank. The Forge implementation is missing filters for controlling which fluids are allowed to enter and exit the tank. My implementation allows for flagging a tank as for example an input tank accepting only fluids that has the coolant property set for example. It would reject any attempt from external sources to pull coolant out or put lava into the tank. As for the enchantment infuser or whatever it's called you flag it as an input tank and set the predicate to only accept fluidXP and only do it when the machine has a recipe, also set the capacity to whatever amount the recipe requires. This will disallow any fluid from going into the tank until the machine has a valid recipe. Then it only accepts liqudXP and only the amount specified by the recipe. It won't allow liquidXP to be pulled out by pipes, however when you are done with your recipe and want to void the fluid that went into the recipe you just use tank.drain([tank.get_amount()], true) to force it to drain all internal content. The reason to why it is so long is that I had to rewrite like the entire class to enable the predicate and to remove the functionality of storing multiple fluids (like in the tinkers smeltery). If you want to I'll point you towards my unfinished implementation of the vat, but it is still missing all the recipe stuff.
I goofed it up bad somehow... submitting the exact same pr again. Sorry for the inconvenience...
Pull request closed