Skip to content

Commit 6b38dfa

Browse files
authored
Merge pull request #666 from zyxkad/dev/1.19.2
only clear owner when new empty card is swapped but not after load
2 parents 6888ed5 + 5433311 commit 6b38dfa

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/main/java/de/srendi/advancedperipherals/common/blocks/blockentities/InventoryManagerEntity.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,16 @@ public boolean canPlaceItemThroughFace(int index, @NotNull ItemStack itemStackIn
5252

5353
@Override
5454
public void setItem(int index, @NotNull ItemStack stack) {
55-
if (stack.getItem() instanceof MemoryCardItem && stack.hasTag() && stack.getTag().contains("ownerId")) {
56-
UUID owner = stack.getTag().getUUID("ownerId");
57-
this.owner = owner;
58-
stack.getTag().remove("ownerId");
59-
stack.getTag().remove("owner");
55+
if (stack.getItem() instanceof MemoryCardItem) {
56+
if (stack.hasTag() && stack.getTag().contains("ownerId")) {
57+
UUID owner = stack.getTag().getUUID("ownerId");
58+
this.owner = owner;
59+
stack.getTag().remove("ownerId");
60+
stack.getTag().remove("owner");
61+
} else if (stack != this.getItem(index)) {
62+
// Only clear owner when the new card item is not the current item
63+
this.owner = null;
64+
}
6065
} else {
6166
this.owner = null;
6267
}

0 commit comments

Comments
 (0)