001package net.tnemc.item.component.impl;
002/*
003 * The New Item Library
004 * Copyright (C) 2022 - 2025 Daniel "creatorfromhell" Vidmar
005 *
006 * This program is free software; you can redistribute it and/or
007 * modify it under the terms of the GNU Lesser General Public
008 * License as published by the Free Software Foundation; either
009 * version 3 of the License, or (at your option) any later version.
010 *
011 * This program is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014 * Lesser General Public License for more details.
015 *
016 * You should have received a copy of the GNU Lesser General Public License
017 * along with this program; if not, write to the Free Software Foundation,
018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
019 */
020
021import net.tnemc.item.AbstractItemStack;
022import net.tnemc.item.JSONHelper;
023import net.tnemc.item.component.SerialComponent;
024import net.tnemc.item.platform.ItemPlatform;
025import org.json.simple.JSONObject;
026
027import java.util.Objects;
028
029/**
030 * HideTooltipComponent - If set, it completely hides this item's tooltip, including its name.
031 *
032 * @author creatorfromhell
033 * @see <a href="https://minecraft.wiki/w/Data_component_format#hide_tooltip">Reference</a>
034 * <p>
035 * @since 0.2.0.0
036 * @deprecated This component was deprecated in MC 1.21.5 in favor of {@link TooltipDisplayComponent}
037 *
038 */
039@Deprecated(
040        since = "1.21.5"
041)
042public abstract class HideTooltipComponent<I extends AbstractItemStack<T>, T> implements SerialComponent<I, T> {
043
044  public HideTooltipComponent() {
045
046  }
047
048  @Override
049  public String identifier() {
050    return "hide_tooltip";
051  }
052
053  @Override
054  public JSONObject toJSON() {
055    return new JSONObject(); // Empty JSON as no additional data is needed
056  }
057
058  @Override
059  public void readJSON(final JSONHelper json, final ItemPlatform<I, T, ?> platform) {
060    // Nothing to read since the component does not contain additional data
061  }
062
063  @Override
064  public boolean similar(final SerialComponent<?, ?> component) {
065    return component instanceof HideTooltipComponent;
066  }
067
068  @Override
069  public int hashCode() {
070    return Objects.hash(identifier());
071  }
072}