Skip to content

Commit

Permalink
Preserve item data when upgrading pocket computers (cc-tweaked#1888)
Browse files Browse the repository at this point in the history
  • Loading branch information
CaptainSqrBeard authored Jul 3, 2024
1 parent 7744d26 commit d77f5f1
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ public ItemStack assemble(CraftingContainer inventory, RegistryAccess registryAc

if (computer.isEmpty()) return ItemStack.EMPTY;

var itemComputer = (PocketComputerItem) computer.getItem();
if (PocketComputerItem.getUpgrade(computer) != null) return ItemStack.EMPTY;

// Check for upgrades around the item
Expand All @@ -81,10 +80,9 @@ public ItemStack assemble(CraftingContainer inventory, RegistryAccess registryAc
if (upgrade == null) return ItemStack.EMPTY;

// Construct the new stack
var computerID = itemComputer.getComputerID(computer);
var label = itemComputer.getLabel(computer);
var colour = itemComputer.getColour(computer);
return itemComputer.create(computerID, label, colour, upgrade);
var newStack = computer.copyWithCount(1);
PocketComputerItem.setUpgrade(newStack, upgrade);
return newStack;
}

@Override
Expand Down

0 comments on commit d77f5f1

Please sign in to comment.