-
Notifications
You must be signed in to change notification settings - Fork 87
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
14 changed files
with
104 additions
and
107 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
48 changes: 48 additions & 0 deletions
48
src/main/java/link/infra/indium/mixin/sodium/MixinChunkBuilderMeshingTask.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,48 @@ | ||
package link.infra.indium.mixin.sodium; | ||
|
||
import link.infra.indium.Indium; | ||
import link.infra.indium.renderer.render.TerrainRenderContext; | ||
import me.jellysquid.mods.sodium.client.render.chunk.compile.ChunkBuildBuffers; | ||
import me.jellysquid.mods.sodium.client.render.chunk.compile.ChunkBuildContext; | ||
import me.jellysquid.mods.sodium.client.render.chunk.compile.ChunkBuildOutput; | ||
import me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.BlockRenderContext; | ||
import me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.BlockRenderer; | ||
import me.jellysquid.mods.sodium.client.render.chunk.compile.tasks.ChunkBuilderMeshingTask; | ||
import me.jellysquid.mods.sodium.client.render.chunk.compile.tasks.ChunkBuilderTask; | ||
import me.jellysquid.mods.sodium.client.util.task.CancellationToken; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
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.CallbackInfoReturnable; | ||
|
||
/** | ||
* The main injection point into Sodium - here we stop Sodium from rendering FRAPI block models, and do it ourselves | ||
*/ | ||
@Mixin(ChunkBuilderMeshingTask.class) | ||
public abstract class MixinChunkBuilderMeshingTask extends ChunkBuilderTask<ChunkBuildOutput> { | ||
@Inject(method = "execute(Lme/jellysquid/mods/sodium/client/render/chunk/compile/ChunkBuildContext;Lme/jellysquid/mods/sodium/client/util/task/CancellationToken;)Lme/jellysquid/mods/sodium/client/render/chunk/compile/ChunkBuildOutput;", | ||
at = @At("HEAD"), remap = false) | ||
public void beforePerformBuild(ChunkBuildContext buildContext, CancellationToken cancellationToken, CallbackInfoReturnable<ChunkBuildOutput> cir) { | ||
// Set up our rendering context | ||
TerrainRenderContext.get(buildContext).prepare(buildContext); | ||
} | ||
|
||
@Inject(method = "execute(Lme/jellysquid/mods/sodium/client/render/chunk/compile/ChunkBuildContext;Lme/jellysquid/mods/sodium/client/util/task/CancellationToken;)Lme/jellysquid/mods/sodium/client/render/chunk/compile/ChunkBuildOutput;", | ||
at = @At("RETURN"), remap = false) | ||
public void afterPerformBuild(ChunkBuildContext buildContext, CancellationToken cancellationToken, CallbackInfoReturnable<ChunkBuildOutput> cir) { | ||
// Tear down our rendering context | ||
TerrainRenderContext.get(buildContext).release(); | ||
} | ||
|
||
@Redirect(method = "execute(Lme/jellysquid/mods/sodium/client/render/chunk/compile/ChunkBuildContext;Lme/jellysquid/mods/sodium/client/util/task/CancellationToken;)Lme/jellysquid/mods/sodium/client/render/chunk/compile/ChunkBuildOutput;", | ||
at = @At(value = "INVOKE", target = "Lme/jellysquid/mods/sodium/client/render/chunk/compile/pipeline/BlockRenderer;renderModel(Lme/jellysquid/mods/sodium/client/render/chunk/compile/pipeline/BlockRenderContext;Lme/jellysquid/mods/sodium/client/render/chunk/compile/ChunkBuildBuffers;)V", remap = false), remap = false) | ||
public void onRenderBlock(BlockRenderer blockRenderer, BlockRenderContext ctx, ChunkBuildBuffers buffers, ChunkBuildContext buildContext, CancellationToken cancellationToken) { | ||
// We need to get the model with a bit more context than BlockRenderer has, so we do it here | ||
if (Indium.ALWAYS_TESSELLATE_INDIUM || !ctx.model().isVanillaAdapter()) { | ||
TerrainRenderContext.get(buildContext).tessellateBlock(ctx); | ||
} else { | ||
blockRenderer.renderModel(ctx, buffers); | ||
} | ||
} | ||
} |
46 changes: 0 additions & 46 deletions
46
src/main/java/link/infra/indium/mixin/sodium/MixinChunkRenderRebuildTask.java
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
src/main/java/link/infra/indium/renderer/accessor/AccessBlockRenderCache.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
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
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
Oops, something went wrong.