-
-
Notifications
You must be signed in to change notification settings - Fork 652
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
130 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/main/java/net/coderbot/iris/compat/dh/mixin/MixinClientLevelModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package net.coderbot.iris.compat.dh.mixin; | ||
|
||
import com.seibel.distanthorizons.core.level.ClientLevelModule; | ||
import com.seibel.distanthorizons.core.level.IDhClientLevel; | ||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper; | ||
import net.irisshaders.iris.api.v0.IrisApi; | ||
import net.minecraft.client.gui.screens.Screen; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
import java.util.concurrent.atomic.AtomicReference; | ||
|
||
@Mixin(ClientLevelModule.class) | ||
public class MixinClientLevelModule { | ||
@Shadow | ||
@Final | ||
public AtomicReference<ClientLevelModule.ClientRenderState> ClientRenderStateRef; | ||
@Shadow | ||
@Final | ||
private IDhClientLevel parentClientLevel; | ||
@Unique | ||
private boolean hasEnabledShaders; | ||
|
||
@Inject(method = "clientTick", at = @At("HEAD"), remap = false) | ||
private void markDirtyIfChanged(CallbackInfo ci) { | ||
if (IrisApi.getInstance().isShaderPackInUse() != hasEnabledShaders) { | ||
hasEnabledShaders = IrisApi.getInstance().isShaderPackInUse(); | ||
if (this.ClientRenderStateRef.get() != null) { | ||
IClientLevelWrapper clientLevelWrapper = this.parentClientLevel.getClientLevelWrapper(); | ||
if (clientLevelWrapper == null) { | ||
return; | ||
} | ||
|
||
this.ClientRenderStateRef.get().quadtree.nodeIterator().forEachRemaining(node -> { | ||
node.value.disposeBufferForRecreate(); | ||
}); | ||
this.ClientRenderStateRef.set(new ClientLevelModule.ClientRenderState(this.parentClientLevel, clientLevelWrapper, this.parentClientLevel.getFileHandler(), this.parentClientLevel.getSaveStructure())); | ||
|
||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/main/java/net/coderbot/iris/compat/dh/mixin/MixinLodUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package net.coderbot.iris.compat.dh.mixin; | ||
|
||
import com.seibel.distanthorizons.core.render.vertexFormat.LodVertexFormat; | ||
import com.seibel.distanthorizons.core.util.LodUtil; | ||
import net.coderbot.iris.compat.dh.DHCompatInternal; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Overwrite; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
@Mixin(LodUtil.class) | ||
public class MixinLodUtil { | ||
@Shadow | ||
@Final | ||
public static LodVertexFormat LOD_VERTEX_FORMAT_EXTENDED; | ||
|
||
@Shadow | ||
@Final | ||
public static LodVertexFormat LOD_VERTEX_FORMAT; | ||
|
||
@Overwrite(remap = false) | ||
public static LodVertexFormat getPreferredVertexFormat() { | ||
return DHCompatInternal.INSTANCE.shouldOverride ? LOD_VERTEX_FORMAT_EXTENDED : LOD_VERTEX_FORMAT; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters