Fix missing hand with Iris 1.1.3 and above (fixes #638)
This commit is contained in:
@@ -9,6 +9,10 @@ import java.io.IOException;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
//#if FABRIC
|
||||||
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
|
//#endif
|
||||||
|
|
||||||
//#if MC>=11400
|
//#if MC>=11400
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
//#else
|
//#else
|
||||||
@@ -34,6 +38,9 @@ public class ReplayModMixinConfigPlugin implements IMixinConfigPlugin {
|
|||||||
|
|
||||||
private final Logger logger = LogManager.getLogger("replaymod/mixin");
|
private final Logger logger = LogManager.getLogger("replaymod/mixin");
|
||||||
private final boolean hasOF = hasClass("optifine.OptiFineForgeTweaker") || hasClass("me.modmuss50.optifabric.mod.Optifabric");
|
private final boolean hasOF = hasClass("optifine.OptiFineForgeTweaker") || hasClass("me.modmuss50.optifabric.mod.Optifabric");
|
||||||
|
//#if FABRIC
|
||||||
|
private final boolean hasIris = FabricLoader.getInstance().isModLoaded("iris");
|
||||||
|
//#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
logger.debug("hasOF: " + hasOF);
|
logger.debug("hasOF: " + hasOF);
|
||||||
@@ -49,6 +56,9 @@ public class ReplayModMixinConfigPlugin implements IMixinConfigPlugin {
|
|||||||
}
|
}
|
||||||
if (mixinClassName.endsWith("_OF")) return hasOF;
|
if (mixinClassName.endsWith("_OF")) return hasOF;
|
||||||
if (mixinClassName.endsWith("_NoOF")) return !hasOF;
|
if (mixinClassName.endsWith("_NoOF")) return !hasOF;
|
||||||
|
//#if FABRIC
|
||||||
|
if (mixinClassName.endsWith("_Iris")) return hasIris;
|
||||||
|
//#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
//#if MC>=11400
|
||||||
|
package com.replaymod.replay.mixin;
|
||||||
|
|
||||||
|
import com.replaymod.replay.camera.CameraEntity;
|
||||||
|
import net.minecraft.client.network.ClientPlayerEntity;
|
||||||
|
import net.minecraft.client.network.ClientPlayerInteractionManager;
|
||||||
|
import net.minecraft.world.GameMode;
|
||||||
|
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.Redirect;
|
||||||
|
|
||||||
|
import static com.replaymod.core.versions.MCVer.getMinecraft;
|
||||||
|
|
||||||
|
@Pseudo
|
||||||
|
@Mixin(targets = "net.coderbot.iris.pipeline.HandRenderer", remap = false)
|
||||||
|
public abstract class Mixin_ShowSpectatedHand_Iris {
|
||||||
|
@Redirect(
|
||||||
|
method = "*",
|
||||||
|
at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;getCurrentGameMode()Lnet/minecraft/world/GameMode;",
|
||||||
|
remap = true
|
||||||
|
)
|
||||||
|
)
|
||||||
|
private GameMode getGameMode(ClientPlayerInteractionManager interactionManager) {
|
||||||
|
ClientPlayerEntity camera = getMinecraft().player;
|
||||||
|
if (camera instanceof CameraEntity) {
|
||||||
|
// alternative doesn't really matter, the caller only checks for equality to SPECTATOR
|
||||||
|
return camera.isSpectator() ? GameMode.SPECTATOR : GameMode.SURVIVAL;
|
||||||
|
}
|
||||||
|
return interactionManager.getCurrentGameMode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//#endif
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
"ClientWorldAccessor",
|
"ClientWorldAccessor",
|
||||||
"EntityLivingBaseAccessor",
|
"EntityLivingBaseAccessor",
|
||||||
//#if MC>=11400
|
//#if MC>=11400
|
||||||
|
"Mixin_ShowSpectatedHand_Iris",
|
||||||
"Mixin_ShowSpectatedHand_NoOF",
|
"Mixin_ShowSpectatedHand_NoOF",
|
||||||
"Mixin_ShowSpectatedHand_OF",
|
"Mixin_ShowSpectatedHand_OF",
|
||||||
//#else
|
//#else
|
||||||
|
|||||||
Reference in New Issue
Block a user