diff --git a/gradle.properties b/gradle.properties index 4252245..fc8578a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -34,7 +34,7 @@ org.gradle.parallel=true numismatic_version=568316:4996365 apoli_version=v2.9.0 levelz_version=517130:5024636 - beans_backpacks_version=Z8o9VqGa + beans_backpacks_version=c11dxUxm # Dev dependencies cardinal_components_version=5.2.2 diff --git a/src/main/java/com/b1n_ry/yigd/compat/BeansBackpacksCompat.java b/src/main/java/com/b1n_ry/yigd/compat/BeansBackpacksCompat.java index 819f160..2dac63c 100644 --- a/src/main/java/com/b1n_ry/yigd/compat/BeansBackpacksCompat.java +++ b/src/main/java/com/b1n_ry/yigd/compat/BeansBackpacksCompat.java @@ -102,7 +102,13 @@ public DefaultedList storeToPlayer(ServerPlayerEntity player) { ItemStack backpack = this.inventory.getBackpack(); DefaultedList backpackContents = this.inventory.getBackpackContents(); - if (backpack.isEmpty()) return extraItems; + if (backpack.isEmpty()) { + for (ItemStack extra : backpackContents) { + if (!extra.isEmpty()) + extraItems.add(extra); + } + return extraItems; + } BackData backData = BackData.get(player); backData.set(backpack); @@ -124,13 +130,16 @@ public DefaultedList storeToPlayer(ServerPlayerEntity player) { @Override public void handleDropRules(DeathContext context) { - if (this.inventory.getBackpack().isEmpty()) return; - YigdConfig.CompatConfig compatConfig = YigdConfig.getConfig().compatConfig; DropRule defaultDropRule = compatConfig.defaultBeansBackpacksDropRule; + if (this.inventory.getBackpack().isEmpty()) { + this.inventory.setDropRule(defaultDropRule); + return; + } + if (defaultDropRule == DropRule.PUT_IN_GRAVE) - this.inventory.dropRule = DropRuleEvent.EVENT.invoker().getDropRule(this.inventory.getBackpack(), -1, context, true); + this.inventory.setDropRule(DropRuleEvent.EVENT.invoker().getDropRule(this.inventory.getBackpack(), -1, context, true)); } @Override @@ -190,6 +199,10 @@ public DefaultedList merge(CompatComponent mergingComponent, Serve BeansBackpackInv mergingInventory = (BeansBackpackInv) mergingComponent.inventory; if (this.inventory.getBackpack().isEmpty()) { + for (ItemStack withoutBackpack : this.inventory.getBackpackContents()) { + if (!withoutBackpack.isEmpty()) + extraItems.add(withoutBackpack); + } this.inventory.setBackpack(mergingInventory.getBackpack()); this.inventory.setDropRule(mergingInventory.getDropRule()); this.inventory.setBackpackContents(mergingInventory.getBackpackContents());