Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| aabb90ada6 | |||
| 963a8dc53f | |||
| aa6d69385b | |||
| f42c9cf8fb | |||
| 92e0011c8d | |||
| c20d95a7c7 | |||
| 353aa1ed2c | |||
| 5aa43ebcc8 | |||
| b6145461b6 | |||
| 478e431076 |
@@ -38,7 +38,7 @@ public final class ModInfo
|
|||||||
public static final String NAME = "DistantHorizons";
|
public static final String NAME = "DistantHorizons";
|
||||||
/** Human-readable version of NAME */
|
/** Human-readable version of NAME */
|
||||||
public static final String READABLE_NAME = "Distant Horizons";
|
public static final String READABLE_NAME = "Distant Horizons";
|
||||||
public static final String VERSION = "2.4.1-b";
|
public static final String VERSION = "2.4.2-b";
|
||||||
/** Returns true if the current build is an unstable developer build, false otherwise. */
|
/** Returns true if the current build is an unstable developer build, false otherwise. */
|
||||||
public static final boolean IS_DEV_BUILD = VERSION.toLowerCase().contains("dev");
|
public static final boolean IS_DEV_BUILD = VERSION.toLowerCase().contains("dev");
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
package com.seibel.distanthorizons.core;
|
package com.seibel.distanthorizons.core;
|
||||||
|
|
||||||
import com.github.luben.zstd.ZstdOutputStream;
|
import com.github.luben.zstd.ZstdOutputStream;
|
||||||
|
import com.seibel.distanthorizons.core.config.Config;
|
||||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
import com.seibel.distanthorizons.core.render.renderer.generic.GenericRenderObjectFactory;
|
import com.seibel.distanthorizons.core.render.renderer.generic.GenericRenderObjectFactory;
|
||||||
@@ -30,19 +31,30 @@ import com.seibel.distanthorizons.core.api.external.methods.config.DhApiConfig;
|
|||||||
import com.seibel.distanthorizons.core.api.external.methods.data.DhApiTerrainDataRepo;
|
import com.seibel.distanthorizons.core.api.external.methods.data.DhApiTerrainDataRepo;
|
||||||
import com.seibel.distanthorizons.api.DhApi;
|
import com.seibel.distanthorizons.api.DhApi;
|
||||||
import com.seibel.distanthorizons.core.render.DhApiRenderProxy;
|
import com.seibel.distanthorizons.core.render.DhApiRenderProxy;
|
||||||
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||||
|
import com.seibel.distanthorizons.coreapi.util.StringUtil;
|
||||||
import net.jpountz.lz4.LZ4FrameOutputStream;
|
import net.jpountz.lz4.LZ4FrameOutputStream;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||||
import org.sqlite.SQLiteJDBCLoader;
|
import org.sqlite.SQLiteJDBCLoader;
|
||||||
import org.tukaani.xz.XZOutputStream;
|
import org.tukaani.xz.XZOutputStream;
|
||||||
|
|
||||||
|
import java.lang.management.GarbageCollectorMXBean;
|
||||||
|
import java.lang.management.ManagementFactory;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/** Handles first time Core setup. */
|
/** Handles first time Core setup. */
|
||||||
public class Initializer
|
public class Initializer
|
||||||
{
|
{
|
||||||
private static final DhLogger LOGGER = new DhLoggerBuilder().build();
|
private static final DhLogger LOGGER = new DhLoggerBuilder().build();
|
||||||
|
|
||||||
|
private static final IMinecraftClientWrapper MC_CLIENT = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void init()
|
public static void init()
|
||||||
{
|
{
|
||||||
|
LOGGER.info("Running library validation...");
|
||||||
|
|
||||||
// confirm that all referenced libraries are available to use
|
// confirm that all referenced libraries are available to use
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -50,7 +62,17 @@ public class Initializer
|
|||||||
// will throw an error (not an exception)
|
// will throw an error (not an exception)
|
||||||
Class<?> lz4Compressor = LZ4FrameOutputStream.class;
|
Class<?> lz4Compressor = LZ4FrameOutputStream.class;
|
||||||
Class<?> zstdCompressor = ZstdOutputStream.class;
|
Class<?> zstdCompressor = ZstdOutputStream.class;
|
||||||
Runnable zstdBlockDecompress = () -> { com.github.luben.zstd.Zstd.decompress(new byte [0]); };
|
|
||||||
|
{
|
||||||
|
byte[] testCompressByteArray = new byte[1024];
|
||||||
|
for (int i = 0; i < testCompressByteArray.length; i++)
|
||||||
|
{
|
||||||
|
testCompressByteArray[i] = (byte) (i % 126);
|
||||||
|
}
|
||||||
|
byte[] compressedBytes = com.github.luben.zstd.Zstd.compress(testCompressByteArray);
|
||||||
|
com.github.luben.zstd.Zstd.decompress(compressedBytes);
|
||||||
|
}
|
||||||
|
|
||||||
Class<?> lzmaCompressor = XZOutputStream.class;
|
Class<?> lzmaCompressor = XZOutputStream.class;
|
||||||
//Class<?> networking = ByteBuf.class;
|
//Class<?> networking = ByteBuf.class;
|
||||||
Class<?> config = com.electronwill.nightconfig.core.Config.class;
|
Class<?> config = com.electronwill.nightconfig.core.Config.class;
|
||||||
@@ -67,9 +89,7 @@ public class Initializer
|
|||||||
}
|
}
|
||||||
catch (Throwable e)
|
catch (Throwable e)
|
||||||
{
|
{
|
||||||
LOGGER.fatal("Critical programmer error: One or more libraries aren't present. Error: [" + e.getMessage() + "].", e);
|
MC_CLIENT.crashMinecraft("Distant Horizons critical setup error: One or more libraries are either in-accessible, corrupted, or overwritten by another mod. Error: [" + e.getMessage() + "].", e);
|
||||||
// throwing here should crash the game, notifying the developer that something is wrong
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// confirm the resource directory is present
|
// confirm the resource directory is present
|
||||||
@@ -83,8 +103,7 @@ public class Initializer
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
LOGGER.fatal("Critical programmer error: Can't read SQL Scripts resource folder is either missing or malformed. Error: [" + e.getMessage() + "].");
|
MC_CLIENT.crashMinecraft("Critical programmer error: Can't read SQL Scripts resource folder is either missing or malformed. Error: [" + e.getMessage() + "].", e);
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This code has been disabled since it can cause Mac
|
// This code has been disabled since it can cause Mac
|
||||||
@@ -115,6 +134,43 @@ public class Initializer
|
|||||||
LOGGER.error("Programmer Error: No ["+IWrapperFactory.class.getSimpleName()+"] assigned to the DhApi.");
|
LOGGER.error("Programmer Error: No ["+IWrapperFactory.class.getSimpleName()+"] assigned to the DhApi.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// log a warning if G1GC is being used
|
||||||
|
// (this garbage collector is known to cause stuttering)
|
||||||
|
{
|
||||||
|
boolean g1GcInUse = false;
|
||||||
|
|
||||||
|
StringBuilder garbageCollectorNames = new StringBuilder();
|
||||||
|
List<GarbageCollectorMXBean> gcMxBeans = ManagementFactory.getGarbageCollectorMXBeans();
|
||||||
|
for (GarbageCollectorMXBean gcMxBean : gcMxBeans)
|
||||||
|
{
|
||||||
|
if (!garbageCollectorNames.toString().isEmpty())
|
||||||
|
{
|
||||||
|
garbageCollectorNames.append(", ");
|
||||||
|
}
|
||||||
|
garbageCollectorNames.append(gcMxBean.getName());
|
||||||
|
|
||||||
|
// "G1 Young Generation" // "G1 Concurrent GC" // "G1 Old Generation"
|
||||||
|
if (gcMxBean.getName().toLowerCase().contains("g1 "))
|
||||||
|
{
|
||||||
|
g1GcInUse = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LOGGER.info("Garbage collectors: ["+garbageCollectorNames+"]");
|
||||||
|
|
||||||
|
|
||||||
|
if (g1GcInUse
|
||||||
|
&& Config.Common.Logging.Warning.logGarbageCollectorWarning.get())
|
||||||
|
{
|
||||||
|
LOGGER.warn(
|
||||||
|
"Distant Horizons: G1 Garbage collector detected. \n" +
|
||||||
|
"This garbage collector can cause FPS stuttering. \n" +
|
||||||
|
"It's recommended to use a concurrent garbage collector \n" +
|
||||||
|
"like ZGC (Java 21+) or Shenandoah (Java 8 through 17) for a smoother experience. \n" +
|
||||||
|
"");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -715,48 +715,6 @@ public class ClientApi
|
|||||||
MC_CLIENT.sendChatMessage(message);
|
MC_CLIENT.sendChatMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// print a warning if G1GC is being used
|
|
||||||
// (this garbage collector is known to cause stuttering)
|
|
||||||
if (this.staticStartupMessageSentRecently()) return;
|
|
||||||
if (!this.g1GarbageCollectorWarningPrinted
|
|
||||||
&& Config.Common.Logging.Warning.showGarbageCollectorWarning.get())
|
|
||||||
{
|
|
||||||
this.g1GarbageCollectorWarningPrinted = true;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
boolean g1GcInUse = false;
|
|
||||||
|
|
||||||
List<GarbageCollectorMXBean> gcMxBeans = ManagementFactory.getGarbageCollectorMXBeans();
|
|
||||||
for (GarbageCollectorMXBean gcMxBean : gcMxBeans)
|
|
||||||
{
|
|
||||||
// "G1 Young Generation" // "G1 Concurrent GC" // "G1 Old Generation"
|
|
||||||
if (gcMxBean.getName().toLowerCase().contains("g1 "))
|
|
||||||
{
|
|
||||||
g1GcInUse = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g1GcInUse)
|
|
||||||
{
|
|
||||||
ClientApi.INSTANCE.showChatMessageNextFrame(
|
|
||||||
// yellow text
|
|
||||||
"\u00A7e" + "Distant Horizons: G1 Garbage collector detected." + "\u00A7r \n" +
|
|
||||||
"This garbage collector can cause FPS stuttering. \n" +
|
|
||||||
"It's recommended to use a concurrent garbage collector \n" +
|
|
||||||
"like ZGC (Java 21+) for a smoother experience. \n" +
|
|
||||||
"");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception re)
|
|
||||||
{
|
|
||||||
LOGGER.warn("Unable to determine garbage collector type. If stuttering occurs please try a concurrent garbage collector like ZGC.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/** done to prevent sending a bunch of startup messages all at once, causing some to be missed. */
|
/** done to prevent sending a bunch of startup messages all at once, causing some to be missed. */
|
||||||
private boolean staticStartupMessageSentRecently()
|
private boolean staticStartupMessageSentRecently()
|
||||||
|
|||||||
@@ -33,13 +33,12 @@ import com.seibel.distanthorizons.core.config.types.enums.*;
|
|||||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||||
|
import com.seibel.distanthorizons.core.util.NativeDialogUtil;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.IWrapperFactory;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.IWrapperFactory;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftSharedWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftSharedWrapper;
|
||||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||||
import org.lwjgl.util.tinyfd.TinyFileDialogs;
|
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -786,6 +785,11 @@ public class Config
|
|||||||
+ "A comma separated list of block resource locations that won't be rendered by DH. \n"
|
+ "A comma separated list of block resource locations that won't be rendered by DH. \n"
|
||||||
+ "Air is always included in this list. \n"
|
+ "Air is always included in this list. \n"
|
||||||
+ "Requires a restart to change. \n"
|
+ "Requires a restart to change. \n"
|
||||||
|
+ "\n"
|
||||||
|
+ "Note:\n"
|
||||||
|
+ "If you see gaps, or holes you may have to change\n"
|
||||||
|
+ "worldCompression to ["+EDhApiWorldCompressionMode.MERGE_SAME_BLOCKS+"] and re-generate the LODs.\n"
|
||||||
|
+ "Black spots may happen occur to block lighting being zero for covered blocks.\n"
|
||||||
+ "")
|
+ "")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@@ -1243,23 +1247,17 @@ public class Config
|
|||||||
.setAppearance(EConfigEntryAppearance.ONLY_IN_FILE) // no GUI renderer set up currently
|
.setAppearance(EConfigEntryAppearance.ONLY_IN_FILE) // no GUI renderer set up currently
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
public static ConfigUIButton uiButtonTest = new ConfigUIButton(() ->
|
public static ConfigUIButton uiButtonTest = new ConfigUIButton(() ->
|
||||||
{
|
{
|
||||||
// running on a separate thread is necessary to prevent locking
|
// running on a separate thread is necessary to prevent locking
|
||||||
new Thread(() ->
|
new Thread(() -> onButtonPressed()).start();
|
||||||
{
|
|
||||||
if (!GraphicsEnvironment.isHeadless())
|
|
||||||
{
|
|
||||||
LOGGER.info("Attempting to show tinyfd message box...");
|
|
||||||
boolean buttonPress = TinyFileDialogs.tinyfd_messageBox("Button pressed!", "UITester dialog", "ok", "info", false);
|
|
||||||
LOGGER.info("dialog returned with ["+(buttonPress ? "TRUE" : "FALSE")+"]");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LOGGER.info("button pressed!");
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
});
|
});
|
||||||
|
public static void onButtonPressed()
|
||||||
|
{
|
||||||
|
LOGGER.info("Attempting to show tinyfd message box...");
|
||||||
|
boolean buttonPress = NativeDialogUtil.showDialog("Button pressed!", "UITester dialog", "ok", "info");
|
||||||
|
LOGGER.info("dialog returned with ["+(buttonPress ? "TRUE" : "FALSE")+"]");
|
||||||
|
}
|
||||||
|
|
||||||
public static ConfigCategory categoryTest = new ConfigCategory.Builder().set(CategoryTest.class).build();
|
public static ConfigCategory categoryTest = new ConfigCategory.Builder().set(CategoryTest.class).build();
|
||||||
|
|
||||||
@@ -1629,15 +1627,6 @@ public class Config
|
|||||||
+ "")
|
+ "")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
public static ConfigEntry<Boolean> showGarbageCollectorWarning = new ConfigEntry.Builder<Boolean>()
|
|
||||||
.set(true)
|
|
||||||
.comment(""
|
|
||||||
+ "If enabled, a chat message will be displayed if the garbage \n"
|
|
||||||
+ "collector Java is currently using is known \n"
|
|
||||||
+ "to cause stutters and/or issues. \n"
|
|
||||||
+ "")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
public static ConfigEntry<Boolean> showReplayWarningOnStartup = new ConfigEntry.Builder<Boolean>()
|
public static ConfigEntry<Boolean> showReplayWarningOnStartup = new ConfigEntry.Builder<Boolean>()
|
||||||
.set(true)
|
.set(true)
|
||||||
.comment(""
|
.comment(""
|
||||||
@@ -1670,6 +1659,15 @@ public class Config
|
|||||||
+ "")
|
+ "")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
public static ConfigEntry<Boolean> logGarbageCollectorWarning = new ConfigEntry.Builder<Boolean>()
|
||||||
|
.set(true)
|
||||||
|
.comment(""
|
||||||
|
+ "If enabled, a message will be logged if the garbage \n"
|
||||||
|
+ "collector Java is currently using is known \n"
|
||||||
|
+ "to cause stutters and/or issues. \n"
|
||||||
|
+ "")
|
||||||
|
.build();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
|||||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||||
import com.seibel.distanthorizons.core.sql.dto.FullDataSourceV2DTO;
|
import com.seibel.distanthorizons.core.sql.dto.FullDataSourceV2DTO;
|
||||||
import com.seibel.distanthorizons.core.sql.repo.FullDataSourceV2Repo;
|
import com.seibel.distanthorizons.core.sql.repo.FullDataSourceV2Repo;
|
||||||
|
import com.seibel.distanthorizons.core.util.NativeDialogUtil;
|
||||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||||
import com.seibel.distanthorizons.core.jar.gui.BaseJFrame;
|
import com.seibel.distanthorizons.core.jar.gui.BaseJFrame;
|
||||||
import com.seibel.distanthorizons.core.jar.gui.cusomJObject.JBox;
|
import com.seibel.distanthorizons.core.jar.gui.cusomJObject.JBox;
|
||||||
@@ -31,7 +32,6 @@ import com.seibel.distanthorizons.core.jar.installer.WebDownloader;
|
|||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||||
import org.apache.logging.log4j.core.LoggerContext;
|
import org.apache.logging.log4j.core.LoggerContext;
|
||||||
import org.lwjgl.util.tinyfd.TinyFileDialogs;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -441,7 +441,7 @@ public class JarMain
|
|||||||
installMod.addActionListener(e -> {
|
installMod.addActionListener(e -> {
|
||||||
if (minecraftDirPop.getSelectedFile() == null)
|
if (minecraftDirPop.getSelectedFile() == null)
|
||||||
{
|
{
|
||||||
TinyFileDialogs.tinyfd_messageBox(ModInfo.READABLE_NAME, "Please select your install directory", "ok", "warning", false);
|
NativeDialogUtil.showDialog(ModInfo.READABLE_NAME, "Please select your install directory", "ok", "warning");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -455,11 +455,11 @@ public class JarMain
|
|||||||
ModInfo.NAME + "-" + ModrinthGetter.releaseNames.get(downloadID.get()) + ".jar"
|
ModInfo.NAME + "-" + ModrinthGetter.releaseNames.get(downloadID.get()) + ".jar"
|
||||||
).toFile());
|
).toFile());
|
||||||
|
|
||||||
TinyFileDialogs.tinyfd_messageBox(ModInfo.READABLE_NAME, "Installation done. \nYou can now close the installer", "ok", "info", false);
|
NativeDialogUtil.showDialog(ModInfo.READABLE_NAME, "Installation done. \nYou can now close the installer", "ok", "info");
|
||||||
}
|
}
|
||||||
catch (Exception f)
|
catch (Exception f)
|
||||||
{
|
{
|
||||||
TinyFileDialogs.tinyfd_messageBox(ModInfo.READABLE_NAME, "Download failed. Check your internet connection \nStacktrace: " + f.getMessage(), "error", "info", false);
|
NativeDialogUtil.showDialog(ModInfo.READABLE_NAME, "Download failed. Check your internet connection \nStacktrace: " + f.getMessage(), "error", "info");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
frame.add(installMod);
|
frame.add(installMod);
|
||||||
|
|||||||
@@ -29,12 +29,12 @@ import com.seibel.distanthorizons.core.jar.installer.ModrinthGetter;
|
|||||||
import com.seibel.distanthorizons.core.jar.installer.WebDownloader;
|
import com.seibel.distanthorizons.core.jar.installer.WebDownloader;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
import com.seibel.distanthorizons.core.logging.f3.F3Screen;
|
import com.seibel.distanthorizons.core.logging.f3.F3Screen;
|
||||||
|
import com.seibel.distanthorizons.core.util.NativeDialogUtil;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.IVersionConstants;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.IVersionConstants;
|
||||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||||
import com.seibel.distanthorizons.coreapi.util.StringUtil;
|
import com.seibel.distanthorizons.coreapi.util.StringUtil;
|
||||||
import com.seibel.distanthorizons.coreapi.util.jar.DeleteOnUnlock;
|
import com.seibel.distanthorizons.coreapi.util.jar.DeleteOnUnlock;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||||
import org.lwjgl.util.tinyfd.TinyFileDialogs;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -174,7 +174,7 @@ public class SelfUpdater
|
|||||||
|
|
||||||
if (!GitlabGetter.INSTANCE.getDownloads(pipeline.get("id")).containsKey(mcVersion))
|
if (!GitlabGetter.INSTANCE.getDownloads(pipeline.get("id")).containsKey(mcVersion))
|
||||||
{
|
{
|
||||||
LOGGER.warn("Minecraft version ["+ mcVersion +"] is not findable on Gitlab, findable versions are ["+ StringUtil.join(",", GitlabGetter.INSTANCE.getDownloads(pipeline.get("id")).keySet().toArray()) +"].");
|
LOGGER.warn("Minecraft version ["+ mcVersion +"] is not findable on Gitlab, findable versions are ["+ StringUtil.join(", ", GitlabGetter.INSTANCE.getDownloads(pipeline.get("id")).keySet().toArray()) +"].");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,14 +258,13 @@ public class SelfUpdater
|
|||||||
|
|
||||||
deleteOldJarOnJvmShutdown = true;
|
deleteOldJarOnJvmShutdown = true;
|
||||||
|
|
||||||
// TODO one of these messages contains something TinyFd doesn't like, find it and fix it
|
String successMessage = "Distant Horizons successfully updated. It will apply on game`s relaunch";
|
||||||
String successMessage = "Distant Horizons successfully updated. It will apply on game's relaunch";
|
|
||||||
LOGGER.info(successMessage);
|
LOGGER.info(successMessage);
|
||||||
new Thread(() ->
|
new Thread(() ->
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
TinyFileDialogs.tinyfd_messageBox(ModInfo.READABLE_NAME, successMessage, "ok", "info", false);
|
NativeDialogUtil.showDialog(ModInfo.READABLE_NAME, successMessage, "ok", "info");
|
||||||
}
|
}
|
||||||
catch (Exception ignore) { }
|
catch (Exception ignore) { }
|
||||||
}).start();
|
}).start();
|
||||||
@@ -288,7 +287,7 @@ public class SelfUpdater
|
|||||||
LOGGER.error(failMessage, e);
|
LOGGER.error(failMessage, e);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
TinyFileDialogs.tinyfd_messageBox(ModInfo.READABLE_NAME, failMessage, "ok", "error", false);
|
NativeDialogUtil.showDialog(ModInfo.READABLE_NAME, failMessage, "ok", "error");
|
||||||
}
|
}
|
||||||
catch (Exception ignore) { }
|
catch (Exception ignore) { }
|
||||||
|
|
||||||
@@ -386,7 +385,7 @@ public class SelfUpdater
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
TinyFileDialogs.tinyfd_messageBox(ModInfo.READABLE_NAME, successMessage, "ok", "info", false);
|
NativeDialogUtil.showDialog(ModInfo.READABLE_NAME, successMessage, "ok", "info");
|
||||||
}
|
}
|
||||||
catch (Exception ignore) { }
|
catch (Exception ignore) { }
|
||||||
}).start();
|
}).start();
|
||||||
@@ -424,7 +423,7 @@ public class SelfUpdater
|
|||||||
LOGGER.error(failMessage, e);
|
LOGGER.error(failMessage, e);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
TinyFileDialogs.tinyfd_messageBox(ModInfo.READABLE_NAME, failMessage, "ok", "error", false);
|
NativeDialogUtil.showDialog(ModInfo.READABLE_NAME, failMessage, "ok", "error");
|
||||||
}
|
}
|
||||||
catch (Exception ignore) { }
|
catch (Exception ignore) { }
|
||||||
|
|
||||||
|
|||||||
+8
@@ -178,6 +178,14 @@ public class FogShader extends AbstractShaderRenderer
|
|||||||
float farFogMax = Config.Client.Advanced.Graphics.Fog.farFogMax.get().floatValue();
|
float farFogMax = Config.Client.Advanced.Graphics.Fog.farFogMax.get().floatValue();
|
||||||
float farFogDensity = Config.Client.Advanced.Graphics.Fog.farFogDensity.get().floatValue();
|
float farFogDensity = Config.Client.Advanced.Graphics.Fog.farFogDensity.get().floatValue();
|
||||||
|
|
||||||
|
// override fog if underwater
|
||||||
|
if (MC_RENDER.isFogStateSpecial())
|
||||||
|
{
|
||||||
|
// hide everything behind fog
|
||||||
|
farFogStart = 0.0f;
|
||||||
|
farFogEnd = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
this.shader.setUniform(this.uFarFogStart, farFogStart);
|
this.shader.setUniform(this.uFarFogStart, farFogStart);
|
||||||
this.shader.setUniform(this.uFarFogLength, farFogEnd - farFogStart);
|
this.shader.setUniform(this.uFarFogLength, farFogEnd - farFogStart);
|
||||||
this.shader.setUniform(this.uFarFogMin, farFogMin);
|
this.shader.setUniform(this.uFarFogMin, farFogMin);
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.seibel.distanthorizons.core.util;
|
||||||
|
|
||||||
|
import org.lwjgl.util.tinyfd.TinyFileDialogs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should be used instead of the direct call to {@link TinyFileDialogs}
|
||||||
|
* so we can run additional validation and/or string cleanup.
|
||||||
|
* Otherwise, we may get error messages back.
|
||||||
|
*
|
||||||
|
* @see TinyFileDialogs
|
||||||
|
*/
|
||||||
|
public class NativeDialogUtil
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param dialogType the dialog type. One of:<br><table><tr><td>"ok"</td><td>"okcancel"</td><td>"yesno"</td><td>"yesnocancel"</td></tr></table>
|
||||||
|
* @param iconType the icon type. One of:<br><table><tr><td>"info"</td><td>"warning"</td><td>"error"</td><td>"question"</td></tr></table>
|
||||||
|
*/
|
||||||
|
public static boolean showDialog(String title, String message, String dialogType, String iconType)
|
||||||
|
{
|
||||||
|
// Tinyfd doesn't support the following characters, attempting to display them will cause the message
|
||||||
|
// to be replaced with an error message
|
||||||
|
String unsafeCharsRegex = "['\"`]";
|
||||||
|
|
||||||
|
title = title.replaceAll(unsafeCharsRegex, "`");
|
||||||
|
message = message.replaceAll(unsafeCharsRegex, "`");
|
||||||
|
|
||||||
|
return TinyFileDialogs.tinyfd_messageBox(title, message, dialogType, iconType, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+4
@@ -52,6 +52,10 @@ public interface ILevelWrapper extends IDhApiLevelWrapper, IBindable
|
|||||||
@Override
|
@Override
|
||||||
IDimensionTypeWrapper getDimensionType();
|
IDimensionTypeWrapper getDimensionType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Includes both the namespace and name. <br>
|
||||||
|
* example: "minecraft@@overworld"
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
String getDimensionName();
|
String getDimensionName();
|
||||||
|
|
||||||
|
|||||||
@@ -725,8 +725,6 @@
|
|||||||
"If DH detects that pooled objects are being garbage collected this will send a chat warning.",
|
"If DH detects that pooled objects are being garbage collected this will send a chat warning.",
|
||||||
"distanthorizons.config.common.logging.warning.showHighVanillaRenderDistanceWarning":
|
"distanthorizons.config.common.logging.warning.showHighVanillaRenderDistanceWarning":
|
||||||
"Show High Vanilla Render Distance Warning",
|
"Show High Vanilla Render Distance Warning",
|
||||||
"distanthorizons.config.common.logging.warning.showGarbageCollectorWarning":
|
|
||||||
"Show Garbage Collector Warning",
|
|
||||||
"distanthorizons.config.common.logging.warning.showReplayWarningOnStartup":
|
"distanthorizons.config.common.logging.warning.showReplayWarningOnStartup":
|
||||||
"Show Replay Warning",
|
"Show Replay Warning",
|
||||||
"distanthorizons.config.common.logging.warning.showUpdateQueueOverloadedChatWarning":
|
"distanthorizons.config.common.logging.warning.showUpdateQueueOverloadedChatWarning":
|
||||||
@@ -735,6 +733,8 @@
|
|||||||
"Show Slow World Gen Warnings",
|
"Show Slow World Gen Warnings",
|
||||||
"distanthorizons.config.common.logging.warning.showModCompatibilityWarningsOnStartup":
|
"distanthorizons.config.common.logging.warning.showModCompatibilityWarningsOnStartup":
|
||||||
"Show Mod Compatibility Warnings",
|
"Show Mod Compatibility Warnings",
|
||||||
|
"distanthorizons.config.common.logging.warning.logGarbageCollectorWarning":
|
||||||
|
"Log Garbage Collector Warning",
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user