Skip to content

Commit

Permalink
change preview warning
Browse files Browse the repository at this point in the history
  • Loading branch information
qouteall committed Aug 19, 2023
1 parent 4db66f7 commit 5e6a104
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -120,10 +102,6 @@ public static void init() {
ClientDebugCommand.register(dispatcher);
});

if (isPreview) {
showPreviewWarning();
}

// showIntelVideoCardWarning();

showNvidiaVideoCardWarning();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ String getVersionRangeStr() {

public static final class ImmPtlInfo {
public String latestReleaseVersion;
public List<String> previewVersions;
public List<ModIncompatInfo> severelyIncompatible;
public List<ModIncompatInfo> incompatible;
public List<String> incompatibleShaderpacks;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 5e6a104

Please sign in to comment.