-
Notifications
You must be signed in to change notification settings - Fork 180
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
Implement Bucket Behavior to Cells #2660
base: master
Are you sure you want to change the base?
Conversation
move methods to IItemBehaviour
|
||
blockHandler = createHandler(cellFluid, world, pos.offset(facing)); | ||
success = GTTransferUtils.transferFluids(cellHandler, blockHandler) > 0; | ||
isFill = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these isFill
backwards? Right now you are setting isFill
to true when you are attempting to transfer fluid from the cell into the world, which is emptying, not filling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i interpreted it as "filling the block", but it really could be either or.
src/main/java/gregtech/api/items/metaitem/stats/ItemFluidContainer.java
Outdated
Show resolved
Hide resolved
|
||
var blockHandler = FluidUtil.getFluidHandler(world, result.getBlockPos().offset(result.sideHit), | ||
result.sideHit); | ||
int freeSpace = cellHandler.getTankProperties()[0].getCapacity() - (cellFluid == null ? 0 : cellFluid.amount); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic feels fragile to me-- if cellhandler.drain()
fails to drain due to the handler saying no, but the handler contains fluid, that situation isn't accounted for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, if we're unable to drain for some reason, then tryPlace()
will return false and then we try to fill the held container. if both fail then nothing will happen
// the defualt assumption is placing fluid, then picking up fluid | ||
if (!pickup && tryPlace(cellHandler, world, pos.offset(result.sideHit), result.sideHit, player)) { | ||
playSound(soundFluid, true, player); | ||
addToPlayerInventory(stack, cellHandler.getContainer(), player, hand); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is cellHandler.getContainer()
the right thing to use here? I know it ought to work in most situations, but I think I remember seeing the canner, which does container fill/drain logic, doing something else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, and fluid canner also uses getContainer()
in its recipemap
What
allows GT cells to pick up and place in world fluids
Implementation Details
add behavior to
ItemFluidContainer
Outcome
"Finally, a weapon to surpass Thermal Expansion Reservoirs"