forked from IrisShaders/Iris
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mekasuit render fix backport. fixes #170
- Loading branch information
1 parent
da63951
commit 30e1eb5
Showing
7 changed files
with
119 additions
and
1 deletion.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
src/main/java/net/irisshaders/iris/mixin/entity_render_context/MixinRenderFlame.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package net.irisshaders.iris.mixin.entity_render_context; | ||
|
||
import net.irisshaders.iris.Iris; | ||
import net.irisshaders.iris.pathways.LightningHandler; | ||
import net.minecraft.client.renderer.RenderType; | ||
import net.minecraft.resources.ResourceLocation; | ||
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 java.util.function.Function; | ||
|
||
@Pseudo | ||
@Mixin(targets = "mekanism/client/render/entity/RenderFlame", remap = false) | ||
public class MixinRenderFlame { | ||
private static Object MEKANISM_FLAME; | ||
|
||
static { | ||
try { | ||
MEKANISM_FLAME = Class.forName("mekanism.client.render.MekanismRenderType").getField("FLAME").get(null); | ||
} catch (IllegalAccessException | NoSuchFieldException | ClassNotFoundException e) { | ||
Iris.logger.fatal("Failed to get Mekanism flame!"); | ||
} | ||
} | ||
|
||
@Redirect(method = { | ||
"render(Lmekanism/common/entity/EntityFlame;FFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V" | ||
}, at = @At(value = "FIELD", target = "Lmekanism/client/render/MekanismRenderType;FLAME:Ljava/util/function/Function;")) | ||
private Function<ResourceLocation, RenderType> doNotSwitchShaders() { | ||
if (Iris.isPackInUseQuick()) { | ||
return LightningHandler.MEKANISM_FLAME; | ||
} else { | ||
return (Function<ResourceLocation, RenderType>) MEKANISM_FLAME; | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/net/irisshaders/iris/mixin/entity_render_context/MixinRenderMekasuit.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package net.irisshaders.iris.mixin.entity_render_context; | ||
|
||
import net.irisshaders.iris.Iris; | ||
import net.irisshaders.iris.pathways.LightningHandler; | ||
import net.irisshaders.iris.vertices.ImmediateState; | ||
import net.minecraft.client.renderer.RenderType; | ||
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; | ||
|
||
@Pseudo | ||
@Mixin(targets = "mekanism/client/render/armor/MekaSuitArmor", remap = false) | ||
public class MixinRenderMekasuit { | ||
private static Object MEKASUIT; | ||
|
||
static { | ||
try { | ||
MEKASUIT = Class.forName("mekanism.client.render.MekanismRenderType").getField("MEKASUIT").get(null); | ||
} catch (IllegalAccessException | NoSuchFieldException | ClassNotFoundException e) { | ||
Iris.logger.fatal("Failed to get Mekanism flame!"); | ||
} | ||
} | ||
|
||
@Redirect(method = { | ||
"renderArm", | ||
"Lmekanism/client/render/armor/MekaSuitArmor;render(Lnet/minecraft/client/model/HumanoidModel;Lnet/minecraft/client/renderer/MultiBufferSource;Lcom/mojang/blaze3d/vertex/PoseStack;IILmekanism/common/lib/Color;ZLnet/minecraft/world/entity/LivingEntity;Ljava/util/Map;Z)V" | ||
}, at = @At(value = "FIELD", target = "Lmekanism/client/render/MekanismRenderType;MEKASUIT:Lnet/minecraft/client/renderer/RenderType;")) | ||
private RenderType doNotSwitchShaders() { | ||
if (Iris.isPackInUseQuick() && ImmediateState.isRenderingLevel) { | ||
return LightningHandler.MEKASUIT; | ||
} else { | ||
return (RenderType) MEKASUIT; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters