mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-10-21 08:57:38 +00:00
Preserve item data when upgrading pocket computers (#1888)
This commit is contained in:
@@ -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
|
||||||
|
Reference in New Issue
Block a user