-
Notifications
You must be signed in to change notification settings - Fork 181
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 Legacy Filter NBT Reading #2570
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -187,7 +187,6 @@ public void setTransferSize(int transferSize) { | |
public NBTTagCompound serializeNBT() { | ||
NBTTagCompound tagCompound = new NBTTagCompound(); | ||
tagCompound.setTag("FilterInventory", super.serializeNBT()); | ||
// tagCompound.setInteger("MaxStackSize", getMaxTransferSize()); | ||
tagCompound.setInteger("TransferStackSize", getTransferSize()); | ||
return tagCompound; | ||
} | ||
|
@@ -201,9 +200,15 @@ public void deserializeNBT(NBTTagCompound nbt) { | |
} | ||
|
||
public void handleLegacyNBT(NBTTagCompound nbt) { | ||
if (hasFilter()) { | ||
getFilter().getFilterReader().handleLegacyNBT(nbt); | ||
// for filters as covers, the stack is set manually, and "FilterInventory" doesn't exist to be deserialized | ||
// also, ItemStackHandler's deserialization doesn't use setStackInSlot, so I have to do that manually here | ||
if (nbt.hasKey("FilterInventory")) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "FilterInventory" only exists when the cover used a FilterContainer (pumps, conveyors, etc). Filters as a cover only used the FilterWrapper, which does not have "FilterInventory" written to the tag. with the filter rework, "FilterInventory" is always written. |
||
super.deserializeNBT(nbt.getCompoundTag("FilterInventory")); | ||
setFilter(BaseFilter.getFilterFromStack(getFilterStack())); | ||
} | ||
|
||
if (hasFilter()) | ||
getFilter().getFilterReader().handleLegacyNBT(nbt); | ||
} | ||
|
||
/** Uses Cleanroom MUI */ | ||
|
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 this converting the legacy tag into the new format? If so, should
IsBlacklist
be removed from the tag?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, since "IsBlacklist" is written to a different place in the tag, this should only run once. i could remove the tag, but i don't see how that's useful.