Item class
Пакет: com.hypixel.hytale.server.core.asset.type.item.config
Файл: com/hypixel/hytale/server/core/asset/type/item/config/Item.java
implements: JsonAssetWithMap<String, DefaultAssetMap<String, Item>>, NetworkSerializable<ItemBase>
Поля (30)
| Модификаторы | Тип | Имя |
|---|---|---|
|
|
ASSET_STORE |
final |
AssetBuilderCodec.Builder<String, Item> |
CODEC_BUILDER |
|
ItemBase |
var1 |
|
String |
var1 |
|
Message |
var1 |
|
String |
var1 |
|
Message |
var1 |
|
Map |
var1 |
|
com.hypixel.hytale.protocol.ItemAppearanceCondition[] |
var10 |
|
IndexedLookupTableAssetMap |
var11 |
|
ItemQuality |
var12 |
|
Object2IntOpenHashMap |
var13 |
|
Map |
var13 |
|
Object2IntOpenHashMap |
var14 |
|
CraftingRecipe |
var14 |
|
CraftingRecipe |
var15 |
|
Object2IntOpenHashMap |
var16 |
|
MaterialQuantity |
var16 |
|
|
var16 |
|
|
var16 |
|
HashMap |
var18 |
|
IntSet |
var19 |
|
ItemBase |
var2 |
|
String |
var2 |
|
Map |
var2 |
|
Map |
var2 |
|
DefaultAssetMap |
var2 |
|
UnarmedInteractions |
var3 |
|
ItemAppearanceCondition[] |
var9 |
|
UnarmedInteractions |
var9 |
Методы (117)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
abstract |
throw new |
IllegalArgumentExceptionthrow new IllegalArgumentException("Block Id Can't be 0") |
public |
void |
collectRecipesToGeneratevoid collectRecipesToGenerate(Collection<CraftingRecipe> var1) |
public |
boolean |
dropsOnDeathboolean dropsOnDeath() |
|
|
for for(int var3 = 0; var3 < this.particles.length; var3++) |
|
|
for for(int var12 = 0; var12 < this.firstPersonParticles.length; var12++) |
|
|
for for(int var11 = 0; var11 < var9.length; var11++) |
|
|
for for(int var20 = 0; var20 < this.hudUI.length; var20++) |
public |
ItemArmor |
getArmorItemArmor getArmor() |
static |
DefaultAssetMap<String, Item> |
getAssetMapDefaultAssetMap<String, Item> getAssetMap() |
static |
AssetStore<String, Item, DefaultAssetMap<String, Item>> |
getAssetStoreAssetStore<String, Item, DefaultAssetMap<String, Item>> getAssetStore() |
public |
String |
getBlockIdString getBlockId() |
public |
BlockSelectorToolData |
getBlockSelectorToolDataBlockSelectorToolData getBlockSelectorToolData() |
public |
BuilderTool |
getBuilderToolBuilderTool getBuilderTool() |
public |
Map<InteractionType, String> |
getCarryHudInputBindingsMap<InteractionType, String> getCarryHudInputBindings() |
public |
Map<InteractionType, String> |
getCarryInteractionsMap<InteractionType, String> getCarryInteractions() |
public |
String[] |
getCategoriesString[] getCategories() |
public |
boolean |
getClipsGeometryboolean getClipsGeometry() |
public |
AssetExtraInfo.Data |
getDataAssetExtraInfo.Data getData() |
public |
int[] |
getDisplayEntityStatsHUDint[] getDisplayEntityStatsHUD() |
public |
String |
getDroppedItemAnimationString getDroppedItemAnimation() |
public |
boolean |
getDurabilityLossOnDeathboolean getDurabilityLossOnDeath() |
public |
double |
getDurabilityLossOnHitdouble getDurabilityLossOnHit() |
public |
double |
getFuelQualitydouble getFuelQuality() |
public |
ItemGlider |
getGliderItemGlider getGlider() |
public |
String |
getIconString getIcon() |
public |
AssetIconProperties |
getIconPropertiesAssetIconProperties getIconProperties() |
public |
String |
getIdString getId() |
public |
InteractionConfiguration |
getInteractionConfigInteractionConfiguration getInteractionConfig() |
public |
Map<String, String> |
getInteractionVarsMap<String, String> getInteractionVars() |
public |
Map<InteractionType, String> |
getInteractionsMap<InteractionType, String> getInteractions() |
public |
ItemEntityConfig |
getItemEntityConfigItemEntityConfig getItemEntityConfig() |
public |
int |
getItemLevelint getItemLevel() |
public |
int |
getItemSoundSetIndexint getItemSoundSetIndex() |
public |
ColorLight |
getLightColorLight getLight() |
public |
double |
getMaxDurabilitydouble getMaxDurability() |
public |
int |
getMaxStackint getMaxStack() |
public |
String |
getModelString getModel() |
public |
String |
getPlayerAnimationsIdString getPlayerAnimationsId() |
public |
ItemPullbackConfig |
getPullbackConfigItemPullbackConfig getPullbackConfig() |
public |
int |
getQualityIndexint getQualityIndex() |
public |
boolean |
getRenderDeployablePreviewboolean getRenderDeployablePreview() |
public |
ItemResourceType[] |
getResourceTypesItemResourceType[] getResourceTypes() |
public |
String |
getReticleIdString getReticleId() |
public |
float |
getScalefloat getScale() |
public |
String |
getSoundEventIdString getSoundEventId() |
public |
int |
getSoundEventIndexint getSoundEventIndex() |
public |
String |
getSubCategoryString getSubCategory() |
public |
String |
getTextureString getTexture() |
public |
ItemTool |
getToolItemTool getTool() |
public |
ItemTranslationProperties |
getTranslationPropertiesItemTranslationProperties getTranslationProperties() |
public |
boolean |
getUsePlayerAnimationsboolean getUsePlayerAnimations() |
public |
ItemWeapon |
getWeaponItemWeapon getWeapon() |
public |
boolean |
hasBlockTypeboolean hasBlockType() |
public |
boolean |
hasRecipesToGenerateboolean hasRecipesToGenerate() |
|
|
if if(ASSET_STORE == null) |
|
|
if if(this.weapon == null) |
|
|
if if(var1 != null) |
|
|
if if(this.icon != null) |
|
|
if if(this.iconProperties != null) |
|
|
if if(this.translationProperties != null) |
|
|
if if(this.model != null) |
|
|
if if(this.texture != null) |
|
|
if if(this.animation != null) |
|
|
if if(this.blockId != null) |
|
|
if if(var2.blockId == 0) |
|
|
if if(this.tool != null) |
|
|
if if(this.blockSelectorToolData != null) |
|
|
if if(this.builderTool != null) |
|
|
if if(this.weapon != null) |
|
|
if if(this.armor != null) |
|
|
if if(this.glider != null) |
|
|
if if(this.utility != null) |
|
|
if if(this.categories != null && this.categories.length > 0) |
|
|
if if(this.subCategory != null) |
|
|
if if(this.set != null) |
|
|
if if(this.particles != null && this.particles.length > 0) |
|
|
if if(this.firstPersonParticles != null && this.firstPersonParticles.length > 0) |
|
|
if if(this.trails != null && this.trails.length > 0) |
|
|
if if(this.light != null) |
|
|
if if(this.resourceTypes != null && this.resourceTypes.length > 0) |
|
|
if if(this.droppedItemAnimation != null) |
|
|
if if(this.itemAppearanceConditions != null) |
|
|
if if(this.data != null) |
|
|
if if(var19 != null) |
|
|
if if(this.pullbackConfig != null) |
|
|
if if(this.hudUI != null && this.hudUI.length > 0) |
|
|
if if(this.translationProperties != null) |
|
|
if if(var1 != null) |
|
|
if if(this.translationProperties != null) |
|
|
if if(var2 != null) |
|
|
if if(this.translationProperties != null) |
|
|
if if(var1 != null) |
|
|
if if(this.translationProperties != null) |
|
|
if if(var2 != null) |
|
|
if if(this.recipeToGenerate != null) |
|
|
if if(this.hasBlockType) |
|
|
if if(this.maxStack == -1) |
|
|
if if(this.tool == null && this.weapon == null && this.armor == null && this.builderTool == null && this.blockSelectorToolData == null) |
|
|
if if(var3 != null) |
|
|
if if(var9 != null) |
|
|
if if(this.reticleId != null) |
|
|
if if(this.qualityId != null) |
|
|
if if(var12 != null) |
|
|
if if(this.itemEntityConfig == null) |
|
|
if if(this.blockId != null) |
|
|
if if(this.interactionConfig == null) |
|
|
if if(this.weapon != null) |
|
|
if if(this.soundEventId != null) |
|
|
if if(this.stateToBlock != null) |
|
|
if if(this.recipeToGenerate != null) |
|
|
if if(var15.outputs == null || var15.outputs.length == 0) |
public |
void |
invalidatePacketCachevoid invalidatePacketCache() |
public |
boolean |
isConsumableboolean isConsumable() |
public |
boolean |
isRepairableboolean isRepairable() |
public |
boolean |
isStateboolean isState() |
public |
boolean |
isVariantboolean isVariant() |
protected |
void |
processConfigvoid processConfig() |
Исходный код
Показать/скрыть
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.codec.AssetCodec;
class="kw">import com.hypixel.hytale.assetstore.codec.ContainedAssetCodec;
class="kw">import com.hypixel.hytale.assetstore.map.DefaultAssetMap;
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.builder.BuilderCodec;
class="kw">import com.hypixel.hytale.codec.codecs.array.ArrayCodec;
class="kw">import com.hypixel.hytale.codec.codecs.map.EnumMapCodec;
class="kw">import com.hypixel.hytale.codec.codecs.map.MapCodec;
class="kw">import com.hypixel.hytale.codec.schema.metadata.AllowEmptyObject;
class="kw">import com.hypixel.hytale.codec.schema.metadata.ui.UIButton;
class="kw">import com.hypixel.hytale.codec.schema.metadata.ui.UICreateButtons;
class="kw">import com.hypixel.hytale.codec.schema.metadata.ui.UIDefaultCollapsedState;
class="kw">import com.hypixel.hytale.codec.schema.metadata.ui.UIDisplayMode;
class="kw">import com.hypixel.hytale.codec.schema.metadata.ui.UIEditor;
class="kw">import com.hypixel.hytale.codec.schema.metadata.ui.UIEditorPreview;
class="kw">import com.hypixel.hytale.codec.schema.metadata.ui.UIEditorSectionStart;
class="kw">import com.hypixel.hytale.codec.schema.metadata.ui.UIPropertyTitle;
class="kw">import com.hypixel.hytale.codec.schema.metadata.ui.UIRebuildCaches;
class="kw">import com.hypixel.hytale.codec.schema.metadata.ui.UISidebarButtons;
class="kw">import com.hypixel.hytale.codec.schema.metadata.ui.UITypeIcon;
class="kw">import com.hypixel.hytale.codec.validation.ValidatorCache;
class="kw">import com.hypixel.hytale.codec.validation.Validators;
class="kw">import com.hypixel.hytale.common.util.MapUtil;
class="kw">import com.hypixel.hytale.protocol.ColorLight;
class="kw">import com.hypixel.hytale.protocol.InteractionType;
class="kw">import com.hypixel.hytale.protocol.ItemBase;
class="kw">import com.hypixel.hytale.protocol.ItemResourceType;
class="kw">import com.hypixel.hytale.protocol.ModelTrail;
class="kw">import com.hypixel.hytale.server.core.Message;
class="kw">import com.hypixel.hytale.server.core.asset.common.CommonAssetValidator;
class="kw">import com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType;
class="kw">import com.hypixel.hytale.server.core.asset.type.buildertool.config.BuilderTool;
class="kw">import com.hypixel.hytale.server.core.asset.type.itemanimation.config.ItemPlayerAnimations;
class="kw">import com.hypixel.hytale.server.core.asset.type.itemsound.config.ItemSoundSet;
class="kw">import com.hypixel.hytale.server.core.asset.type.model.config.ModelAsset;
class="kw">import com.hypixel.hytale.server.core.asset.type.model.config.ModelParticle;
class="kw">import com.hypixel.hytale.server.core.asset.type.soundevent.config.SoundEvent;
class="kw">import com.hypixel.hytale.server.core.codec.ProtocolCodecs;
class="kw">import com.hypixel.hytale.server.core.inventory.MaterialQuantity;
class="kw">import com.hypixel.hytale.server.core.io.NetworkSerializable;
class="kw">import com.hypixel.hytale.server.core.modules.entitystats.EntityStatsModule;
class="kw">import com.hypixel.hytale.server.core.modules.entitystats.asset.EntityStatType;
class="kw">import com.hypixel.hytale.server.core.modules.interaction.interaction.UnarmedInteractions;
class="kw">import com.hypixel.hytale.server.core.modules.interaction.interaction.config.InteractionConfiguration;
class="kw">import com.hypixel.hytale.server.core.modules.interaction.interaction.config.RootInteraction;
class="kw">import com.hypixel.hytale.server.core.modules.interaction.interaction.config.none.ChangeActiveSlotInteraction;
class="kw">import it.unimi.dsi.fastutil.ints.IntSet;
class="kw">import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
class="kw">import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
class="kw">import java.lang.ref.SoftReference;
class="kw">import java.util.Collection;
class="kw">import java.util.Collections;
class="kw">import java.util.EnumMap;
class="kw">import java.util.HashMap;
class="kw">import java.util.Map;
class="kw">import java.util.Map.Entry;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">public class Item class="kw">implements JsonAssetWithMap<String, DefaultAssetMap<String, Item>>, NetworkSerializable<ItemBase> {
class="kw">private class="kw">static class="kw">final AssetBuilderCodec.Builder<String, Item> CODEC_BUILDER = AssetBuilderCodec.<String, Item>builder(
Item.class, Item::new, Codec.STRING, (var0, var1) -> var0.id = var1, var0 -> var0.id, (var0, var1) -> var0.data = var1, var0 -> var0.data
)
.metadata(new UIEditorPreview(UIEditorPreview.PreviewType.ITEM))
.metadata(new UITypeIcon("Item.png"))
.metadata(
new UIRebuildCaches(
false,
UIRebuildCaches.ClientCache.MODELS,
UIRebuildCaches.ClientCache.BLOCK_TEXTURES,
UIRebuildCaches.ClientCache.MODEL_TEXTURES,
UIRebuildCaches.ClientCache.MAP_GEOMETRY,
UIRebuildCaches.ClientCache.ITEM_ICONS
)
)
.metadata(
new UISidebarButtons(
new UIButton("server.assetEditor.buttons.equipItem", "EquipItem"),
new UIButton("server.assetEditor.buttons.recomputeTextureColor", "RecomputeTextureColor")
)
)
.metadata(new UICreateButtons(new UIButton("server.assetEditor.buttons.createAndEquipItem", "EquipItem")))
.<String>appendInherited(
new KeyedCodec<>("Icon", Codec.STRING), (var0, var1) -> var0.icon = var1, var0 -> var0.icon, (var0, var1) -> var0.icon = var1.icon
)
.addValidator(CommonAssetValidator.ICON_ITEM)
.metadata(new UIEditor(new UIEditor.Icon("Icons/ItemsGenerated/{assetId}.png", 64, 64)))
.metadata(new UIRebuildCaches(UIRebuildCaches.ClientCache.ITEM_ICONS))
.add()
.<String[]>appendInherited(
new KeyedCodec<>("Categories", new ArrayCodec<>(Codec.STRING, String[]::new).metadata(new UIEditor(new UIEditor.Dropdown("ItemCategories")))),
(var0, var1) -> var0.categories = var1,
var0 -> var0.categories,
(var0, var1) -> var0.categories = var1.categories
)
.addValidatorLate(() -> ItemCategory.VALIDATOR_CACHE.getArrayValidator().late())
.documentation("A list of categories this item will be shown in on the creative library menu.")
.add()
.<String>appendInherited(
new KeyedCodec<>("SubCategory", Codec.STRING),
(var0, var1) -> var0.subCategory = var1,
var0 -> var0.subCategory,
(var0, var1) -> var0.subCategory = var1.subCategory
)
.documentation("Optional sub-category for grouping items with a label header in the creative library menu.")
.add()
.<AssetIconProperties>appendInherited(
new KeyedCodec<>("IconProperties", AssetIconProperties.CODEC),
(var0, var1) -> var0.iconProperties = var1,
var0 -> var0.iconProperties,
(var0, var1) -> var0.iconProperties = var1.iconProperties
)
.metadata(UIDisplayMode.HIDDEN)
.add()
.<ItemTranslationProperties>appendInherited(
new KeyedCodec<>("TranslationProperties", ItemTranslationProperties.CODEC),
(var0, var1) -> var0.translationProperties = var1,
var0 -> var0.translationProperties,
(var0, var1) -> var0.translationProperties = var1.translationProperties
)
.documentation("The translation properties for this item asset.")
.add()
.appendInherited(
new KeyedCodec<>("ItemLevel", Codec.INTEGER),
(var0, var1) -> var0.itemLevel = var1,
var0 -> var0.itemLevel,
(var0, var1) -> var0.itemLevel = var1.itemLevel
)
.add()
.<String>appendInherited(
new KeyedCodec<>("Reticle", new ContainedAssetCodec<>(ItemReticleConfig.class, ItemReticleConfig.CODEC)),
(var0, var1) -> var0.reticleId = var1,
var0 -> var0.reticleId,
(var0, var1) -> var0.reticleId = var1.reticleId
)
.addValidator(ItemReticleConfig.VALIDATOR_CACHE.getValidator())
.add()
.<Integer>appendInherited(
new KeyedCodec<>("MaxStack", Codec.INTEGER),
(var0, var1) -> var0.maxStack = var1,
var0 -> var0.maxStack,
(var0, var1) -> var0.maxStack = var1.maxStack
)
.metadata(new UIPropertyTitle("Max Stack Size"))
.documentation("The maximum amount this item can be stacked in the inventory")
.addValidator(Validators.greaterThan(0))
.add()
.<String>append(new KeyedCodec<>("Quality", Codec.STRING), (var0, var1) -> var0.qualityId = var1, var0 -> var0.qualityId)
.addValidator(ItemQuality.VALIDATOR_CACHE.getValidator())
.add()
.<ItemEntityConfig>appendInherited(
new KeyedCodec<>("ItemEntity", ItemEntityConfig.CODEC),
(var0, var1) -> var0.itemEntityConfig = var1,
var0 -> var0.itemEntityConfig,
(var0, var1) -> var0.itemEntityConfig = var1.itemEntityConfig
)
.addValidator(Validators.nonNull())
.add()
.<String>appendInherited(
new KeyedCodec<>("SoundEventId", Codec.STRING),
(var0, var1) -> var0.soundEventId = var1,
var0 -> var0.soundEventId,
(var0, var1) -> var0.soundEventId = var1.soundEventId
)
.addValidator(SoundEvent.VALIDATOR_CACHE.getValidator())
.add()
.<String>appendInherited(
new KeyedCodec<>("ItemSoundSetId", Codec.STRING),
(var0, var1) -> var0.itemSoundSetId = var1,
var0 -> var0.itemSoundSetId,
(var0, var1) -> var0.itemSoundSetId = var1.itemSoundSetId
)
.addValidator(Validators.nonNull())
.addValidator(ItemSoundSet.VALIDATOR_CACHE.getValidator())
.add()
.appendInherited(new KeyedCodec<>("Set", Codec.STRING), (var0, var1) -> var0.set = var1, var0 -> var0.set, (var0, var1) -> var0.set = var1.set)
.add()
.<String>appendInherited(
new KeyedCodec<>("Model", Codec.STRING), (var0, var1) -> var0.model = var1, var0 -> var0.model, (var0, var1) -> var0.model = var1.model
)
.addValidator(CommonAssetValidator.MODEL_ITEM)
.metadata(new UIEditorSectionStart("Rendering"))
.metadata(new UIRebuildCaches(false, UIRebuildCaches.ClientCache.MODELS))
.metadata(new UIPropertyTitle("Item Model"))
.documentation(
"The model used for rendering this item when held, in inventory, or attached. If set, takes priority over BlockType.CustomModel. Block entities always use BlockType.CustomModel."
)
.add()
.<Double>appendInherited(
new KeyedCodec<>("Scale", Codec.DOUBLE),
(var0, var1) -> var0.scale = var1.floatValue(),
var0 -> (double)var0.scale,
(var0, var1) -> var0.scale = var1.scale
)
.metadata(new UIPropertyTitle("Item Scale"))
.add()
.<String>appendInherited(
new KeyedCodec<>("Texture", Codec.STRING), (var0, var1) -> var0.texture = var1, var0 -> var0.texture, (var0, var1) -> var0.texture = var1.texture
)
.addValidator(CommonAssetValidator.TEXTURE_ITEM)
.metadata(new UIRebuildCaches(UIRebuildCaches.ClientCache.MODELS))
.metadata(new UIPropertyTitle("Item Texture"))
.documentation(
"The texture used for rendering this item when held, in inventory, or attached. Paired with Item.Model when set; otherwise block-specific texture properties are used."
)
.add()
.<String>appendInherited(
new KeyedCodec<>("Animation", Codec.STRING),
(var0, var1) -> var0.animation = var1,
var0 -> var0.animation,
(var0, var1) -> var0.animation = var1.animation
)
.addValidator(CommonAssetValidator.ANIMATION_ITEM_BLOCK)
.metadata(new UIRebuildCaches(UIRebuildCaches.ClientCache.MODELS))
.metadata(new UIPropertyTitle("Item Animation"))
.documentation("The animation used for rendering this item. Used only when Item.Model is set; otherwise the block's animation is used.")
.add()
.appendInherited(
new KeyedCodec<>("UsePlayerAnimations", Codec.BOOLEAN),
(var0, var1) -> var0.usePlayerAnimations = var1,
var0 -> var0.usePlayerAnimations,
(var0, var1) -> var0.usePlayerAnimations = var1.usePlayerAnimations
)
.add()
.<String>appendInherited(
new KeyedCodec<>("PlayerAnimationsId", ItemPlayerAnimations.CHILD_CODEC),
(var0, var1) -> var0.playerAnimationsId = var1,
var0 -> var0.playerAnimationsId,
(var0, var1) -> var0.playerAnimationsId = var1.playerAnimationsId
)
.addValidator(Validators.nonNull())
.addValidator(ItemPlayerAnimations.VALIDATOR_CACHE.getValidator())
.add()
.<String>appendInherited(
new KeyedCodec<>("DroppedItemAnimation", Codec.STRING),
(var0, var1) -> var0.droppedItemAnimation = var1,
var0 -> var0.droppedItemAnimation,
(var0, var1) -> var0.droppedItemAnimation = var1.droppedItemAnimation
)
.addValidator(CommonAssetValidator.ANIMATION_ITEM_BLOCK)
.add()
.<ModelParticle[]>appendInherited(
new KeyedCodec<>("Particles", ModelParticle.ARRAY_CODEC),
(var0, var1) -> var0.particles = var1,
var0 -> var0.particles,
(var0, var1) -> var0.particles = var1.particles
)
.metadata(new UIPropertyTitle("Item Particles"))
.metadata(new UIRebuildCaches(UIRebuildCaches.ClientCache.MODELS))
.documentation("The particles played for this item. Used only when Item.Model is set; otherwise the block's particles are used.")
.add()
.<ModelParticle[]>appendInherited(
new KeyedCodec<>("FirstPersonParticles", ModelParticle.ARRAY_CODEC),
(var0, var1) -> var0.firstPersonParticles = var1,
var0 -> var0.firstPersonParticles,
(var0, var1) -> var0.firstPersonParticles = var1.firstPersonParticles
)
.metadata(new UIPropertyTitle("Item First Person Particles"))
.metadata(new UIRebuildCaches(UIRebuildCaches.ClientCache.MODELS))
.documentation("The particles played for this item when in first person. Used only when Item.Model is set; otherwise the block's particles are used.")
.add()
.<ModelTrail[]>appendInherited(
new KeyedCodec<>("Trails", ModelAsset.MODEL_TRAIL_ARRAY_CODEC),
(var0, var1) -> var0.trails = var1,
var0 -> var0.trails,
(var0, var1) -> var0.trails = var1.trails
)
.metadata(new UIPropertyTitle("Item Trails"))
.documentation("The trail attached to this item")
.add()
.<ColorLight>appendInherited(
new KeyedCodec<>("Light", ProtocolCodecs.COLOR_LIGHT), (var0, var1) -> var0.light = var1, var0 -> var0.light, (var0, var1) -> var0.light = var1.light
)
.metadata(new UIPropertyTitle("Item Light"))
.metadata(new UIRebuildCaches(UIRebuildCaches.ClientCache.MODELS))
.documentation(
"The light this item is emitting when being held or dropped. Used only when Item.Model is set; otherwise the block's emitted light is used."
)
.add()
.<CraftingRecipe>append(new KeyedCodec<>("Recipe", CraftingRecipe.CODEC), (var0, var1) -> var0.recipeToGenerate = var1, var0 -> var0.recipeToGenerate)
.metadata(new UIEditorSectionStart("Crafting"))
.add()
.appendInherited(
new KeyedCodec<>(
"ResourceTypes",
new ArrayCodec<>(
BuilderCodec.builder(ItemResourceType.class, ItemResourceType::new)
.append(new KeyedCodec<>("Id", Codec.STRING), (var0, var1) -> var0.id = var1, var0 -> var0.id)
.addValidator(ResourceType.VALIDATOR_CACHE.getValidator())
.addValidator(Validators.nonNull())
.add()
.<Integer>append(new KeyedCodec<>("Quantity", Codec.INTEGER), (var0, var1) -> var0.quantity = var1, var0 -> var0.quantity)
.addValidator(Validators.greaterThan(0))
.add()
.build(),
ItemResourceType[]::new
)
),
(var0, var1) -> var0.resourceTypes = var1,
var0 -> var0.resourceTypes,
(var0, var1) -> var0.resourceTypes = var1.resourceTypes
)
.add()
.<ItemTool>appendInherited(
new KeyedCodec<>("Tool", ItemTool.CODEC), (var0, var1) -> var0.tool = var1, var0 -> var0.tool, (var0, var1) -> var0.tool = var1.tool
)
.metadata(new UIEditorSectionStart("Functionality"))
.add()
.appendInherited(
new KeyedCodec<>("BlockSelectorTool", BlockSelectorToolData.CODEC),
(var0, var1) -> var0.blockSelectorToolData = var1,
var0 -> var0.blockSelectorToolData,
(var0, var1) -> var0.blockSelectorToolData = var1.blockSelectorToolData
)
.add()
.appendInherited(
new KeyedCodec<>("BuilderTool", BuilderTool.CODEC),
(var0, var1) -> var0.builderTool = var1,
var0 -> var0.builderTool,
(var0, var1) -> var0.builderTool = var1.builderTool
)
.add()
.<ItemWeapon>appendInherited(
new KeyedCodec<>("Weapon", ItemWeapon.CODEC), (var0, var1) -> var0.weapon = var1, var0 -> var0.weapon, (var0, var1) -> var0.weapon = var1.weapon
)
.metadata(AllowEmptyObject.INSTANCE)
.add()
.appendInherited(
new KeyedCodec<>("Armor", ItemArmor.CODEC), (var0, var1) -> var0.armor = var1, var0 -> var0.armor, (var0, var1) -> var0.armor = var1.armor
)
.add()
.appendInherited(
new KeyedCodec<>("Glider", ItemGlider.CODEC), (var0, var1) -> var0.glider = var1, var0 -> var0.glider, (var0, var1) -> var0.glider = var1.glider
)
.add()
.<ItemMusic>appendInherited(
new KeyedCodec<>("Music", ItemMusic.CODEC), (var0, var1) -> var0.music = var1, var0 -> var0.music, (var0, var1) -> var0.music = var1.music
)
.documentation("Music this item plays when placed in a music player block.")
.add()
.<ItemUtility>appendInherited(
new KeyedCodec<>("Utility", ItemUtility.CODEC), (var0, var1) -> var0.utility = var1, var0 -> var0.utility, (var0, var1) -> var0.utility = var1.utility
)
.addValidator(Validators.nonNull())
.add()
.appendInherited(
new KeyedCodec<>("PortalKey", PortalKey.CODEC),
(var0, var1) -> var0.portalKey = var1,
var0 -> var0.portalKey,
(var0, var1) -> var0.portalKey = var1.portalKey
)
.add()
.<ItemStackContainerConfig>appendInherited(
new KeyedCodec<>("Container", ItemStackContainerConfig.CODEC),
(var0, var1) -> var0.itemStackContainerConfig = var1,
var0 -> var0.itemStackContainerConfig,
(var0, var1) -> var0.itemStackContainerConfig = var1.itemStackContainerConfig
)
.addValidator(Validators.nonNull())
.add()
.appendInherited(
new KeyedCodec<>("Consumable", Codec.BOOLEAN),
(var0, var1) -> var0.consumable = var1,
var0 -> var0.consumable,
(var0, var1) -> var0.consumable = var1.consumable
)
.add()
.<Boolean>appendInherited(
new KeyedCodec<>("Variant", Codec.BOOLEAN), (var0, var1) -> var0.variant = var1, var0 -> var0.variant, (var0, var1) -> var0.variant = var1.variant
)
.documentation(
"Whether this item is a variant of another. Typically this is only the case for connected blocks. If this item is marked as a variant, then we filter it out of the item library menu by class="kw">default, unless the player chooses to display variants."
)
.add()
.appendInherited(
new KeyedCodec<>("MaxDurability", Codec.DOUBLE),
(var0, var1) -> var0.maxDurability = var1,
var0 -> var0.maxDurability,
(var0, var1) -> var0.maxDurability = var1.maxDurability
)
.add()
.appendInherited(
new KeyedCodec<>("FuelQuality", Codec.DOUBLE),
(var0, var1) -> var0.fuelQuality = var1,
var0 -> var0.fuelQuality,
(var0, var1) -> var0.fuelQuality = var1.fuelQuality
)
.add()
.appendInherited(
new KeyedCodec<>("DurabilityLossOnHit", Codec.DOUBLE),
(var0, var1) -> var0.durabilityLossOnHit = var1,
var0 -> var0.durabilityLossOnHit,
(var0, var1) -> var0.durabilityLossOnHit = var1.durabilityLossOnHit
)
.add()
.<Boolean>appendInherited(
new KeyedCodec<>("DurabilityLossOnDeath", Codec.BOOLEAN),
(var0, var1) -> var0.durabilityLossOnDeath = var1,
var0 -> var0.durabilityLossOnDeath,
(var0, var1) -> var0.durabilityLossOnDeath = var1.durabilityLossOnDeath
)
.documentation("Whether this item should loose durability on death, if so configured in DeathConfig.")
.add()
.<Boolean>appendInherited(
new KeyedCodec<>("Repairable", Codec.BOOLEAN),
(var0, var1) -> var0.repairable = var1,
var0 -> var0.repairable,
(var0, var1) -> var0.repairable = var1.repairable
)
.documentation(
"Whether this item can be repaired with a repair kit. Defaults to true. Set to false for items that use durability as a consumable resource (e.g. watering cans, fertilizer)."
)
.add()
.<String>appendInherited(
new KeyedCodec<>("BlockType", new ContainedAssetCodec<>(BlockType.class, BlockType.CODEC, ContainedAssetCodec.Mode.INHERIT_ID_AND_PARENT)),
(var0, var1) -> var0.hasBlockType = true,
var0 -> var0.blockId,
(var0, var1) -> var0.blockId = var1.blockId
)
.metadata(new UIEditorSectionStart("Block"))
.metadata(
new UIRebuildCaches(false, UIRebuildCaches.ClientCache.MODELS, UIRebuildCaches.ClientCache.BLOCK_TEXTURES, UIRebuildCaches.ClientCache.MODEL_TEXTURES)
)
.metadata(UIDefaultCollapsedState.UNCOLLAPSED)
.add()
.<Map<InteractionType, String>>appendInherited(
new KeyedCodec<>("Interactions", new EnumMapCodec<>(InteractionType.class, RootInteraction.CHILD_ASSET_CODEC)),
(var0, var1) -> var0.interactions = MapUtil.combineUnmodifiable(var0.interactions, var1, () -> new EnumMap<>(InteractionType.class)),
var0 -> var0.interactions,
(var0, var1) -> var0.interactions = var1.interactions
)
.addValidator(RootInteraction.VALIDATOR_CACHE.getMapValueValidator())
.metadata(new UIEditorSectionStart("Interactions"))
.add()
.<Map<InteractionType, String>>appendInherited(
new KeyedCodec<>("CarryInteractions", new EnumMapCodec<>(InteractionType.class, RootInteraction.CHILD_ASSET_CODEC)),
(var0, var1) -> var0.carryInteractions = MapUtil.combineUnmodifiable(var0.carryInteractions, var1, () -> new EnumMap<>(InteractionType.class)),
var0 -> var0.carryInteractions,
(var0, var1) -> var0.carryInteractions = var1.carryInteractions
)
.documentation("The map interactions available when carrying the item.")
.addValidator(RootInteraction.VALIDATOR_CACHE.getMapValueValidator())
.metadata(new UIEditorSectionStart("CarryInteractions"))
.add()
.<Map<InteractionType, String>>appendInherited(
new KeyedCodec<>("CarryHudInputBindings", new EnumMapCodec<>(InteractionType.class, Codec.STRING)),
(var0, var1) -> var0.carryHudInputBindings = MapUtil.combineUnmodifiable(var0.carryHudInputBindings, var1, () -> new EnumMap<>(InteractionType.class)),
var0 -> var0.carryHudInputBindings,
(var0, var1) -> var0.carryHudInputBindings = var1.carryHudInputBindings
)
.documentation("Per carry interaction, the localization key the client shows as an input binding hint on the HUD while the item is carried.")
.add()
.<InteractionConfiguration>appendInherited(
new KeyedCodec<>("InteractionConfig", InteractionConfiguration.CODEC),
(var0, var1) -> var0.interactionConfig = var1,
var0 -> var0.interactionConfig,
(var0, var1) -> var0.interactionConfig = var1.interactionConfig
)
.addValidator(Validators.nonNull())
.add()
.<Map>appendInherited(
new KeyedCodec<>("InteractionVars", new MapCodec<>(RootInteraction.CHILD_ASSET_CODEC, HashMap::new)),
(var0, var1) -> var0.interactionVars = MapUtil.combineUnmodifiable(var0.interactionVars, var1),
var0 -> var0.interactionVars,
(var0, var1) -> var0.interactionVars = var1.interactionVars
)
.addValidator(RootInteraction.VALIDATOR_CACHE.getMapValueValidator())
.add()
.<Map>appendInherited(
new KeyedCodec<>(
"ItemAppearanceConditions", new MapCodec<>(new ArrayCodec<>(ItemAppearanceCondition.CODEC, ItemAppearanceCondition[]::new), HashMap::new)
),
(var0, var1) -> var0.itemAppearanceConditions = var1,
var0 -> var0.itemAppearanceConditions,
(var0, var1) -> var0.itemAppearanceConditions = var1.itemAppearanceConditions
)
.documentation("Define per EntityStat an array of ItemAppearanceCondition. Only a single condition will be applied to the item at the same time.")
.addValidator(EntityStatType.VALIDATOR_CACHE.getMapKeyValidator().late())
.add()
.<String[]>appendInherited(
new KeyedCodec<>("DisplayEntityStatsHUD", Codec.STRING_ARRAY),
(var0, var1) -> var0.rawDisplayEntityStatsHUD = var1,
var0 -> var0.rawDisplayEntityStatsHUD,
(var0, var1) -> var0.rawDisplayEntityStatsHUD = var1.rawDisplayEntityStatsHUD
)
.documentation("Used to indicate to the client whether an EntityStat HUD UI needs to be displayed")
.add()
.<ItemPullbackConfig>appendInherited(
new KeyedCodec<>("PullbackConfig", ItemPullbackConfig.CODEC),
(var0, var1) -> var0.pullbackConfig = var1,
var0 -> var0.pullbackConfig,
(var0, var1) -> var0.pullbackConfig = var1.pullbackConfig
)
.documentation("Overrides the offset of first person arms when close to obstacles")
.add()
.appendInherited(
new KeyedCodec<>("ClipsGeometry", Codec.BOOLEAN),
(var0, var1) -> var0.clipsGeometry = var1,
var0 -> var0.clipsGeometry,
(var0, var1) -> var0.clipsGeometry = var1.clipsGeometry
)
.add()
.appendInherited(
new KeyedCodec<>("RenderDeployablePreview", Codec.BOOLEAN),
(var0, var1) -> var0.renderDeployablePreview = var1,
var0 -> var0.renderDeployablePreview,
(var0, var1) -> var0.renderDeployablePreview = var1.renderDeployablePreview
)
.add()
.addField(new KeyedCodec<>("HudUI", new ArrayCodec<>(ItemHudUI.CODEC, ItemHudUI[]::new)), (var0, var1) -> var0.hudUI = var1, var0 -> var0.hudUI)
.appendInherited(
new KeyedCodec<>("DropOnDeath", Codec.BOOLEAN),
(var0, var1) -> var0.dropOnDeath = var1,
var0 -> var0.dropOnDeath,
(var0, var1) -> var0.dropOnDeath = var1.dropOnDeath
)
.add()
.afterDecode(Item::processConfig);
class="kw">public class="kw">static class="kw">final AssetCodec<String, Item> CODEC = CODEC_BUILDER.build();
class="kw">public class="kw">static class="kw">final ValidatorCache<String> VALIDATOR_CACHE = new ValidatorCache<>(new AssetKeyValidator<>(Item::getAssetStore));
class="kw">private class="kw">static AssetStore<String, Item, DefaultAssetMap<String, Item>> ASSET_STORE;
class="kw">public class="kw">static class="kw">final String UNKNOWN_TEXTURE = "Items/Unknown.png";
class="kw">public class="kw">static class="kw">final Item UNKNOWN = new Item("Unknown") {
{
this.playerAnimationsId = "Item";
this.model = "Items/CreativeTools/EditorTool.blockymodel";
this.texture = "Items/Unknown.png";
this.maxStack = 100;
this.itemEntityConfig = ItemEntityConfig.DEFAULT;
this.interactionConfig = InteractionConfiguration.DEFAULT;
this.interactions = Map.of(InteractionType.SwapFrom, ChangeActiveSlotInteraction.DEFAULT_ROOT.getId());
}
};
class="kw">protected AssetExtraInfo.Data data;
class="kw">protected String id;
class="kw">protected String icon;
class="kw">protected AssetIconProperties iconProperties;
class="kw">protected ItemTranslationProperties translationProperties;
class="kw">protected String reticleId;
class="kw">protected int reticleIndex = 0;
class="kw">protected int itemLevel;
class="kw">protected int maxStack = -1;
class="kw">protected String qualityId;
class="kw">protected int qualityIndex = 0;
class="kw">protected CraftingRecipe recipeToGenerate;
class="kw">protected String blockId;
class="kw">protected boolean hasBlockType;
class="kw">protected boolean consumable;
class="kw">protected boolean variant;
class="kw">protected ItemTool tool;
class="kw">protected BlockSelectorToolData blockSelectorToolData;
class="kw">protected BuilderTool builderTool;
class="kw">protected ItemWeapon weapon;
class="kw">protected ItemArmor armor;
class="kw">protected ItemGlider glider;
class="kw">protected ItemMusic music;
class="kw">protected ItemUtility utility = ItemUtility.DEFAULT;
class="kw">protected ItemStackContainerConfig itemStackContainerConfig = ItemStackContainerConfig.DEFAULT;
class="kw">protected PortalKey portalKey;
class="kw">protected String playerAnimationsId = "Default";
class="kw">protected boolean usePlayerAnimations = false;
class="kw">protected String model;
class="kw">protected float scale = 1.0F;
class="kw">protected String texture = "Items/Unknown.png";
class="kw">protected String animation;
class="kw">protected String[] categories;
class="kw">protected String subCategory;
class="kw">protected String set;
class="kw">protected String soundEventId;
class="kw">protected class="kw">transient int soundEventIndex;
class="kw">protected String itemSoundSetId = "ISS_Default";
class="kw">protected class="kw">transient int itemSoundSetIndex;
class="kw">protected ModelParticle[] particles;
class="kw">protected ModelParticle[] firstPersonParticles;
class="kw">protected ModelTrail[] trails;
class="kw">protected ColorLight light;
class="kw">protected ItemResourceType[] resourceTypes;
class="kw">protected Map<String, String> stateToBlock;
class="kw">protected Map<String, String> blockToState;
class="kw">protected Map<InteractionType, String> interactions = Collections.emptyMap();
class="kw">protected Map<InteractionType, String> carryInteractions = Collections.emptyMap();
class="kw">protected Map<InteractionType, String> carryHudInputBindings = Collections.emptyMap();
class="kw">protected Map<String, String> interactionVars = Collections.emptyMap();
class="kw">protected InteractionConfiguration interactionConfig;
class="kw">protected ItemEntityConfig itemEntityConfig;
class="kw">protected String droppedItemAnimation;
class="kw">protected double maxDurability;
class="kw">protected double fuelQuality = 1.0;
class="kw">protected double durabilityLossOnHit;
class="kw">protected Map<String, ItemAppearanceCondition[]> itemAppearanceConditions;
class="kw">protected String[] rawDisplayEntityStatsHUD;
@Nullable
class="kw">protected int[] displayEntityStatsHUD;
class="kw">protected ItemPullbackConfig pullbackConfig;
class="kw">protected boolean clipsGeometry;
class="kw">protected boolean renderDeployablePreview;
class="kw">protected ItemHudUI[] hudUI;
class="kw">protected boolean dropOnDeath;
class="kw">protected boolean durabilityLossOnDeath = true;
class="kw">protected boolean repairable = true;
class="kw">private class="kw">transient SoftReference<ItemBase> cachedPacket;
class="kw">public class="kw">static AssetStore<String, Item, DefaultAssetMap<String, Item>> getAssetStore() {
if (ASSET_STORE == null) {
ASSET_STORE = AssetRegistry.getAssetStore(Item.class);
}
class="kw">return ASSET_STORE;
}
class="kw">public class="kw">static DefaultAssetMap<String, Item> getAssetMap() {
class="kw">return (DefaultAssetMap<String, Item>)getAssetStore().getAssetMap();
}
class="kw">public void invalidatePacketCache() {
this.cachedPacket = null;
}
@Nullable
class="kw">public ItemWeapon unshareWeapon() {
if (this.weapon == null) {
class="kw">return null;
}
this.weapon = new ItemWeapon(this.weapon);
class="kw">return this.weapon;
}
class="kw">protected Item() {
}
class="kw">public Item(String var1) {
this.id = var1;
}
class="kw">public Item(@Nonnull Item var1) {
this.data = var1.data;
this.id = var1.id;
this.icon = var1.icon;
this.iconProperties = var1.iconProperties;
this.translationProperties = var1.translationProperties;
this.reticleId = var1.reticleId;
this.itemLevel = var1.itemLevel;
this.maxStack = var1.maxStack;
this.qualityId = var1.qualityId;
this.recipeToGenerate = var1.recipeToGenerate;
this.consumable = var1.consumable;
this.variant = var1.variant;
this.playerAnimationsId = var1.playerAnimationsId;
this.usePlayerAnimations = var1.usePlayerAnimations;
this.model = var1.model;
this.scale = var1.scale;
this.texture = var1.texture;
this.animation = var1.animation;
this.tool = var1.tool;
this.blockSelectorToolData = var1.blockSelectorToolData;
this.builderTool = var1.builderTool;
this.weapon = var1.weapon;
this.armor = var1.armor;
this.utility = var1.utility;
this.portalKey = var1.portalKey;
this.categories = var1.categories;
this.subCategory = var1.subCategory;
this.set = var1.set;
this.soundEventId = var1.soundEventId;
this.soundEventIndex = var1.soundEventIndex;
this.itemSoundSetId = var1.itemSoundSetId;
this.itemSoundSetIndex = var1.itemSoundSetIndex;
this.particles = var1.particles;
this.firstPersonParticles = var1.firstPersonParticles;
this.trails = var1.trails;
this.light = var1.light;
this.resourceTypes = var1.resourceTypes;
this.interactions = var1.interactions;
this.carryInteractions = var1.carryInteractions;
this.carryHudInputBindings = var1.carryHudInputBindings;
this.interactionVars = var1.interactionVars;
this.interactionConfig = var1.interactionConfig;
this.droppedItemAnimation = var1.droppedItemAnimation;
this.itemEntityConfig = var1.itemEntityConfig;
this.stateToBlock = var1.stateToBlock;
this.blockId = var1.blockId;
this.hasBlockType = var1.hasBlockType;
this.displayEntityStatsHUD = var1.displayEntityStatsHUD;
this.pullbackConfig = var1.pullbackConfig;
this.clipsGeometry = var1.clipsGeometry;
this.renderDeployablePreview = var1.renderDeployablePreview;
this.dropOnDeath = var1.dropOnDeath;
this.repairable = var1.repairable;
}
@Nonnull
class="kw">public ItemBase toPacket() {
ItemBase var1 = this.cachedPacket == null ? null : this.cachedPacket.get();
if (var1 != null) {
class="kw">return var1;
}
ItemBase var2 = new ItemBase();
var2.id = this.id;
if (this.icon != null) {
var2.icon = this.icon;
}
if (this.iconProperties != null) {
var2.iconProperties = this.iconProperties.toPacket();
}
if (this.translationProperties != null) {
var2.translationProperties = this.translationProperties.toPacket();
}
if (this.model != null) {
var2.model = this.model;
}
var2.scale = this.scale;
if (this.texture != null) {
var2.texture = this.texture;
}
if (this.animation != null) {
var2.animation = this.animation;
}
var2.playerAnimationsId = this.playerAnimationsId;
var2.usePlayerAnimations = this.usePlayerAnimations;
var2.reticleIndex = this.reticleIndex;
var2.maxStack = this.maxStack;
var2.itemLevel = this.itemLevel;
var2.qualityIndex = this.qualityIndex;
if (this.blockId != null) {
var2.blockId = BlockType.getAssetMap().getIndexOrDefault(this.blockId, 1);
if (var2.blockId == 0) {
throw new IllegalArgumentException("Block Id Can't be 0");
}
}
var2.consumable = this.consumable;
var2.variant = this.variant;
if (this.tool != null) {
var2.tool = this.tool.toPacket();
}
if (this.blockSelectorToolData != null) {
var2.blockSelectorTool = this.blockSelectorToolData.toPacket();
}
if (this.builderTool != null) {
var2.builderToolData = this.builderTool.toPacket();
}
if (this.weapon != null) {
var2.weapon = this.weapon.toPacket();
}
if (this.armor != null) {
var2.armor = this.armor.toPacket();
}
if (this.glider != null) {
var2.gliderConfig = this.glider.toPacket();
}
if (this.utility != null) {
var2.utility = this.utility.toPacket();
}
if (this.categories != null && this.categories.length > 0) {
var2.categories = this.categories;
}
if (this.subCategory != null) {
var2.subCategory = this.subCategory;
}
if (this.set != null) {
var2.set = this.set;
}
var2.soundEventIndex = this.soundEventIndex;
var2.itemSoundSetIndex = this.itemSoundSetIndex;
if (this.particles != null && this.particles.length > 0) {
var2.particles = new com.hypixel.hytale.protocol.ModelParticle[this.particles.length];
for (int var3 = 0; var3 < this.particles.length; var3++) {
var2.particles[var3] = this.particles[var3].toPacket();
}
}
if (this.firstPersonParticles != null && this.firstPersonParticles.length > 0) {
var2.firstPersonParticles = new com.hypixel.hytale.protocol.ModelParticle[this.firstPersonParticles.length];
for (int var12 = 0; var12 < this.firstPersonParticles.length; var12++) {
var2.firstPersonParticles[var12] = this.firstPersonParticles[var12].toPacket();
}
}
if (this.trails != null && this.trails.length > 0) {
var2.trails = this.trails;
}
if (this.light != null) {
var2.light = this.light;
}
if (this.resourceTypes != null && this.resourceTypes.length > 0) {
var2.resourceTypes = this.resourceTypes;
}
Object2IntOpenHashMap var13 = new Object2IntOpenHashMap();
for (Entry var5 : this.interactions.entrySet()) {
var13.put(var5.getKey(), RootInteraction.getRootInteractionIdOrUnknown(var5.getValue()));
}
var2.interactions = var13;
Object2IntOpenHashMap var14 = new Object2IntOpenHashMap();
for (Entry var6 : this.carryInteractions.entrySet()) {
var14.put(var6.getKey(), RootInteraction.getRootInteractionIdOrUnknown(var6.getValue()));
}
var2.carryInteractions = var14;
var2.carryHudInputBindings = this.carryHudInputBindings;
Object2IntOpenHashMap var16 = new Object2IntOpenHashMap();
for (Entry var7 : this.interactionVars.entrySet()) {
var16.put(var7.getKey(), RootInteraction.getRootInteractionIdOrUnknown(var7.getValue()));
}
var2.interactionVars = var16;
var2.interactionConfig = this.interactionConfig.toPacket();
var2.durability = this.getMaxDurability();
var2.itemEntity = this.itemEntityConfig.toPacket();
if (this.droppedItemAnimation != null) {
var2.droppedItemAnimation = this.droppedItemAnimation;
}
if (this.itemAppearanceConditions != null) {
HashMap var18 = new HashMap<>();
for (Entry var8 : this.itemAppearanceConditions.entrySet()) {
ItemAppearanceCondition[] var9 = var8.getValue();
com.hypixel.hytale.protocol.ItemAppearanceCondition[] var10 = new com.hypixel.hytale.protocol.ItemAppearanceCondition[var9.length];
for (int var11 = 0; var11 < var9.length; var11++) {
var10[var11] = var9[var11].toPacket();
}
var18.put(EntityStatType.getAssetMap().getIndex(var8.getKey()), var10);
}
var2.itemAppearanceConditions = var18;
}
if (this.data != null) {
IntSet var19 = this.data.getExpandedTagIndexes();
if (var19 != null) {
var2.tagIndexes = var19.toIntArray();
}
}
var2.displayEntityStatsHUD = this.displayEntityStatsHUD;
if (this.pullbackConfig != null) {
var2.pullbackConfig = this.pullbackConfig.toPacket();
}
var2.clipsGeometry = this.clipsGeometry;
var2.renderDeployablePreview = this.renderDeployablePreview;
if (this.hudUI != null && this.hudUI.length > 0) {
var2.hudUI = new com.hypixel.hytale.protocol.ItemHudUI[this.hudUI.length];
for (int var20 = 0; var20 < this.hudUI.length; var20++) {
var2.hudUI[var20] = this.hudUI[var20].toPacket();
}
}
this.cachedPacket = new SoftReference<>(var2);
class="kw">return var2;
}
@Nullable
class="kw">public String getItemIdForState(String var1) {
class="kw">return this.stateToBlock != null ? this.stateToBlock.get(var1) : null;
}
@Nullable
class="kw">public Item getItemForState(String var1) {
String var2 = this.getItemIdForState(var1);
class="kw">return var2 == null ? null : getAssetMap().getAsset(var2);
}
class="kw">public boolean isState() {
class="kw">return this.getStateForItem(this.id) != null;
}
@Nullable
class="kw">public String getStateForItem(@Nonnull Item var1) {
class="kw">return this.getStateForItem(var1.getId());
}
@Nullable
class="kw">public String getStateForItem(String var1) {
class="kw">return this.blockToState != null ? this.blockToState.get(var1) : null;
}
class="kw">public AssetExtraInfo.Data getData() {
class="kw">return this.data;
}
class="kw">public String getId() {
class="kw">return this.id;
}
class="kw">public String getBlockId() {
class="kw">return this.blockId;
}
@Nonnull
class="kw">public String getTranslationKey() {
if (this.translationProperties != null) {
String var1 = this.translationProperties.getName();
if (var1 != null) {
class="kw">return var1;
}
}
class="kw">return "server.items." + this.id + ".name";
}
@Nonnull
class="kw">public Message getTranslationMessage() {
Message var1 = Message.translation(this.getTranslationKey());
if (this.translationProperties != null) {
Map var2 = this.translationProperties.getNameArguments();
if (var2 != null) {
for (Entry var4 : var2.entrySet()) {
var1.param(var4.getKey(), var4.getValue());
}
}
}
class="kw">return var1;
}
@Nonnull
class="kw">public String getDescriptionTranslationKey() {
if (this.translationProperties != null) {
String var1 = this.translationProperties.getDescription();
if (var1 != null) {
class="kw">return var1;
}
}
class="kw">return "server.items." + this.id + ".description";
}
@Nonnull
class="kw">public Message getDescriptionTranslationMessage() {
Message var1 = Message.translation(this.getDescriptionTranslationKey());
if (this.translationProperties != null) {
Map var2 = this.translationProperties.getDescriptionArguments();
if (var2 != null) {
for (Entry var4 : var2.entrySet()) {
var1.param(var4.getKey(), var4.getValue());
}
}
}
class="kw">return var1;
}
class="kw">public String getModel() {
class="kw">return this.model;
}
class="kw">public String getTexture() {
class="kw">return this.texture;
}
class="kw">public boolean isConsumable() {
class="kw">return this.consumable;
}
class="kw">public boolean isVariant() {
class="kw">return this.variant;
}
class="kw">public boolean getUsePlayerAnimations() {
class="kw">return this.usePlayerAnimations;
}
class="kw">public String getPlayerAnimationsId() {
class="kw">return this.playerAnimationsId;
}
class="kw">public String getIcon() {
class="kw">return this.icon;
}
class="kw">public AssetIconProperties getIconProperties() {
class="kw">return this.iconProperties;
}
class="kw">public ItemTranslationProperties getTranslationProperties() {
class="kw">return this.translationProperties;
}
class="kw">public float getScale() {
class="kw">return this.scale;
}
class="kw">public String getReticleId() {
class="kw">return this.reticleId;
}
class="kw">public int getItemLevel() {
class="kw">return this.itemLevel;
}
class="kw">public int getMaxStack() {
class="kw">return this.maxStack;
}
class="kw">public int getQualityIndex() {
class="kw">return this.qualityIndex;
}
class="kw">public ItemTool getTool() {
class="kw">return this.tool;
}
class="kw">public BlockSelectorToolData getBlockSelectorToolData() {
class="kw">return this.blockSelectorToolData;
}
class="kw">public BuilderTool getBuilderTool() {
class="kw">return this.builderTool;
}
class="kw">public ItemArmor getArmor() {
class="kw">return this.armor;
}
class="kw">public ItemGlider getGlider() {
class="kw">return this.glider;
}
@Nullable
class="kw">public ItemMusic getMusic() {
class="kw">return this.music;
}
@Nonnull
class="kw">public ItemUtility getUtility() {
class="kw">return this.utility;
}
@Nullable
class="kw">public PortalKey getPortalKey() {
class="kw">return this.portalKey;
}
@Nonnull
class="kw">public ItemStackContainerConfig getItemStackContainerConfig() {
class="kw">return this.itemStackContainerConfig;
}
class="kw">public String[] getCategories() {
class="kw">return this.categories;
}
class="kw">public String getSubCategory() {
class="kw">return this.subCategory;
}
class="kw">public String getSoundEventId() {
class="kw">return this.soundEventId;
}
class="kw">public int getSoundEventIndex() {
class="kw">return this.soundEventIndex;
}
class="kw">public boolean hasBlockType() {
class="kw">return this.blockId != null;
}
class="kw">public ItemWeapon getWeapon() {
class="kw">return this.weapon;
}
class="kw">public ItemResourceType[] getResourceTypes() {
class="kw">return this.resourceTypes;
}
class="kw">public double getMaxDurability() {
class="kw">return this.maxDurability;
}
class="kw">public ColorLight getLight() {
class="kw">return this.light;
}
class="kw">public Map<InteractionType, String> getInteractions() {
class="kw">return this.interactions;
}
class="kw">public Map<InteractionType, String> getCarryInteractions() {
class="kw">return this.carryInteractions;
}
class="kw">public Map<InteractionType, String> getCarryHudInputBindings() {
class="kw">return this.carryHudInputBindings;
}
class="kw">public Map<String, String> getInteractionVars() {
class="kw">return this.interactionVars;
}
class="kw">public ItemEntityConfig getItemEntityConfig() {
class="kw">return this.itemEntityConfig;
}
class="kw">public String getDroppedItemAnimation() {
class="kw">return this.droppedItemAnimation;
}
class="kw">public double getDurabilityLossOnHit() {
class="kw">return this.durabilityLossOnHit;
}
class="kw">public boolean getDurabilityLossOnDeath() {
class="kw">return this.durabilityLossOnDeath;
}
class="kw">public boolean isRepairable() {
class="kw">return this.repairable;
}
class="kw">public int[] getDisplayEntityStatsHUD() {
class="kw">return this.displayEntityStatsHUD;
}
class="kw">public ItemPullbackConfig getPullbackConfig() {
class="kw">return this.pullbackConfig;
}
class="kw">public boolean getClipsGeometry() {
class="kw">return this.clipsGeometry;
}
class="kw">public boolean getRenderDeployablePreview() {
class="kw">return this.renderDeployablePreview;
}
class="kw">public double getFuelQuality() {
class="kw">return this.fuelQuality;
}
class="kw">public InteractionConfiguration getInteractionConfig() {
class="kw">return this.interactionConfig;
}
class="kw">public int getItemSoundSetIndex() {
class="kw">return this.itemSoundSetIndex;
}
class="kw">public void collectRecipesToGenerate(Collection<CraftingRecipe> var1) {
if (this.recipeToGenerate != null) {
var1.add(this.recipeToGenerate);
}
}
class="kw">public boolean hasRecipesToGenerate() {
class="kw">return this.recipeToGenerate != null;
}
class="kw">public boolean dropsOnDeath() {
class="kw">return this.dropOnDeath;
}
class="kw">protected void processConfig() {
if (this.hasBlockType) {
this.blockId = this.id;
}
if (this.maxStack == -1) {
if (this.tool == null && this.weapon == null && this.armor == null && this.builderTool == null && this.blockSelectorToolData == null) {
this.maxStack = 100;
} else {
this.maxStack = 1;
}
}
Map var1 = this.interactions.isEmpty() ? new EnumMap<>(InteractionType.class) : new EnumMap<>(this.interactions);
DefaultAssetMap var2 = UnarmedInteractions.getAssetMap();
UnarmedInteractions var3 = this.playerAnimationsId != null ? var2.getAsset(this.playerAnimationsId) : null;
if (var3 != null) {
for (Entry var5 : var3.getInteractions().entrySet()) {
var1.putIfAbsent(var5.getKey(), var5.getValue());
}
}
UnarmedInteractions var9 = var2.getAsset("Empty");
if (var9 != null) {
for (Entry var6 : var9.getInteractions().entrySet()) {
var1.putIfAbsent(var6.getKey(), var6.getValue());
}
}
this.interactions = Collections.unmodifiableMap(var1);
this.carryInteractions = Collections.unmodifiableMap(
this.carryInteractions.isEmpty() ? new EnumMap<>(InteractionType.class) : new EnumMap<>(this.carryInteractions)
);
this.carryHudInputBindings = Collections.unmodifiableMap(
this.carryHudInputBindings.isEmpty() ? new EnumMap<>(InteractionType.class) : new EnumMap<>(this.carryHudInputBindings)
);
if (this.reticleId != null) {
this.reticleIndex = ItemReticleConfig.getAssetMap().getIndexOrDefault(this.reticleId, 0);
}
IndexedLookupTableAssetMap var11 = ItemQuality.getAssetMap();
if (this.qualityId != null) {
this.qualityIndex = var11.getIndexOrDefault(this.qualityId, 0);
ItemQuality var12 = var11.getAsset(this.qualityIndex);
if (var12 != null) {
this.itemEntityConfig = var12.getItemEntityConfig();
}
}
if (this.itemEntityConfig == null) {
if (this.blockId != null) {
this.itemEntityConfig = ItemEntityConfig.DEFAULT_BLOCK;
} else {
this.itemEntityConfig = ItemEntityConfig.DEFAULT;
}
}
if (this.interactionConfig == null) {
if (this.weapon != null) {
this.interactionConfig = InteractionConfiguration.DEFAULT_WEAPON;
} else {
this.interactionConfig = InteractionConfiguration.DEFAULT;
}
}
if (this.soundEventId != null) {
this.soundEventIndex = SoundEvent.getAssetMap().getIndex(this.soundEventId);
}
this.itemSoundSetIndex = ItemSoundSet.getAssetMap().getIndex(this.itemSoundSetId);
if (this.stateToBlock != null) {
Map var13 = new Object2ObjectOpenHashMap();
for (Entry var8 : this.stateToBlock.entrySet()) {
var13.put(var8.getValue(), var8.getKey());
}
this.blockToState = Collections.unmodifiableMap(var13);
}
if (this.recipeToGenerate != null) {
CraftingRecipe var14 = this.recipeToGenerate;
CraftingRecipe var15 = new CraftingRecipe(var14);
MaterialQuantity var16;
if (var15.outputs != null && var15.outputs.length == 1 && this.id.equals(var15.outputs[0].getItemId())) {
var16 = var15.outputs[0];
} else {
var16 = new MaterialQuantity(this.id, null, null, var15.primaryOutputQuantity, null);
if (var15.outputs == null || var15.outputs.length == 0) {
var15.outputs = new MaterialQuantity[]{var16};
}
}
var15.primaryOutput = var16;
var15.applyOutputExclusions();
var15.id = CraftingRecipe.generateIdFromItemRecipe(this, 0);
this.recipeToGenerate = var15;
}
this.displayEntityStatsHUD = EntityStatsModule.resolveEntityStats(this.rawDisplayEntityStatsHUD);
}
class="kw">static {
CODEC_BUILDER.<Map>appendInherited(
new KeyedCodec<>("State", new MapCodec(new ContainedAssetCodec<>(Item.class, CODEC, ContainedAssetCodec.Mode.INJECT_PARENT), HashMap::new)),
(var0, var1) -> var0.stateToBlock = var1,
var0 -> var0.stateToBlock,
(var0, var1) -> var0.stateToBlock = var1.stateToBlock
)
.metadata(new UIEditorSectionStart("State"))
.add();
}
}