From f634670fa8d136ee6a0de7f4a586ce644c547fd0 Mon Sep 17 00:00:00 2001 From: P3pp3rF1y Date: Mon, 1 Apr 2024 23:46:53 +0200 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Fix=20Glacial=20staff?= =?UTF-8?q?=20to=20not=20try=20to=20melt=20down=20ice=20in=20unloaded=20ch?= =?UTF-8?q?unks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/reliquary/items/GlacialStaffItem.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/reliquary/items/GlacialStaffItem.java b/src/main/java/reliquary/items/GlacialStaffItem.java index 272864eb..1dba9853 100644 --- a/src/main/java/reliquary/items/GlacialStaffItem.java +++ b/src/main/java/reliquary/items/GlacialStaffItem.java @@ -101,6 +101,10 @@ private void meltBlocks(ItemStack staff, Level world, Player player) { if (!world.isClientSide) { BlockPos playerPos = player.blockPosition(); for (BlockPos pos : getBlockLocations(staff)) { + if (!world.isLoaded(pos)) { + continue; + } + int xOff = Math.abs(playerPos.getX() - pos.getX()); int yOff = Math.abs(playerPos.getY() - pos.getY()); int zOff = Math.abs(playerPos.getZ() - pos.getZ()); From 1c0e4c557a232005eb4fe741c4ad4b8532faeb2b Mon Sep 17 00:00:00 2001 From: P3pp3rF1y Date: Sun, 7 Apr 2024 12:13:24 +0200 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Fix=20crash=20with=20?= =?UTF-8?q?mob=20charm=20code=20when=20there=20are=20multiple=20players=20?= =?UTF-8?q?in=20the=20world?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 2 +- src/main/java/reliquary/items/MobCharmItem.java | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index 328ca6b5..80144b95 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ org.gradle.jvmargs=-Xmx2048m minecraft_version=1.20.1 forge_version=47.1.5 -mod_version=2.0.39 +mod_version=2.0.40 jei_mc_version=1.20.1-forge jei_version=15.1.0.19 curios_version=5.2.0-beta.3+1.20.1 diff --git a/src/main/java/reliquary/items/MobCharmItem.java b/src/main/java/reliquary/items/MobCharmItem.java index 487457fc..570799e0 100644 --- a/src/main/java/reliquary/items/MobCharmItem.java +++ b/src/main/java/reliquary/items/MobCharmItem.java @@ -224,8 +224,8 @@ public void setCharmInventoryHandler(CharmInventoryHandler charmInventoryHandler } public static class CharmInventoryHandler { - private static long lastCharmCacheTime = -1; - private static final Map> charmsInInventoryCache = new HashMap<>(); + private long lastCharmCacheTime = -1; + private final Map> charmsInInventoryCache = new HashMap<>(); protected Set getCharmRegistryNames(Player player) { Set ret = new HashSet<>(); @@ -249,9 +249,8 @@ public boolean playerHasMobCharm(Player player, MobCharmDefinition charmDefiniti if (lastCharmCacheTime != player.level().getGameTime()) { lastCharmCacheTime = player.level().getGameTime(); charmsInInventoryCache.clear(); - charmsInInventoryCache.put(player.getUUID(), getCharmRegistryNames(player)); } - return charmsInInventoryCache.get(player.getUUID()).contains(registryName); + return charmsInInventoryCache.computeIfAbsent(player.getUUID(), u -> getCharmRegistryNames(player)).contains(registryName); }