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
Conversation
src/main/scala/li/cil/oc/integration/appeng/ConverterPattern.java
Outdated
Show resolved
Hide resolved
@@ -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) |
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 hope AC2FC won't take item for fluid in that case...
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 tested it and it seemed to work fine, AE2FC checks if the item is a drop for the fluid part.
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'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?.
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 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.
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.
"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.
Fixes modifying pattern inputs and outputs that have fluids in them.