diff --git a/src/main/java/nl/enjarai/showmeyourskin/client/ModRenderLayers.java b/src/main/java/nl/enjarai/showmeyourskin/client/ModRenderLayers.java index 6271f44..845aa23 100644 --- a/src/main/java/nl/enjarai/showmeyourskin/client/ModRenderLayers.java +++ b/src/main/java/nl/enjarai/showmeyourskin/client/ModRenderLayers.java @@ -5,6 +5,7 @@ import net.minecraft.client.render.VertexFormat; import net.minecraft.client.render.VertexFormats; import net.minecraft.util.Identifier; +import net.minecraft.util.TriState; import net.minecraft.util.Util; import java.util.function.Function; @@ -15,7 +16,7 @@ public class ModRenderLayers { public static final Function ARMOR_TRANSLUCENT_NO_CULL = Util.memoize(texture -> { var params = RenderLayer.MultiPhaseParameters.builder() .program(ARMOR_CUTOUT_NO_CULL_PROGRAM) - .texture(new RenderPhase.Texture(texture, false, false)) + .texture(new RenderPhase.Texture(texture, TriState.DEFAULT, false)) .transparency(TRANSLUCENT_TRANSPARENCY) .cull(DISABLE_CULLING) .lightmap(ENABLE_LIGHTMAP) diff --git a/src/main/java/nl/enjarai/showmeyourskin/compat/elytratrinket/ElytraTrinketMixinPlugin.java b/src/main/java/nl/enjarai/showmeyourskin/compat/elytratrinket/ElytraTrinketMixinPlugin.java deleted file mode 100644 index 5e05ead..0000000 --- a/src/main/java/nl/enjarai/showmeyourskin/compat/elytratrinket/ElytraTrinketMixinPlugin.java +++ /dev/null @@ -1,16 +0,0 @@ -package nl.enjarai.showmeyourskin.compat.elytratrinket; - -import nl.enjarai.cicada.api.compat.CompatMixinPlugin; - -import java.util.Set; - -/** - * Non-critical mixin config plugin, just disables mixins if Elytra Trinket isn't present, - * since otherwise the log gets spammed with warnings. - */ -public class ElytraTrinketMixinPlugin implements CompatMixinPlugin { - @Override - public Set getRequiredMods() { - return Set.of("elytratrinket"); - } -} diff --git a/src/main/java/nl/enjarai/showmeyourskin/compat/elytratrinket/mixin/ElytraTrinketRendererMixin.java b/src/main/java/nl/enjarai/showmeyourskin/compat/elytratrinket/mixin/ElytraTrinketRendererMixin.java deleted file mode 100644 index cb37fee..0000000 --- a/src/main/java/nl/enjarai/showmeyourskin/compat/elytratrinket/mixin/ElytraTrinketRendererMixin.java +++ /dev/null @@ -1,63 +0,0 @@ -package nl.enjarai.showmeyourskin.compat.elytratrinket.mixin; - -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.feature.ElytraFeatureRenderer; -import net.minecraft.client.render.entity.feature.FeatureRendererContext; -import net.minecraft.client.render.entity.model.EntityModel; -import net.minecraft.client.render.entity.model.EntityModelLoader; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import nl.enjarai.showmeyourskin.config.HideableEquipment; -import nl.enjarai.showmeyourskin.config.ModConfig; -import org.spongepowered.asm.mixin.Dynamic; -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.Inject; -import org.spongepowered.asm.mixin.injection.ModifyArg; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Pseudo -@Mixin(targets = "top.theillusivec4.elytratrinket.client.ElytraTrinketRenderer") -public abstract class ElytraTrinketRendererMixin> extends ElytraFeatureRenderer { - private final ThreadLocal showmeyourskin$player = new ThreadLocal<>(); - - public ElytraTrinketRendererMixin(FeatureRendererContext context, EntityModelLoader loader) { - super(context, loader); - } - - @Dynamic - @Inject( - method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/entity/LivingEntity;FFFFFF)V", - at = @At(value = "HEAD"), - cancellable = true - ) - private void showmeyourskin$hideElytra(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, T livingEntity, float f, float g, float h, float j, float k, float l, CallbackInfo ci) { - if (livingEntity instanceof PlayerEntity player) { -// if (!ModConfig.INSTANCE.getApplicable(player.getUuid()).showElytra) { -// ci.cancel(); -// } else { -// showmeyourskin$player.set(player); -// } TODO - } - } - - @Dynamic - @ModifyArg( - method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/entity/LivingEntity;FFFFFF)V", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/render/item/ItemRenderer;getArmorGlintConsumer(Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/render/RenderLayer;ZZ)Lnet/minecraft/client/render/VertexConsumer;" - ), - index = 3 - ) - private boolean showmeyourskin$hideElytraGlint(boolean original) { - var player = showmeyourskin$player.get(); - if (player != null) { // TODO - return original && ModConfig.INSTANCE.getApplicableGlintTransparency(player.getUuid(), HideableEquipment.ELYTRA) > 0; - } - - return original; - } -} diff --git a/src/main/java/nl/enjarai/showmeyourskin/compat/wildfire_gender/mixin/GenderArmorLayerMixin.java b/src/main/java/nl/enjarai/showmeyourskin/compat/wildfire_gender/mixin/GenderArmorLayerMixin.java index b1d5c5c..b96238f 100644 --- a/src/main/java/nl/enjarai/showmeyourskin/compat/wildfire_gender/mixin/GenderArmorLayerMixin.java +++ b/src/main/java/nl/enjarai/showmeyourskin/compat/wildfire_gender/mixin/GenderArmorLayerMixin.java @@ -78,7 +78,7 @@ public abstract class GenderArmorLayerMixin { if (entity instanceof PlayerEntity player) { var transparency = ModConfig.INSTANCE.getApplicablePieceTransparency(player.getUuid(), HideableEquipment.CHEST); if (transparency < 1) { - return ItemRenderer.getDirectItemGlintConsumer(vertexConsumerProvider, renderLayer, solid, hasGlint); + return ItemRenderer.getItemGlintConsumer(vertexConsumerProvider, renderLayer, solid, hasGlint); } } diff --git a/src/main/java/nl/enjarai/showmeyourskin/gui/OverrideableConfigScreen.java b/src/main/java/nl/enjarai/showmeyourskin/gui/OverrideableConfigScreen.java index d1b069d..a637f77 100644 --- a/src/main/java/nl/enjarai/showmeyourskin/gui/OverrideableConfigScreen.java +++ b/src/main/java/nl/enjarai/showmeyourskin/gui/OverrideableConfigScreen.java @@ -3,6 +3,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.render.RenderLayer; import net.minecraft.text.Text; import net.minecraft.util.Identifier; import nl.enjarai.showmeyourskin.ShowMeYourSkin; @@ -42,7 +43,7 @@ protected void renderBackgroundTextures(DrawContext context) { int leftSide = getWindowLeft() + 3; int topSide = getSelectorTop(); - context.drawTexture(OverrideableConfigScreen.SELECTOR_TEXTURE, leftSide, topSide, 1, 1, 236, 127); + context.drawTexture(RenderLayer::getGuiTextured, OverrideableConfigScreen.SELECTOR_TEXTURE, leftSide, topSide, 1, 1, 236, 127, 256, 256); } @Override diff --git a/src/main/java/nl/enjarai/showmeyourskin/gui/widget/ArmorConfigWindow.java b/src/main/java/nl/enjarai/showmeyourskin/gui/widget/ArmorConfigWindow.java index f2363f1..79a8fd1 100644 --- a/src/main/java/nl/enjarai/showmeyourskin/gui/widget/ArmorConfigWindow.java +++ b/src/main/java/nl/enjarai/showmeyourskin/gui/widget/ArmorConfigWindow.java @@ -13,6 +13,7 @@ import net.minecraft.client.gui.widget.ClickableWidget; import net.minecraft.client.gui.widget.SliderWidget; import net.minecraft.client.render.DiffuseLighting; +import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.sound.PositionedSoundInstance; @@ -262,7 +263,7 @@ public void renderBackground(DrawContext context, Identifier backgroundTexture, matrices.push(); matrices.translate(0, 0, zIndex); - context.drawTexture(backgroundTexture, leftSide, topSide, 1, 1, 236, 254); + context.drawTexture(RenderLayer::getGuiTextured, backgroundTexture, leftSide, topSide, 1, 1, 236, 254, 256, 256); matrices.pop(); RenderSystem.disableBlend(); diff --git a/src/main/java/nl/enjarai/showmeyourskin/gui/widget/ConfigEntryWidget.java b/src/main/java/nl/enjarai/showmeyourskin/gui/widget/ConfigEntryWidget.java index 715ce37..194d2b2 100644 --- a/src/main/java/nl/enjarai/showmeyourskin/gui/widget/ConfigEntryWidget.java +++ b/src/main/java/nl/enjarai/showmeyourskin/gui/widget/ConfigEntryWidget.java @@ -5,6 +5,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.*; import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder; +import net.minecraft.client.render.RenderLayer; import net.minecraft.client.sound.PositionedSoundInstance; import net.minecraft.client.sound.SoundManager; import net.minecraft.sound.SoundEvents; @@ -78,9 +79,9 @@ public void directRender(DrawContext context, int index, int x, int y, int mouse RenderSystem.enableBlend(); if (selected) { - context.drawTexture(SELECTION_TEXTURE, x - 1, y - 1, 0, 0, 32, 32, 128, 128); + context.drawTexture(RenderLayer::getGuiTextured, SELECTION_TEXTURE, x - 1, y - 1, 0, 0, 32, 32, 128, 128); } else if (hovered && children().stream().noneMatch(element -> element.isMouseOver(mouseX, mouseY))) { - context.drawTexture(SELECTION_TEXTURE, x - 1, y - 1, 32, 0, 32, 32, 128, 128); + context.drawTexture(RenderLayer::getGuiTextured, SELECTION_TEXTURE, x - 1, y - 1, 32, 0, 32, 32, 128, 128); } renderIcon(context, index, x, y, mouseX, mouseY, hovered, tickDelta); @@ -89,7 +90,7 @@ public void directRender(DrawContext context, int index, int x, int y, int mouse } protected void renderIcon(DrawContext context, int index, int x, int y, int mouseX, int mouseY, boolean hovered, float tickDelta) { - context.drawTexture(GLOBAL_ICON, x + 3, y + 3, 24, 24, 0, 0, 24, 24, 24, 24); + context.drawTexture(RenderLayer::getGuiTextured, GLOBAL_ICON, x + 3, y + 3, 24, 24, 0, 0, 24, 24, 24, 24); } public void playDownSound(SoundManager soundManager) { diff --git a/src/main/java/nl/enjarai/showmeyourskin/gui/widget/PlayerSelectorEntry.java b/src/main/java/nl/enjarai/showmeyourskin/gui/widget/PlayerSelectorEntry.java index 858fa62..68aff94 100644 --- a/src/main/java/nl/enjarai/showmeyourskin/gui/widget/PlayerSelectorEntry.java +++ b/src/main/java/nl/enjarai/showmeyourskin/gui/widget/PlayerSelectorEntry.java @@ -8,6 +8,7 @@ import net.minecraft.client.gui.screen.ButtonTextures; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TexturedButtonWidget; +import net.minecraft.client.render.RenderLayer; import net.minecraft.client.sound.PositionedSoundInstance; import net.minecraft.client.sound.SoundManager; import net.minecraft.client.util.SkinTextures; @@ -75,9 +76,9 @@ public void directRender(DrawContext context, int index, int x, int y, int mouse @Override protected void renderIcon(DrawContext context, int index, int x, int y, int mouseX, int mouseY, boolean hovered, float tickDelta) { - context.drawTexture(skinTextures.get().texture(), x + 3, y + 3, 24, 24, 8.0F, 8.0F, 8, 8, 64, 64); + context.drawTexture(RenderLayer::getGuiTextured, skinTextures.get().texture(), x + 3, y + 3, 8.0F, 8.0F, 24, 24, 8, 8, 64, 64); RenderSystem.enableBlend(); - context.drawTexture(skinTextures.get().texture(), x + 3, y + 3, 24, 24, 40.0F, 8.0F, 8, 8, 64, 64); + context.drawTexture(RenderLayer::getGuiTextured, skinTextures.get().texture(), x + 3, y + 3, 40.0F, 8.0F, 24, 24, 8, 8, 64, 64); RenderSystem.disableBlend(); } diff --git a/src/main/java/nl/enjarai/showmeyourskin/gui/widget/PressButtonWidget.java b/src/main/java/nl/enjarai/showmeyourskin/gui/widget/PressButtonWidget.java index 61310ca..4a60af1 100644 --- a/src/main/java/nl/enjarai/showmeyourskin/gui/widget/PressButtonWidget.java +++ b/src/main/java/nl/enjarai/showmeyourskin/gui/widget/PressButtonWidget.java @@ -6,6 +6,7 @@ import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder; import net.minecraft.client.gui.tooltip.Tooltip; import net.minecraft.client.gui.widget.PressableWidget; +import net.minecraft.client.render.RenderLayer; import net.minecraft.screen.ScreenTexts; import net.minecraft.text.Text; import nl.enjarai.showmeyourskin.ShowMeYourSkin; @@ -46,18 +47,15 @@ public boolean isEnabled() { @Override protected void renderWidget(DrawContext context, int mouseX, int mouseY, float delta) { - context.setShaderColor(1.0f, 1.0f, 1.0f, this.alpha); RenderSystem.enableBlend(); RenderSystem.enableDepthTest(); renderButtonBackground(context, mouseX, mouseY, delta); - context.drawGuiTexture(textures.get(isEnabled(), isSelected()), this.getX(), this.getY(), this.getWidth(), this.getHeight()); - - context.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f); + context.drawGuiTexture(RenderLayer::getGuiTextured, textures.get(isEnabled(), isSelected()), this.getX(), this.getY(), this.getWidth(), this.getHeight()); } protected void renderButtonBackground(DrawContext context, int mouseX, int mouseY, float delta) { - context.drawGuiTexture(BACKGROUND_TEXTURES.get(isEnabled(), isSelected()), this.getX(), this.getY(), this.getWidth(), this.getHeight()); + context.drawGuiTexture(RenderLayer::getGuiTextured, BACKGROUND_TEXTURES.get(isEnabled(), isSelected()), this.getX(), this.getY(), this.getWidth(), this.getHeight()); } @Override diff --git a/src/main/java/nl/enjarai/showmeyourskin/gui/widget/SliderSetTab.java b/src/main/java/nl/enjarai/showmeyourskin/gui/widget/SliderSetTab.java index c74f230..9c93336 100644 --- a/src/main/java/nl/enjarai/showmeyourskin/gui/widget/SliderSetTab.java +++ b/src/main/java/nl/enjarai/showmeyourskin/gui/widget/SliderSetTab.java @@ -3,6 +3,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.advancement.AdvancementTabType; +import net.minecraft.client.render.RenderLayer; import net.minecraft.util.Identifier; import nl.enjarai.showmeyourskin.ShowMeYourSkin; @@ -26,7 +27,7 @@ public void render(DrawContext context, int mouseX, int mouseY, boolean selected int v = selected ? 64 + 28 : 64; AdvancementTabType.LEFT.drawBackground(context, x + 28, y - 29, selected, 1); // index 1 always renders the "middle" texture RenderSystem.enableBlend(); - context.drawTexture(ICON_TEXTURE, x + (selected ? 6 : 10), y + 5, iconX, iconY, 16, 16); + context.drawTexture(RenderLayer::getGuiTextured, ICON_TEXTURE, x + (selected ? 6 : 10), y + 5, iconX, iconY, 16, 16, 256, 256); RenderSystem.disableBlend(); } diff --git a/src/main/java/nl/enjarai/showmeyourskin/mixin/EntityRenderDispatcherMixin.java b/src/main/java/nl/enjarai/showmeyourskin/mixin/EntityRenderDispatcherMixin.java new file mode 100644 index 0000000..6e6df70 --- /dev/null +++ b/src/main/java/nl/enjarai/showmeyourskin/mixin/EntityRenderDispatcherMixin.java @@ -0,0 +1,44 @@ +package nl.enjarai.showmeyourskin.mixin; + +import com.llamalad7.mixinextras.sugar.Share; +import com.llamalad7.mixinextras.sugar.ref.LocalRef; +import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.client.render.entity.EntityRenderDispatcher; +import net.minecraft.client.render.entity.EntityRenderer; +import net.minecraft.client.render.entity.state.EntityRenderState; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.entity.Entity; +import nl.enjarai.showmeyourskin.ShowMeYourSkin; +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; + +@Mixin(EntityRenderDispatcher.class) +public class EntityRenderDispatcherMixin { + @Inject( + method = "render(Lnet/minecraft/entity/Entity;DDDFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/client/render/entity/EntityRenderer;)V", + at = @At("HEAD") + ) + private void captureEntityContext(E entity, double x, double y, double z, + float tickDelta, MatrixStack matrices, + VertexConsumerProvider vertexConsumers, + int light, EntityRenderer renderer, + CallbackInfo ci, + @Share(namespace = ShowMeYourSkin.MODID, value = "renderedEntity") LocalRef ctx) { + ctx.set(entity); + } + + @Inject( + method = "render(Lnet/minecraft/entity/Entity;DDDFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/client/render/entity/EntityRenderer;)V", + at = @At("RETURN") + ) + private void clearEntityContext(E entity, double x, double y, double z, + float tickDelta, MatrixStack matrices, + VertexConsumerProvider vertexConsumers, + int light, EntityRenderer renderer, + CallbackInfo ci, + @Share(namespace = ShowMeYourSkin.MODID, value = "renderedEntity") LocalRef ctx) { + ctx.set(null); + } +} diff --git a/src/main/java/nl/enjarai/showmeyourskin/mixin/ClientPlayerEntityMixin.java b/src/main/java/nl/enjarai/showmeyourskin/mixin/LivingEntityMixin.java similarity index 52% rename from src/main/java/nl/enjarai/showmeyourskin/mixin/ClientPlayerEntityMixin.java rename to src/main/java/nl/enjarai/showmeyourskin/mixin/LivingEntityMixin.java index 062e32c..a65f2e6 100644 --- a/src/main/java/nl/enjarai/showmeyourskin/mixin/ClientPlayerEntityMixin.java +++ b/src/main/java/nl/enjarai/showmeyourskin/mixin/LivingEntityMixin.java @@ -1,20 +1,24 @@ package nl.enjarai.showmeyourskin.mixin; import net.minecraft.client.network.ClientPlayerEntity; +import net.minecraft.entity.LivingEntity; import net.minecraft.entity.damage.DamageSource; import nl.enjarai.showmeyourskin.util.CombatLogger; 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.CallbackInfoReturnable; -@Mixin(ClientPlayerEntity.class) -public abstract class ClientPlayerEntityMixin { +@Mixin(LivingEntity.class) +public abstract class LivingEntityMixin { @Inject( - method = "damage(Lnet/minecraft/entity/damage/DamageSource;F)Z", + method = "onDamaged", at = @At(value = "HEAD") ) - private void showmeyourskin$triggerCombat(DamageSource source, float amount, CallbackInfoReturnable cir) { - CombatLogger.INSTANCE.triggerCombat(((ClientPlayerEntity) (Object) this).getUuid()); + private void showmeyourskin$triggerCombat(DamageSource damageSource, CallbackInfo ci) { + if ((Object) this instanceof ClientPlayerEntity player) { + CombatLogger.INSTANCE.triggerCombat(player.getUuid()); + } } } diff --git a/src/main/java/nl/enjarai/showmeyourskin/mixin/LivingEntityRendererMixin.java b/src/main/java/nl/enjarai/showmeyourskin/mixin/LivingEntityRendererMixin.java index a4dd135..5071e49 100644 --- a/src/main/java/nl/enjarai/showmeyourskin/mixin/LivingEntityRendererMixin.java +++ b/src/main/java/nl/enjarai/showmeyourskin/mixin/LivingEntityRendererMixin.java @@ -12,11 +12,11 @@ @Mixin(LivingEntityRenderer.class) public abstract class LivingEntityRendererMixin { @Inject( - method = "hasLabel(Lnet/minecraft/entity/LivingEntity;)Z", + method = "hasLabel(Lnet/minecraft/entity/LivingEntity;D)Z", at = @At("HEAD"), cancellable = true ) - private void showmeyourskin$removeLabel(T livingEntity, CallbackInfoReturnable cir) { + private void showmeyourskin$removeLabel(T livingEntity, double d, CallbackInfoReturnable cir) { if ( livingEntity instanceof DummyClientPlayerEntity || !ModConfig.INSTANCE.getApplicable(livingEntity.getUuid()).showNameTag diff --git a/src/main/java/nl/enjarai/showmeyourskin/mixin/OtherClientPlayerEntityMixin.java b/src/main/java/nl/enjarai/showmeyourskin/mixin/OtherClientPlayerEntityMixin.java deleted file mode 100644 index d9d0a2f..0000000 --- a/src/main/java/nl/enjarai/showmeyourskin/mixin/OtherClientPlayerEntityMixin.java +++ /dev/null @@ -1,20 +0,0 @@ -package nl.enjarai.showmeyourskin.mixin; - -import net.minecraft.client.network.OtherClientPlayerEntity; -import net.minecraft.entity.damage.DamageSource; -import nl.enjarai.showmeyourskin.util.CombatLogger; -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.CallbackInfoReturnable; - -@Mixin(OtherClientPlayerEntity.class) -public abstract class OtherClientPlayerEntityMixin { - @Inject( - method = "damage(Lnet/minecraft/entity/damage/DamageSource;F)Z", - at = @At(value = "HEAD") - ) - private void showmeyourskin$triggerCombat(DamageSource source, float amount, CallbackInfoReturnable cir) { - CombatLogger.INSTANCE.triggerCombat(((OtherClientPlayerEntity) (Object) this).getUuid()); - } -} diff --git a/src/main/java/nl/enjarai/showmeyourskin/mixin/armor/ArmorFeatureRendererMixin.java b/src/main/java/nl/enjarai/showmeyourskin/mixin/armor/ArmorFeatureRendererMixin.java index e9a71a2..5eb031c 100644 --- a/src/main/java/nl/enjarai/showmeyourskin/mixin/armor/ArmorFeatureRendererMixin.java +++ b/src/main/java/nl/enjarai/showmeyourskin/mixin/armor/ArmorFeatureRendererMixin.java @@ -1,129 +1,108 @@ package nl.enjarai.showmeyourskin.mixin.armor; -import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.TexturedRenderLayers; -import net.minecraft.client.render.VertexConsumer; +import com.llamalad7.mixinextras.sugar.Share; +import com.llamalad7.mixinextras.sugar.ref.LocalRef; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.feature.ArmorFeatureRenderer; import net.minecraft.client.render.entity.model.BipedEntityModel; -import net.minecraft.client.texture.Sprite; -import net.minecraft.client.texture.SpriteAtlasTexture; +import net.minecraft.client.render.entity.state.BipedEntityRenderState; import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.component.DataComponentTypes; +import net.minecraft.entity.Entity; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.LivingEntity; -import net.minecraft.item.ArmorItem; -import net.minecraft.item.ArmorMaterial; -import net.minecraft.item.trim.ArmorTrim; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.ColorHelper; -import nl.enjarai.showmeyourskin.client.ModRenderLayers; -import nl.enjarai.showmeyourskin.compat.armored_elytra.ArmoredElytraCompat; +import net.minecraft.item.ItemStack; +import nl.enjarai.showmeyourskin.ShowMeYourSkin; import nl.enjarai.showmeyourskin.config.HideableEquipment; import nl.enjarai.showmeyourskin.util.ArmorContext; -import nl.enjarai.showmeyourskin.util.MixinContext; -import org.jetbrains.annotations.Nullable; -import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -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 java.util.LinkedList; - @Mixin(value = ArmorFeatureRenderer.class, priority = 500) -public abstract class ArmorFeatureRendererMixin, A extends BipedEntityModel> { - @Shadow @Final private SpriteAtlasTexture armorTrimsAtlas; - - @Unique - private final LinkedList trimContextQueue = new LinkedList<>(); - +public abstract class ArmorFeatureRendererMixin, A extends BipedEntityModel> { @Inject( method = "renderArmor", at = @At(value = "HEAD") ) - private void showmeyourskin$captureContext(MatrixStack matrices, VertexConsumerProvider vertexConsumers, T entity, EquipmentSlot armorSlot, int light, A model, CallbackInfo ci) { - if (ArmoredElytraCompat.IS_LOADED && armorSlot == EquipmentSlot.OFFHAND) { - armorSlot = EquipmentSlot.CHEST; + private void setArmorContext(MatrixStack matrices, VertexConsumerProvider vertexConsumers, ItemStack stack, + EquipmentSlot slot, int light, A armorModel, CallbackInfo ci, + @Share(namespace = ShowMeYourSkin.MODID, value = "renderedEntity") LocalRef entity, + @Share(namespace = ShowMeYourSkin.MODID, value = "renderEquipmentContext") LocalRef ctx) { + if (entity.get() instanceof LivingEntity livingEntity) { + ctx.set(new ArmorContext(HideableEquipment.fromSlot(slot), livingEntity)); } - - MixinContext.ARMOR.setContext(new ArmorContext(HideableEquipment.fromSlot(armorSlot), entity)); } - @ModifyExpressionValue( - method = "renderArmor", - at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;hasGlint()Z") - ) - private boolean showmeyourskin$toggleGlint(boolean original) { - var ctx = MixinContext.ARMOR.getContext(); - - if (ctx != null && ctx.shouldModify()) { - return original && ctx.getApplicableGlintTransparency() > 0; - } - return original; - } - - @Inject( - method = "renderArmorParts", - at = @At(value = "HEAD"), - cancellable = true - ) - private void showmeyourskin$armorTransparency(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, A model, int i, Identifier overlay, CallbackInfo ci) { - var ctx = MixinContext.ARMOR.getContext(); - if (ctx == null) throw new IllegalStateException("ArmorContext is null"); - - // Some mod is probably up to no good. That's fine, but we should make sure to ignore it. - if (ctx.getSlot() == null) return; - - if (ctx.getEntity().getEquippedStack(ctx.getSlot().toSlot()).get(DataComponentTypes.TRIM) != null) { - trimContextQueue.offer(ctx); - } - - if (ctx.shouldModify()) { - var t = ctx.getApplicablePieceTransparency(); - - if (t < 1) { - if (t > 0) { - VertexConsumer vertexConsumer = vertexConsumers.getBuffer( - ModRenderLayers.ARMOR_TRANSLUCENT_NO_CULL.apply(overlay)); - model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV, - ColorHelper.Argb.withAlpha(ColorHelper.channelFromFloat(t), i) - ); - } - - ci.cancel(); - } - } - } - - @Inject( - method = "renderTrim", - at = @At(value = "HEAD"), - cancellable = true - ) - private void showmeyourskin$trimTransparency(RegistryEntry armorMaterial, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, ArmorTrim trim, A model, boolean leggings, CallbackInfo ci) { - if (FabricLoader.getInstance().isModLoaded("allthetrims")) return; - - var ctx = trimContextQueue.poll(); - - if (ctx != null && ctx.shouldModify()) { - var t = ctx.getApplicableTrimTransparency(); - - if (t < 1) { - if (t > 0) { - Sprite sprite = this.armorTrimsAtlas.getSprite(leggings ? trim.getLeggingsModelId(armorMaterial) : trim.getGenericModelId(armorMaterial)); - VertexConsumer vertexConsumer = sprite.getTextureSpecificVertexConsumer(vertexConsumers - .getBuffer(ModRenderLayers.ARMOR_TRANSLUCENT_NO_CULL.apply(TexturedRenderLayers.ARMOR_TRIMS_ATLAS_TEXTURE))); - model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV, ColorHelper.Argb.fromFloats(t, 1.0f, 1.0f, 1.0f)); - } - - ci.cancel(); - } - } - } +// @ModifyExpressionValue( +// method = "renderArmor", +// at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;hasGlint()Z") +// ) +// private boolean showmeyourskin$toggleGlint(boolean original) { +// var ctx = MixinContext.ARMOR.getContext(); +// +// if (ctx != null && ctx.shouldModify()) { +// return original && ctx.getApplicableGlintTransparency() > 0; +// } +// return original; +// } +// +// @Inject( +// method = "renderArmorParts", +// at = @At(value = "HEAD"), +// cancellable = true +// ) +// private void showmeyourskin$armorTransparency(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, A model, int i, Identifier overlay, CallbackInfo ci) { +// var ctx = MixinContext.ARMOR.getContext(); +// if (ctx == null) throw new IllegalStateException("ArmorContext is null"); +// +// // Some mod is probably up to no good. That's fine, but we should make sure to ignore it. +// if (ctx.getSlot() == null) return; +// +// if (ctx.getEntity().getEquippedStack(ctx.getSlot().toSlot()).get(DataComponentTypes.TRIM) != null) { +// trimContextQueue.offer(ctx); +// } +// +// if (ctx.shouldModify()) { +// var t = ctx.getApplicablePieceTransparency(); +// +// if (t < 1) { +// if (t > 0) { +// VertexConsumer vertexConsumer = vertexConsumers.getBuffer( +// ModRenderLayers.ARMOR_TRANSLUCENT_NO_CULL.apply(overlay)); +// model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV, +// ColorHelper.Argb.withAlpha(ColorHelper.channelFromFloat(t), i) +// ); +// } +// +// ci.cancel(); +// } +// } +// } +// +// @Inject( +// method = "renderTrim", +// at = @At(value = "HEAD"), +// cancellable = true +// ) +// private void showmeyourskin$trimTransparency(RegistryEntry armorMaterial, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, ArmorTrim trim, A model, boolean leggings, CallbackInfo ci) { +// if (FabricLoader.getInstance().isModLoaded("allthetrims")) return; +// +// var ctx = trimContextQueue.poll(); +// +// if (ctx != null && ctx.shouldModify()) { +// var t = ctx.getApplicableTrimTransparency(); +// +// if (t < 1) { +// if (t > 0) { +// Sprite sprite = this.armorTrimsAtlas.getSprite(leggings ? trim.getLeggingsModelId(armorMaterial) : trim.getGenericModelId(armorMaterial)); +// VertexConsumer vertexConsumer = sprite.getTextureSpecificVertexConsumer(vertexConsumers +// .getBuffer(ModRenderLayers.ARMOR_TRANSLUCENT_NO_CULL.apply(TexturedRenderLayers.ARMOR_TRIMS_ATLAS_TEXTURE))); +// model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV, ColorHelper.Argb.fromFloats(t, 1.0f, 1.0f, 1.0f)); +// } +// +// ci.cancel(); +// } +// } +// } } diff --git a/src/main/java/nl/enjarai/showmeyourskin/mixin/armor/EquipmentRendererMixin.java b/src/main/java/nl/enjarai/showmeyourskin/mixin/armor/EquipmentRendererMixin.java new file mode 100644 index 0000000..da5e7ce --- /dev/null +++ b/src/main/java/nl/enjarai/showmeyourskin/mixin/armor/EquipmentRendererMixin.java @@ -0,0 +1,83 @@ +package nl.enjarai.showmeyourskin.mixin.armor; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import com.llamalad7.mixinextras.sugar.Share; +import com.llamalad7.mixinextras.sugar.ref.LocalRef; +import net.minecraft.client.model.Model; +import net.minecraft.client.render.RenderLayer; +import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.client.render.entity.equipment.EquipmentRenderer; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.item.ItemStack; +import net.minecraft.item.equipment.EquipmentModel; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.ColorHelper; +import nl.enjarai.showmeyourskin.ShowMeYourSkin; +import nl.enjarai.showmeyourskin.util.ArmorContext; +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.ModifyArg; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(EquipmentRenderer.class) +public class EquipmentRendererMixin { + @ModifyExpressionValue( + method = "render(Lnet/minecraft/item/equipment/EquipmentModel$LayerType;Lnet/minecraft/util/Identifier;Lnet/minecraft/client/model/Model;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/util/Identifier;)V", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/item/ItemStack;hasGlint()Z" + ) + ) + private boolean toggleGlint(boolean original, + @Share(namespace = ShowMeYourSkin.MODID, value = "renderEquipmentContext") LocalRef ctx) { + if (ctx.get() != null && ctx.get().shouldModify()) { + return original && ctx.get().getApplicableGlintTransparency() > 0; + } + return original; + } + + @WrapOperation( + method = "render(Lnet/minecraft/item/equipment/EquipmentModel$LayerType;Lnet/minecraft/util/Identifier;Lnet/minecraft/client/model/Model;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/util/Identifier;)V", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/client/render/RenderLayer;getArmorCutoutNoCull(Lnet/minecraft/util/Identifier;)Lnet/minecraft/client/render/RenderLayer;" + ) + ) + private RenderLayer modifyRenderLayer(Identifier texture, Operation original, + @Share(namespace = ShowMeYourSkin.MODID, value = "renderEquipmentContext") LocalRef ctx) { + if (ctx.get() != null && ctx.get().getApplicablePieceTransparency() < 1) { + return RenderLayer.createArmorTranslucent(texture); + } + return original.call(texture); + } + + @ModifyArg( + method = "render(Lnet/minecraft/item/equipment/EquipmentModel$LayerType;Lnet/minecraft/util/Identifier;Lnet/minecraft/client/model/Model;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/util/Identifier;)V", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/client/model/Model;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;III)V" + ), + index = 4 + ) + private int modifyAlpha(int color, + @Share(namespace = ShowMeYourSkin.MODID, value = "renderEquipmentContext") LocalRef ctx) { + if (ctx.get() != null && ctx.get().getApplicablePieceTransparency() < 1) { + return ColorHelper.withAlpha(ColorHelper.channelFromFloat(ctx.get().getApplicablePieceTransparency()), color); + } + return color; + } + + @Inject( + method = "render(Lnet/minecraft/item/equipment/EquipmentModel$LayerType;Lnet/minecraft/util/Identifier;Lnet/minecraft/client/model/Model;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/util/Identifier;)V", + at = @At("RETURN") + ) + private void resetContext(EquipmentModel.LayerType layerType, Identifier modelId, Model model, + ItemStack stack, MatrixStack matrices, VertexConsumerProvider vertexConsumers, + int light, Identifier texture, CallbackInfo ci, + @Share(namespace = ShowMeYourSkin.MODID, value = "renderEquipmentContext") LocalRef ctx) { + ctx.set(null); + } +} diff --git a/src/main/java/nl/enjarai/showmeyourskin/mixin/armor/PlayerEntityModelMixin.java b/src/main/java/nl/enjarai/showmeyourskin/mixin/armor/PlayerEntityModelMixin.java deleted file mode 100644 index c79e6af..0000000 --- a/src/main/java/nl/enjarai/showmeyourskin/mixin/armor/PlayerEntityModelMixin.java +++ /dev/null @@ -1,38 +0,0 @@ -package nl.enjarai.showmeyourskin.mixin.armor; - -import net.minecraft.client.model.ModelPart; -import net.minecraft.client.render.entity.model.PlayerEntityModel; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import nl.enjarai.showmeyourskin.config.ModConfig; -import nl.enjarai.showmeyourskin.util.CombatLogger; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(PlayerEntityModel.class) -public abstract class PlayerEntityModelMixin { - @Shadow @Final private ModelPart cloak; - - @Inject( - method = "setAngles(Lnet/minecraft/entity/LivingEntity;FFFFF)V", - at = @At(value = "TAIL") - ) - private void showmeyourskin$fixCapeAngle(T livingEntity, float f, float g, float h, float i, float j, CallbackInfo ci) { - var applicable = ModConfig.INSTANCE.getApplicable(livingEntity.getUuid()); - if (livingEntity instanceof PlayerEntity player && - !applicable.shouldTransformCape(player) && - !CombatLogger.INSTANCE.isInCombat(livingEntity.getUuid())) { - if (livingEntity.isInSneakingPose()) { - cloak.pivotZ = 1.4F; - cloak.pivotY = 1.85F; - } else { - cloak.pivotZ = 0.0F; - cloak.pivotY = 0.0F; - } - } - } -} diff --git a/src/main/java/nl/enjarai/showmeyourskin/mixin/armor/fabric/ArmorRendererMixin.java b/src/main/java/nl/enjarai/showmeyourskin/mixin/armor/fabric/ArmorRendererMixin.java index 0e8297c..3941f5e 100644 --- a/src/main/java/nl/enjarai/showmeyourskin/mixin/armor/fabric/ArmorRendererMixin.java +++ b/src/main/java/nl/enjarai/showmeyourskin/mixin/armor/fabric/ArmorRendererMixin.java @@ -36,7 +36,7 @@ public interface ArmorRendererMixin { vertexConsumers, ModRenderLayers.ARMOR_TRANSLUCENT_NO_CULL.apply(texture), stack.hasGlint() && ctx.getApplicableGlintTransparency() > 0 ); - model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV, ColorHelper.Argb.fromFloats(t, 1.0f, 1.0f, 1.0f)); + model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV, ColorHelper.fromFloats(t, 1.0f, 1.0f, 1.0f)); } ci.cancel(); diff --git a/src/main/java/nl/enjarai/showmeyourskin/mixin/elytra/CapeFeatureRendererMixin.java b/src/main/java/nl/enjarai/showmeyourskin/mixin/elytra/CapeFeatureRendererMixin.java deleted file mode 100644 index cdaee0e..0000000 --- a/src/main/java/nl/enjarai/showmeyourskin/mixin/elytra/CapeFeatureRendererMixin.java +++ /dev/null @@ -1,27 +0,0 @@ -package nl.enjarai.showmeyourskin.mixin.elytra; - -import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import com.llamalad7.mixinextras.sugar.Local; -import net.minecraft.client.network.AbstractClientPlayerEntity; -import net.minecraft.client.render.entity.feature.CapeFeatureRenderer; -import nl.enjarai.showmeyourskin.config.HideableEquipment; -import nl.enjarai.showmeyourskin.config.ModConfig; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; - -@Mixin(CapeFeatureRenderer.class) -public abstract class CapeFeatureRendererMixin { - @ModifyExpressionValue( - method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/client/network/AbstractClientPlayerEntity;FFFFFF)V", - at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;isOf(Lnet/minecraft/item/Item;)Z") - ) - private boolean showmeyourskin$renderCapeIfElytraHidden(boolean original, @Local(argsOnly = true) AbstractClientPlayerEntity player) { - if (player != null) { - if (!player.isFallFlying() || !ModConfig.INSTANCE.getApplicable(player.getUuid()).forceElytraWhenFlying) { - var uuid = player.getUuid(); - return original && ModConfig.INSTANCE.getApplicablePieceTransparency(uuid, HideableEquipment.ELYTRA) > 0; - } - } - return original; - } -} diff --git a/src/main/java/nl/enjarai/showmeyourskin/mixin/elytra/ElytraFeatureRendererMixin.java b/src/main/java/nl/enjarai/showmeyourskin/mixin/elytra/ElytraFeatureRendererMixin.java deleted file mode 100644 index 46e6b0a..0000000 --- a/src/main/java/nl/enjarai/showmeyourskin/mixin/elytra/ElytraFeatureRendererMixin.java +++ /dev/null @@ -1,131 +0,0 @@ -package nl.enjarai.showmeyourskin.mixin.elytra; - -import com.llamalad7.mixinextras.injector.wrapoperation.Operation; -import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; -import com.llamalad7.mixinextras.sugar.Local; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.feature.ElytraFeatureRenderer; -import net.minecraft.client.render.entity.feature.FeatureRenderer; -import net.minecraft.client.render.entity.feature.FeatureRendererContext; -import net.minecraft.client.render.entity.model.ElytraEntityModel; -import net.minecraft.client.render.entity.model.EntityModel; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.ColorHelper; -import nl.enjarai.showmeyourskin.config.HideableEquipment; -import nl.enjarai.showmeyourskin.config.ModConfig; -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.ModifyArg; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(ElytraFeatureRenderer.class) -public abstract class ElytraFeatureRendererMixin> extends FeatureRenderer { - public ElytraFeatureRendererMixin(FeatureRendererContext context) { - super(context); - } - - @Inject( - method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/entity/LivingEntity;FFFFFF)V", - at = @At("HEAD"), - cancellable = true - ) - private void showmeyourskin$hideElytra( - MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, T livingEntity, float f, - float g, float h, float j, float k, float l, CallbackInfo ci) { - if (livingEntity instanceof PlayerEntity player) { - if (!player.isFallFlying() || !ModConfig.INSTANCE.getApplicable(player.getUuid()).forceElytraWhenFlying) { - if (ModConfig.INSTANCE.getApplicablePieceTransparency(player.getUuid(), HideableEquipment.ELYTRA) <= 0) { - ci.cancel(); - } - } - } - } - - @ModifyArg( - method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/entity/LivingEntity;FFFFFF)V", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/render/item/ItemRenderer;getArmorGlintConsumer(Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/render/RenderLayer;Z)Lnet/minecraft/client/render/VertexConsumer;" - ), - index = 2 - ) - private boolean showmeyourskin$hideElytraGlint(boolean original, @Local(argsOnly = true) LivingEntity entity) { - if (entity instanceof PlayerEntity player) { - return original && ModConfig.INSTANCE.getApplicableGlintTransparency(player.getUuid(), HideableEquipment.ELYTRA) > 0; - } - - return original; - } - - @WrapOperation( - method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/entity/LivingEntity;FFFFFF)V", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/render/item/ItemRenderer;getArmorGlintConsumer(Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/render/RenderLayer;Z)Lnet/minecraft/client/render/VertexConsumer;" - ) - ) - private VertexConsumer showmeyourskin$enableElytraTransparency1( - VertexConsumerProvider vertexConsumerProvider, RenderLayer renderLayer, boolean solid, Operation original, @Local(argsOnly = true) LivingEntity entity) { - if (entity instanceof PlayerEntity player) { - if (!player.isFallFlying() || !ModConfig.INSTANCE.getApplicable(player.getUuid()).forceElytraWhenFlying) { - var transparency = ModConfig.INSTANCE.getApplicablePieceTransparency(player.getUuid(), HideableEquipment.ELYTRA); - if (transparency < 1) { - return ItemRenderer.getDirectItemGlintConsumer(vertexConsumerProvider, renderLayer, solid, solid); - } - } - } - - return original.call(vertexConsumerProvider, renderLayer, solid); - } - - @WrapOperation( - method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/entity/LivingEntity;FFFFFF)V", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/render/RenderLayer;getArmorCutoutNoCull(Lnet/minecraft/util/Identifier;)Lnet/minecraft/client/render/RenderLayer;" - ) - ) - private RenderLayer showmeyourskin$enableElytraTransparency2( - Identifier texture, Operation original, @Local(argsOnly = true) LivingEntity entity) { - if (entity instanceof PlayerEntity player) { - if (!player.isFallFlying() || !ModConfig.INSTANCE.getApplicable(player.getUuid()).forceElytraWhenFlying) { - var transparency = ModConfig.INSTANCE.getApplicablePieceTransparency(player.getUuid(), HideableEquipment.ELYTRA); - if (transparency < 1) { - return RenderLayer.getEntityTranslucent(texture); - } - } - } - - return original.call(texture); - } - - @WrapOperation( - method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/entity/LivingEntity;FFFFFF)V", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/render/entity/model/ElytraEntityModel;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;II)V" - ) - ) - private void showmeyourskin$applyElytraTransparency(ElytraEntityModel instance, MatrixStack matrixStack, VertexConsumer vertexConsumer, int i, int uv, Operation original, @Local(argsOnly = true) LivingEntity entity) { - if (entity instanceof PlayerEntity player) { - if (!player.isFallFlying() || !ModConfig.INSTANCE.getApplicable(player.getUuid()).forceElytraWhenFlying) { - var transparency = ModConfig.INSTANCE.getApplicablePieceTransparency(player.getUuid(), HideableEquipment.ELYTRA); - if (transparency < 1) { - instance.render(matrixStack, vertexConsumer, i, uv, - ColorHelper.Argb.withAlpha(ColorHelper.channelFromFloat(transparency), -1) - ); - return; - } - } - } - - original.call(instance, matrixStack, vertexConsumer, i, uv); - } -} diff --git a/src/main/java/nl/enjarai/showmeyourskin/mixin/hat/HeadFeatureRendererMixin.java b/src/main/java/nl/enjarai/showmeyourskin/mixin/hat/HeadFeatureRendererMixin.java deleted file mode 100644 index 1d4c018..0000000 --- a/src/main/java/nl/enjarai/showmeyourskin/mixin/hat/HeadFeatureRendererMixin.java +++ /dev/null @@ -1,32 +0,0 @@ -package nl.enjarai.showmeyourskin.mixin.hat; - -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.feature.HeadFeatureRenderer; -import net.minecraft.client.render.entity.model.EntityModel; -import net.minecraft.client.render.entity.model.ModelWithHead; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.LivingEntity; -import nl.enjarai.showmeyourskin.util.MixinContext; -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; - -@Mixin(HeadFeatureRenderer.class) -public abstract class HeadFeatureRendererMixin & ModelWithHead> { - @Inject( - method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/entity/LivingEntity;FFFFFF)V", - at = @At("HEAD") - ) - private void grabHatRenderContext(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, T livingEntity, float f, float g, float h, float j, float k, float l, CallbackInfo ci) { - MixinContext.ENTITY.setContext(livingEntity); - } - - @Inject( - method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/entity/LivingEntity;FFFFFF)V", - at = @At("RETURN") - ) - private void resetHatRenderContext(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, T livingEntity, float f, float g, float h, float j, float k, float l, CallbackInfo ci) { - MixinContext.ENTITY.clearContext(); - } -} diff --git a/src/main/java/nl/enjarai/showmeyourskin/mixin/hat/SkullBlockEntityRendererMixin.java b/src/main/java/nl/enjarai/showmeyourskin/mixin/hat/SkullBlockEntityRendererMixin.java deleted file mode 100644 index 820acb3..0000000 --- a/src/main/java/nl/enjarai/showmeyourskin/mixin/hat/SkullBlockEntityRendererMixin.java +++ /dev/null @@ -1,71 +0,0 @@ -package nl.enjarai.showmeyourskin.mixin.hat; - -import com.llamalad7.mixinextras.injector.wrapoperation.Operation; -import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.block.entity.SkullBlockEntityModel; -import net.minecraft.client.render.block.entity.SkullBlockEntityRenderer; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.ColorHelper; -import nl.enjarai.showmeyourskin.config.HideableEquipment; -import nl.enjarai.showmeyourskin.config.ModConfig; -import nl.enjarai.showmeyourskin.util.MixinContext; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; - -@Mixin(SkullBlockEntityRenderer.class) -public abstract class SkullBlockEntityRendererMixin { - @WrapOperation( - method = "renderSkull", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/render/block/entity/SkullBlockEntityModel;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;II)V" - ) - ) - private static void modifySkullTransparency(SkullBlockEntityModel instance, MatrixStack matrixStack, VertexConsumer vertexConsumer, int light, int uv, Operation original) { - var wearingEntity = MixinContext.ENTITY.getContext(); - - if (wearingEntity != null) { - var transparency = ModConfig.INSTANCE.getApplicablePieceTransparency(wearingEntity.getUuid(), HideableEquipment.HAT); - - if (transparency < 1) { - if (transparency > 0) { - // If transparency is below one but above 0, we *should* call the original but modify the alpha - instance.render(matrixStack, vertexConsumer, light, uv, - ColorHelper.Argb.withAlpha(ColorHelper.channelFromFloat(transparency), -1) - ); - } - - // If transparency is below 1, we potentially don't want to call the original - return; - } - } - - // Continue as usual - original.call(instance, matrixStack, vertexConsumer, light, uv); - } - - @WrapOperation( - method = "getRenderLayer", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/render/RenderLayer;getEntityCutoutNoCullZOffset(Lnet/minecraft/util/Identifier;)Lnet/minecraft/client/render/RenderLayer;" - ) - ) - private static RenderLayer modifySkullRenderLayer(Identifier texture, Operation original) { - var wearingEntity = MixinContext.ENTITY.getContext(); - - if (wearingEntity != null) { - var transparency = ModConfig.INSTANCE.getApplicablePieceTransparency(wearingEntity.getUuid(), HideableEquipment.HAT); - - if (transparency < 1) { - // If the transparency is below 1, use a translucent render layer anyway - return RenderLayer.getEntityTranslucent(texture); - } - } - - return original.call(texture); - } -} diff --git a/src/main/java/nl/enjarai/showmeyourskin/mixin/shield/BannerBlockEntityRendererMixin.java b/src/main/java/nl/enjarai/showmeyourskin/mixin/shield/BannerBlockEntityRendererMixin.java deleted file mode 100644 index 666e730..0000000 --- a/src/main/java/nl/enjarai/showmeyourskin/mixin/shield/BannerBlockEntityRendererMixin.java +++ /dev/null @@ -1,155 +0,0 @@ -package nl.enjarai.showmeyourskin.mixin.shield; - -import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; -import net.minecraft.client.model.ModelPart; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.block.entity.BannerBlockEntityRenderer; -import net.minecraft.client.util.SpriteIdentifier; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.component.type.BannerPatternsComponent; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.DyeColor; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.ColorHelper; -import nl.enjarai.showmeyourskin.config.HideableEquipment; -import nl.enjarai.showmeyourskin.config.ModConfig; -import nl.enjarai.showmeyourskin.util.MixinContext; -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.ModifyArg; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import java.util.List; -import java.util.function.Function; - -@Mixin(BannerBlockEntityRenderer.class) -public abstract class BannerBlockEntityRendererMixin { - private static final ThreadLocal showmeyourskin$isShield = ThreadLocal.withInitial(() -> false); - - @Inject( - method = "renderCanvas(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IILnet/minecraft/client/model/ModelPart;Lnet/minecraft/client/util/SpriteIdentifier;ZLnet/minecraft/util/DyeColor;Lnet/minecraft/component/type/BannerPatternsComponent;Z)V", - at = @At("HEAD"), - cancellable = true - ) - private static void showmeyourskin$captureBannerCanvasContext(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, ModelPart canvas, SpriteIdentifier baseSprite, boolean isBanner, DyeColor color, BannerPatternsComponent patterns, boolean glint, CallbackInfo ci) { - showmeyourskin$isShield.set(!isBanner); - - if (!isBanner) { - var ctx = MixinContext.ENTITY.getContext(); - - if (ctx instanceof PlayerEntity) { - var t = ModConfig.INSTANCE.getApplicablePieceTransparency(ctx.getUuid(), HideableEquipment.SHIELD); - - if (t <= 0) { - ci.cancel(); - } - } - } - } - - @ModifyArg( - method = "renderCanvas(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IILnet/minecraft/client/model/ModelPart;Lnet/minecraft/client/util/SpriteIdentifier;ZLnet/minecraft/util/DyeColor;Lnet/minecraft/component/type/BannerPatternsComponent;Z)V", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/util/SpriteIdentifier;getVertexConsumer(Lnet/minecraft/client/render/VertexConsumerProvider;Ljava/util/function/Function;Z)Lnet/minecraft/client/render/VertexConsumer;" - ), - index = 1 - ) - private static Function showmeyourskin$modifyBannerCanvasRenderLayer(Function original) { - if (showmeyourskin$isShield.get()) { - var ctx = MixinContext.ENTITY.getContext(); - - if (ctx instanceof PlayerEntity) { - var t = ModConfig.INSTANCE.getApplicablePieceTransparency(ctx.getUuid(), HideableEquipment.SHIELD); - - if (t < 1) { - return RenderLayer::getEntityTranslucent; - } - } - } - - return original; - } - - @WrapWithCondition( - method = "renderCanvas(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IILnet/minecraft/client/model/ModelPart;Lnet/minecraft/client/util/SpriteIdentifier;ZLnet/minecraft/util/DyeColor;Lnet/minecraft/component/type/BannerPatternsComponent;Z)V", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/model/ModelPart;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;II)V" - ) - ) - private static boolean showmeyourskin$applyShieldCanvasTransparency(ModelPart canvas, MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay) { - if (showmeyourskin$isShield.get()) { - var ctx = MixinContext.ENTITY.getContext(); - - if (ctx instanceof PlayerEntity) { - var t = ModConfig.INSTANCE.getApplicablePieceTransparency(ctx.getUuid(), HideableEquipment.SHIELD); - - if (t < 1) { - if (t > 0) { - canvas.render( - matrices, vertexConsumer, - light, overlay, - ColorHelper.Argb.fromFloats(t, 1.0f, 1.0f, 1.0f) - ); - } - - return false; - } - } - } - - return true; - } - - @ModifyArg( - method = "renderLayer", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/util/SpriteIdentifier;getVertexConsumer(Lnet/minecraft/client/render/VertexConsumerProvider;Ljava/util/function/Function;)Lnet/minecraft/client/render/VertexConsumer;" - ), - index = 1 - ) - private static Function showmeyourskin$modifyBannerPatternRenderLayer(Function original) { - if (showmeyourskin$isShield.get()) { - var ctx = MixinContext.ENTITY.getContext(); - - if (ctx instanceof PlayerEntity) { - var t = ModConfig.INSTANCE.getApplicablePieceTransparency(ctx.getUuid(), HideableEquipment.SHIELD); - - if (t < 1) { - return RenderLayer::getEntityTranslucent; - } - } - } - - return original; - } - - @ModifyArg( - method = "renderLayer", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/model/ModelPart;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;III)V" - ), - index = 4 - ) - private static int showmeyourskin$modifyBannerPatternTransparency(int original) { - if (showmeyourskin$isShield.get()) { - var ctx = MixinContext.ENTITY.getContext(); - - if (ctx instanceof PlayerEntity) { - var t = ModConfig.INSTANCE.getApplicablePieceTransparency(ctx.getUuid(), HideableEquipment.SHIELD); - - if (t < 1) { - return ColorHelper.Argb.withAlpha(ColorHelper.channelFromFloat(t), original); - } - } - } - - return original; - } -} diff --git a/src/main/java/nl/enjarai/showmeyourskin/mixin/shield/BuiltinModelItemRendererMixin.java b/src/main/java/nl/enjarai/showmeyourskin/mixin/shield/BuiltinModelItemRendererMixin.java deleted file mode 100644 index b44d3f5..0000000 --- a/src/main/java/nl/enjarai/showmeyourskin/mixin/shield/BuiltinModelItemRendererMixin.java +++ /dev/null @@ -1,119 +0,0 @@ -package nl.enjarai.showmeyourskin.mixin.shield; - -import com.llamalad7.mixinextras.injector.wrapoperation.Operation; -import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; -import net.minecraft.client.model.ModelPart; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.model.ShieldEntityModel; -import net.minecraft.client.render.item.BuiltinModelItemRenderer; -import net.minecraft.client.render.model.json.ModelTransformationMode; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.ColorHelper; -import nl.enjarai.showmeyourskin.config.HideableEquipment; -import nl.enjarai.showmeyourskin.config.ModConfig; -import nl.enjarai.showmeyourskin.util.MixinContext; -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.ModifyArg; -import org.spongepowered.asm.mixin.injection.Redirect; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(BuiltinModelItemRenderer.class) -public abstract class BuiltinModelItemRendererMixin { - - private boolean showmeyourskin$getShieldGlint() { - var ctx = MixinContext.ENTITY.getContext(); - - if (ctx instanceof PlayerEntity) { - return ModConfig.INSTANCE.getApplicable(ctx.getUuid()).getGlints().get(HideableEquipment.SHIELD).getTransparency() > 0; - } - - return true; - } - - @ModifyArg( - method = "render", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/render/item/ItemRenderer;getDirectItemGlintConsumer(Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/render/RenderLayer;ZZ)Lnet/minecraft/client/render/VertexConsumer;" - ), - index = 3 - ) - private boolean showmeyourskin$modifyGlint1(boolean original) { - return original && showmeyourskin$getShieldGlint(); - } - - @ModifyArg( - method = "render", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/render/block/entity/BannerBlockEntityRenderer;renderCanvas(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IILnet/minecraft/client/model/ModelPart;Lnet/minecraft/client/util/SpriteIdentifier;ZLnet/minecraft/util/DyeColor;Lnet/minecraft/component/type/BannerPatternsComponent;Z)V" - ), - index = 9 - ) - private boolean showmeyourskin$modifyGlint2(boolean original) { - return original && showmeyourskin$getShieldGlint(); - } - - @Inject( - method = "render", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/item/ItemStack;getOrDefault(Lnet/minecraft/component/ComponentType;Ljava/lang/Object;)Ljava/lang/Object;" - ), - cancellable = true - ) - private void showmeyourskin$cancelShieldRender(ItemStack stack, ModelTransformationMode mode, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, CallbackInfo ci) { - var ctx = MixinContext.ENTITY.getContext(); - - if (ctx instanceof PlayerEntity) { - if (ModConfig.INSTANCE.getApplicablePieceTransparency(ctx.getUuid(), HideableEquipment.SHIELD) <= 0) { - ci.cancel(); - } - } - } - - @WrapOperation( - method = "render", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/render/entity/model/ShieldEntityModel;getLayer(Lnet/minecraft/util/Identifier;)Lnet/minecraft/client/render/RenderLayer;", - ordinal = 0 - ) - ) - private RenderLayer showmeyourskin$enableShieldTransparency(ShieldEntityModel model, Identifier texture, Operation original) { - var ctx = MixinContext.ENTITY.getContext(); - - if (ctx instanceof PlayerEntity) { - if (ModConfig.INSTANCE.getApplicablePieceTransparency(ctx.getUuid(), HideableEquipment.SHIELD) < 1) { - return RenderLayer.getEntityTranslucent(texture); - } - } - - return original.call(model, texture); - } - - @WrapOperation( - method = "render", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/model/ModelPart;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;II)V" - ) - ) - private void showmeyourskin$modifyShieldTransparency(ModelPart instance, MatrixStack matrices, VertexConsumer vertices, int light, int overlay, Operation original) { - var ctx = MixinContext.ENTITY.getContext(); - - if (ctx instanceof PlayerEntity) { - instance.render(matrices, vertices, light, overlay, ColorHelper.Argb.withAlpha(ColorHelper.channelFromFloat(ModConfig.INSTANCE.getApplicablePieceTransparency(ctx.getUuid(), HideableEquipment.SHIELD)), -1)); - return; - } - - original.call(instance, matrices, vertices, light, overlay); - } -} diff --git a/src/main/java/nl/enjarai/showmeyourskin/mixin/shield/HeldItemRendererMixin.java b/src/main/java/nl/enjarai/showmeyourskin/mixin/shield/HeldItemRendererMixin.java deleted file mode 100644 index 7df6368..0000000 --- a/src/main/java/nl/enjarai/showmeyourskin/mixin/shield/HeldItemRendererMixin.java +++ /dev/null @@ -1,32 +0,0 @@ -package nl.enjarai.showmeyourskin.mixin.shield; - -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.item.HeldItemRenderer; -import net.minecraft.client.render.model.json.ModelTransformationMode; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.ItemStack; -import nl.enjarai.showmeyourskin.util.MixinContext; -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; - -@Mixin(HeldItemRenderer.class) -public abstract class HeldItemRendererMixin { - @Inject( - method = "renderItem(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformationMode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", - at = @At("HEAD") - ) - private void showmeyourskin$captureItemRenderContext(LivingEntity entity, ItemStack stack, ModelTransformationMode renderMode, boolean leftHanded, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) { - MixinContext.ENTITY.setContext(entity); - } - - @Inject( - method = "renderItem(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformationMode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", - at = @At("RETURN") - ) - private void showmeyourskin$clearItemRenderContext(LivingEntity entity, ItemStack stack, ModelTransformationMode renderMode, boolean leftHanded, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) { - MixinContext.ENTITY.clearContext(); - } -} diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 08d03de..a9b0f45 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -37,15 +37,14 @@ }, "mixins": [ "showmeyourskin.mixins.json", - "showmeyourskin.compat.wildfire_gender.mixins.json", - "showmeyourskin.compat.elytratrinket.mixins.json" + "showmeyourskin.compat.wildfire_gender.mixins.json" ], "accessWidener" : "showmeyourskin.accesswidener", "depends": { "fabricloader": ">=0.15.0", "fabric-api": "*", - "minecraft": ">=1.21.0- <=1.21.1", + "minecraft": ">=1.21.2- <=1.21.3", "cicada": ">=0.7.0 <1.0.0", "cardinal-components-base": "*", "cardinal-components-entity": "*" diff --git a/src/main/resources/showmeyourskin.compat.elytratrinket.mixins.json b/src/main/resources/showmeyourskin.compat.elytratrinket.mixins.json deleted file mode 100644 index 44ed8ac..0000000 --- a/src/main/resources/showmeyourskin.compat.elytratrinket.mixins.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "required": true, - "minVersion": "0.8", - "package": "nl.enjarai.showmeyourskin.compat.elytratrinket.mixin", - "plugin": "nl.enjarai.showmeyourskin.compat.elytratrinket.ElytraTrinketMixinPlugin", - "compatibilityLevel": "JAVA_17", - "mixins": [ - "ElytraTrinketRendererMixin" - ], - "injectors": { - "defaultRequire": 0 - } -} diff --git a/src/main/resources/showmeyourskin.mixins.json b/src/main/resources/showmeyourskin.mixins.json index 9a41a61..86f8dc2 100644 --- a/src/main/resources/showmeyourskin.mixins.json +++ b/src/main/resources/showmeyourskin.mixins.json @@ -9,18 +9,11 @@ "defaultRequire": 1 }, "client": [ - "ClientPlayerEntityMixin", + "LivingEntityMixin", + "EntityRenderDispatcherMixin", "LivingEntityRendererMixin", - "OtherClientPlayerEntityMixin", "armor.ArmorFeatureRendererMixin", - "armor.PlayerEntityModelMixin", - "armor.fabric.ArmorRendererMixin", - "elytra.CapeFeatureRendererMixin", - "elytra.ElytraFeatureRendererMixin", - "hat.HeadFeatureRendererMixin", - "hat.SkullBlockEntityRendererMixin", - "shield.BannerBlockEntityRendererMixin", - "shield.BuiltinModelItemRendererMixin", - "shield.HeldItemRendererMixin" + "armor.EquipmentRendererMixin", + "armor.fabric.ArmorRendererMixin" ] }