Skip to content

Commit

Permalink
Automatically disable block face culling for ships on Sodium #1003
Browse files Browse the repository at this point in the history
  • Loading branch information
xiewuzhiying committed Nov 16, 2024
1 parent 990eb3f commit b2029ce
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.valkyrienskies.mod.mixin.mod_compat.sodium;

import me.jellysquid.mods.sodium.client.model.quad.properties.ModelQuadFacing;
import me.jellysquid.mods.sodium.client.render.chunk.DefaultChunkRenderer;
import net.minecraft.client.Minecraft;
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.callback.CallbackInfoReturnable;
import org.valkyrienskies.mod.common.VSGameUtilsKt;

@Mixin(DefaultChunkRenderer.class)
public abstract class MixinDefaultChunkRenderer {
@Inject(
method = "getVisibleFaces",
at = @At("HEAD"),
cancellable = true,
remap = false
)
private static void cancelBlockFaceCulling(final int originX, final int originY, final int originZ, final int chunkX, final int chunkY, final int chunkZ, final CallbackInfoReturnable<Integer> cir) {
if(VSGameUtilsKt.isChunkInShipyard(Minecraft.getInstance().level, chunkX, chunkZ))
cir.setReturnValue(ModelQuadFacing.ALL);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@
"mod_compat.optifine.RenderChunkInfoAccessorOptifine",
"mod_compat.optifine_vanilla.MixinLevelRenderer",
"mod_compat.sodium.MixinChunkTracker",
"mod_compat.sodium.MixinDefaultChunkRenderer",
"mod_compat.sodium.MixinRenderSectionManager",
"mod_compat.sodium.MixinSodiumWorldRenderer",
"mod_compat.sound_physics_remastered.MixinSoundPhysics",
Expand Down

0 comments on commit b2029ce

Please sign in to comment.