From cfb59d11c9d6f68f7cbf42c74a0c43ca0ba4377d Mon Sep 17 00:00:00 2001 From: Alexandra-Myers <78748498+Alexandra-Myers@users.noreply.github.com> Date: Mon, 13 May 2024 21:09:58 -0400 Subject: [PATCH] improv: Change accessories to hold their own accessory slot identifiers (#2154) --- .../dispenser/AetherDispenseBehaviors.java | 16 +++--------- .../accessory/layer/ArmorStandCapeLayer.java | 3 +-- .../aether/event/hooks/EntityHooks.java | 26 +++++++------------ .../accessories/SlotIdentifierHolder.java | 19 ++++++++++++++ .../item/accessories/cape/CapeItem.java | 21 ++++++++++++++- .../item/accessories/gloves/GlovesItem.java | 22 ++++++++++++++-- .../miscellaneous/ShieldOfRepulsionItem.java | 20 +++++++++++++- .../item/accessories/pendant/PendantItem.java | 20 +++++++++++++- .../aether/mixin/AetherMixinHooks.java | 8 +++--- .../mixin/mixins/client/ElytraLayerMixin.java | 4 +-- .../mixins/client/SmithingScreenMixin.java | 3 +-- .../mixin/mixins/common/ArmorStandMixin.java | 18 +++---------- 12 files changed, 123 insertions(+), 57 deletions(-) create mode 100644 src/main/java/com/aetherteam/aether/item/accessories/SlotIdentifierHolder.java diff --git a/src/main/java/com/aetherteam/aether/block/dispenser/AetherDispenseBehaviors.java b/src/main/java/com/aetherteam/aether/block/dispenser/AetherDispenseBehaviors.java index 208f11a8a7..011437d945 100644 --- a/src/main/java/com/aetherteam/aether/block/dispenser/AetherDispenseBehaviors.java +++ b/src/main/java/com/aetherteam/aether/block/dispenser/AetherDispenseBehaviors.java @@ -1,6 +1,5 @@ package com.aetherteam.aether.block.dispenser; -import com.aetherteam.aether.AetherConfig; import com.aetherteam.aether.AetherTags; import com.aetherteam.aether.attachment.AetherDataAttachments; import com.aetherteam.aether.entity.projectile.weapon.HammerProjectile; @@ -9,9 +8,8 @@ import com.aetherteam.aether.inventory.menu.AccessoriesMenu; import com.aetherteam.aether.item.AetherItems; import com.aetherteam.aether.item.accessories.AccessoryItem; -import com.aetherteam.aether.item.accessories.cape.CapeItem; +import com.aetherteam.aether.item.accessories.SlotIdentifierHolder; import com.aetherteam.aether.item.accessories.gloves.GlovesItem; -import com.aetherteam.aether.item.accessories.miscellaneous.ShieldOfRepulsionItem; import com.aetherteam.aether.item.accessories.pendant.PendantItem; import com.aetherteam.aether.item.miscellaneous.bucket.SkyrootBucketItem; import net.minecraft.Util; @@ -105,15 +103,9 @@ public static boolean dispenseAccessory(BlockSource blockSource, ItemStack stack CuriosApi.getCurio(itemStack).flatMap(curio -> CuriosApi.getCuriosInventory(livingEntity)).ifPresent(handler -> { if (itemStack.is(AetherTags.Items.ACCESSORIES)) { String identifier = ""; - if (itemStack.getItem() instanceof GlovesItem) { - identifier = AetherConfig.COMMON.use_curios_menu.get() ? "hands" : "aether_gloves"; - } else if (itemStack.getItem() instanceof PendantItem) { - identifier = AetherConfig.COMMON.use_curios_menu.get() ? "necklace" : "aether_pendant"; - } else if (itemStack.getItem() instanceof CapeItem) { - identifier = AetherConfig.COMMON.use_curios_menu.get() ? "back" : "aether_cape"; - } else if (itemStack.getItem() instanceof ShieldOfRepulsionItem) { - identifier = AetherConfig.COMMON.use_curios_menu.get() ? "body" : "aether_shield"; - } + if (itemStack.getItem() instanceof SlotIdentifierHolder slotIdentifierHolder) + identifier = slotIdentifierHolder.getIdentifier(); + Optional stacksHandler = handler.getStacksHandler(identifier); if (stacksHandler.isPresent()) { IDynamicStackHandler stackHandler = stacksHandler.get().getCosmeticStacks(); diff --git a/src/main/java/com/aetherteam/aether/client/renderer/accessory/layer/ArmorStandCapeLayer.java b/src/main/java/com/aetherteam/aether/client/renderer/accessory/layer/ArmorStandCapeLayer.java index 897bb68245..0ecbbab6f9 100644 --- a/src/main/java/com/aetherteam/aether/client/renderer/accessory/layer/ArmorStandCapeLayer.java +++ b/src/main/java/com/aetherteam/aether/client/renderer/accessory/layer/ArmorStandCapeLayer.java @@ -1,7 +1,6 @@ package com.aetherteam.aether.client.renderer.accessory.layer; import com.aetherteam.aether.Aether; -import com.aetherteam.aether.AetherConfig; import com.aetherteam.aether.client.renderer.AetherModelLayers; import com.aetherteam.aether.client.renderer.accessory.model.CapeModel; import com.aetherteam.aether.item.accessories.cape.CapeItem; @@ -43,7 +42,7 @@ public ArmorStandCapeLayer(RenderLayerParent render @Override public void render(PoseStack poseStack, MultiBufferSource buffer, int packedLight, ArmorStand livingEntity, float limbSwing, float limbSwingAmount, float partialTick, float ageInTicks, float netHeadYaw, float headPitch) { - String identifier = AetherConfig.COMMON.use_curios_menu.get() ? "back" : "aether_cape"; + String identifier = CapeItem.getIdentifierStatic(); Optional lazyHandler = CuriosApi.getCuriosInventory(livingEntity); if (lazyHandler.isPresent()) { ICuriosItemHandler handler = lazyHandler.get(); diff --git a/src/main/java/com/aetherteam/aether/event/hooks/EntityHooks.java b/src/main/java/com/aetherteam/aether/event/hooks/EntityHooks.java index 9c8cf1abc7..832e89dd02 100644 --- a/src/main/java/com/aetherteam/aether/event/hooks/EntityHooks.java +++ b/src/main/java/com/aetherteam/aether/event/hooks/EntityHooks.java @@ -1,6 +1,5 @@ package com.aetherteam.aether.event.hooks; -import com.aetherteam.aether.AetherConfig; import com.aetherteam.aether.AetherTags; import com.aetherteam.aether.attachment.AetherDataAttachments; import com.aetherteam.aether.block.AetherBlocks; @@ -15,6 +14,7 @@ import com.aetherteam.aether.entity.projectile.crystal.ThunderCrystal; import com.aetherteam.aether.item.AetherItems; import com.aetherteam.aether.item.accessories.AccessoryItem; +import com.aetherteam.aether.item.accessories.SlotIdentifierHolder; import com.aetherteam.aether.item.accessories.cape.CapeItem; import com.aetherteam.aether.item.accessories.gloves.GlovesItem; import com.aetherteam.aether.item.accessories.miscellaneous.ShieldOfRepulsionItem; @@ -179,7 +179,7 @@ private static void equipAccessory(Mob mob, String identifier, ArmorMaterials ar */ @Nullable private static Item getEquipmentForSlot(String identifier, ArmorMaterials armorMaterials) { - if (identifier.equals(AetherConfig.COMMON.use_curios_menu.get() ? "hands" : "aether_gloves")) { + if (identifier.equals(GlovesItem.getIdentifierStatic())) { switch (armorMaterials) { case LEATHER -> { return AetherItems.LEATHER_GLOVES.get(); @@ -197,7 +197,7 @@ private static Item getEquipmentForSlot(String identifier, ArmorMaterials armorM return AetherItems.DIAMOND_GLOVES.get(); } } - } else if (identifier.equals(AetherConfig.COMMON.use_curios_menu.get() ? "necklace" : "aether_pendant")) { + } else if (identifier.equals(PendantItem.getIdentifierStatic())) { switch (armorMaterials) { case GOLD -> { return AetherItems.GOLDEN_PENDANT.get(); @@ -342,15 +342,9 @@ public static Optional interactWithArmorStand(Entity target, if (!stack.isEmpty()) { // Equip behavior. if (stack.is(AetherTags.Items.ACCESSORIES)) { String identifier = ""; - if (stack.getItem() instanceof GlovesItem) { - identifier = AetherConfig.COMMON.use_curios_menu.get() ? "hands" : "aether_gloves"; - } else if (stack.getItem() instanceof PendantItem) { - identifier = AetherConfig.COMMON.use_curios_menu.get() ? "necklace" : "aether_pendant"; - } else if (stack.getItem() instanceof CapeItem) { - identifier = AetherConfig.COMMON.use_curios_menu.get() ? "back" : "aether_cape"; - } else if (stack.getItem() instanceof ShieldOfRepulsionItem) { - identifier = AetherConfig.COMMON.use_curios_menu.get() ? "body" : "aether_shield"; - } + if (stack.getItem() instanceof SlotIdentifierHolder slotIdentifierHolder) + identifier = slotIdentifierHolder.getIdentifier(); + Optional lazyHandler = CuriosApi.getCuriosInventory(armorStand); if (lazyHandler.isPresent()) { ICuriosItemHandler handler = lazyHandler.get(); @@ -427,10 +421,10 @@ private static String slotToUnequip(ArmorStand armorStand, Vec3 pos) { double z = isSmall ? pos.z * 2.0 : pos.z; double front = axis == Direction.Axis.X ? z : x; double vertical = isSmall ? pos.y * 2.0 : pos.y; - String glovesIdentifier = AetherConfig.COMMON.use_curios_menu.get() ? "hands" : "aether_gloves"; - String pendantIdentifier = AetherConfig.COMMON.use_curios_menu.get() ? "necklace" : "aether_pendant"; - String capeIdentifier = AetherConfig.COMMON.use_curios_menu.get() ? "back" : "aether_cape"; - String shieldIdentifier = AetherConfig.COMMON.use_curios_menu.get() ? "body" : "aether_shield"; + String glovesIdentifier = GlovesItem.getIdentifierStatic(); + String pendantIdentifier = PendantItem.getIdentifierStatic(); + String capeIdentifier = CapeItem.getIdentifierStatic(); + String shieldIdentifier = ShieldOfRepulsionItem.getIdentifierStatic(); if (!getItemByIdentifier(armorStand, glovesIdentifier).isEmpty() && Math.abs(front) >= (isSmall ? 0.15 : 0.2) && vertical >= (isSmall ? 0.65 : 0.75) diff --git a/src/main/java/com/aetherteam/aether/item/accessories/SlotIdentifierHolder.java b/src/main/java/com/aetherteam/aether/item/accessories/SlotIdentifierHolder.java new file mode 100644 index 0000000000..e8a378f1f4 --- /dev/null +++ b/src/main/java/com/aetherteam/aether/item/accessories/SlotIdentifierHolder.java @@ -0,0 +1,19 @@ +package com.aetherteam.aether.item.accessories; + + +/** + * Functional interface whose only defines an accessory slot identifier for an item. + *

+ * Should be used to avoid hard-coding specific identifiers + * and enable easy changing and addition of new accessory slot identifiers. + * + * @author Alexandra + */ +@FunctionalInterface +public interface SlotIdentifierHolder { + /** + * @implNote May be best to pair with a static method to get an identifier if no instance methods are needed. + * @return The string used as an identifier for an accessory slot. + */ + String getIdentifier(); +} diff --git a/src/main/java/com/aetherteam/aether/item/accessories/cape/CapeItem.java b/src/main/java/com/aetherteam/aether/item/accessories/cape/CapeItem.java index 2239ce6519..cc016b2884 100644 --- a/src/main/java/com/aetherteam/aether/item/accessories/cape/CapeItem.java +++ b/src/main/java/com/aetherteam/aether/item/accessories/cape/CapeItem.java @@ -1,11 +1,13 @@ package com.aetherteam.aether.item.accessories.cape; import com.aetherteam.aether.Aether; +import com.aetherteam.aether.AetherConfig; import com.aetherteam.aether.client.AetherSoundEvents; import com.aetherteam.aether.item.accessories.AccessoryItem; +import com.aetherteam.aether.item.accessories.SlotIdentifierHolder; import net.minecraft.resources.ResourceLocation; -public class CapeItem extends AccessoryItem { +public class CapeItem extends AccessoryItem implements SlotIdentifierHolder { protected ResourceLocation CAPE_LOCATION; public CapeItem(String capeLocation, Properties properties) { @@ -24,4 +26,21 @@ public void setRenderTexture(String modId, String registryName) { public ResourceLocation getCapeTexture() { return this.CAPE_LOCATION; } + + + /** + * @return {@link CapeItem}'s own identifier for its accessory slot, + * using a static method as it is used in other conditions without access to an instance. + */ + @Override + public String getIdentifier() { + return getIdentifierStatic(); + } + + /** + * @return {@link CapeItem}'s own identifier for its accessory slot. + */ + public static String getIdentifierStatic() { + return AetherConfig.COMMON.use_curios_menu.get() ? "back" : "aether_cape"; + } } diff --git a/src/main/java/com/aetherteam/aether/item/accessories/gloves/GlovesItem.java b/src/main/java/com/aetherteam/aether/item/accessories/gloves/GlovesItem.java index c416fb09aa..5dc08d6afb 100644 --- a/src/main/java/com/aetherteam/aether/item/accessories/gloves/GlovesItem.java +++ b/src/main/java/com/aetherteam/aether/item/accessories/gloves/GlovesItem.java @@ -1,7 +1,9 @@ package com.aetherteam.aether.item.accessories.gloves; import com.aetherteam.aether.Aether; +import com.aetherteam.aether.AetherConfig; import com.aetherteam.aether.item.accessories.AccessoryItem; +import com.aetherteam.aether.item.accessories.SlotIdentifierHolder; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; import net.minecraft.resources.ResourceLocation; @@ -19,7 +21,7 @@ import java.util.UUID; import java.util.function.Supplier; -public class GlovesItem extends AccessoryItem { +public class GlovesItem extends AccessoryItem implements SlotIdentifierHolder { protected final ArmorMaterial material; protected final double damage; protected ResourceLocation GLOVES_TEXTURE; @@ -85,4 +87,20 @@ public ImmutableTriple getColors(ItemStack stack) { } return new ImmutableTriple<>(red, green, blue); } -} \ No newline at end of file + + /** + * @return {@link GlovesItem}'s own identifier for its accessory slot, + * using a static method as it is used in other conditions without access to an instance. + */ + @Override + public String getIdentifier() { + return getIdentifierStatic(); + } + + /** + * @return {@link GlovesItem}'s own identifier for its accessory slot. + */ + public static String getIdentifierStatic() { + return AetherConfig.COMMON.use_curios_menu.get() ? "hands" : "aether_gloves"; + } +} diff --git a/src/main/java/com/aetherteam/aether/item/accessories/miscellaneous/ShieldOfRepulsionItem.java b/src/main/java/com/aetherteam/aether/item/accessories/miscellaneous/ShieldOfRepulsionItem.java index b151d5e88d..fa30af00e7 100644 --- a/src/main/java/com/aetherteam/aether/item/accessories/miscellaneous/ShieldOfRepulsionItem.java +++ b/src/main/java/com/aetherteam/aether/item/accessories/miscellaneous/ShieldOfRepulsionItem.java @@ -1,10 +1,12 @@ package com.aetherteam.aether.item.accessories.miscellaneous; import com.aetherteam.aether.Aether; +import com.aetherteam.aether.AetherConfig; import com.aetherteam.aether.item.accessories.AccessoryItem; +import com.aetherteam.aether.item.accessories.SlotIdentifierHolder; import net.minecraft.resources.ResourceLocation; -public class ShieldOfRepulsionItem extends AccessoryItem { +public class ShieldOfRepulsionItem extends AccessoryItem implements SlotIdentifierHolder { private static final ResourceLocation SHIELD_OF_REPULSION = new ResourceLocation(Aether.MODID, "textures/models/accessory/shield_of_repulsion/shield_of_repulsion_accessory.png"); private static final ResourceLocation SHIELD_OF_REPULSION_INACTIVE = new ResourceLocation(Aether.MODID, "textures/models/accessory/shield_of_repulsion/shield_of_repulsion_inactive_accessory.png"); private static final ResourceLocation SHIELD_OF_REPULSION_SLIM = new ResourceLocation(Aether.MODID, "textures/models/accessory/shield_of_repulsion/shield_of_repulsion_slim_accessory.png"); @@ -29,4 +31,20 @@ public ResourceLocation getShieldOfRepulsionSlimTexture() { public ResourceLocation getShieldOfRepulsionSlimInactiveTexture() { return SHIELD_OF_REPULSION_SLIM_INACTIVE; } + + /** + * @return {@link ShieldOfRepulsionItem}'s own identifier for its accessory slot, + * using a static method as it is used in other conditions without access to an instance. + */ + @Override + public String getIdentifier() { + return getIdentifierStatic(); + } + + /** + * @return {@link ShieldOfRepulsionItem}'s own identifier for its accessory slot. + */ + public static String getIdentifierStatic() { + return AetherConfig.COMMON.use_curios_menu.get() ? "body" : "aether_shield"; + } } diff --git a/src/main/java/com/aetherteam/aether/item/accessories/pendant/PendantItem.java b/src/main/java/com/aetherteam/aether/item/accessories/pendant/PendantItem.java index 79bd12a8f3..167afdce3c 100644 --- a/src/main/java/com/aetherteam/aether/item/accessories/pendant/PendantItem.java +++ b/src/main/java/com/aetherteam/aether/item/accessories/pendant/PendantItem.java @@ -1,13 +1,15 @@ package com.aetherteam.aether.item.accessories.pendant; import com.aetherteam.aether.Aether; +import com.aetherteam.aether.AetherConfig; import com.aetherteam.aether.item.accessories.AccessoryItem; +import com.aetherteam.aether.item.accessories.SlotIdentifierHolder; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvent; import java.util.function.Supplier; -public class PendantItem extends AccessoryItem { +public class PendantItem extends AccessoryItem implements SlotIdentifierHolder { protected ResourceLocation PENDANT_LOCATION; public PendantItem(String pendantLocation, Supplier pendantSound, Properties properties) { @@ -26,4 +28,20 @@ public void setRenderTexture(String modId, String registryName) { public ResourceLocation getPendantTexture() { return this.PENDANT_LOCATION; } + + /** + * @return {@link PendantItem}'s own identifier for its accessory slot, + * using a static method as it is used in other conditions without access to an instance. + */ + @Override + public String getIdentifier() { + return getIdentifierStatic(); + } + + /** + * @return {@link PendantItem}'s own identifier for its accessory slot. + */ + public static String getIdentifierStatic() { + return AetherConfig.COMMON.use_curios_menu.get() ? "necklace" : "aether_pendant"; + } } diff --git a/src/main/java/com/aetherteam/aether/mixin/AetherMixinHooks.java b/src/main/java/com/aetherteam/aether/mixin/AetherMixinHooks.java index ab60c066ab..04757c5e5b 100644 --- a/src/main/java/com/aetherteam/aether/mixin/AetherMixinHooks.java +++ b/src/main/java/com/aetherteam/aether/mixin/AetherMixinHooks.java @@ -130,15 +130,15 @@ public static String getIdentifierForItem(LivingEntity livingEntity, ItemStack s TagKey glovesTag = TagKey.create(Registries.ITEM, new ResourceLocation(CuriosConstants.MOD_ID, "hands")); TagKey pendantTag = TagKey.create(Registries.ITEM, new ResourceLocation(CuriosConstants.MOD_ID, "necklace")); if (stack.is(glovesTag)) { - return "hands"; + return GlovesItem.getIdentifierStatic(); } else if (stack.is(pendantTag) && (livingEntity.getType() == EntityType.PIGLIN || livingEntity.getType() == EntityType.ZOMBIFIED_PIGLIN)) { - return "necklace"; + return PendantItem.getIdentifierStatic(); } } else { if (stack.is(AetherTags.Items.AETHER_GLOVES)) { - return "aether_gloves"; + return GlovesItem.getIdentifierStatic(); } else if (stack.is(AetherTags.Items.AETHER_PENDANT) && (livingEntity.getType() == EntityType.PIGLIN || livingEntity.getType() == EntityType.ZOMBIFIED_PIGLIN)) { - return "aether_pendant"; + return PendantItem.getIdentifierStatic(); } } return ""; diff --git a/src/main/java/com/aetherteam/aether/mixin/mixins/client/ElytraLayerMixin.java b/src/main/java/com/aetherteam/aether/mixin/mixins/client/ElytraLayerMixin.java index dcaeaa91d9..40e61b2d5f 100644 --- a/src/main/java/com/aetherteam/aether/mixin/mixins/client/ElytraLayerMixin.java +++ b/src/main/java/com/aetherteam/aether/mixin/mixins/client/ElytraLayerMixin.java @@ -1,6 +1,6 @@ package com.aetherteam.aether.mixin.mixins.client; -import com.aetherteam.aether.AetherConfig; +import com.aetherteam.aether.item.accessories.cape.CapeItem; import com.aetherteam.aether.mixin.AetherMixinHooks; import net.minecraft.client.renderer.entity.layers.ElytraLayer; import net.minecraft.resources.ResourceLocation; @@ -30,7 +30,7 @@ public class ElytraLayerMixin { @Inject(at = @At("HEAD"), method = "getElytraTexture(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/entity/LivingEntity;)Lnet/minecraft/resources/ResourceLocation;", cancellable = true, remap = false) private void getElytraTexture(ItemStack stack, T entity, CallbackInfoReturnable cir) { if (entity instanceof ArmorStand armorStand) { - String identifier = AetherConfig.COMMON.use_curios_menu.get() ? "back" : "aether_cape"; + String identifier = CapeItem.getIdentifierStatic(); Optional lazyHandler = CuriosApi.getCuriosInventory(armorStand); if (lazyHandler.isPresent()) { ICuriosItemHandler handler = lazyHandler.get(); diff --git a/src/main/java/com/aetherteam/aether/mixin/mixins/client/SmithingScreenMixin.java b/src/main/java/com/aetherteam/aether/mixin/mixins/client/SmithingScreenMixin.java index cf0d140cba..87549560e4 100644 --- a/src/main/java/com/aetherteam/aether/mixin/mixins/client/SmithingScreenMixin.java +++ b/src/main/java/com/aetherteam/aether/mixin/mixins/client/SmithingScreenMixin.java @@ -1,6 +1,5 @@ package com.aetherteam.aether.mixin.mixins.client; -import com.aetherteam.aether.AetherConfig; import com.aetherteam.aether.item.accessories.gloves.GlovesItem; import net.minecraft.client.gui.screens.inventory.SmithingScreen; import net.minecraft.world.entity.EquipmentSlot; @@ -33,7 +32,7 @@ public class SmithingScreenMixin { @Inject(at = @At("HEAD"), method = "updateArmorStandPreview(Lnet/minecraft/world/item/ItemStack;)V", cancellable = true) private void updateArmorStandPreview(ItemStack stack, CallbackInfo ci) { if (this.armorStandPreview != null) { - String identifier = AetherConfig.COMMON.use_curios_menu.get() ? "hands" : "aether_gloves"; + String identifier = GlovesItem.getIdentifierStatic(); Optional lazyHandler = CuriosApi.getCuriosInventory(this.armorStandPreview); if (lazyHandler.isPresent()) { ICuriosItemHandler handler = lazyHandler.get(); diff --git a/src/main/java/com/aetherteam/aether/mixin/mixins/common/ArmorStandMixin.java b/src/main/java/com/aetherteam/aether/mixin/mixins/common/ArmorStandMixin.java index 0020f3b706..1f0f550f08 100644 --- a/src/main/java/com/aetherteam/aether/mixin/mixins/common/ArmorStandMixin.java +++ b/src/main/java/com/aetherteam/aether/mixin/mixins/common/ArmorStandMixin.java @@ -1,10 +1,6 @@ package com.aetherteam.aether.mixin.mixins.common; -import com.aetherteam.aether.AetherConfig; -import com.aetherteam.aether.item.accessories.cape.CapeItem; -import com.aetherteam.aether.item.accessories.gloves.GlovesItem; -import com.aetherteam.aether.item.accessories.miscellaneous.ShieldOfRepulsionItem; -import com.aetherteam.aether.item.accessories.pendant.PendantItem; +import com.aetherteam.aether.item.accessories.SlotIdentifierHolder; import com.aetherteam.aether.mixin.AetherMixinHooks; import net.minecraft.world.entity.decoration.ArmorStand; import net.minecraft.world.item.ItemStack; @@ -25,15 +21,9 @@ public class ArmorStandMixin { private void canTakeItem(ItemStack stack, CallbackInfoReturnable cir) { ArmorStand armorStand = (ArmorStand) (Object) this; String identifier = ""; - if (stack.getItem() instanceof GlovesItem) { - identifier = AetherConfig.COMMON.use_curios_menu.get() ? "hands" : "aether_gloves"; - } else if (stack.getItem() instanceof PendantItem) { - identifier = AetherConfig.COMMON.use_curios_menu.get() ? "necklace" : "aether_pendant"; - } else if (stack.getItem() instanceof CapeItem) { - identifier = AetherConfig.COMMON.use_curios_menu.get() ? "back" : "aether_cape"; - } else if (stack.getItem() instanceof ShieldOfRepulsionItem) { - identifier = AetherConfig.COMMON.use_curios_menu.get() ? "body" : "aether_shield"; - } + if (stack.getItem() instanceof SlotIdentifierHolder slotIdentifierHolder) + identifier = slotIdentifierHolder.getIdentifier(); + if (!identifier.isEmpty()) { ItemStack accessory = AetherMixinHooks.getItemByIdentifier(armorStand, identifier); if (accessory.isEmpty()) {