Skip to content

Commit

Permalink
Fix DH compat
Browse files Browse the repository at this point in the history
  • Loading branch information
dima-dencep committed Apr 28, 2024
1 parent 840aacd commit d382b26
Show file tree
Hide file tree
Showing 16 changed files with 178 additions and 240 deletions.
Binary file not shown.
12 changes: 11 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ sourceSets {
}
}

dhCompatibility {
java {
compileClasspath += main.compileClasspath
compileClasspath += main.output
}
}

sodiumCompatibility {
java {
compileClasspath += main.compileClasspath
Expand All @@ -72,6 +79,7 @@ loom {
sourceSet sourceSets.main
sourceSet sourceSets.vendored
sourceSet sourceSets.sodiumCompatibility
sourceSet sourceSets.dhCompatibility
}
}
}
Expand Down Expand Up @@ -108,7 +116,7 @@ dependencies {
forge "net.neoforged:forge:${minecraft_version}-${forge_version}"

modImplementation "org.embeddedt:embeddium-${minecraft_version}:${embeddium_version}"
modCompileOnly(files("DHApi.jar"))
modCompileOnly(files("DistantHorizons-forge-2.0.4-a-dev-1.20.1.jar"))

forgeRuntimeLibrary(implementation(shadow(project(path: ":glsl-relocated", configuration: "bundledJar")))) {
transitive = false
Expand Down Expand Up @@ -147,6 +155,7 @@ remapJar {

jar {
from sourceSets.sodiumCompatibility.output
from sourceSets.dhCompatibility.output
from sourceSets.vendored.output
from sourceSets.desktop.output
}
Expand All @@ -157,6 +166,7 @@ java {

sourcesJar {
from sourceSets.sodiumCompatibility.allSource
from sourceSets.dhCompatibility.allSource
from sourceSets.vendored.allSource
from sourceSets.desktop.allSource
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package net.irisshaders.iris.compat.dh.mixin;

import com.seibel.distanthorizons.api.interfaces.override.rendering.IDhApiShadowCullingFrustum;
import com.seibel.distanthorizons.coreapi.util.math.Mat4f;
import net.irisshaders.iris.shadows.frustum.advanced.AdvancedShadowCullingFrustum;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;

@Mixin(value = AdvancedShadowCullingFrustum.class, remap = false)
public class AdvancedShadowCullingFrustumMixin implements IDhApiShadowCullingFrustum {
@Shadow
private int worldMinYDH;
@Shadow
private int worldMaxYDH;
@Shadow
public int isVisible(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) {
throw new AssertionError();
}

@Override
public void update(int worldMinBlockY, int worldMaxBlockY, Mat4f worldViewProjection) {
this.worldMinYDH = worldMinBlockY;
this.worldMaxYDH = worldMaxBlockY;
}

@Override
public boolean intersects(int lodBlockPosMinX, int lodBlockPosMinZ, int lodBlockWidth, int lodDetailLevel) {
return this.isVisible(lodBlockPosMinX, this.worldMinYDH, lodBlockPosMinZ, lodBlockPosMinX + lodBlockWidth, this.worldMaxYDH, lodBlockPosMinZ + lodBlockWidth) != 0;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package net.irisshaders.iris.compat.dh.mixin;

import com.seibel.distanthorizons.api.interfaces.override.rendering.IDhApiShadowCullingFrustum;
import com.seibel.distanthorizons.coreapi.util.math.Mat4f;
import net.irisshaders.iris.shadows.frustum.BoxCuller;
import net.irisshaders.iris.shadows.frustum.fallback.BoxCullingFrustum;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;

@Mixin(value = BoxCullingFrustum.class, remap = false)
public class BoxCullingFrustumMixin implements IDhApiShadowCullingFrustum {
@Shadow
@Final
protected BoxCuller boxCuller;
@Shadow
private int worldMinYDH;
@Shadow
private int worldMaxYDH;

@Override
public void update(int worldMinBlockY, int worldMaxBlockY, Mat4f worldViewProjection) {
this.worldMinYDH = worldMinBlockY;
this.worldMaxYDH = worldMaxBlockY;
}

@Override
public boolean intersects(int lodBlockPosMinX, int lodBlockPosMinZ, int lodBlockWidth, int lodDetailLevel) {
return !boxCuller.isCulled(lodBlockPosMinX, this.worldMinYDH, lodBlockPosMinZ, lodBlockPosMinX + lodBlockWidth, this.worldMaxYDH, lodBlockPosMinZ + lodBlockWidth);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package net.irisshaders.iris.compat.dh.mixin;

import com.seibel.distanthorizons.api.interfaces.override.rendering.IDhApiShadowCullingFrustum;
import com.seibel.distanthorizons.coreapi.util.math.Mat4f;
import net.irisshaders.iris.shadows.frustum.CullEverythingFrustum;
import org.spongepowered.asm.mixin.Mixin;

@Mixin(value = CullEverythingFrustum.class, remap = false)
public class CullEverythingFrustumMixin implements IDhApiShadowCullingFrustum {
@Override
public void update(int worldMinBlockY, int worldMaxBlockY, Mat4f worldViewProjection) {

}

@Override
public boolean intersects(int lodBlockPosMinX, int lodBlockPosMinZ, int lodBlockWidth, int lodDetailLevel) {
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package net.irisshaders.iris.compat.dh.mixin;

import com.seibel.distanthorizons.api.interfaces.override.rendering.IDhApiShadowCullingFrustum;
import com.seibel.distanthorizons.coreapi.util.math.Mat4f;
import net.irisshaders.iris.shadows.frustum.fallback.NonCullingFrustum;
import org.spongepowered.asm.mixin.Mixin;

@Mixin(value = NonCullingFrustum.class, remap = false)
public class NonCullingFrustumMixin implements IDhApiShadowCullingFrustum {
@Override
public void update(int worldMinBlockY, int worldMaxBlockY, Mat4f worldViewProjection) {

}

@Override
public boolean intersects(int lodBlockPosMinX, int lodBlockPosMinZ, int lodBlockWidth, int lodDetailLevel) {
return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package net.irisshaders.iris.compat.dh.mixin;

import net.minecraftforge.fml.loading.LoadingModList;
import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;

import java.util.List;
import java.util.Set;

public class OculusDHCompatMixinPlugin implements IMixinConfigPlugin {
@Override
public void onLoad(String s) {

}

@Override
public String getRefMapperConfig() {
return null;
}

@Override
public boolean shouldApplyMixin(String s, String s1) {
return LoadingModList.get().getModFileById("distanthorizons") != null;
}

@Override
public void acceptTargets(Set<String> set, Set<String> set1) {

}

@Override
public List<String> getMixins() {
return null;
}

@Override
public void preApply(String s, ClassNode classNode, String s1, IMixinInfo iMixinInfo) {

}

@Override
public void postApply(String s, ClassNode classNode, String s1, IMixinInfo iMixinInfo) {

}
}
Loading

0 comments on commit d382b26

Please sign in to comment.