-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
03a01d4
commit 8ce5872
Showing
6 changed files
with
32 additions
and
33 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
11 changes: 4 additions & 7 deletions
11
src/main/java/org/teacon/signmeup/mixin/IrisSodiumShaderMixin.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 |
---|---|---|
@@ -1,22 +1,19 @@ | ||
package org.teacon.signmeup.mixin; | ||
|
||
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; | ||
import com.mojang.blaze3d.pipeline.RenderTarget; | ||
import net.irisshaders.iris.pipeline.programs.SodiumShader; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
import org.teacon.signmeup.hud.InnerMiniMapPanel; | ||
|
||
/** | ||
* @author USS_Shenzhou | ||
*/ | ||
@Mixin(value = SodiumShader.class, remap = false) | ||
public class IrisSodiumShaderMixin { | ||
|
||
@Redirect(method = "resetState", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/pipeline/RenderTarget;bindWrite(Z)V")) | ||
private void cancelBindWhenRenderingMiniMap(RenderTarget instance, boolean setViewport) { | ||
if (!InnerMiniMapPanel.rendering) { | ||
instance.bindWrite(setViewport); | ||
} | ||
@WrapWithCondition(method = "resetState", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/pipeline/RenderTarget;bindWrite(Z)V")) | ||
private boolean cancelBindWhenRenderingMiniMap(RenderTarget instance, boolean setViewport) { | ||
return !InnerMiniMapPanel.rendering; | ||
} | ||
} |
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
42 changes: 20 additions & 22 deletions
42
src/main/java/org/teacon/signmeup/mixin/SodiumRenderSectionManagerMixin.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 |
---|---|---|
@@ -1,44 +1,42 @@ | ||
package org.teacon.signmeup.mixin; | ||
|
||
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import net.caffeinemc.mods.sodium.client.render.chunk.ChunkUpdateType; | ||
import net.caffeinemc.mods.sodium.client.render.chunk.RenderSectionManager; | ||
import net.caffeinemc.mods.sodium.client.render.chunk.compile.executor.ChunkJobCollector; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import org.teacon.signmeup.hud.InnerMiniMapPanel; | ||
|
||
/** | ||
* @author USS_Shenzhou | ||
*/ | ||
@Mixin(value = RenderSectionManager.class, remap = false) | ||
public abstract class SodiumRenderSectionManagerMixin { | ||
|
||
@Shadow | ||
protected abstract float getSearchDistance(); | ||
|
||
@Shadow protected abstract void submitSectionTasks(ChunkJobCollector collector, ChunkUpdateType type, boolean ignoreEffortCategory); | ||
|
||
@Redirect(method = "createTerrainRenderList", at = @At(value = "INVOKE", target = "Lnet/caffeinemc/mods/sodium/client/render/chunk/RenderSectionManager;getSearchDistance()F"), require = 0) | ||
private float disableDistanceLimitWhenRenderingMiniMap(RenderSectionManager instance) { | ||
@WrapOperation(method = "createTerrainRenderList", at = @At(value = "INVOKE", target = "Lnet/caffeinemc/mods/sodium/client/render/chunk/RenderSectionManager;getSearchDistance()F"), require = 0) | ||
private float disableDistanceLimitWhenRenderingMiniMap(RenderSectionManager instance, Operation<Float> original) { | ||
if (InnerMiniMapPanel.rendering) { | ||
return 1000; | ||
} | ||
return this.getSearchDistance(); | ||
return original.call(instance); | ||
} | ||
|
||
@Inject(method = "submitSectionTasks(Lnet/caffeinemc/mods/sodium/client/render/chunk/compile/executor/ChunkJobCollector;Lnet/caffeinemc/mods/sodium/client/render/chunk/compile/executor/ChunkJobCollector;Lnet/caffeinemc/mods/sodium/client/render/chunk/compile/executor/ChunkJobCollector;)V", at = @At("HEAD"), cancellable = true) | ||
private void takeOverSectionTasksWhenRenderingMiniMap(ChunkJobCollector importantCollector, ChunkJobCollector semiImportantCollector, ChunkJobCollector deferredCollector, CallbackInfo ci) { | ||
if (InnerMiniMapPanel.rendering) { | ||
//this.submitSectionTasks(importantCollector, ChunkUpdateType.IMPORTANT_SORT, true); | ||
this.submitSectionTasks(semiImportantCollector, ChunkUpdateType.IMPORTANT_REBUILD, true); | ||
this.submitSectionTasks(deferredCollector, ChunkUpdateType.REBUILD, false); | ||
this.submitSectionTasks(deferredCollector, ChunkUpdateType.INITIAL_BUILD, false); | ||
//this.submitSectionTasks(deferredCollector, ChunkUpdateType.SORT, true); | ||
ci.cancel(); | ||
@WrapWithCondition( | ||
method = "submitSectionTasks(Lnet/caffeinemc/mods/sodium/client/render/chunk/compile/executor/ChunkJobCollector;Lnet/caffeinemc/mods/sodium/client/render/chunk/compile/executor/ChunkJobCollector;Lnet/caffeinemc/mods/sodium/client/render/chunk/compile/executor/ChunkJobCollector;)V", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/caffeinemc/mods/sodium/client/render/chunk/RenderSectionManager;submitSectionTasks(Lnet/caffeinemc/mods/sodium/client/render/chunk/compile/executor/ChunkJobCollector;Lnet/caffeinemc/mods/sodium/client/render/chunk/ChunkUpdateType;Z)V" | ||
) | ||
) | ||
private boolean takeOverSectionTasksWhenRenderingMiniMap(RenderSectionManager instance, ChunkJobCollector result, ChunkUpdateType job, boolean section) { | ||
if (!InnerMiniMapPanel.rendering) { | ||
return true; | ||
} | ||
return switch (job) { | ||
case IMPORTANT_SORT, SORT -> false; | ||
default -> true; | ||
}; | ||
} | ||
} |