From 4c6e227360152f2a7dc27d531f045febb87d6bc1 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Sat, 18 Jun 2022 14:48:08 -0700 Subject: [PATCH] Sync Starlight SaveUtil with 1.1.1 Code isn't used, but still should be synced --- patches/server/Rewrite-the-light-engine.patch | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/patches/server/Rewrite-the-light-engine.patch b/patches/server/Rewrite-the-light-engine.patch index 56d8c19818..436cf207c2 100644 --- a/patches/server/Rewrite-the-light-engine.patch +++ b/patches/server/Rewrite-the-light-engine.patch @@ -4143,9 +4143,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public static void saveLightHook(final Level world, final ChunkAccess chunk, final CompoundTag nbt) { + try { + saveLightHookReal(world, chunk, nbt); -+ } catch (final Exception ex) { ++ } catch (final Throwable ex) { + // failing to inject is not fatal so we catch anything here. if it fails, it will have correctly set lit to false + // for Vanilla to relight on load and it will not set our lit tag so we will relight on load ++ if (ex instanceof ThreadDeath) { ++ throw (ThreadDeath)ex; ++ } + LOGGER.warn("Failed to inject light data into save data for chunk " + chunk.getPos() + ", chunk light will be recalculated on its next load", ex); + } + } @@ -4237,9 +4240,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public static void loadLightHook(final Level world, final ChunkPos pos, final CompoundTag tag, final ChunkAccess into) { + try { + loadLightHookReal(world, pos, tag, into); -+ } catch (final Exception ex) { ++ } catch (final Throwable ex) { + // failing to inject is not fatal so we catch anything here. if it fails, then we simply relight. Not a problem, we get correct + // lighting in both cases. ++ if (ex instanceof ThreadDeath) { ++ throw (ThreadDeath)ex; ++ } + LOGGER.warn("Failed to load light for chunk " + pos + ", light will be recalculated", ex); + } + } @@ -4297,7 +4303,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + private SaveUtil() {} -+ +} diff --git a/src/main/java/ca/spottedleaf/starlight/common/util/WorldUtil.java b/src/main/java/ca/spottedleaf/starlight/common/util/WorldUtil.java new file mode 100644