From 6903bad4868c395b96bd7b26de5ee7f928f85f0e Mon Sep 17 00:00:00 2001 From: MightyKnight <38622942+MightyKnight@users.noreply.github.com> Date: Wed, 24 Apr 2024 13:46:36 +0200 Subject: [PATCH] Change to detect new #c:tools/shields tag Tags were unified in 1.20.5 between mod loaders and now contain folders. See PR: https://github.com/FabricMC/fabric/pull/3310 Shield tag is now: #c:tools/shields --- .../sd/common/mixin/MixinHeldItemRenderer.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/mightyknight/sd/common/mixin/MixinHeldItemRenderer.java b/src/main/java/me/mightyknight/sd/common/mixin/MixinHeldItemRenderer.java index 917b196..90c0c6d 100644 --- a/src/main/java/me/mightyknight/sd/common/mixin/MixinHeldItemRenderer.java +++ b/src/main/java/me/mightyknight/sd/common/mixin/MixinHeldItemRenderer.java @@ -62,7 +62,14 @@ private void hideShield(LivingEntity entity, ItemStack stack, ModelTransformatio return; } + // Block items in the tag "c:tools/shields" (>1.20.5) + if(Versioned.REGISTRY.stackHasTag(stack, new Identifier("c", "tools/shields"))) { + callback.cancel(); + return; + } + // Block items in the item tag "c:shields" + // [LEGACY] This tag was changed to "c:tools/shields" in 1.20.5 if(Versioned.REGISTRY.stackHasTag(stack, new Identifier("c", "shields"))) { callback.cancel(); return; @@ -81,7 +88,7 @@ private void hideShield(LivingEntity entity, ItemStack stack, ModelTransformatio for(String tagKey : ShieldDisruptor.getMain().getConfig().hiddenItems) { // Validate tag to prevent crashes - if (!tagKey.matches("#[a-z0-9_.-]+:[a-z0-9_.-]+")) { + if (!tagKey.matches("#[a-z0-9_.-]+:[a-z0-9_.-/]+")) { continue; }