Fixed block destructions not showing on tile entities when sodium is installed

This commit is contained in:
Sollace 2022-09-20 18:17:02 +02:00
parent bc19a32a41
commit 0e74cc6bbe
4 changed files with 26 additions and 2 deletions

View file

@ -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 {

View file

@ -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();

View file

@ -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<SortedSet<BlockBreakingInfo>> modifyDestruction(Long2ObjectMap<SortedSet<BlockBreakingInfo>> blockBreakingProgressions) {
ClientBlockDestructionManager destructions = ((ClientBlockDestructionManager.Source)MinecraftClient.getInstance().worldRenderer).getDestructionManager();
return destructions.getCombinedDestructions(blockBreakingProgressions);
}
}

View file

@ -50,7 +50,8 @@
"client.MixinMouse",
"client.MixinPlayerEntityRenderer",
"client.MixinTooltipComponent",
"client.MixinWorldRenderer"
"client.MixinWorldRenderer",
"client.sodium.MixinSodiumWorldRenderer"
],
"injectors": {
"defaultRequire": 1