ItemAppearanceCondition class
Пакет: com.hypixel.hytale.server.core.asset.type.item.config
Файл: com/hypixel/hytale/server/core/asset/type/item/config/ItemAppearanceCondition.java
implements: NetworkSerializable<com.hypixel.hytale.protocol.ItemAppearanceCondition>
Поля (2)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
BuilderCodec<ItemAppearanceCondition> |
CODEC |
|
com.hypixel.hytale.protocol.ItemAppearanceCondition |
var1 |
Методы (16)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
|
for for(int var2 = 0; var2 < this.particles.length; var2++) |
|
|
for for(int var3 = 0; var3 < this.firstPersonParticles.length; var3++) |
public |
FloatRange |
getConditionFloatRange getCondition() |
public |
ValueType |
getConditionValueTypeValueType getConditionValueType() |
public |
String |
getLocalSoundEventIdString getLocalSoundEventId() |
public |
int |
getLocalSoundEventIndexint getLocalSoundEventIndex() |
public |
String |
getModelString getModel() |
public |
String |
getModelVFXIdString getModelVFXId() |
public |
ModelParticle[] |
getParticlesModelParticle[] getParticles() |
public |
String |
getTextureString getTexture() |
public |
String |
getWorldSoundEventIdString getWorldSoundEventId() |
public |
int |
getWorldSoundEventIndexint getWorldSoundEventIndex() |
|
|
if if(var0.worldSoundEventId != null) |
|
|
if if(var0.localSoundEventId != null) |
|
|
if if(this.particles != null && this.particles.length > 0) |
|
|
if if(this.firstPersonParticles != null && this.firstPersonParticles.length > 0) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.asset.type.item.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.EnumCodec;
class="kw">import com.hypixel.hytale.codec.validation.Validators;
class="kw">import com.hypixel.hytale.math.range.FloatRange;
class="kw">import com.hypixel.hytale.protocol.ValueType;
class="kw">import com.hypixel.hytale.server.core.asset.common.CommonAssetValidator;
class="kw">import com.hypixel.hytale.server.core.asset.type.model.config.ModelParticle;
class="kw">import com.hypixel.hytale.server.core.asset.type.modelvfx.config.ModelVFX;
class="kw">import com.hypixel.hytale.server.core.asset.type.soundevent.config.SoundEvent;
class="kw">import com.hypixel.hytale.server.core.asset.type.soundevent.validator.SoundEventValidators;
class="kw">import com.hypixel.hytale.server.core.io.NetworkSerializable;
class="kw">import java.util.Arrays;
class="kw">import javax.annotation.Nonnull;
class="kw">public class ItemAppearanceCondition class="kw">implements NetworkSerializable<com.hypixel.hytale.protocol.ItemAppearanceCondition> {
class="kw">public class="kw">static class="kw">final BuilderCodec<ItemAppearanceCondition> CODEC = BuilderCodec.builder(ItemAppearanceCondition.class, ItemAppearanceCondition::new)
.append(new KeyedCodec<>("Particles", ModelParticle.ARRAY_CODEC), (var0, var1) -> var0.particles = var1, var0 -> var0.particles)
.add()
.append(
new KeyedCodec<>("FirstPersonParticles", ModelParticle.ARRAY_CODEC),
(var0, var1) -> var0.firstPersonParticles = var1,
var0 -> var0.firstPersonParticles
)
.add()
.<String>append(new KeyedCodec<>("Model", Codec.STRING), (var0, var1) -> var0.model = var1, var0 -> var0.model)
.addValidator(CommonAssetValidator.MODEL_CHARACTER)
.add()
.<String>append(new KeyedCodec<>("Texture", Codec.STRING), (var0, var1) -> var0.texture = var1, var0 -> var0.texture)
.addValidator(CommonAssetValidator.TEXTURE_CHARACTER)
.add()
.<String>append(new KeyedCodec<>("ModelVFXId", Codec.STRING), (var0, var1) -> var0.modelVFXId = var1, var0 -> var0.modelVFXId)
.addValidator(ModelVFX.VALIDATOR_CACHE.getValidator())
.add()
.<String>append(new KeyedCodec<>("WorldSoundEventId", Codec.STRING), (var0, var1) -> var0.worldSoundEventId = var1, var0 -> var0.worldSoundEventId)
.addValidator(SoundEvent.VALIDATOR_CACHE.getValidator())
.addValidator(SoundEventValidators.MONO)
.addValidator(SoundEventValidators.LOOPING)
.documentation("3D sound to play in the world when applying this condition.")
.add()
.<String>append(new KeyedCodec<>("LocalSoundEventId", Codec.STRING), (var0, var1) -> var0.localSoundEventId = var1, var0 -> var0.localSoundEventId)
.addValidator(SoundEvent.VALIDATOR_CACHE.getValidator())
.addValidator(SoundEventValidators.LOOPING)
.documentation("Local sound to play for the owner of this condition.")
.add()
.<FloatRange>append(new KeyedCodec<>("Condition", FloatRange.CODEC), (var0, var1) -> var0.condition = var1, var0 -> var0.condition)
.documentation("An array of 2 floats to define when the condition is active. 'Infinite' and '-Infinite' can be used to define bounds.")
.addValidator(Validators.nonNull())
.add()
.<ValueType>append(
new KeyedCodec<>("ConditionValueType", new EnumCodec<>(ValueType.class)),
(var0, var1) -> var0.conditionValueType = var1,
var0 -> var0.conditionValueType
)
.documentation(
"Enum to specify if the condition range must be considered as absolute values or percent. Default value is Absolute. When using ValueType.Absolute, '100' matches the max value."
)
.addValidator(Validators.nonNull())
.add()
.afterDecode(var0 -> {
if (var0.worldSoundEventId != null) {
var0.worldSoundEventIndex = SoundEvent.getAssetMap().getIndex(var0.worldSoundEventId);
}
if (var0.localSoundEventId != null) {
var0.localSoundEventIndex = SoundEvent.getAssetMap().getIndex(var0.localSoundEventId);
}
})
.build();
class="kw">protected ModelParticle[] particles;
class="kw">protected ModelParticle[] firstPersonParticles;
class="kw">protected String worldSoundEventId;
class="kw">protected class="kw">transient int worldSoundEventIndex = 0;
class="kw">protected String localSoundEventId;
class="kw">protected class="kw">transient int localSoundEventIndex = 0;
class="kw">protected String model;
class="kw">protected String texture;
class="kw">protected FloatRange condition;
@Nonnull
class="kw">protected ValueType conditionValueType = ValueType.Absolute;
class="kw">protected String modelVFXId;
class="kw">public ItemAppearanceCondition() {
}
class="kw">public ModelParticle[] getParticles() {
class="kw">return this.particles;
}
class="kw">public String getModel() {
class="kw">return this.model;
}
class="kw">public String getTexture() {
class="kw">return this.texture;
}
class="kw">public FloatRange getCondition() {
class="kw">return this.condition;
}
class="kw">public ValueType getConditionValueType() {
class="kw">return this.conditionValueType;
}
class="kw">public String getModelVFXId() {
class="kw">return this.modelVFXId;
}
class="kw">public String getWorldSoundEventId() {
class="kw">return this.worldSoundEventId;
}
class="kw">public int getWorldSoundEventIndex() {
class="kw">return this.worldSoundEventIndex;
}
class="kw">public String getLocalSoundEventId() {
class="kw">return this.localSoundEventId;
}
class="kw">public int getLocalSoundEventIndex() {
class="kw">return this.localSoundEventIndex;
}
@Nonnull
class="kw">public com.hypixel.hytale.protocol.ItemAppearanceCondition toPacket() {
com.hypixel.hytale.protocol.ItemAppearanceCondition var1 = new com.hypixel.hytale.protocol.ItemAppearanceCondition();
if (this.particles != null && this.particles.length > 0) {
var1.particles = new com.hypixel.hytale.protocol.ModelParticle[this.particles.length];
for (int var2 = 0; var2 < this.particles.length; var2++) {
var1.particles[var2] = this.particles[var2].toPacket();
}
}
if (this.firstPersonParticles != null && this.firstPersonParticles.length > 0) {
var1.firstPersonParticles = new com.hypixel.hytale.protocol.ModelParticle[this.firstPersonParticles.length];
for (int var3 = 0; var3 < this.firstPersonParticles.length; var3++) {
var1.firstPersonParticles[var3] = this.firstPersonParticles[var3].toPacket();
}
}
var1.model = this.model;
var1.texture = this.texture;
var1.condition = new com.hypixel.hytale.protocol.FloatRange(this.condition.getInclusiveMin(), this.condition.getInclusiveMax());
var1.conditionValueType = this.conditionValueType;
var1.modelVFXId = this.modelVFXId;
var1.localSoundEventId = this.localSoundEventIndex != 0 ? this.localSoundEventIndex : this.worldSoundEventIndex;
var1.worldSoundEventId = this.worldSoundEventIndex;
class="kw">return var1;
}
@Nonnull
@Override
class="kw">public String toString() {
class="kw">return "ItemAppearanceCondition{particles="
+ Arrays.toString(this.particles)
+ ", firstPersonParticles="
+ Arrays.toString(this.firstPersonParticles)
+ ", worldSoundEventId='"
+ this.worldSoundEventId
+ "', localSoundEventId='"
+ this.localSoundEventId
+ "', model='"
+ this.model
+ "', texture='"
+ this.texture
+ "', condition="
+ this.condition
+ ", conditionValueType="
+ this.conditionValueType
+ ", modelVFXId="
+ this.modelVFXId
+ "}";
}
}