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

Read NBT tags combine and beSubstitute from ItemStack when converting them to FluidPattern #268

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ protected void encodeFluidPattern() {
pattern.setInputs(collectInventory(this.craftingSlots));
pattern.setOutputs(collectInventory(this.outputSlots));
pattern.setCanBeSubstitute(this.beSubstitute ? 1 : 0);
pattern.setCombine(this.combine ? 1 : 0);
patternSlotOUT.putStack(stampAuthor(pattern.writeToStack()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ public boolean readFromStack() {
return false;
}
NBTTagCompound tag = Objects.requireNonNull(patternStack.getTagCompound());
setCanBeSubstitute(tag.getBoolean("beSubstitute") ? 1 : 0);
setCombine(tag.getInteger("combine"));

// may be possible to enter a partially-correct state if setInputs succeeds but setOutputs failed
// but outside code should treat it as completely incorrect and not attempt to make calls
return setInputs(readStackArray(tag.getTagList("in", Constants.NBT.TAG_COMPOUND)))
Expand Down