diff --git a/imm_ptl_core/src/main/java/qouteall/imm_ptl/core/IPModMainClient.java b/imm_ptl_core/src/main/java/qouteall/imm_ptl/core/IPModMainClient.java index 8c9678d88..2587599e2 100644 --- a/imm_ptl_core/src/main/java/qouteall/imm_ptl/core/IPModMainClient.java +++ b/imm_ptl_core/src/main/java/qouteall/imm_ptl/core/IPModMainClient.java @@ -4,7 +4,6 @@ import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; import qouteall.imm_ptl.core.collision.CollisionHelper; import qouteall.imm_ptl.core.commands.ClientDebugCommand; import qouteall.imm_ptl.core.compat.IPFlywheelCompat; @@ -32,23 +31,6 @@ public class IPModMainClient { - private static final boolean isPreview = false; - - private static void showPreviewWarning() { - IPGlobal.clientTaskList.addTask(MyTaskList.withDelayCondition( - () -> Minecraft.getInstance().level == null, - MyTaskList.oneShotTask(() -> { - if (IPConfig.getConfig().shouldDisplayWarning("preview")) { - MutableComponent text = Component.translatable("imm_ptl.preview_warning").append( - McHelper.getLinkText(O_O.getIssueLink()) - ); - - CHelper.printChat(text); - } - }) - )); - } - private static void showNvidiaVideoCardWarning() { IPGlobal.clientTaskList.addTask(MyTaskList.withDelayCondition( () -> Minecraft.getInstance().level == null, @@ -120,10 +102,6 @@ public static void init() { ClientDebugCommand.register(dispatcher); }); - if (isPreview) { - showPreviewWarning(); - } - // showIntelVideoCardWarning(); showNvidiaVideoCardWarning(); diff --git a/imm_ptl_core/src/main/java/qouteall/imm_ptl/core/compat/IPModInfoChecking.java b/imm_ptl_core/src/main/java/qouteall/imm_ptl/core/compat/IPModInfoChecking.java index 93f699260..83ecbe427 100644 --- a/imm_ptl_core/src/main/java/qouteall/imm_ptl/core/compat/IPModInfoChecking.java +++ b/imm_ptl_core/src/main/java/qouteall/imm_ptl/core/compat/IPModInfoChecking.java @@ -66,6 +66,7 @@ String getVersionRangeStr() { public static final class ImmPtlInfo { public String latestReleaseVersion; + public List previewVersions; public List severelyIncompatible; public List incompatible; public List incompatibleShaderpacks; @@ -156,6 +157,15 @@ public static void initClient() { } } + if (IPConfig.getConfig().shouldDisplayWarning("preview")) { + MutableComponent text1 = Component.translatable("imm_ptl.preview_warning") + .append(McHelper.getLinkText(O_O.getIssueLink())) + .append(" ") + .append(IPMcHelper.getDisableWarningText("preview")); + + texts.add(text1); + } + for (ModIncompatInfo info : immPtlInfo.severelyIncompatible) { if (info != null && info.isModLoadedWithinVersion()) { MutableComponent text1; diff --git a/imm_ptl_core/src/main/java/qouteall/imm_ptl/core/platform_specific/O_O.java b/imm_ptl_core/src/main/java/qouteall/imm_ptl/core/platform_specific/O_O.java index 89941aa36..cdb07bea1 100644 --- a/imm_ptl_core/src/main/java/qouteall/imm_ptl/core/platform_specific/O_O.java +++ b/imm_ptl_core/src/main/java/qouteall/imm_ptl/core/platform_specific/O_O.java @@ -28,11 +28,11 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.LevelChunk; +import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import qouteall.imm_ptl.core.chunk_loading.ImmPtlClientChunkMap; import qouteall.imm_ptl.core.portal.custom_portal_gen.PortalGenInfo; -import org.jetbrains.annotations.Nullable; import java.nio.file.Path; import java.util.Optional; @@ -143,6 +143,16 @@ public static boolean isModLoadedWithinVersion(String modId, @Nullable String st } } + public static @Nullable String getImmPtlVersion() { + if (FabricLoader.getInstance().isDevelopmentEnvironment()) { + return null; + } + + return FabricLoader.getInstance() + .getModContainer("imm_ptl_core").get() + .getMetadata().getVersion().toString(); + } + public static boolean shouldUpdateImmPtl(String latestReleaseVersion) { if (FabricLoader.getInstance().isDevelopmentEnvironment()) { return false;