1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-01-10 01:10:30 +00:00

Preserve item data when upgrading pocket computers (#1888)

This commit is contained in:
csqrb 2024-07-03 13:21:02 +06:00 committed by GitHub
parent 7744d2663b
commit d77f5f135f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -59,7 +59,6 @@ public final class PocketComputerUpgradeRecipe extends CustomRecipe {
if (computer.isEmpty()) return ItemStack.EMPTY; if (computer.isEmpty()) return ItemStack.EMPTY;
var itemComputer = (PocketComputerItem) computer.getItem();
if (PocketComputerItem.getUpgrade(computer) != null) return ItemStack.EMPTY; if (PocketComputerItem.getUpgrade(computer) != null) return ItemStack.EMPTY;
// Check for upgrades around the item // Check for upgrades around the item
@ -81,10 +80,9 @@ public final class PocketComputerUpgradeRecipe extends CustomRecipe {
if (upgrade == null) return ItemStack.EMPTY; if (upgrade == null) return ItemStack.EMPTY;
// Construct the new stack // Construct the new stack
var computerID = itemComputer.getComputerID(computer); var newStack = computer.copyWithCount(1);
var label = itemComputer.getLabel(computer); PocketComputerItem.setUpgrade(newStack, upgrade);
var colour = itemComputer.getColour(computer); return newStack;
return itemComputer.create(computerID, label, colour, upgrade);
} }
@Override @Override