Skip to content

Commit

Permalink
fix nametags not working with a stack of 1
Browse files Browse the repository at this point in the history
  • Loading branch information
afamiliarquiet committed Dec 2, 2024
1 parent 132b7da commit bdd6e16
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.github.afamiliarquiet.familiar_magic.item;

import io.github.afamiliarquiet.familiar_magic.FamiliarMagic;
import io.github.afamiliarquiet.familiar_magic.FamiliarTricks;
import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.core.component.DataComponents;
Expand Down Expand Up @@ -31,7 +32,7 @@ public InteractionResult interactLivingEntity(ItemStack nameTag, Player player,
ItemStack trueName = FamiliarItems.TRUE_NAME_ITEM.toStack();
trueName.set(DataComponents.CUSTOM_NAME, Component.literal(FamiliarTricks.uuidToTrueName(target.getUUID())));

ItemStack handStack = ItemUtils.createFilledResult(nameTag, player, trueName, false);
ItemStack handStack = ItemUtils.createFilledResult(nameTag.copy(), player, trueName, false);
player.setItemInHand(hand, handStack);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private void interactLivingEntity(ItemStack nameTag, Player player, LivingEntity
ItemStack trueName = FamiliarItems.TRUE_NAME_ITEM.toStack();
trueName.set(DataComponents.CUSTOM_NAME, Component.literal(FamiliarTricks.uuidToTrueName(target.getUUID())));

ItemStack handStack = ItemUtils.createFilledResult(nameTag, player, trueName, false);
ItemStack handStack = ItemUtils.createFilledResult(nameTag.copy(), player, trueName, false);
player.setItemInHand(hand, handStack);
}

Expand Down

0 comments on commit bdd6e16

Please sign in to comment.