Skip to content

Commit

Permalink
Removed owner tag from the memory card
Browse files Browse the repository at this point in the history
  • Loading branch information
SirEndii committed Sep 23, 2024
1 parent 19f4de9 commit c507f0a
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ public boolean isEnabled() {
public void appendHoverText(ItemStack stack, @Nullable Level levelIn, List<Component> tooltip, TooltipFlag flagIn) {
super.appendHoverText(stack, levelIn, tooltip, flagIn);
CompoundTag data = stack.getOrCreateTag();
// TODO <0.8>: remove the owner name field
if (data.contains("ownerId") && data.contains("owner")) {
tooltip.add(EnumColor.buildTextComponent(Component.translatable("item.advancedperipherals.tooltip.binding.boundto", data.getString("owner"))));
if (data.contains("ownerId")) {
tooltip.add(EnumColor.buildTextComponent(Component.translatable("item.advancedperipherals.tooltip.binding.boundto", data.getString("ownerId"))));
}
}

Expand All @@ -41,15 +40,12 @@ public InteractionResultHolder<ItemStack> use(Level worldIn, Player playerIn, In
if (!worldIn.isClientSide) {
ItemStack stack = playerIn.getItemInHand(handIn);
CompoundTag data = stack.getOrCreateTag();
// TODO <0.8>: remove the owner name field
if (data.contains("ownerId") || data.contains("owner")) {
if (data.contains("ownerId")) {
playerIn.displayClientMessage(EnumColor.buildTextComponent(Component.translatable("text.advancedperipherals.cleared_memorycard")), true);
data.remove("ownerId");
data.remove("owner");
} else {
playerIn.displayClientMessage(EnumColor.buildTextComponent(Component.translatable("text.advancedperipherals.bind_memorycard")), true);
data.putUUID("ownerId", playerIn.getUUID());
data.putString("owner", playerIn.getName().getString());
}
}
return super.use(worldIn, playerIn, handIn);
Expand Down

0 comments on commit c507f0a

Please sign in to comment.