Skip to content

Commit

Permalink
cleanup: Skip unnecessary NBT copying when checking for Item class (R…
Browse files Browse the repository at this point in the history
…S485#46)

We can take the underlying `Item` from an `ItemIdentifierStack`
directly without converting to an `ItemStack` first. The temporary
`ItemStack` is heavy-weight for fluids since the fluid/amount is
stored in an NBT that has to be copied.

(cherry picked from commit 4960669)
  • Loading branch information
szuend authored and Dream-Master committed May 20, 2024
1 parent 89abaad commit 88313fe
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public ItemIdentifierStack getFluidContainer(FluidStack stack) {

@Override
public FluidStack getFluidFromContainer(ItemIdentifierStack stack) {
if (stack.makeNormalStack().getItem() instanceof LogisticsFluidContainer && stack.getItem().tag != null) {
if (stack.getItem().item instanceof LogisticsFluidContainer && stack.getItem().tag != null) {
return FluidStack.loadFluidStackFromNBT(stack.getItem().tag);
}
return null;
Expand Down

0 comments on commit 88313fe

Please sign in to comment.