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

Fix modifying fluid patterns with OC #106

Merged
merged 7 commits into from Aug 11, 2023
Merged

Fix modifying fluid patterns with OC #106

merged 7 commits into from Aug 11, 2023

Conversation

S4mpsa
Copy link

@S4mpsa S4mpsa commented Aug 9, 2023

Fixes modifying pattern inputs and outputs that have fluids in them.

@S4mpsa S4mpsa marked this pull request as draft August 9, 2023 15:47
@S4mpsa S4mpsa marked this pull request as ready for review August 9, 2023 16:05
@@ -162,6 +162,7 @@ object DriverBlockInterface extends DriverSidedTileEntity {
val nbt = new NBTTagCompound()
stack.writeToNBT(nbt)
nbt.setInteger("Count", stack.stackSize)
nbt.setLong("Cnt", stack.stackSize)

Choose a reason for hiding this comment

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

I hope AC2FC won't take item for fluid in that case...

Copy link
Author

Choose a reason for hiding this comment

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

I tested it and it seemed to work fine, AE2FC checks if the item is a drop for the fluid part.

Copy link

@Sopel97 Sopel97 Aug 10, 2023

Choose a reason for hiding this comment

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

I'd still do

val tag = inTag.getCompoundTagAt(index)
if (tag.getLong("Cnt") > 0)
  nbt.setLong("Cnt", stack.stackSize)
else
  nbt.setLong("Count", stack.stackSize)

just to be safe an mimick the logic for get.

This, however, would break if a new input item is added, so might need a check for the pattern type? What should adding a fluid to a normal pattern do?.

Copy link
Author

Choose a reason for hiding this comment

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

I tried a few ways to avoid setting Count if the pattern is a fluid pattern, but it always invalidated the pattern. Having both Count and Cnt set doesn't impact functionality (tested on full pack), just introduces a small amout of extra NBT to the pattern if it is touched by OC.

Copy link

@Sopel97 Sopel97 Aug 10, 2023

Choose a reason for hiding this comment

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

"Count" is present but set to 0 for every fluid pattern normally. If you're certain it has no impact then it's fine I guess.

@Dream-Master Dream-Master merged commit 91c32e5 into master Aug 11, 2023
1 check passed
@Dream-Master Dream-Master deleted the fixFluidPatterns branch August 11, 2023 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants