add ItemStack to/from NBT helpers (#202)

to simplify the "stackSize" NBT tag workaround
This commit is contained in:
MycroftJr
2023-01-08 20:10:35 -08:00
committed by GitHub
parent c46eadec08
commit 662a7805dd
15 changed files with 89 additions and 69 deletions
@@ -52,6 +52,7 @@ import java.io.IOException;
import java.util.*;
import static appeng.client.render.BlockPosHighlighter.hilightBlock;
import static appeng.helpers.ItemStackHelper.stackFromNBT;
public class GuiInterfaceTerminal extends AEBaseGui {
@@ -321,7 +322,7 @@ public class GuiInterfaceTerminal extends AEBaseGui {
for (int x = 0; x < current.getInventory().getSlots(); x++) {
final String which = Integer.toString(x);
if (invData.hasKey(which)) {
current.getInventory().setStackInSlot(x, new ItemStack(invData.getCompoundTag(which)));
current.getInventory().setStackInSlot(x, stackFromNBT(invData.getCompoundTag(which)));
}
}
} catch (final NumberFormatException ignored) {