forked from IrisShaders/Iris
-
Notifications
You must be signed in to change notification settings - Fork 58
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. (#701)
* Mekasuit render fix backport. fixes #170 * Fixed tabulations and spaces. * Fixed inconsistent tabulation length between GitHub and IDEs. Replaced tabs with spaces to ensure consistent formatting across environments. * Revert "Fixed inconsistent tabulation length between GitHub and IDEs. Replaced tabs with spaces to ensure consistent formatting across environments." This reverts commit 3a0a300. * Revert "Fixed tabulations and spaces." This reverts commit ded724e. * Revert formatting for ShaderKey.
- Loading branch information
1 parent
d2bc9aa
commit 0573ebc
Showing
8 changed files
with
129 additions
and
2 deletions.
There are no files selected for viewing
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
37 changes: 37 additions & 0 deletions
37
src/main/java/net/coderbot/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.coderbot.iris.mixin.entity_render_context; | ||
|
||
import net.coderbot.iris.Iris; | ||
import net.coderbot.iris.pipeline.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/coderbot/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.coderbot.iris.mixin.entity_render_context; | ||
|
||
import net.coderbot.iris.Iris; | ||
import net.coderbot.iris.pipeline.LightningHandler; | ||
import net.coderbot.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