-
-
Notifications
You must be signed in to change notification settings - Fork 636
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
176 additions
and
19 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
src/main/java/net/coderbot/iris/mixin/entity_render_context/MixinCapeLayer.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,35 @@ | ||
package net.coderbot.iris.mixin.entity_render_context; | ||
|
||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import net.coderbot.iris.block_rendering.BlockRenderingSettings; | ||
import net.coderbot.iris.shaderpack.materialmap.NamespacedId; | ||
import net.coderbot.iris.uniforms.CapturedRenderingState; | ||
import net.minecraft.client.player.AbstractClientPlayer; | ||
import net.minecraft.client.renderer.MultiBufferSource; | ||
import net.minecraft.client.renderer.entity.layers.CapeLayer; | ||
import net.minecraft.core.Registry; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.Items; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture; | ||
|
||
@Mixin(CapeLayer.class) | ||
public class MixinCapeLayer { | ||
private static final NamespacedId CAPE_LOCATION = new NamespacedId("minecraft", "player_cape"); | ||
|
||
@Inject(method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/client/player/AbstractClientPlayer;FFFFFF)V", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/PoseStack;pushPose()V"), locals = LocalCapture.CAPTURE_FAILHARD) | ||
private void changeId(PoseStack pCapeLayer0, MultiBufferSource pMultiBufferSource1, int pInt2, AbstractClientPlayer pAbstractClientPlayer3, float pFloat4, float pFloat5, float pFloat6, float pFloat7, float pFloat8, float pFloat9, CallbackInfo ci, ItemStack lvItemStack11) { | ||
if (BlockRenderingSettings.INSTANCE.getItemIds() == null) return; | ||
|
||
CapturedRenderingState.INSTANCE.setCurrentRenderedItem(BlockRenderingSettings.INSTANCE.getItemIds().applyAsInt(CAPE_LOCATION)); | ||
} | ||
|
||
@Inject(method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/client/player/AbstractClientPlayer;FFFFFF)V", at = @At(value = "RETURN")) | ||
private void changeId2(CallbackInfo ci) { | ||
CapturedRenderingState.INSTANCE.setCurrentRenderedItem(0); | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
src/main/java/net/coderbot/iris/mixin/entity_render_context/MixinElytraLayer.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,59 @@ | ||
package net.coderbot.iris.mixin.entity_render_context; | ||
|
||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import net.coderbot.iris.block_rendering.BlockRenderingSettings; | ||
import net.coderbot.iris.shaderpack.materialmap.NamespacedId; | ||
import net.coderbot.iris.uniforms.CapturedRenderingState; | ||
import net.minecraft.client.model.EntityModel; | ||
import net.minecraft.client.model.HumanoidModel; | ||
import net.minecraft.client.player.AbstractClientPlayer; | ||
import net.minecraft.client.renderer.MultiBufferSource; | ||
import net.minecraft.client.renderer.entity.RenderLayerParent; | ||
import net.minecraft.client.renderer.entity.layers.ElytraLayer; | ||
import net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer; | ||
import net.minecraft.client.renderer.entity.layers.RenderLayer; | ||
import net.minecraft.core.Registry; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.entity.EquipmentSlot; | ||
import net.minecraft.world.entity.LivingEntity; | ||
import net.minecraft.world.entity.player.PlayerModelPart; | ||
import net.minecraft.world.item.ArmorItem; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.Items; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture; | ||
|
||
@Mixin(ElytraLayer.class) | ||
public abstract class MixinElytraLayer<T extends LivingEntity, M extends EntityModel<T>> extends RenderLayer<T, M> { | ||
@Unique | ||
private static final NamespacedId ELYTRA_CAPE_LOCATION = new NamespacedId("minecraft", "elytra_with_cape"); | ||
|
||
public MixinElytraLayer(RenderLayerParent<T, M> pRenderLayer0) { | ||
super(pRenderLayer0); | ||
} | ||
|
||
@Inject(method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/world/entity/LivingEntity;FFFFFF)V", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/PoseStack;pushPose()V"), locals = LocalCapture.CAPTURE_FAILHARD) | ||
private void changeId(PoseStack pElytraLayer0, MultiBufferSource pMultiBufferSource1, int pInt2, T pLivingEntity3, float pFloat4, float pFloat5, float pFloat6, float pFloat7, float pFloat8, float pFloat9, CallbackInfo ci, ItemStack lvItemStack11, ResourceLocation lvResourceLocation12) { | ||
if (BlockRenderingSettings.INSTANCE.getItemIds() == null) return; | ||
|
||
if (pLivingEntity3 instanceof AbstractClientPlayer player && player.isCapeLoaded() | ||
&& player.getCloakTextureLocation() != null | ||
&& player.isModelPartShown(PlayerModelPart.CAPE)) { | ||
CapturedRenderingState.INSTANCE.setCurrentRenderedItem(BlockRenderingSettings.INSTANCE.getItemIds().applyAsInt(ELYTRA_CAPE_LOCATION)); | ||
return; | ||
} | ||
|
||
ResourceLocation location = Registry.ITEM.getKey(Items.ELYTRA); | ||
|
||
CapturedRenderingState.INSTANCE.setCurrentRenderedItem(BlockRenderingSettings.INSTANCE.getItemIds().applyAsInt(new NamespacedId(location.getNamespace(), location.getPath()))); | ||
} | ||
|
||
@Inject(method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/world/entity/LivingEntity;FFFFFF)V", at = @At(value = "RETURN")) | ||
private void changeId2(CallbackInfo ci) { | ||
CapturedRenderingState.INSTANCE.setCurrentRenderedItem(0); | ||
} | ||
} |
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/MixinHorseArmorLayer.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 com.mojang.blaze3d.vertex.PoseStack; | ||
import net.coderbot.iris.block_rendering.BlockRenderingSettings; | ||
import net.coderbot.iris.shaderpack.materialmap.NamespacedId; | ||
import net.coderbot.iris.uniforms.CapturedRenderingState; | ||
import net.minecraft.client.renderer.MultiBufferSource; | ||
import net.minecraft.client.renderer.block.model.ItemTransforms; | ||
import net.minecraft.client.renderer.entity.layers.HorseArmorLayer; | ||
import net.minecraft.client.resources.model.BakedModel; | ||
import net.minecraft.core.Registry; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.entity.animal.horse.Horse; | ||
import net.minecraft.world.item.BlockItem; | ||
import net.minecraft.world.item.HorseArmorItem; | ||
import net.minecraft.world.item.ItemStack; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(HorseArmorLayer.class) | ||
public class MixinHorseArmorLayer { | ||
@Inject(method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/world/entity/animal/horse/Horse;FFFFFF)V", at = @At(value = "HEAD")) | ||
private void changeId(PoseStack pHorseArmorLayer0, MultiBufferSource pMultiBufferSource1, int pInt2, Horse pHorse3, float pFloat4, float pFloat5, float pFloat6, float pFloat7, float pFloat8, float pFloat9, CallbackInfo ci) { | ||
if (BlockRenderingSettings.INSTANCE.getItemIds() == null || !(pHorse3.getArmor().getItem() instanceof HorseArmorItem)) return; | ||
|
||
ResourceLocation location = Registry.ITEM.getKey((pHorse3.getArmor().getItem())); | ||
CapturedRenderingState.INSTANCE.setCurrentRenderedItem(BlockRenderingSettings.INSTANCE.getItemIds().applyAsInt(new NamespacedId(location.getNamespace(), location.getPath()))); | ||
} | ||
|
||
@Inject(method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/world/entity/animal/horse/Horse;FFFFFF)V", at = @At(value = "TAIL")) | ||
private void changeId2(CallbackInfo ci) { | ||
CapturedRenderingState.INSTANCE.setCurrentRenderedItem(0); | ||
} | ||
} |
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