EntityStatUIComponent class
Пакет: com.hypixel.hytale.server.core.modules.entityui.asset
Файл: com/hypixel/hytale/server/core/modules/entityui/asset/EntityStatUIComponent.java
extends: EntityUIComponent
Поля (2)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
BuilderCodec<EntityStatUIComponent> |
CODEC |
|
com.hypixel.hytale.protocol.EntityUIComponent |
var1 |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.modules.entityui.asset;
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.validation.Validators;
class="kw">import com.hypixel.hytale.protocol.EntityUIType;
class="kw">import com.hypixel.hytale.server.core.modules.entitystats.asset.EntityStatType;
class="kw">import javax.annotation.Nonnull;
class="kw">public class EntityStatUIComponent class="kw">extends EntityUIComponent {
class="kw">public class="kw">static class="kw">final BuilderCodec<EntityStatUIComponent> CODEC = BuilderCodec.builder(
EntityStatUIComponent.class, EntityStatUIComponent::new, EntityUIComponent.ABSTRACT_CODEC
)
.appendInherited(
new KeyedCodec<>("EntityStat", Codec.STRING),
(var0, var1) -> var0.entityStat = var1,
var0 -> var0.entityStat,
(var0, var1) -> var0.entityStat = var1.entityStat
)
.addValidator(Validators.nonNull())
.addValidator(Validators.nonEmptyString())
.addValidator(EntityStatType.VALIDATOR_CACHE.getValidator())
.documentation("The entity stat to represent.")
.add()
.afterDecode(var0 -> var0.entityStatIndex = EntityStatType.getAssetMap().getIndex(var0.entityStat))
.build();
class="kw">protected String entityStat;
class="kw">protected int entityStatIndex;
class="kw">public EntityStatUIComponent() {
}
@Nonnull
@Override
class="kw">protected com.hypixel.hytale.protocol.EntityUIComponent generatePacket() {
com.hypixel.hytale.protocol.EntityUIComponent var1 = super.generatePacket();
var1.type = EntityUIType.EntityStat;
var1.entityStatIndex = this.entityStatIndex;
class="kw">return var1;
}
@Nonnull
@Override
class="kw">public String toString() {
class="kw">return "EntityStatUIComponent{entityStat='" + this.entityStat + "', entityStatIndex=" + this.entityStatIndex + "} " + super.toString();
}
}