diff --git a/build.gradle b/build.gradle index a038c47e..553ed649 100644 --- a/build.gradle +++ b/build.gradle @@ -53,6 +53,8 @@ dependencies { include "com.minelittlepony:kirin:${project.kirin_version}" modCompileOnly("com.terraformersmc:modmenu:${project.modmenu_version}") + // implementation 'org.jetbrains:intellij-fernflower:1.2.1.16' + modCompileOnly("net.caffienemc.sodium:sodium-fabric-mc1.19.2:0.4.4+build.18") } processResources { diff --git a/src/main/java/com/minelittlepony/unicopia/mixin/client/MixinWorldRenderer.java b/src/main/java/com/minelittlepony/unicopia/mixin/client/MixinWorldRenderer.java index b9dc9479..313a4488 100644 --- a/src/main/java/com/minelittlepony/unicopia/mixin/client/MixinWorldRenderer.java +++ b/src/main/java/com/minelittlepony/unicopia/mixin/client/MixinWorldRenderer.java @@ -18,7 +18,7 @@ import net.minecraft.client.render.BlockBreakingInfo; import net.minecraft.client.render.WorldRenderer; import net.minecraft.resource.SynchronousResourceReloader; -@Mixin(WorldRenderer.class) +@Mixin(value = WorldRenderer.class, priority = 1001) abstract class MixinWorldRenderer implements SynchronousResourceReloader, AutoCloseable, ClientBlockDestructionManager.Source { private final ClientBlockDestructionManager destructions = new ClientBlockDestructionManager(); diff --git a/src/main/java/com/minelittlepony/unicopia/mixin/client/sodium/MixinSodiumWorldRenderer.java b/src/main/java/com/minelittlepony/unicopia/mixin/client/sodium/MixinSodiumWorldRenderer.java new file mode 100644 index 00000000..f1775201 --- /dev/null +++ b/src/main/java/com/minelittlepony/unicopia/mixin/client/sodium/MixinSodiumWorldRenderer.java @@ -0,0 +1,21 @@ +package com.minelittlepony.unicopia.mixin.client.sodium; + +import java.util.SortedSet; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.*; +import com.minelittlepony.unicopia.client.ClientBlockDestructionManager; + +import it.unimi.dsi.fastutil.longs.Long2ObjectMap; +import me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.render.*; + +@Mixin(SodiumWorldRenderer.class) +abstract class MixinSodiumWorldRenderer { + @ModifyVariable(method = "renderTileEntities", at = @At("HEAD")) + public Long2ObjectMap> modifyDestruction(Long2ObjectMap> blockBreakingProgressions) { + ClientBlockDestructionManager destructions = ((ClientBlockDestructionManager.Source)MinecraftClient.getInstance().worldRenderer).getDestructionManager(); + return destructions.getCombinedDestructions(blockBreakingProgressions); + } +} diff --git a/src/main/resources/unicopia.mixin.json b/src/main/resources/unicopia.mixin.json index bbbd7813..0a1e37b3 100644 --- a/src/main/resources/unicopia.mixin.json +++ b/src/main/resources/unicopia.mixin.json @@ -50,7 +50,8 @@ "client.MixinMouse", "client.MixinPlayerEntityRenderer", "client.MixinTooltipComponent", - "client.MixinWorldRenderer" + "client.MixinWorldRenderer", + "client.sodium.MixinSodiumWorldRenderer" ], "injectors": { "defaultRequire": 1