Skip to content

Commit c67cbf0

Browse files
committed
Fix inheriting existing items on player inventories
1 parent 04f9a1e commit c67cbf0

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ val javaVersion: Int = 21
1515

1616
allprojects {
1717
group = "com.noxcrew.interfaces"
18-
version = "1.1.6-SNAPSHOT"
18+
version = "1.1.7-SNAPSHOT"
1919

2020
tasks.withType<JavaCompile> {
2121
sourceCompatibility = javaVersion.toString()

interfaces/src/main/kotlin/com/noxcrew/interfaces/view/PlayerInterfaceView.kt

+9-7
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,16 @@ public class PlayerInterfaceView internal constructor(
4242

4343
// Double-check that this inventory is open now!
4444
if (isOpen()) {
45-
// Clear the player's inventory!
46-
player.inventory.clear()
47-
if (player.openInventory.topInventory.type == InventoryType.CRAFTING ||
48-
player.openInventory.topInventory.type == InventoryType.CREATIVE
49-
) {
50-
player.openInventory.topInventory.clear()
45+
if (!backing.properties.inheritExistingItems) {
46+
// Clear the player's inventory!
47+
player.inventory.clear()
48+
if (player.openInventory.topInventory.type == InventoryType.CRAFTING ||
49+
player.openInventory.topInventory.type == InventoryType.CREATIVE
50+
) {
51+
player.openInventory.topInventory.clear()
52+
}
53+
player.openInventory.cursor = null
5154
}
52-
player.openInventory.cursor = null
5355

5456
// Trigger onOpen manually because there is no real inventory being opened,
5557
// this will also re-draw the player inventory parts!

0 commit comments

Comments
 (0)