Skip to content

Commit

Permalink
Fix crash without Sodium / with Embeddium
Browse files Browse the repository at this point in the history
  • Loading branch information
BluSpring committed Aug 8, 2024
1 parent 73bdf6a commit aaccbbd
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.bawnorton.mixinsquared.TargetHandler;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.moulberry.mixinconstraints.annotations.IfModLoaded;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.block.ModelBlockRenderer;
import net.minecraft.client.renderer.block.model.BakedQuad;
Expand Down Expand Up @@ -125,6 +126,7 @@ public void renderModel(PoseStack.Pose pose, VertexConsumer vertexConsumer, @Nul
}

// Sodium compatibility
@IfModLoaded(value = "sodium", maxVersion = "0.6.0")
@Dynamic
@TargetHandler(
mixin = "me.jellysquid.mods.sodium.mixin.features.render.model.block.BlockModelRendererMixin",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.block.state.BlockState;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Pseudo;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
Expand All @@ -21,6 +22,7 @@

@IfModLoaded("indium")
@IfModAbsent(value = "sodium", minVersion = "0.6.0") // Sodium version that supports FRAPI
@Pseudo // We can't @IfModAbsent for Embeddium, so this is the next best bet...
@Mixin(value = BakedModel.class, priority = 1500)
public interface BakedModelMixin {
@TargetHandler(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package xyz.bluspring.kilt.mixin.compat.sodium;

import com.moulberry.mixinconstraints.annotations.IfModLoaded;
import me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.BlockRenderContext;
import net.minecraftforge.client.model.data.ModelData;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import xyz.bluspring.kilt.injections.sodium.BlockRenderContextInjection;

@IfModLoaded("sodium")
@Mixin(value = BlockRenderContext.class, remap = false)
public class BlockRenderContextMixin implements BlockRenderContextInjection {
@Unique
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package xyz.bluspring.kilt.mixin.compat.sodium;

import com.moulberry.mixinconstraints.annotations.IfModLoaded;
import me.jellysquid.mods.sodium.client.model.color.ColorProvider;
import me.jellysquid.mods.sodium.client.model.color.ColorProviderRegistry;
import me.jellysquid.mods.sodium.client.model.light.LightMode;
Expand Down Expand Up @@ -28,7 +29,8 @@

import java.util.List;

@Mixin(value = BlockRenderer.class, remap = false)
@IfModLoaded("sodium")
@Mixin(BlockRenderer.class)
public abstract class BlockRendererMixin {

@Shadow @Final private ColorProviderRegistry colorProviderRegistry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Share;
import com.llamalad7.mixinextras.sugar.ref.LocalRef;
import com.moulberry.mixinconstraints.annotations.IfModLoaded;
import me.jellysquid.mods.sodium.client.render.chunk.RenderSection;
import me.jellysquid.mods.sodium.client.render.chunk.compile.ChunkBuildContext;
import me.jellysquid.mods.sodium.client.render.chunk.compile.ChunkBuildOutput;
Expand All @@ -26,7 +27,8 @@

import java.util.Map;

@Mixin(value = ChunkBuilderMeshingTask.class, remap = false)
@IfModLoaded("sodium")
@Mixin(ChunkBuilderMeshingTask.class)
public class ChunkBuilderMeshingTaskMixin {
@Shadow @Final private RenderSection render;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import xyz.bluspring.kilt.mixin.LevelRendererAccessor;

@IfModLoaded("sodium")
@Mixin(value = SodiumWorldRenderer.class, remap = false)
@Mixin(SodiumWorldRenderer.class)
@Pseudo
public class SodiumWorldRendererMixin {
@IfModLoaded(value = "sodium", maxVersion = "0.5.8")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package xyz.bluspring.kilt.mixin.compat.sodium;

import com.moulberry.mixinconstraints.annotations.IfModLoaded;
import me.jellysquid.mods.sodium.client.world.WorldSlice;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.core.BlockPos;
Expand All @@ -11,6 +12,7 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;

@IfModLoaded("sodium")
@Mixin(WorldSlice.class)
public class WorldSliceMixin implements IForgeBlockGetter {
@Shadow @Final private ClientLevel world;
Expand Down

0 comments on commit aaccbbd

Please sign in to comment.