ItemQuality class
Пакет: com.hypixel.hytale.server.core.asset.type.item.config
Файл: com/hypixel/hytale/server/core/asset/type/item/config/ItemQuality.java
implements: JsonAssetWithMap<String, IndexedLookupTableAssetMap<String, ItemQuality>>,
NetworkSerializable<com.hypixel.hytale.protocol.ItemQuality>
Поля (3)
| Модификаторы | Тип | Имя |
|---|---|---|
|
|
ASSET_STORE |
|
com.hypixel.hytale.protocol.ItemQuality |
var1 |
|
com.hypixel.hytale.protocol.ItemQuality |
var2 |
Методы (15)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
String |
getBlockSlotTextureString getBlockSlotTexture() |
public |
String |
getIdString getId() |
public |
ItemEntityConfig |
getItemEntityConfigItemEntityConfig getItemEntityConfig() |
public |
String |
getItemTooltipArrowTextureString getItemTooltipArrowTexture() |
public |
String |
getItemTooltipTextureString getItemTooltipTexture() |
public |
String |
getLocalizationKeyString getLocalizationKey() |
public |
int |
getQualityValueint getQualityValue() |
public |
String |
getSlotTextureString getSlotTexture() |
public |
String |
getSpecialSlotTextureString getSpecialSlotTexture() |
public |
Color |
getTextColorColor getTextColor() |
|
|
if if(ASSET_STORE == null) |
|
|
if if(var1 != null) |
public |
boolean |
isHiddenFromSearchboolean isHiddenFromSearch() |
public |
boolean |
isRenderSpecialSlotboolean isRenderSpecialSlot() |
public |
boolean |
isVisibleQualityLabelboolean isVisibleQualityLabel() |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.asset.type.item.config;
class="kw">import com.hypixel.hytale.assetstore.AssetExtraInfo;
class="kw">import com.hypixel.hytale.assetstore.AssetKeyValidator;
class="kw">import com.hypixel.hytale.assetstore.AssetRegistry;
class="kw">import com.hypixel.hytale.assetstore.AssetStore;
class="kw">import com.hypixel.hytale.assetstore.codec.AssetBuilderCodec;
class="kw">import com.hypixel.hytale.assetstore.map.IndexedLookupTableAssetMap;
class="kw">import com.hypixel.hytale.assetstore.map.JsonAssetWithMap;
class="kw">import com.hypixel.hytale.codec.Codec;
class="kw">import com.hypixel.hytale.codec.KeyedCodec;
class="kw">import com.hypixel.hytale.codec.schema.metadata.ui.UIEditor;
class="kw">import com.hypixel.hytale.codec.validation.ValidatorCache;
class="kw">import com.hypixel.hytale.codec.validation.Validators;
class="kw">import com.hypixel.hytale.protocol.Color;
class="kw">import com.hypixel.hytale.server.core.asset.common.CommonAssetValidator;
class="kw">import com.hypixel.hytale.server.core.asset.util.ColorParseUtil;
class="kw">import com.hypixel.hytale.server.core.codec.ProtocolCodecs;
class="kw">import com.hypixel.hytale.server.core.io.NetworkSerializable;
class="kw">import java.lang.ref.SoftReference;
class="kw">import javax.annotation.Nonnull;
class="kw">public class ItemQuality
class="kw">implements JsonAssetWithMap<String, IndexedLookupTableAssetMap<String, ItemQuality>>,
NetworkSerializable<com.hypixel.hytale.protocol.ItemQuality> {
@Nonnull
class="kw">public class="kw">static class="kw">final AssetBuilderCodec<String, ItemQuality> CODEC = AssetBuilderCodec.builder(
ItemQuality.class,
ItemQuality::new,
Codec.STRING,
(var0, var1) -> var0.id = var1,
ItemQuality::getId,
(var0, var1) -> var0.data = var1,
var0 -> var0.data
)
.append(new KeyedCodec<>("QualityValue", Codec.INTEGER), (var0, var1) -> var0.qualityValue = var1, var0 -> var0.qualityValue)
.documentation("Define the value of the quality to order them, 0 being the lowest quality.")
.add()
.<String>append(new KeyedCodec<>("ItemTooltipTexture", Codec.STRING), (var0, var1) -> var0.itemTooltipTexture = var1, var0 -> var0.itemTooltipTexture)
.documentation("The path to the texture of the item tooltip. It has to be located in Common/Items/Qualities.")
.addValidator(Validators.nonNull())
.addValidator(Validators.nonEmptyString())
.addValidator(CommonAssetValidator.TEXTURE_ITEM_QUALITY)
.add()
.<String>append(
new KeyedCodec<>("ItemTooltipArrowTexture", Codec.STRING), (var0, var1) -> var0.itemTooltipArrowTexture = var1, var0 -> var0.itemTooltipArrowTexture
)
.documentation("The path to the texture of the item tooltip arrow. It has to be located in Common/Items/Qualities.")
.addValidator(Validators.nonNull())
.addValidator(Validators.nonEmptyString())
.addValidator(CommonAssetValidator.TEXTURE_ITEM_QUALITY)
.add()
.<String>append(new KeyedCodec<>("SlotTexture", Codec.STRING), (var0, var1) -> var0.slotTexture = var1, var0 -> var0.slotTexture)
.documentation("The path to the texture of the item slot. It has to be located in Common/Items/Qualities.")
.addValidator(Validators.nonNull())
.addValidator(Validators.nonEmptyString())
.addValidator(CommonAssetValidator.TEXTURE_ITEM_QUALITY)
.add()
.<String>append(new KeyedCodec<>("BlockSlotTexture", Codec.STRING), (var0, var1) -> var0.blockSlotTexture = var1, var0 -> var0.blockSlotTexture)
.documentation("The path to the texture of the item slot, if it has an associated block type. It has to be located in Common/Items/Qualities.")
.addValidator(Validators.nonNull())
.addValidator(Validators.nonEmptyString())
.addValidator(CommonAssetValidator.TEXTURE_ITEM_QUALITY)
.add()
.<String>append(new KeyedCodec<>("SpecialSlotTexture", Codec.STRING), (var0, var1) -> var0.specialSlotTexture = var1, var0 -> var0.specialSlotTexture)
.documentation(
"The path to the texture of the item slot used when RenderSpecialSlot is true and the item is consumable or usable. It has to be located in Common/Items/Qualities."
)
.addValidator(Validators.nonNull())
.addValidator(Validators.nonEmptyString())
.addValidator(CommonAssetValidator.TEXTURE_ITEM_QUALITY)
.add()
.<Color>append(new KeyedCodec<>("TextColor", ProtocolCodecs.COLOR), (var0, var1) -> var0.textColor = var1, var0 -> var0.textColor)
.documentation("The color that'll be used to display the text of the item in the inventory.")
.addValidator(Validators.nonNull())
.add()
.<String>append(new KeyedCodec<>("LocalizationKey", Codec.STRING), (var0, var1) -> var0.localizationKey = var1, var0 -> var0.localizationKey)
.documentation("The localization key for the item quality name.")
.addValidator(Validators.nonNull())
.addValidator(Validators.nonEmptyString())
.metadata(new UIEditor(new UIEditor.LocalizationKeyField("qualities.{assetId}", true)))
.add()
.<Boolean>append(
new KeyedCodec<>("VisibleQualityLabel", Codec.BOOLEAN), (var0, var1) -> var0.visibleQualityLabel = var1, var0 -> var0.visibleQualityLabel
)
.documentation("To specify the quality label should be displayed in the tooltip.")
.add()
.<Boolean>append(new KeyedCodec<>("RenderSpecialSlot", Codec.BOOLEAN), (var0, var1) -> var0.renderSpecialSlot = var1, var0 -> var0.renderSpecialSlot)
.documentation("To specify if we display a special slot texture if the item is a consumable or usable.")
.add()
.<ItemEntityConfig>append(
new KeyedCodec<>("ItemEntityConfig", ItemEntityConfig.CODEC), (var0, var1) -> var0.itemEntityConfig = var1, var0 -> var0.itemEntityConfig
)
.documentation(
"Provides an ItemEntityConfig used for all items with their item quality set to this asset unless overridden by an ItemEntityConfig defined on the item itself."
)
.add()
.<Boolean>append(new KeyedCodec<>("HideFromSearch", Codec.BOOLEAN), (var0, var1) -> var0.hideFromSearch = var1, var0 -> var0.hideFromSearch)
.documentation("Whether this item is hidden from typical class="kw">public search, like the creative library")
.add()
.build();
class="kw">public class="kw">static class="kw">final int DEFAULT_INDEX = 0;
class="kw">public class="kw">static class="kw">final String DEFAULT_ID = "Default";
@Nonnull
class="kw">public class="kw">static class="kw">final ItemQuality DEFAULT_ITEM_QUALITY = new ItemQuality("Default") {
{
this.qualityValue = -1;
this.itemTooltipTexture = "UI/ItemQualities/Tooltips/ItemTooltipDefault.png";
this.itemTooltipArrowTexture = "UI/ItemQualities/Tooltips/ItemTooltipDefaultArrow.png";
this.slotTexture = "UI/ItemQualities/Slots/SlotDefault.png";
this.blockSlotTexture = "UI/ItemQualities/Slots/SlotDefault.png";
this.specialSlotTexture = "UI/ItemQualities/Slots/SpecialSlotDefault.png";
this.textColor = ColorParseUtil.hexStringToColor("#c9d2dd");
this.localizationKey = "server.general.qualities.Default";
this.hideFromSearch = false;
}
};
@Nonnull
class="kw">public class="kw">static class="kw">final ValidatorCache<String> VALIDATOR_CACHE = new ValidatorCache<>(new AssetKeyValidator<>(ItemQuality::getAssetStore));
class="kw">private class="kw">static AssetStore<String, ItemQuality, IndexedLookupTableAssetMap<String, ItemQuality>> ASSET_STORE;
class="kw">protected AssetExtraInfo.Data data;
class="kw">protected String id;
class="kw">protected int qualityValue;
class="kw">protected String itemTooltipTexture;
class="kw">protected String itemTooltipArrowTexture;
class="kw">protected String slotTexture;
class="kw">protected String blockSlotTexture;
class="kw">protected String specialSlotTexture;
class="kw">protected Color textColor;
class="kw">protected String localizationKey;
class="kw">protected boolean visibleQualityLabel;
class="kw">protected boolean renderSpecialSlot;
class="kw">protected ItemEntityConfig itemEntityConfig;
class="kw">protected boolean hideFromSearch = false;
class="kw">private class="kw">transient SoftReference<com.hypixel.hytale.protocol.ItemQuality> cachedPacket;
@Nonnull
class="kw">public class="kw">static AssetStore<String, ItemQuality, IndexedLookupTableAssetMap<String, ItemQuality>> getAssetStore() {
if (ASSET_STORE == null) {
ASSET_STORE = AssetRegistry.getAssetStore(ItemQuality.class);
}
class="kw">return ASSET_STORE;
}
@Nonnull
class="kw">public class="kw">static IndexedLookupTableAssetMap<String, ItemQuality> getAssetMap() {
class="kw">return (IndexedLookupTableAssetMap<String, ItemQuality>)getAssetStore().getAssetMap();
}
class="kw">public ItemQuality(
String var1,
int var2,
String var3,
String var4,
String var5,
String var6,
String var7,
Color var8,
String var9,
boolean var10,
boolean var11,
boolean var12,
ItemEntityConfig var13
) {
this.id = var1;
this.qualityValue = var2;
this.itemTooltipTexture = var3;
this.itemTooltipArrowTexture = var4;
this.slotTexture = var5;
this.blockSlotTexture = var6;
this.specialSlotTexture = var7;
this.textColor = var8;
this.localizationKey = var9;
this.visibleQualityLabel = var10;
this.renderSpecialSlot = var11;
this.hideFromSearch = var12;
this.itemEntityConfig = var13;
}
class="kw">public ItemQuality(@Nonnull String var1) {
this.id = var1;
}
class="kw">protected ItemQuality() {
}
class="kw">public String getId() {
class="kw">return this.id;
}
class="kw">public int getQualityValue() {
class="kw">return this.qualityValue;
}
class="kw">public String getItemTooltipTexture() {
class="kw">return this.itemTooltipTexture;
}
class="kw">public String getItemTooltipArrowTexture() {
class="kw">return this.itemTooltipArrowTexture;
}
class="kw">public String getSlotTexture() {
class="kw">return this.slotTexture;
}
class="kw">public String getBlockSlotTexture() {
class="kw">return this.blockSlotTexture;
}
class="kw">public String getSpecialSlotTexture() {
class="kw">return this.specialSlotTexture;
}
class="kw">public Color getTextColor() {
class="kw">return this.textColor;
}
class="kw">public String getLocalizationKey() {
class="kw">return this.localizationKey;
}
class="kw">public boolean isVisibleQualityLabel() {
class="kw">return this.visibleQualityLabel;
}
class="kw">public boolean isRenderSpecialSlot() {
class="kw">return this.renderSpecialSlot;
}
class="kw">public boolean isHiddenFromSearch() {
class="kw">return this.hideFromSearch;
}
class="kw">public ItemEntityConfig getItemEntityConfig() {
class="kw">return this.itemEntityConfig;
}
@Nonnull
class="kw">public com.hypixel.hytale.protocol.ItemQuality toPacket() {
com.hypixel.hytale.protocol.ItemQuality var1 = this.cachedPacket == null ? null : this.cachedPacket.get();
if (var1 != null) {
class="kw">return var1;
}
com.hypixel.hytale.protocol.ItemQuality var2 = new com.hypixel.hytale.protocol.ItemQuality();
var2.id = this.id;
var2.itemTooltipTexture = this.itemTooltipTexture;
var2.itemTooltipArrowTexture = this.itemTooltipArrowTexture;
var2.slotTexture = this.slotTexture;
var2.blockSlotTexture = this.blockSlotTexture;
var2.specialSlotTexture = this.specialSlotTexture;
var2.textColor = this.textColor;
var2.localizationKey = this.localizationKey;
var2.visibleQualityLabel = this.visibleQualityLabel;
var2.renderSpecialSlot = this.renderSpecialSlot;
var2.hideFromSearch = this.hideFromSearch;
this.cachedPacket = new SoftReference<>(var2);
class="kw">return var2;
}
@Nonnull
@Override
class="kw">public String toString() {
class="kw">return "ItemQuality{id='"
+ this.id
+ "', qualityValue="
+ this.qualityValue
+ ", itemTooltipTexture='"
+ this.itemTooltipTexture
+ "', itemTooltipArrowTexture='"
+ this.itemTooltipArrowTexture
+ "', slotTexture='"
+ this.slotTexture
+ "', blockSlotTexture='"
+ this.blockSlotTexture
+ "', specialSlotTexture='"
+ this.specialSlotTexture
+ "', textColor='"
+ this.textColor
+ "', localizationKey='"
+ this.localizationKey
+ "', visibleQualityLabel="
+ this.visibleQualityLabel
+ ", renderSpecialSlot="
+ this.renderSpecialSlot
+ ", itemEntityConfig="
+ this.itemEntityConfig
+ ", hideFromSearch="
+ this.hideFromSearch
+ "}";
}
}