From a065a4f9cfa301926e4361d766aeaf2729bbe52b Mon Sep 17 00:00:00 2001 From: Nightenom <17338378+Nightenom@users.noreply.github.com> Date: Sun, 22 Sep 2024 20:13:37 +0200 Subject: [PATCH] Fix ldtteam/Structurize#696 --- gradle.properties | 2 +- .../common/config/AbstractConfiguration.java | 1 - .../ldtteam/common/fakelevel/FakeLevel.java | 28 ++++++++++++------- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/gradle.properties b/gradle.properties index 4b8762b..d686cf5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ javaVersion=21 useJavaToolChains=true #The currently running forge. -forgeVersion=21.1.4 +forgeVersion=21.1.31 fml_range=[4,) forge_range=[21.0.143,) diff --git a/src/main/java/com/ldtteam/common/config/AbstractConfiguration.java b/src/main/java/com/ldtteam/common/config/AbstractConfiguration.java index fd65a91..aca2ba6 100644 --- a/src/main/java/com/ldtteam/common/config/AbstractConfiguration.java +++ b/src/main/java/com/ldtteam/common/config/AbstractConfiguration.java @@ -14,7 +14,6 @@ import net.neoforged.neoforge.common.ModConfigSpec.RestartType; import net.neoforged.neoforge.common.util.LogicalSidedProvider; import org.jetbrains.annotations.Nullable; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; diff --git a/src/main/java/com/ldtteam/common/fakelevel/FakeLevel.java b/src/main/java/com/ldtteam/common/fakelevel/FakeLevel.java index 4be838e..07523a2 100644 --- a/src/main/java/com/ldtteam/common/fakelevel/FakeLevel.java +++ b/src/main/java/com/ldtteam/common/fakelevel/FakeLevel.java @@ -126,8 +126,15 @@ public FakeLevel(final SOURCE levelSource, final boolean overrideBeLevel) { // we have to pass null in ctor, so realLevel can be used - super(new FakeLevelData(realLevel.getLevelData(), - lightProvider), null, realLevel.registryAccess(), realLevel.dimensionTypeRegistration(), null, true, false, 0, 0); + super(new FakeLevelData(realLevel.getLevelData(), lightProvider), + realLevel.dimension(), + realLevel.registryAccess(), + realLevel.dimensionTypeRegistration(), + realLevel.getProfilerSupplier(), + true, + false, + 0, + 0); this.levelSource = levelSource; this.lightProvider = lightProvider; this.realLevel = realLevel; @@ -214,53 +221,54 @@ public void setEntities(final Collection entities) // ======================================== // ======= CTOR REAL LEVEL REDIRECTS ====== // ======================================== + // Note: must have null check because super ctor @Override public ResourceKey dimension() { - return realLevel().dimension(); + return realLevel() != null ? realLevel().dimension() : super.dimension(); } @Override public RegistryAccess registryAccess() { - return realLevel().registryAccess(); + return realLevel() != null ? realLevel().registryAccess() : super.registryAccess(); } @Override public DamageSources damageSources() { - return realLevel().damageSources(); + return realLevel() != null ? realLevel().damageSources() : super.damageSources(); } @Override public ProfilerFiller getProfiler() { - return realLevel().getProfiler(); + return realLevel() != null ? realLevel().getProfiler() : super.getProfiler(); } @Override public Supplier getProfilerSupplier() { - return realLevel().getProfilerSupplier(); + return realLevel() != null ? realLevel().getProfilerSupplier() : super.getProfilerSupplier(); } @Override public DimensionType dimensionType() { - return realLevel().dimensionType(); + return realLevel() != null ? realLevel().dimensionType() : super.dimensionType(); } @Override public Holder dimensionTypeRegistration() { - return realLevel().dimensionTypeRegistration(); + return realLevel() != null ? realLevel().dimensionTypeRegistration() : super.dimensionTypeRegistration(); } @Override public WorldBorder getWorldBorder() { - return realLevel().getWorldBorder(); + return realLevel() != null ? realLevel().getWorldBorder() : super.getWorldBorder(); } // ========================================