Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ build:
parallel:
matrix:
- MC_VER: [
"1.21.11", "1.21.10", "1.21.9", "1.21.8", "1.21.6", "1.21.5", "1.21.4", "1.21.3", "1.21.1",
"26.1.2", "1.21.10", "1.21.9", "1.21.8", "1.21.6", "1.21.5", "1.21.4", "1.21.3", "1.21.1",
"1.20.6", "1.20.4", "1.20.2", "1.20.1",
"1.19.4", "1.19.2",
"1.18.2",
Expand Down
16 changes: 9 additions & 7 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A Fabric extension mod that adds native **Vulkan rendering** to [Distant Horizon

LODs are rendered using VulkanMod's Vulkan pipeline instead of OpenGL, enabling Distant Horizons to work on systems and configurations running VulkanMod.

> **This is not a standalone mod.** You must have both Distant Horizons and VulkanMod installed. Versions v2.4.6+vm.3 and earlier were standalone forks of DH; Newer versions are a separate extension mod that runs alongside unmodified DH. Tested for Minecraft versions 1.20.6 and 1.21.11.
> **This is not a standalone mod.** You must have both Distant Horizons and VulkanMod installed. Versions v2.4.6+vm.3 and earlier were standalone forks of DH; Newer versions are a separate extension mod that runs alongside unmodified DH. Tested for Minecraft versions 1.20.6 and 26.1–26.1.2.

![Distant Horizons running on VulkanMod](docs/dh-vulkanmod.jpg)
*Distant Horizons LODs rendered via VulkanMod's Vulkan backend*
Expand Down Expand Up @@ -32,30 +32,32 @@ See [docs/vulkan_implementation_roadmap.md](docs/vulkan_implementation_roadmap.m

## Requirements

- **Minecraft:** 1.20.6 or 1.21.11
- **Minecraft:** 1.20.6 or 26.1 / 26.1.1 / 26.1.2
- **Mod loader:** Fabric
- **VulkanMod** must be installed (0.4.2 for MC 1.20.6, 0.6.1 for MC 1.21.11)
- **Distant Horizons** 2.4.0+ or 3.0.0+ must be installed
- **VulkanMod** must be installed (0.4.2 for MC 1.20.6, 0.6.6+ for MC 26.1.x)
- **Distant Horizons** 2.4.0+ (1.20.6) or 3.0.0+ (26.1.x) must be installed

> This is not the official Distant Horizons mod. For the original, see the [GitLab](https://gitlab.com/distant-horizons-team/distant-horizons) or [CurseForge](https://www.curseforge.com/minecraft/mc-mods/distant-horizons) pages.

## Building

```bash
# MC 1.21.11
./gradlew :vulkan:build -PmcVer="1.21.11"
# MC 26.1.2 (also supports 26.1 and 26.1.1 in the same jar)
./gradlew :vulkan:build -PmcVer="26.1.2"

# MC 1.20.6
./gradlew :vulkan:build -PmcVer="1.20.6"
```

Place matching **Distant Horizons** and **VulkanMod** jars in `jars/` before building (see Modrinth: DH 3.0.3-b for 26.1.2, VulkanMod 0.6.6 for 26.1.2).

The compiled jar will be in `vulkan/build/libs/`.

## Source Code Setup

### Prerequisites

* JDK 21 or newer — https://www.oracle.com/java/technologies/downloads/
* JDK 21+ for MC 1.20.6 builds; **JDK 25+** for MC 26.1.x (Gradle auto-downloads via toolchains)
* Git — https://git-scm.com/

### IntelliJ IDEA
Expand Down
Binary file added buildSrc/.DS_Store
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions docs/curseforge_description.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ An extension mod that makes [Distant Horizons](https://www.curseforge.com/minecr

**Requirements:**
- Fabric
- MC 1.20.6 or 1.21.11
- VulkanMod must be installed. 0.6+ for 1.21.11 and 0.4.2 for 1.20.6
- MC 1.20.6 or 26.1 / 26.1.1 / 26.1.2
- VulkanMod must be installed. 0.6.6+ for 26.1.x and 0.4.2 for 1.20.6
- Distant Horizons 2.4.0+ or 3.0.0+ must be installed

> This is not a standalone mod. Both Distant Horizons and VulkanMod are required.
Expand Down
7 changes: 4 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
org.gradle.jvmargs=-Xmx4096M
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.java.home=/Library/Java/JavaVirtualMachines/zulu-21.jdk/Contents/Home
# MC 26.1+ needs Java 25+ for Gradle; MC 1.20.6 builds work with Java 21+
# org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk-25.jdk/Contents/Home

# Mod Info
mod_name=DistantHorizons-VulkanMod
mod_version=2.4.0-3.0.0+vm.2
api_version=5.1.0
api_version=6.1.1
maven_group=com.seibel.distanthorizons
mod_readable_name=Distant Horizons for VulkanMod
mod_description=VulkanMod port of Distant Horizons. 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.
Expand Down Expand Up @@ -52,7 +53,7 @@ versionStr=

# This defines what MC version Intellij will use for the preprocessor
# and what version is used automatically by build and run commands
mcVer=1.21.11
mcVer=26.1.2

# Defines the maximum amount of memory Minecraft is allowed when run in a development environment
#minecraftMemoryJavaArg="-Xmx4G"
Binary file added gradle/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
12 changes: 11 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,22 @@ pluginManagement {
gradlePluginPortal()
mavenLocal()
}
plugins {
id "dev.architectury.loom" version "1.13-SNAPSHOT"
id "net.fabricmc.fabric-loom" version "1.16-SNAPSHOT"
id "systems.manifold.manifold-gradle-plugin" version "0.0.2-alpha"
id "org.gradle.toolchains.foojay-resolver-convention" version "1.0.0"
}
}

plugins {
id "org.gradle.toolchains.foojay-resolver-convention"
}


/** Loads version properties for the selected Minecraft version. */
def loadProperties() {
def defaultMcVersion = "1.21.11"
def defaultMcVersion = "26.1.2"
def mcVersion = ""
def mcVers = fileTree("versionProperties").files.name
for (int i = 0; i < mcVers.size(); i++) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# 1.21.11 version (VulkanMod port - Fabric only)
java_version=21
minecraft_version=1.21.11
parchment_version=1.21:2024.07.28
compatible_minecraft_versions=["1.21.11"]
accessWidenerVersion=1_21_11
# 26.1.2 version (VulkanMod port - Fabric only)
# Single jar supports 26.1, 26.1.1, and 26.1.2+ (matches DH / VulkanMod releases)
java_version=25
minecraft_version=26.1.2
parchment_version=
compatible_minecraft_versions=["26.1","26.1.1","26.1.2"]
accessWidenerVersion=26_1_2
builds_for=fabric
unobfuscated=true

# Netty
netty_version=4.1.97.Final
Expand All @@ -13,8 +15,8 @@ netty_version=4.1.97.Final
lwjgl_version=3.3.3

# Fabric loader
fabric_loader_version=0.17.3
fabric_api_version=0.139.4+1.21.11
fabric_loader_version=0.18.4
fabric_api_version=0.149.1+26.1.2
modmenu_version=17.0.0-alpha.1
starlight_version_fabric=
phosphor_version_fabric=
Expand All @@ -29,9 +31,6 @@ fabric_api_version=0.139.4+1.21.11
fabric_recommend_list={}

# Fabric mod run - all disabled for VulkanMod port
# 0 = Don't enable and don't run
# 1 = Can be referenced in code but doesn't run
# 2 = Can be referenced in code and runs in client
enable_mod_menu=2
enable_starlight=0
enable_phosphor=0
Expand All @@ -42,5 +41,5 @@ fabric_api_version=0.139.4+1.21.11
enable_immersive_portals=0
enable_canvas=0

# Empty stubs for root build.gradle processResources (references these even for Fabric-only builds)
# Empty stubs for root build.gradle processResources
neoforge_version_range=
Binary file added vulkan/.DS_Store
Binary file not shown.
82 changes: 54 additions & 28 deletions vulkan/build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,36 @@
plugins {
id "dev.architectury.loom" version "1.13-SNAPSHOT"
id "net.fabricmc.fabric-loom" version "1.16-SNAPSHOT"
id "systems.manifold.manifold-gradle-plugin" version "0.0.2-alpha"
}

version = rootProject.mod_version
archivesBaseName = "DistantHorizons-VulkanMod-fabric"
def mcVer = rootProject.minecraft_version
def isUnobfuscatedMc = mcVer.startsWith("26.")

jar {
archiveFileName = "${archivesBaseName}-${version}-mc${rootProject.minecraft_version}.jar"
sourceSets {
main {
resources {
if (isUnobfuscatedMc) {
srcDir "src/main/resources-mc26"
} else {
srcDir "src/main/resources-legacy"
}
}
if (isUnobfuscatedMc) {
java {
exclude "**/dh24/**"
exclude "**/mixin/dh24/**"
}
}
}
}

remapJar {
inputFile = jar.archiveFile
archiveFileName = "DistantHorizons-VulkanMod-fabric-${version}-mc${rootProject.minecraft_version}.jar"
dependsOn jar
version = rootProject.mod_version
base {
archivesName = "DistantHorizons-VulkanMod-fabric"
}

jar {
archiveFileName.set("${base.archivesName.get()}-${version}-mc${rootProject.minecraft_version}.jar")
}

processResources {
Expand All @@ -22,17 +39,16 @@ processResources {
inputs.property "minecraft_version", rootProject.minecraft_version
inputs.property "vulkanmod_min_version", vmMinVersion
filesMatching("fabric.mod.json") {
expand "version": project.version, "minecraft_version": rootProject.minecraft_version, "vulkanmod_min_version": vmMinVersion
expand "version": project.version,
"minecraft_version": rootProject.minecraft_version,
"vulkanmod_min_version": vmMinVersion
}
}

// Manifold preprocessor version
manifold {
manifoldVersion = "2025.1.31"
}

// Resolve DH and VulkanMod jars dynamically based on MC version
def mcVer = rootProject.minecraft_version
def dhJar = fileTree("${rootDir}/jars").matching { include "DistantHorizons-*-${mcVer}-*.jar" }.files
def vmJar = fileTree("${rootDir}/jars").matching { include "VulkanMod_${mcVer}-*.jar" }.files

Expand All @@ -41,24 +57,34 @@ if (vmJar.isEmpty()) throw new GradleException("No VulkanMod jar found for MC ${

dependencies {
minecraft "com.mojang:minecraft:${mcVer}"
mappings loom.layered() {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${rootProject.parchment_version}@zip")
}
// Fabric loader + API
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"

// Distant Horizons — compile against all matched jars (DH 2.4 + DH 3.0)
dhJar.each { modCompileOnly files(it) }

// VulkanMod — compile against the jar
modCompileOnly files(vmJar.first())
if (isUnobfuscatedMc) {
implementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
implementation "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
dhJar.each { compileOnly files(it) }
compileOnly files(vmJar.first())
} else {
mappings loom.layered() {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${rootProject.parchment_version}@zip")
}
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
dhJar.each { modCompileOnly files(it) }
modCompileOnly files(vmJar.first())
}

// LWJGL vulkan types (VkCommandBuffer, MemoryStack) surfaced by VulkanMod's API
compileOnly "org.lwjgl:lwjgl:${rootProject.lwjgl_version}"
compileOnly "org.lwjgl:lwjgl-vulkan:${rootProject.lwjgl_version}"

// Manifold preprocessor
annotationProcessor("systems.manifold:manifold-preprocessor:2025.1.31")
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(rootProject.java_version as int)
}
}

tasks.withType(JavaCompile).configureEach {
options.release = rootProject.java_version as int
}
32 changes: 12 additions & 20 deletions vulkan/src/main/java/com/braffolk/dhvulkan/DhVulkanMixinPlugin.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.braffolk.dhvulkan;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.Mixins;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
Expand All @@ -24,6 +26,8 @@
*/
public class DhVulkanMixinPlugin implements IMixinConfigPlugin {

private static final Logger LOGGER = LogManager.getLogger("DH-VulkanMod");

private static final String DH_CONFIG_NAME = "DistantHorizons.fabric.mixins.json";
private static final String DH_MIXIN_TO_REMOVE = "client.MixinTextureUtil";
// DH 3.0's MixinSharedConstants sets IS_RUNNING_IN_IDE = true, which enables
Expand All @@ -34,7 +38,7 @@ public class DhVulkanMixinPlugin implements IMixinConfigPlugin {

@Override
public void onLoad(String mixinPackage) {
System.out.println("[DH-VulkanMod] Mixin plugin loaded, resolving DH/VulkanMod mixin conflicts...");
LOGGER.debug("Resolving DH/VulkanMod mixin conflicts...");

boolean removed = false;
try {
Expand All @@ -45,12 +49,12 @@ public void onLoad(String mixinPackage) {
continue;
}

System.out.println("[DH-VulkanMod] Found DH config: " + configName);
LOGGER.debug("Found DH config: {}", configName);

// Config.getConfig() returns the internal MixinConfig
Object mixinConfig = getFieldValue(config, "config");
if (mixinConfig == null) {
System.err.println("[DH-VulkanMod] Could not access internal MixinConfig");
LOGGER.warn("Could not access internal MixinConfig");
continue;
}

Expand All @@ -71,28 +75,16 @@ public void onLoad(String mixinPackage) {
if (clientMixins != null) {
if (clientMixins.remove(DH_MIXIN_TO_REMOVE)) {
removed = true;
System.out.println("[DH-VulkanMod] ✓ Removed " + DH_MIXIN_TO_REMOVE
+ " from DH config — TextureUtil conflict resolved");
LOGGER.debug("Removed {} from DH config (TextureUtil conflict)", DH_MIXIN_TO_REMOVE);
}
if (clientMixins.remove(DH_MIXIN_SHARED_CONSTANTS)) {
removed = true;
System.out.println("[DH-VulkanMod] ✓ Removed " + DH_MIXIN_SHARED_CONSTANTS
+ " from DH config — prevents VulkanMod validation crash");
LOGGER.debug("Removed {} from DH config (validation crash)", DH_MIXIN_SHARED_CONSTANTS);
}
}
if (!removed) {
System.out.println("[DH-VulkanMod] No conflicting DH mixins found in config"
+ " (may not exist in this DH version — no conflict)");
}
}
} catch (Exception e) {
System.err.println("[DH-VulkanMod] WARNING: Failed to strip DH's MixinTextureUtil: " + e);
e.printStackTrace();
}

if (!removed) {
System.err.println("[DH-VulkanMod] Could not remove conflicting DH mixins from DH config.");
System.err.println("[DH-VulkanMod] If a mixin crash occurs, add JVM arg: -Dmixin.checks=false");
LOGGER.warn("Failed to strip conflicting DH mixins from DH config", e);
}
}

Expand Down Expand Up @@ -157,10 +149,10 @@ public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
"com.seibel.distanthorizons.core.wrapperInterfaces.render.AbstractDhRenderApiDefinition"
);
isDh3Present = true;
System.out.println("[DH-VulkanMod] DH 3.0 detected. Using API integration + dh3 mixins.");
LOGGER.debug("DH 3.0 detected; using API integration + dh3 mixins.");
} catch (ClassNotFoundException e) {
isDh3Present = false;
System.out.println("[DH-VulkanMod] DH 2.4 detected. Using mixin integration + dh24 mixins.");
LOGGER.debug("DH 2.4 detected; using mixin integration + dh24 mixins.");
}
}

Expand Down
Loading