From d77f5f135f9251d027cc900dc27fd80160b632b9 Mon Sep 17 00:00:00 2001 From: csqrb <56765288+CaptainSqrBeard@users.noreply.github.com> Date: Wed, 3 Jul 2024 13:21:02 +0600 Subject: [PATCH] Preserve item data when upgrading pocket computers (#1888) --- .../pocket/recipes/PocketComputerUpgradeRecipe.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/projects/common/src/main/java/dan200/computercraft/shared/pocket/recipes/PocketComputerUpgradeRecipe.java b/projects/common/src/main/java/dan200/computercraft/shared/pocket/recipes/PocketComputerUpgradeRecipe.java index bf55800a2..d6e7f8d9e 100644 --- a/projects/common/src/main/java/dan200/computercraft/shared/pocket/recipes/PocketComputerUpgradeRecipe.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/pocket/recipes/PocketComputerUpgradeRecipe.java @@ -59,7 +59,6 @@ public final class PocketComputerUpgradeRecipe extends CustomRecipe { 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 @@ -81,10 +80,9 @@ public final class PocketComputerUpgradeRecipe extends CustomRecipe { 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