This repository has been archived by the owner on May 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix crashes when using indigo renderer, still needs work
- Loading branch information
Showing
6 changed files
with
75 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
43 changes: 43 additions & 0 deletions
43
src/main/java/me/modmuss50/optifabric/mixin/MixinChunkCacheOF.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,43 @@ | ||
package me.modmuss50.optifabric.mixin; | ||
|
||
import net.fabricmc.indigo.renderer.accessor.AccessChunkRendererRegion; | ||
import net.fabricmc.indigo.renderer.render.TerrainRenderContext; | ||
import net.minecraft.client.render.chunk.ChunkRendererRegion; | ||
import net.minecraft.util.math.BlockPos; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Pseudo; | ||
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.callback.CallbackInfo; | ||
|
||
//Fabric API's indigo renderer support for optifine. This stops it from crashing, I dont really know whats going on here | ||
@Pseudo | ||
@Mixin(targets = "net.optifine.override.ChunkCacheOF") | ||
public abstract class MixinChunkCacheOF implements AccessChunkRendererRegion { | ||
private TerrainRenderContext fabric_renderer; | ||
|
||
@Shadow @Final | ||
private ChunkRendererRegion chunkCache; | ||
|
||
//This was taken from https://github.com/FabricMC/fabric/blob/master/fabric-renderer-indigo/src/main/java/net/fabricmc/indigo/renderer/mixin/MixinChunkRenderTask.java honesly no idea what it does, but it doesnt crash the game here | ||
@Inject(method = "<init>", at = @At("RETURN")) | ||
private void constructor(ChunkRendererRegion chunkCache, BlockPos posFromIn, BlockPos posToIn, int subIn, CallbackInfo info){ | ||
if(chunkCache != null) { | ||
final TerrainRenderContext renderer = TerrainRenderContext.POOL.get(); | ||
renderer.setBlockView(chunkCache); | ||
fabric_setRenderer(renderer); | ||
} | ||
} | ||
|
||
@Override | ||
public TerrainRenderContext fabric_getRenderer() { | ||
return fabric_renderer; | ||
} | ||
|
||
@Override | ||
public void fabric_setRenderer(TerrainRenderContext renderer) { | ||
fabric_renderer = renderer; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"required": true, | ||
"package": "me.modmuss50.optifabric.mixin", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": [ | ||
"MixinChunkCacheOF" | ||
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
} |