Skip to content

Commit

Permalink
Read NBT tags combine and beSubstitute from ItemStack when conv…
Browse files Browse the repository at this point in the history
…erting them to `FluidPattern` (#268)
  • Loading branch information
TwoDCube authored Feb 23, 2025
1 parent e88af75 commit d78618d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
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

0 comments on commit d78618d

Please sign in to comment.