Skip to content

Commit

Permalink
Partial update to 1.21.3 (show me your skins needs to get their affai…
Browse files Browse the repository at this point in the history
…rs in order before we can continue)
  • Loading branch information
Sollace committed Dec 17, 2024
1 parent 1ae97d0 commit 913c356
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 36 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
}
}
plugins {
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'fabric-loom' version '1.7-SNAPSHOT'
id 'maven-publish'
id 'com.modrinth.minotaur' version '2.+'
id 'org.ajoberstar.reckon' version '0.13.1'
Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ org.gradle.daemon=false

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21-pre2
yarn_mappings=1.21-pre2+build.2
loader_version=0.15.11
fabric_version=0.99.4+1.21
minecraft_version=1.21.3
yarn_mappings=1.21.3+build.2
loader_version=0.16.7
fabric_version=0.106.1+1.21.3

# Mod Properties
group=com.minelittlepony
Expand All @@ -19,8 +19,8 @@ org.gradle.daemon=false
modrinth_project_id=u4AW2clL

# Dependencies
modmenu_version=11.0.0-beta.1
minelp_version=4.12.0-beta.2+1.21
modmenu_version=12.0.0-beta.1
minelp_version=4.13.0-beta.1+1.21.3
smys_version=1.10.0+1.20.5
cicada_version=0.7.1+1.20.5-and-above
# https://github.com/OnyxStudios/Cardinal-Components-API/releases
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
61 changes: 33 additions & 28 deletions src/main/java/com/minelittlepony/smyp/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@
import net.fabricmc.api.ClientModInitializer;
import net.minecraft.client.model.Model;
import net.minecraft.client.render.*;
import net.minecraft.client.render.entity.state.BipedEntityRenderState;
import net.minecraft.client.render.entity.state.LivingEntityRenderState;
import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ArmorMaterial;
import net.minecraft.item.ItemStack;
import net.minecraft.item.trim.ArmorTrim;
import net.minecraft.item.equipment.EquipmentModel;
import net.minecraft.item.equipment.EquipmentModel.LayerType;
import net.minecraft.item.equipment.trim.ArmorTrim;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.util.Arm;
import net.minecraft.util.Identifier;
import nl.enjarai.showmeyourskin.client.ModRenderLayers;
import nl.enjarai.showmeyourskin.config.HideableEquipment;
Expand All @@ -19,8 +23,8 @@

import org.jetbrains.annotations.Nullable;

import com.minelittlepony.client.model.armour.ArmourLayer;
import com.minelittlepony.client.model.armour.ArmourRendererPlugin;
import com.minelittlepony.client.model.armour.ArmourRendererPlugin.ArmourType;

public class Main implements ClientModInitializer {
@Override
Expand All @@ -38,22 +42,33 @@ static final class PluginImpl implements ArmourRendererPlugin {
this.parent = parent;
}

@Override
public ItemStack[] getArmorStacks(LivingEntity entity, EquipmentSlot armorSlot, ArmourLayer layer, ArmourType type) {
//@Override
public ItemStack[] getArmorStacks(LivingEntity entity, EquipmentSlot armorSlot, EquipmentModel.LayerType layerType, ArmourType type) {
MixinContext.ENTITY.setContext(entity);
MixinContext.ARMOR.setContext(context = new ArmorContext(switch (type) {
case ARMOUR -> HideableEquipment.fromSlot(armorSlot);
case CAPE, ELYTRA -> HideableEquipment.ELYTRA;
case SKULL -> HideableEquipment.HAT;
}, entity));
return parent.getArmorStacks(entity, armorSlot, layer, type);
return new ItemStack[] { entity.getEquippedStack(armorSlot) };
}

@Override
public ItemStack[] getArmorStacks(BipedEntityRenderState state, EquipmentSlot armorSlot, EquipmentModel.LayerType layerType, ArmourType type) {
MixinContext.ENTITY.setContext(entity);
MixinContext.ARMOR.setContext(context = new ArmorContext(switch (type) {
case ARMOUR -> HideableEquipment.fromSlot(armorSlot);
case CAPE, ELYTRA -> HideableEquipment.ELYTRA;
case SKULL -> HideableEquipment.HAT;
}, state));
return parent.getArmorStacks(state, armorSlot, layerType, type);
}

@Override
public void onArmourRendered(LivingEntity entity, MatrixStack matrices, VertexConsumerProvider provider, EquipmentSlot armorSlot, ArmourLayer layer, ArmourType type) {
public void onArmourRendered(LivingEntityRenderState state, MatrixStack matrices, VertexConsumerProvider provider, EquipmentSlot armorSlot, EquipmentModel.LayerType layerType, ArmourType type) {
MixinContext.ENTITY.clearContext();
MixinContext.ARMOR.clearContext();
parent.onArmourRendered(entity, matrices, provider, armorSlot, layer, type);
parent.onArmourRendered(state, matrices, provider, armorSlot, layerType, type);
}

@Override
Expand All @@ -62,54 +77,44 @@ public float getGlintAlpha(EquipmentSlot slot, ItemStack stack) {
}

@Override
public float getArmourAlpha(EquipmentSlot slot, ArmourLayer layer) {
return context != null && context.shouldModify() ? context.getApplicablePieceTransparency() : parent.getArmourAlpha(slot, layer);
public float getArmourAlpha(EquipmentSlot slot, EquipmentModel.LayerType layerType) {
return context != null && context.shouldModify() ? context.getApplicablePieceTransparency() : parent.getArmourAlpha(slot, layerType);
}

@Override
public float getTrimAlpha(EquipmentSlot slot, RegistryEntry<ArmorMaterial> material, ArmorTrim trim, ArmourLayer layer) {
return context != null && context.shouldModify() ? context.getApplicableTrimTransparency() : parent.getTrimAlpha(slot, material, trim, layer);
public float getTrimAlpha(EquipmentSlot slot, ArmorTrim trim, EquipmentModel.LayerType layerType) {
return context != null && context.shouldModify() ? context.getApplicableTrimTransparency() : parent.getTrimAlpha(slot, trim, layerType);
}

@Override
public float getElytraAlpha(ItemStack stack, Model model, LivingEntity entity) {
public float getElytraAlpha(ItemStack stack, Model model, LivingEntityRenderState entity) {
MixinContext.ARMOR.setContext(context = new ArmorContext(HideableEquipment.ELYTRA, entity));
return parent.getElytraAlpha(stack, model, entity) * (context.shouldModify() ? context.getApplicablePieceTransparency() : 1);
}

@Override
@Nullable
public RenderLayer getArmourLayer(EquipmentSlot slot, Identifier texture, ArmourLayer layer) {
public RenderLayer getArmourLayer(EquipmentSlot slot, Identifier texture, EquipmentModel.LayerType layerType) {
return context != null && context.shouldModify() && context.getApplicablePieceTransparency() < 1
? ModRenderLayers.ARMOR_TRANSLUCENT_NO_CULL.apply(texture)
: parent.getArmourLayer(slot, texture, layer);
: parent.getArmourLayer(slot, texture, layerType);
}

@Override
@Nullable
public RenderLayer getTrimLayer(EquipmentSlot slot, RegistryEntry<ArmorMaterial> material, ArmorTrim trim, ArmourLayer layer) {
public RenderLayer getTrimLayer(EquipmentSlot slot, ArmorTrim trim, EquipmentModel.LayerType layerType, Identifier modelId) {
return context != null && context.shouldModify() && context.getApplicableTrimTransparency() < 1
? ModRenderLayers.ARMOR_TRANSLUCENT_NO_CULL.apply(TexturedRenderLayers.ARMOR_TRIMS_ATLAS_TEXTURE)
: parent.getTrimLayer(slot, material, trim, layer);
: parent.getTrimLayer(slot, trim, layerType, modelId);
}

@Override
@Nullable
public RenderLayer getCapeLayer(LivingEntity entity, Identifier texture) {
public RenderLayer getCapeLayer(BipedEntityRenderState entity, Identifier texture) {
MixinContext.ARMOR.setContext(context = new ArmorContext(HideableEquipment.ELYTRA, entity));
return context.shouldModify() && context.getApplicablePieceTransparency() <= 0
? null
: parent.getCapeLayer(entity, texture);
}

@Override
@Nullable
public VertexConsumer getElytraConsumer(ItemStack stack, Model model, LivingEntity entity, VertexConsumerProvider provider, Identifier texture) {
MixinContext.ARMOR.setContext(context = new ArmorContext(HideableEquipment.ELYTRA, entity));
if (context.shouldModify() && context.getApplicablePieceTransparency() < 1) {
return ItemRenderer.getDirectItemGlintConsumer(provider, ModRenderLayers.ARMOR_TRANSLUCENT_NO_CULL.apply(texture), false, getGlintAlpha(EquipmentSlot.CHEST, stack) > 0);
}
return parent.getElytraConsumer(stack, model, entity, provider, texture);
}
}
}

0 comments on commit 913c356

Please sign in to comment.