Compare commits
39 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 008ad52bbc | |||
| d0b44a1ffc | |||
| 4ffe430686 | |||
| 19ca97c6c1 | |||
| 3334394bfd | |||
| 180e7cd814 | |||
| 84cf4505f2 | |||
| 1d74eea3ef | |||
| 6ee2e6be25 | |||
| b5c47d67cb | |||
| ead59d0817 | |||
| 1c9229c8f1 | |||
| 968a14c6a5 | |||
| 851c7439d5 | |||
| c902357a8f | |||
| 63170078f5 | |||
| d0dd1f125b | |||
| 32950d793e | |||
| 54e9bad907 | |||
| bb4ac770bd | |||
| 16afada6e9 | |||
| 7d0785a5fa | |||
| 6a67df462b | |||
| 0c45c76ff8 | |||
| bcb442e38d | |||
| 977ae471ea | |||
| b1701ab0d0 | |||
| c048d5cb56 | |||
| 2702f742d6 | |||
| 7add025c8a | |||
| 9dc220feb2 | |||
| 79955252c9 | |||
| bf13cc48a3 | |||
| cf454c80d7 | |||
| e6404cd882 | |||
| 52e64dc403 | |||
| 7c858afc5d | |||
| a44a5d7465 | |||
| f2d373b779 |
+39
-8
@@ -5,6 +5,9 @@ import org.apache.tools.zip.ZipEntry
|
||||
import javax.annotation.Nonnull
|
||||
import org.apache.tools.zip.ZipOutputStream
|
||||
|
||||
import java.util.function.Function
|
||||
import java.util.function.Predicate
|
||||
|
||||
|
||||
plugins {
|
||||
id "java"
|
||||
@@ -73,12 +76,23 @@ writeBuildGradlePredefine(rootProject.mcVers, rootProject.mcIndex)
|
||||
rootProject.versionStr = rootProject.mod_version + "-" + rootProject.minecraft_version // + "-" + new Date().format("yyyy_MM_dd_HH_mm")
|
||||
|
||||
class NativeTransformer implements Transformer {
|
||||
private Predicate<String> fileMatcher
|
||||
private Function<String, String> filePathMapper
|
||||
|
||||
private final HashMap<String, String> replacements = new HashMap()
|
||||
private final HashMap<String, byte[]> rewrittenFiles = new HashMap()
|
||||
private var nativeRelocator
|
||||
|
||||
public File rootDir
|
||||
|
||||
void matchFiles(Predicate<String> matcher) {
|
||||
fileMatcher = matcher
|
||||
}
|
||||
|
||||
void mapPaths(Function<String, String> mapper) {
|
||||
filePathMapper = mapper
|
||||
}
|
||||
|
||||
void relocateNative(String target, String replacement) {
|
||||
if (replacement.length() > target.length()) {
|
||||
throw new GradleException("Length of value \"${replacement}\" exceeds the length of \"${target}\": ${replacement.length()} > ${target.length()}")
|
||||
@@ -89,9 +103,7 @@ class NativeTransformer implements Transformer {
|
||||
|
||||
@Override
|
||||
boolean canTransformResource(@Nonnull FileTreeElement element) {
|
||||
return replacements.keySet().stream().anyMatch {
|
||||
element.name.startsWith(it as String)
|
||||
}
|
||||
return fileMatcher.test(element.name)
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -103,11 +115,9 @@ class NativeTransformer implements Transformer {
|
||||
}
|
||||
|
||||
try {
|
||||
Map.Entry<String, String> pathReplacement = replacements.entrySet().stream().filter {
|
||||
context.path.startsWith(it.key as String)
|
||||
}.findFirst().orElseThrow()
|
||||
|
||||
String path = context.path.replace(pathReplacement.key as String, pathReplacement.value as String)
|
||||
String path = filePathMapper != null
|
||||
? filePathMapper.apply(context.path)
|
||||
: context.path
|
||||
content = nativeRelocator.processBinary(path, content, replacements)
|
||||
|
||||
rewrittenFiles.put(path, content)
|
||||
@@ -351,9 +361,30 @@ subprojects { p ->
|
||||
|
||||
transform(NativeTransformer) {
|
||||
rootDir = project.rootDir
|
||||
|
||||
matchFiles { it.startsWith("org/sqlite") }
|
||||
mapPaths { it.replace("org/sqlite", "dh_sqlite") }
|
||||
|
||||
relocateNative "org/sqlite", "dh_sqlite"
|
||||
relocateNative "org_sqlite", "dh_1sqlite"
|
||||
}
|
||||
|
||||
// ZStd
|
||||
// librariesLocation isn't used because it's too long for replacing paths in native libraries
|
||||
// Allowing strings larger than the original string would require shifting the entire binary's contents
|
||||
relocate "com.github.luben", "dhcomgithubluben"
|
||||
relocate "libzstd-jni", "libzstd-jni_dh"
|
||||
relocate "zstd-jni", "zstd-jni_dh"
|
||||
|
||||
transform(NativeTransformer) {
|
||||
rootDir = project.rootDir
|
||||
|
||||
matchFiles { it.contains("libzstd-jni") && !it.contains("aix/ppc64") }
|
||||
mapPaths { it.replace("libzstd-jni", "libzstd-jni_dh") }
|
||||
|
||||
relocateNative "com/github/luben", "dhcomgithubluben"
|
||||
relocateNative "com_github_luben", "dhcomgithubluben"
|
||||
}
|
||||
|
||||
|
||||
// JOML
|
||||
|
||||
@@ -166,6 +166,10 @@ public abstract class AbstractModInitializer
|
||||
//noinspection unchecked
|
||||
ModAccessorInjector.INSTANCE.bind((Class<? extends IModAccessor>) accessorClass, accessorConstructor.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.debug("Skipping mod compatibility accessor for: ["+modId+"]");
|
||||
}
|
||||
}
|
||||
|
||||
private void initConfig()
|
||||
|
||||
+18
-21
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
package com.seibel.distanthorizons.common.wrappers.chunk;
|
||||
|
||||
import com.seibel.distanthorizons.api.DhApi;
|
||||
import com.seibel.distanthorizons.common.wrappers.block.BiomeWrapper;
|
||||
import com.seibel.distanthorizons.common.wrappers.block.BlockStateWrapper;
|
||||
import com.seibel.distanthorizons.common.wrappers.misc.MutableBlockPosWrapper;
|
||||
@@ -80,6 +81,8 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
private static final ThreadLocal<BlockPos.MutableBlockPos> MUTABLE_BLOCK_POS_REF = ThreadLocal.withInitial(() -> new BlockPos.MutableBlockPos());
|
||||
private static final ThreadLocal<MutableBlockPosWrapper> MUTABLE_BLOCK_POS_WRAPPER_REF = ThreadLocal.withInitial(() -> new MutableBlockPosWrapper());
|
||||
|
||||
private static boolean heightmapThreadWarningLogged = false;
|
||||
|
||||
|
||||
private final ChunkAccess chunk;
|
||||
private final DhChunkPos chunkPos;
|
||||
@@ -107,22 +110,21 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
// constructor //
|
||||
//=============//
|
||||
|
||||
/**
|
||||
* Note: this constructor should be very
|
||||
* fast since it will be called frequently on the MC
|
||||
* server thread and a slow method will cause server lag.
|
||||
*/
|
||||
public ChunkWrapper(ChunkAccess chunk, ILevelWrapper wrappedLevel)
|
||||
{
|
||||
this(chunk, wrappedLevel, true);
|
||||
}
|
||||
public ChunkWrapper(ChunkAccess chunk, ILevelWrapper wrappedLevel, boolean recreateHeightmaps)
|
||||
{
|
||||
this.chunk = chunk;
|
||||
this.wrappedLevel = wrappedLevel;
|
||||
this.chunkPos = new DhChunkPos(chunk.getPos().x, chunk.getPos().z);
|
||||
|
||||
if (recreateHeightmaps)
|
||||
{
|
||||
this.createDhHeightMaps();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkWrapper copy() { return new ChunkWrapper(this.chunk, this.wrappedLevel); }
|
||||
|
||||
|
||||
|
||||
//=========//
|
||||
@@ -242,11 +244,15 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
}
|
||||
private int getChunkSectionMinHeight(int index) { return (index * 16) + this.getInclusiveMinBuildHeight(); }
|
||||
|
||||
@Override
|
||||
public void createDhHeightMaps()
|
||||
{
|
||||
// re-calculate the min/max heights for consistency (during world gen these may be wrong)
|
||||
this.minNonEmptyHeight = Integer.MIN_VALUE;
|
||||
this.maxNonEmptyHeight = Integer.MAX_VALUE;
|
||||
if (heightmapThreadWarningLogged
|
||||
&& !DhApi.isDhThread())
|
||||
{
|
||||
LOGGER.warn("ChunkWrapper Height maps created on non-DH thread ["+Thread.currentThread().getName()+"]. This may cause stuttering.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.solidHeightMap = new int[LodUtil.CHUNK_WIDTH][LodUtil.CHUNK_WIDTH];
|
||||
@@ -614,15 +620,6 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
|
||||
|
||||
|
||||
//===============//
|
||||
// other methods //
|
||||
//===============//
|
||||
|
||||
@Override
|
||||
public boolean isStillValid() { return this.wrappedLevel.tryGetChunk(this.chunkPos) == this; }
|
||||
|
||||
|
||||
|
||||
//================//
|
||||
// base overrides //
|
||||
//================//
|
||||
|
||||
+2
-8
@@ -203,19 +203,13 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GLProxy.hasInstance())
|
||||
{
|
||||
// rendering setup hasn't finished
|
||||
return;
|
||||
}
|
||||
|
||||
#if MC_VER < MC_1_19_2
|
||||
player.sendMessage(new TextComponent(string), getPlayer().getUUID());
|
||||
#elif MC_VER < MC_1_21_9
|
||||
player.displayClientMessage(net.minecraft.network.chat.Component.translatable(string), /*isOverlay*/false);
|
||||
#else
|
||||
|
||||
GLProxy.getInstance().queueRunningOnRenderThread(() ->
|
||||
GLProxy.queueRunningOnRenderThread(() ->
|
||||
{
|
||||
player.displayClientMessage(net.minecraft.network.chat.Component.translatable(string), /*isOverlay*/false);
|
||||
});
|
||||
@@ -293,7 +287,7 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
||||
@Override
|
||||
public void crashMinecraft(String errorMessage, Throwable exception)
|
||||
{
|
||||
LOGGER.error(ModInfo.READABLE_NAME + " had the following error: [" + errorMessage + "]. Crashing Minecraft...", exception);
|
||||
LOGGER.fatal(ModInfo.READABLE_NAME + " had the following error: [" + errorMessage + "]. Crashing Minecraft...", exception);
|
||||
CrashReport report = new CrashReport(errorMessage, exception);
|
||||
#if MC_VER < MC_1_20_4
|
||||
Minecraft.crash(report);
|
||||
|
||||
+1
-18
@@ -259,7 +259,7 @@ public class ClientLevelWrapper implements IClientLevelWrapper
|
||||
#if MC_VER <= MC_1_21_10
|
||||
return this.level.dimension().location().toString();
|
||||
#else
|
||||
return this.level.dimension().identifier().getPath();
|
||||
return this.level.dimension().identifier().toString();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -295,23 +295,6 @@ public class ClientLevelWrapper implements IClientLevelWrapper
|
||||
#endif
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChunkWrapper tryGetChunk(DhChunkPos pos)
|
||||
{
|
||||
if (!this.level.hasChunk(pos.getX(), pos.getZ()))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
ChunkAccess chunk = this.level.getChunk(pos.getX(), pos.getZ(), ChunkStatus.EMPTY, false);
|
||||
if (chunk == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ChunkWrapper(chunk, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClientLevel getWrappedMcObject() { return this.level; }
|
||||
|
||||
|
||||
+1
-18
@@ -187,7 +187,7 @@ public class ServerLevelWrapper implements IServerLevelWrapper
|
||||
#if MC_VER <= MC_1_21_10
|
||||
return this.level.dimension().location().toString();
|
||||
#else
|
||||
return this.level.dimension().identifier().getPath();
|
||||
return this.level.dimension().identifier().toString();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -223,23 +223,6 @@ public class ServerLevelWrapper implements IServerLevelWrapper
|
||||
#endif
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChunkWrapper tryGetChunk(DhChunkPos pos)
|
||||
{
|
||||
if (!this.level.hasChunk(pos.getX(), pos.getZ()))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
ChunkAccess chunk = this.level.getChunk(pos.getX(), pos.getZ(), ChunkStatus.FULL, false);
|
||||
if (chunk == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ChunkWrapper(chunk, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerLevel getWrappedMcObject() { return this.level; }
|
||||
|
||||
|
||||
+39
-4
@@ -28,6 +28,7 @@ import com.seibel.distanthorizons.common.wrappers.world.ServerLevelWrapper;
|
||||
import com.seibel.distanthorizons.common.wrappers.worldGeneration.chunkFileHandling.ChunkFileReader;
|
||||
import com.seibel.distanthorizons.common.wrappers.worldGeneration.mimicObject.*;
|
||||
import com.seibel.distanthorizons.common.wrappers.worldGeneration.params.GlobalWorldGenParams;
|
||||
import com.seibel.distanthorizons.core.api.internal.SharedApi;
|
||||
import com.seibel.distanthorizons.core.generation.DhLightingEngine;
|
||||
import com.seibel.distanthorizons.core.level.IDhServerLevel;
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
@@ -37,6 +38,7 @@ import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||
import com.seibel.distanthorizons.core.sql.dto.BeaconBeamDTO;
|
||||
import com.seibel.distanthorizons.core.util.ExceptionUtil;
|
||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||
import com.seibel.distanthorizons.core.util.TimerUtil;
|
||||
import com.seibel.distanthorizons.core.util.gridList.ArrayGridList;
|
||||
import com.seibel.distanthorizons.core.util.objects.UncheckedInterruptedException;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.ChunkLightStorage;
|
||||
@@ -100,6 +102,15 @@ public final class BatchGenerationEnvironment implements IBatchGeneratorEnvironm
|
||||
public static final long EXCEPTION_TIMER_RESET_TIME = TimeUnit.NANOSECONDS.convert(1, TimeUnit.SECONDS);
|
||||
public static final int EXCEPTION_COUNTER_TRIGGER = 20;
|
||||
|
||||
/**
|
||||
* Used to revert the ignore logic in {@link SharedApi} so
|
||||
* that a given chunk pos can be handled again.
|
||||
* A timer is used so we don't have to inject into MC's code and it works sell enough
|
||||
* most of the time.
|
||||
* If a chunk does get through due the timeout not being long enough that isn't the end of the world.
|
||||
*/
|
||||
private static final int MS_TO_IGNORE_CHUNK_AFTER_COMPLETION = 5_000;
|
||||
|
||||
|
||||
|
||||
private final IDhServerLevel dhServerLevel;
|
||||
@@ -107,6 +118,8 @@ public final class BatchGenerationEnvironment implements IBatchGeneratorEnvironm
|
||||
public final InternalServerGenerator internalServerGenerator;
|
||||
public final ChunkFileReader chunkFileReader;
|
||||
|
||||
private final Timer chunkSaveIgnoreTimer = TimerUtil.CreateTimer("ChunkSaveIgnoreTimer");
|
||||
|
||||
|
||||
|
||||
public final LinkedBlockingQueue<GenerationEvent> generationEventQueue = new LinkedBlockingQueue<>();
|
||||
@@ -435,10 +448,9 @@ public final class BatchGenerationEnvironment implements IBatchGeneratorEnvironm
|
||||
|
||||
|
||||
|
||||
//=============================//
|
||||
//=========================//
|
||||
// process existing chunks //
|
||||
//
|
||||
//=============================//
|
||||
//=========================//
|
||||
|
||||
ArrayGridList<ChunkWrapper> chunkWrapperList = new ArrayGridList<>(regionChunks.gridSize);
|
||||
regionChunks.forEachPos((relX, relZ) ->
|
||||
@@ -454,8 +466,8 @@ public final class BatchGenerationEnvironment implements IBatchGeneratorEnvironm
|
||||
}
|
||||
else if (chunk != null)
|
||||
{
|
||||
//
|
||||
ChunkWrapper chunkWrapper = new ChunkWrapper(chunk, this.dhServerLevel.getLevelWrapper());
|
||||
chunkWrapper.createDhHeightMaps();
|
||||
chunkWrapperList.set(relX, relZ, chunkWrapper);
|
||||
|
||||
// try setting the wrapper's lighting
|
||||
@@ -575,6 +587,11 @@ public final class BatchGenerationEnvironment implements IBatchGeneratorEnvironm
|
||||
ProtoChunk protoChunk = ((ProtoChunk) chunk);
|
||||
protoChunk.setLightEngine(region.getLightEngine());
|
||||
}
|
||||
|
||||
// usually ignoring the chunk's position is unnecessary,
|
||||
// but this improves performance if a chunk update event does sneak through
|
||||
SharedApi.CHUNK_UPDATE_QUEUE_MANAGER.addPosToIgnore(chunkWrapper.getChunkPos());
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -684,6 +701,24 @@ public final class BatchGenerationEnvironment implements IBatchGeneratorEnvironm
|
||||
this.dhServerLevel.updateBeaconBeamsForChunkPos(centerChunkWrapper.getChunkPos(), activeBeamList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < iChunkWrapperList.size(); i++)
|
||||
{
|
||||
ChunkWrapper chunkWrapper = (ChunkWrapper) iChunkWrapperList.get(i);
|
||||
if (chunkWrapper == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// give MC a few seconds to save the chunk before
|
||||
// we can process update events there again
|
||||
this.chunkSaveIgnoreTimer.schedule(new TimerTask()
|
||||
{
|
||||
@Override
|
||||
public void run() { SharedApi.CHUNK_UPDATE_QUEUE_MANAGER.removePosToIgnore(chunkWrapper.getChunkPos()); }
|
||||
}, MS_TO_IGNORE_CHUNK_AFTER_COMPLETION);
|
||||
}
|
||||
}
|
||||
}
|
||||
private static <T> ArrayGridList<T> GetCutoutFrom(ArrayGridList<T> total, int border) { return new ArrayGridList<>(total, border, total.gridSize - border); }
|
||||
|
||||
+2
-1
@@ -51,7 +51,7 @@ public class InternalServerGenerator
|
||||
|
||||
/**
|
||||
* Used to revert the ignore logic in {@link SharedApi} so
|
||||
* that given chunk pos can be handled again.
|
||||
* that a given chunk pos can be handled again.
|
||||
* A timer is used so we don't have to inject into MC's code and it works sell enough
|
||||
* most of the time.
|
||||
* If a chunk does get through due the timeout not being long enough that isn't the end of the world.
|
||||
@@ -156,6 +156,7 @@ public class InternalServerGenerator
|
||||
if (chunk != null)
|
||||
{
|
||||
ChunkWrapper chunkWrapper = new ChunkWrapper(chunk, this.dhServerLevel.getLevelWrapper());
|
||||
chunkWrapper.createDhHeightMaps();
|
||||
chunkWrappers.add(chunkWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -222,7 +222,8 @@ public class ChunkCompoundTagParser
|
||||
boolean hasHeightmapData = readHeightmaps(chunk, chunkData);
|
||||
|
||||
// chunk wrapper so we can pass along extra data more easily
|
||||
ChunkWrapper chunkWrapper = new ChunkWrapper(chunk, dhServerLevel.getServerLevelWrapper(), !hasHeightmapData);
|
||||
ChunkWrapper chunkWrapper = new ChunkWrapper(chunk, dhServerLevel.getServerLevelWrapper());
|
||||
chunkWrapper.createDhHeightMaps();
|
||||
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -293,7 +293,7 @@ public class ChunkFileReader implements AutoCloseable
|
||||
public ChunkWrapper CreateProtoChunkWrapper(ServerLevel level, ChunkPos chunkPos)
|
||||
{
|
||||
ProtoChunk chunk = CreateProtoChunk(level, chunkPos);
|
||||
return new ChunkWrapper(chunk, this.params.dhServerLevel.getLevelWrapper(), false);
|
||||
return new ChunkWrapper(chunk, this.params.dhServerLevel.getLevelWrapper());
|
||||
}
|
||||
public static ProtoChunk CreateProtoChunk(ServerLevel level, ChunkPos chunkPos)
|
||||
{
|
||||
|
||||
@@ -24,6 +24,9 @@ accessible method net/minecraft/server/level/ChunkMap tick (Ljava/util/function/
|
||||
accessible field net/minecraft/server/level/ServerLevel entityManager Lnet/minecraft/world/level/entity/PersistentEntitySectionManager;
|
||||
accessible field net/minecraft/server/level/ChunkMap mainThreadExecutor Lnet/minecraft/util/thread/BlockableEventLoop;
|
||||
|
||||
# getting existing chunks outside the main thread
|
||||
accessible method net/minecraft/server/level/ChunkMap getVisibleChunkIfPresent (J)Lnet/minecraft/server/level/ChunkHolder;
|
||||
|
||||
# lod generation from save file
|
||||
accessible field net/minecraft/world/level/chunk/storage/SimpleRegionStorage worker Lnet/minecraft/world/level/chunk/storage/IOWorker;
|
||||
accessible field net/minecraft/world/level/chunk/storage/IOWorker storage Lnet/minecraft/world/level/chunk/storage/RegionFileStorage;
|
||||
|
||||
+1
-1
Submodule coreSubProjects updated: a2c61ed278...7c4ac2bd7e
@@ -113,14 +113,6 @@ public class FabricClientProxy implements AbstractModInitializer.IEventProxy
|
||||
|
||||
|
||||
|
||||
//=============//
|
||||
// tick events //
|
||||
//=============//
|
||||
|
||||
ClientTickEvents.START_CLIENT_TICK.register((client) -> { ClientApi.INSTANCE.clientTickEvent(); });
|
||||
|
||||
|
||||
|
||||
//==============//
|
||||
// chunk events //
|
||||
//==============//
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.util.NativeDialogUtil;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.IPluginPacketSender;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.*;
|
||||
@@ -38,7 +39,6 @@ import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||
import org.lwjgl.util.tinyfd.TinyFileDialogs;
|
||||
|
||||
#if MC_VER >= MC_1_19_2
|
||||
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
|
||||
@@ -103,7 +103,7 @@ public class FabricMain extends AbstractModInitializer implements ClientModIniti
|
||||
String indiumMissingMessage = ModInfo.READABLE_NAME + " needs Indium to work with Sodium.\nPlease download Indium from https://modrinth.com/mod/indium";
|
||||
LOGGER.fatal(indiumMissingMessage);
|
||||
|
||||
TinyFileDialogs.tinyfd_messageBox(ModInfo.READABLE_NAME, indiumMissingMessage, "ok", "error", false);
|
||||
NativeDialogUtil.showDialog(ModInfo.READABLE_NAME, indiumMissingMessage, "ok", "error");
|
||||
|
||||
IMinecraftClientWrapper mc = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
|
||||
String errorMessage = "loading Distant Horizons. Distant Horizons requires Indium in order to run with Sodium.";
|
||||
|
||||
@@ -107,21 +107,6 @@ public class ForgeClientProxy implements AbstractModInitializer.IEventProxy
|
||||
|
||||
|
||||
|
||||
//=============//
|
||||
// tick events //
|
||||
//=============//
|
||||
|
||||
@SubscribeEvent
|
||||
public void clientTickEvent(TickEvent.ClientTickEvent event)
|
||||
{
|
||||
if (event.phase == TickEvent.Phase.START)
|
||||
{
|
||||
ClientApi.INSTANCE.clientTickEvent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//==============//
|
||||
// world events //
|
||||
//==============//
|
||||
|
||||
@@ -22,17 +22,16 @@ package com.seibel.distanthorizons.forge;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.seibel.distanthorizons.common.AbstractModInitializer;
|
||||
import com.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen;
|
||||
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.IPluginPacketSender;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IIrisAccessor;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModChecker;
|
||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IOptifineAccessor;
|
||||
|
||||
import com.seibel.distanthorizons.forge.wrappers.modAccessor.ModChecker;
|
||||
import com.seibel.distanthorizons.forge.wrappers.modAccessor.OptifineAccessor;
|
||||
import com.seibel.distanthorizons.forge.wrappers.modAccessor.OculusAccessor;
|
||||
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
@@ -104,6 +103,7 @@ public class ForgeMain extends AbstractModInitializer
|
||||
protected void initializeModCompat()
|
||||
{
|
||||
this.tryCreateModCompatAccessor("optifine", IOptifineAccessor.class, OptifineAccessor::new);
|
||||
this.tryCreateModCompatAccessor("oculus", IIrisAccessor.class, OculusAccessor::new);
|
||||
|
||||
#if MC_VER < MC_1_17_1
|
||||
ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.CONFIGGUIFACTORY,
|
||||
|
||||
+5
-3
@@ -67,9 +67,11 @@ public class MixinFogRenderer
|
||||
|
||||
Entity entity = camera.getEntity();
|
||||
boolean isSpecialFog = (entity instanceof LivingEntity) && ((LivingEntity) entity).hasEffect(MobEffects.BLINDNESS);
|
||||
if (!isSpecialFog && cameraNotInFluid && fogMode == FogMode.FOG_TERRAIN
|
||||
&& !SingletonInjector.INSTANCE.get(IMinecraftRenderWrapper.class).isFogStateSpecial()
|
||||
&& Config.Client.Advanced.Graphics.Fog.disableVanillaFog.get())
|
||||
if (!isSpecialFog
|
||||
&& cameraNotInFluid
|
||||
&& fogMode == FogMode.FOG_TERRAIN
|
||||
&& !SingletonInjector.INSTANCE.get(IMinecraftRenderWrapper.class).isFogStateSpecial()
|
||||
&& !Config.Client.Advanced.Graphics.Fog.enableVanillaFog.get())
|
||||
{
|
||||
#if MC_VER < MC_1_17_1
|
||||
RenderSystem.fogStart(A_REALLY_REALLY_BIG_VALUE);
|
||||
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* This file is part of the Distant Horizons mod
|
||||
* licensed under the GNU LGPL v3 License.
|
||||
*
|
||||
* Copyright (C) 2020 James Seibel
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.distanthorizons.forge.wrappers.modAccessor;
|
||||
|
||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IIrisAccessor;
|
||||
|
||||
public class OculusAccessor implements IIrisAccessor
|
||||
{
|
||||
protected static final DhLogger LOGGER = new DhLoggerBuilder().build();
|
||||
|
||||
|
||||
public OculusAccessor()
|
||||
{
|
||||
LOGGER.warn("Partial Oculus support enabled. Some DH features may be disabled or behave strangely, use Iris instead if possible.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String getModName()
|
||||
{
|
||||
return "oculus";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShaderPackInUse()
|
||||
{
|
||||
// assume shaders are always active
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRenderingShadowPass()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
+3
-3
@@ -5,8 +5,8 @@ org.gradle.caching=true
|
||||
|
||||
# Mod Info
|
||||
mod_name=DistantHorizons
|
||||
mod_version=2.4.0-b
|
||||
api_version=5.0.0
|
||||
mod_version=2.4.4-b
|
||||
api_version=5.1.0
|
||||
maven_group=com.seibel.distanthorizons
|
||||
mod_readable_name=Distant Horizons
|
||||
mod_description=This mod generates and renders simplified terrain beyond the normal view distance at a low performance cost. Allowing you to see much farther without turning your game into a slideshow.
|
||||
@@ -18,7 +18,7 @@ mod_issues=https://gitlab.com/jeseibel/distant-horizons/-/issues
|
||||
mod_discord=https://discord.gg/xAB8G4cENx
|
||||
|
||||
# Global Plugin Versions
|
||||
manifold_version=2025.1.27
|
||||
manifold_version=2025.1.28
|
||||
# 2023.1.17 can be used if there are mystery Java compiler issues
|
||||
nightconfig_version=3.6.6
|
||||
lz4_version=1.8.0
|
||||
|
||||
@@ -73,29 +73,6 @@ public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy
|
||||
|
||||
|
||||
|
||||
//=============//
|
||||
// tick events //
|
||||
//=============//
|
||||
|
||||
#if MC_VER < MC_1_20_6
|
||||
@SubscribeEvent
|
||||
public void clientTickEvent(TickEvent.ClientTickEvent event)
|
||||
{
|
||||
if (event.phase == TickEvent.Phase.START)
|
||||
{
|
||||
ClientApi.INSTANCE.clientTickEvent();
|
||||
}
|
||||
}
|
||||
#else
|
||||
@SubscribeEvent
|
||||
public void clientTickEvent(ClientTickEvent.Pre event)
|
||||
{
|
||||
ClientApi.INSTANCE.clientTickEvent();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
//==============//
|
||||
// world events //
|
||||
//==============//
|
||||
|
||||
+3
-3
@@ -33,9 +33,9 @@ public class IrisAccessor implements IIrisAccessor
|
||||
{
|
||||
public IrisAccessor()
|
||||
{
|
||||
#if MC_VER == MC_1_21_11
|
||||
throw new UnsupportedOperationException("Iris isn't supported on this version of DH. When this version of DH was created Iris wasn't available for Neoforge yet.");
|
||||
#endif
|
||||
//#if MC_VER == MC_1_21_11
|
||||
//throw new UnsupportedOperationException("Iris isn't supported on this version of DH. When this version of DH was created Iris wasn't available for Neoforge yet.");
|
||||
//#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,15 +12,29 @@ How to add a library's natives:
|
||||
Example:
|
||||
|
||||
```groovy
|
||||
// Relocate the namespace (Java side)
|
||||
relocate "org.sqlite", "dh_sqlite", {
|
||||
// (Specific to SQLite's relocation)
|
||||
// Make sure that native paths are not changed before steps below
|
||||
exclude "org/sqlite/native/**"
|
||||
}
|
||||
// Shadow also replaces strings inside the Java code
|
||||
// See the library's source code to find strings used to call into the native code
|
||||
// This also includes native library paths, if you use mapPaths {} below they will likely need adjustment as well
|
||||
relocate "jdbc:sqlite", "jdbc:dh_sqlite"
|
||||
|
||||
transform(NativeTransformer) {
|
||||
// NativeTransformer configuration
|
||||
rootDir = project.rootDir
|
||||
|
||||
// Match native libraries
|
||||
matchFiles { it.startsWith("org/sqlite") }
|
||||
// Replace paths with ones that won't overlap with other mods
|
||||
// Libraries are the ones choosing the path to use for natives; check the source code to see which paths are acceptable.
|
||||
mapPaths { it.replace("org/sqlite", "dh_sqlite") }
|
||||
|
||||
// Replace native strings, e.g. used in calls back to Java
|
||||
// They must be of the same length or shorter!
|
||||
relocateNative "org/sqlite", "dh_sqlite"
|
||||
// Rename native methods used when calling from Java
|
||||
relocateNative "org_sqlite", "dh_1sqlite"
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user