ModelOverride class
Пакет: com.hypixel.hytale.server.core.asset.type.entityeffect.config
Файл: com/hypixel/hytale/server/core/asset/type/entityeffect/config/ModelOverride.java
implements: NetworkSerializable<com.hypixel.hytale.protocol.ModelOverride>
Поля (2)
| Модификаторы | Тип | Имя |
|---|---|---|
|
com.hypixel.hytale.protocol.ModelOverride |
var1 |
|
Map |
var2 |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.asset.type.entityeffect.config;
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.map.MapCodec;
class="kw">import com.hypixel.hytale.protocol.AnimationSet;
class="kw">import com.hypixel.hytale.server.core.asset.common.CommonAssetValidator;
class="kw">import com.hypixel.hytale.server.core.asset.type.model.config.ModelAsset;
class="kw">import com.hypixel.hytale.server.core.io.NetworkSerializable;
class="kw">import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
class="kw">import java.util.Collections;
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 ModelOverride class="kw">implements NetworkSerializable<com.hypixel.hytale.protocol.ModelOverride> {
@Nonnull
class="kw">public class="kw">static class="kw">final BuilderCodec<ModelOverride> CODEC = BuilderCodec.builder(ModelOverride.class, ModelOverride::new)
.appendInherited(
new KeyedCodec<>("Model", Codec.STRING, true), (var0, var1) -> var0.model = var1, var0 -> var0.model, (var0, var1) -> var0.model = var1.model
)
.addValidator(CommonAssetValidator.MODEL_CHARACTER)
.add()
.<String>appendInherited(
new KeyedCodec<>("Texture", Codec.STRING, true),
(var0, var1) -> var0.texture = var1,
var0 -> var0.texture,
(var0, var1) -> var0.texture = var1.texture
)
.addValidator(CommonAssetValidator.TEXTURE_CHARACTER)
.add()
.appendInherited(
new KeyedCodec<>("AnimationSets", new MapCodec<>(ModelAsset.AnimationSet.CODEC, HashMap::new)),
(var0, var1) -> var0.animationSetMap = var1,
var0 -> var0.animationSetMap,
(var0, var1) -> var0.animationSetMap = var1.animationSetMap
)
.add()
.build();
@Nullable
class="kw">protected String model;
@Nullable
class="kw">protected String texture;
@Nonnull
class="kw">protected Map<String, ModelAsset.AnimationSet> animationSetMap = Collections.emptyMap();
class="kw">protected ModelOverride() {
}
@Nonnull
class="kw">public com.hypixel.hytale.protocol.ModelOverride toPacket() {
com.hypixel.hytale.protocol.ModelOverride var1 = new com.hypixel.hytale.protocol.ModelOverride();
var1.model = this.model;
var1.texture = this.texture;
if (!this.animationSetMap.isEmpty()) {
Map var2 = new Object2ObjectOpenHashMap(this.animationSetMap.size());
for (Entry var4 : this.animationSetMap.entrySet()) {
var2.put(var4.getKey(), var4.getValue().toPacket(var4.getKey()));
}
var1.animationSets = var2;
}
class="kw">return var1;
}
@Nonnull
@Override
class="kw">public String toString() {
class="kw">return "ModelOverride{model='" + this.model + "', texture='" + this.texture + "', animationSetMap=" + this.animationSetMap + "}";
}
}