From 5ab5e53e9a48225e00ce292f370f71ab9b6f4610 Mon Sep 17 00:00:00 2001 From: P3pp3rF1y Date: Sat, 28 Dec 2024 22:12:37 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Fixed=20backpack=20data?= =?UTF-8?q?=20to=20properly=20save=20after=20backpack=20removal,=20also=20?= =?UTF-8?q?made=20it=20so=20that=20data=20of=20backpack=20worn=20by=20mobs?= =?UTF-8?q?=20is=20removed=20a=20bit=20more=20aggressively=20-=20in=20rare?= =?UTF-8?q?=20circumstances=20that=20would=20make=20jukebox=20upgrade=20di?= =?UTF-8?q?sappear=20from=20these=20bags=20if=20the=20mob=20has=20just=20u?= =?UTF-8?q?nloaded,=20but=20should=20fix=20the=20issue=20of=20backpack=20d?= =?UTF-8?q?ata=20continuously=20getting=20bigger=20the=20older=20the=20wor?= =?UTF-8?q?ld=20gets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 2 +- .../sophisticatedbackpacks/backpack/BackpackStorage.java | 1 + .../common/EntityBackpackAdditionHandler.java | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 68bb939c..efdf2554 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ loader_version_range=[4,) mod_id=sophisticatedbackpacks mod_name=Sophisticated Backpacks mod_license=GNU General Public License v3.0 -mod_version=3.20.29 +mod_version=3.20.30 mod_group_id=sophisticatedbackpacks mod_authors=P3pp3rF1y, Ridanisaurus mod_description=Fancy and functional backpacks. diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackStorage.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackStorage.java index d4bdefa2..0bce4af8 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackStorage.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/backpack/BackpackStorage.java @@ -105,6 +105,7 @@ public void putAccessLog(AccessLogRecord alr) { public void removeBackpackContents(UUID backpackUuid) { backpackContents.remove(backpackUuid); + setDirty(); } public void setBackpackContents(UUID backpackUuid, CompoundTag contents) { diff --git a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/common/EntityBackpackAdditionHandler.java b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/common/EntityBackpackAdditionHandler.java index f2b78ea1..2f665c9e 100644 --- a/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/common/EntityBackpackAdditionHandler.java +++ b/src/main/java/net/p3pp3rf1y/sophisticatedbackpacks/common/EntityBackpackAdditionHandler.java @@ -286,7 +286,7 @@ public static void removeBeneficialEffects(Creeper creeper) { } public static void removeBackpackUuid(Monster entity, Level level) { - if (level.isClientSide() || (entity.getRemovalReason() != Entity.RemovalReason.KILLED && entity.getRemovalReason() != Entity.RemovalReason.DISCARDED) || !entity.getTags().contains(SPAWNED_WITH_BACKPACK)) { + if (level.isClientSide() || !entity.getTags().contains(SPAWNED_WITH_BACKPACK)) { return; }