BenchSlot class
Пакет: com.hypixel.hytale.server.core.asset.type.blocktype.config.bench
Файл: com/hypixel/hytale/server/core/asset/type/blocktype/config/bench/Bench.java
Поля (3)
| Модификаторы | Тип | Имя |
|---|---|---|
|
public static final BuilderCodec<Bench.BenchSlot> |
CODEC |
|
protected String |
icon |
|
Bench.BenchSlot |
var2 |
Методы (5)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
public boolean |
equalspublic boolean equals(@Nullable Object var1) |
|
public String |
getIconpublic String getIcon() |
|
public int |
hashCodepublic int hashCode() |
|
|
if if(this == var1) |
|
public String |
toStringpublic String toString() |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.asset.type.blocktype.config.bench;
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.codecs.array.ArrayCodec;
class="kw">import com.hypixel.hytale.codec.lookup.ObjectCodecMapCodec;
class="kw">import com.hypixel.hytale.protocol.BenchType;
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 com.hypixel.hytale.server.core.modules.interaction.interaction.config.RootInteraction;
class="kw">import java.util.Arrays;
class="kw">import java.util.EnumMap;
class="kw">import java.util.Map;
class="kw">import java.util.Objects;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">public class="kw">abstract class Bench class="kw">implements NetworkSerializable<com.hypixel.hytale.protocol.Bench> {
class="kw">public class="kw">static class="kw">final ObjectCodecMapCodec<BenchType, Bench> CODEC = new ObjectCodecMapCodec<>("Type", new EnumCodec<>(BenchType.class));
class="kw">public class="kw">static class="kw">final BuilderCodec<Bench> BASE_CODEC = BuilderCodec.abstractBuilder(Bench.class)
.append(new KeyedCodec<>("Id", Codec.STRING), (var0, var1) -> var0.id = var1, var0 -> var0.id)
.add()
.append(new KeyedCodec<>("DescriptiveLabel", Codec.STRING), (var0, var1) -> var0.descriptiveLabel = var1, var0 -> var0.descriptiveLabel)
.add()
.appendInherited(
new KeyedCodec<>("TierLevels", new ArrayCodec<>(BenchTierLevel.CODEC, BenchTierLevel[]::new)),
(var0, var1) -> var0.tierLevels = var1,
var0 -> var0.tierLevels,
(var0, var1) -> var0.tierLevels = var1.tierLevels
)
.add()
.<String>append(
new KeyedCodec<>("LocalOpenSoundEventId", Codec.STRING), (var0, var1) -> var0.localOpenSoundEventId = var1, var0 -> var0.localOpenSoundEventId
)
.addValidator(SoundEvent.VALIDATOR_CACHE.getValidator())
.addValidator(SoundEventValidators.ONESHOT)
.add()
.<String>append(
new KeyedCodec<>("LocalCloseSoundEventId", Codec.STRING), (var0, var1) -> var0.localCloseSoundEventId = var1, var0 -> var0.localCloseSoundEventId
)
.addValidator(SoundEvent.VALIDATOR_CACHE.getValidator())
.addValidator(SoundEventValidators.ONESHOT)
.add()
.<String>append(
new KeyedCodec<>("CompletedSoundEventId", Codec.STRING), (var0, var1) -> var0.completedSoundEventId = var1, var0 -> var0.completedSoundEventId
)
.addValidator(SoundEvent.VALIDATOR_CACHE.getValidator())
.addValidator(SoundEventValidators.MONO)
.addValidator(SoundEventValidators.ONESHOT)
.add()
.<String>append(new KeyedCodec<>("FailedSoundEventId", Codec.STRING), (var0, var1) -> var0.failedSoundEventId = var1, var0 -> var0.failedSoundEventId)
.addValidator(SoundEvent.VALIDATOR_CACHE.getValidator())
.addValidator(SoundEventValidators.MONO)
.addValidator(SoundEventValidators.ONESHOT)
.add()
.<String>append(
new KeyedCodec<>("BenchUpgradeSoundEventId", Codec.STRING),
(var0, var1) -> var0.benchUpgradeSoundEventId = var1,
var0 -> var0.benchUpgradeSoundEventId
)
.addValidator(SoundEvent.VALIDATOR_CACHE.getValidator())
.addValidator(SoundEventValidators.MONO)
.addValidator(SoundEventValidators.ONESHOT)
.add()
.<String>append(
new KeyedCodec<>("BenchUpgradeCompletedSoundEventId", Codec.STRING),
(var0, var1) -> var0.benchUpgradeCompletedSoundEventId = var1,
var0 -> var0.benchUpgradeCompletedSoundEventId
)
.addValidator(SoundEvent.VALIDATOR_CACHE.getValidator())
.addValidator(SoundEventValidators.MONO)
.addValidator(SoundEventValidators.ONESHOT)
.add()
.afterDecode(var0 -> {
var0.type = CODEC.getIdFor((Class<? class="kw">extends Bench>)var0.getClass());
if (var0.localOpenSoundEventId != null) {
var0.localOpenSoundEventIndex = SoundEvent.getAssetMap().getIndex(var0.localOpenSoundEventId);
}
if (var0.localCloseSoundEventId != null) {
var0.localCloseSoundEventIndex = SoundEvent.getAssetMap().getIndex(var0.localCloseSoundEventId);
}
if (var0.completedSoundEventId != null) {
var0.completedSoundEventIndex = SoundEvent.getAssetMap().getIndex(var0.completedSoundEventId);
}
if (var0.benchUpgradeSoundEventId != null) {
var0.benchUpgradeSoundEventIndex = SoundEvent.getAssetMap().getIndex(var0.benchUpgradeSoundEventId);
}
if (var0.benchUpgradeCompletedSoundEventId != null) {
var0.benchUpgradeCompletedSoundEventIndex = SoundEvent.getAssetMap().getIndex(var0.benchUpgradeCompletedSoundEventId);
}
if (var0.failedSoundEventId != null) {
var0.failedSoundEventIndex = SoundEvent.getAssetMap().getIndex(var0.failedSoundEventId);
}
})
.build();
@Deprecated(forRemoval = true)
class="kw">protected class="kw">static class="kw">final Map<BenchType, RootInteraction> BENCH_INTERACTIONS = new EnumMap<>(BenchType.class);
@Nonnull
class="kw">protected BenchType type = BenchType.Crafting;
class="kw">protected String id;
class="kw">protected String descriptiveLabel;
class="kw">protected BenchTierLevel[] tierLevels;
@Nullable
class="kw">protected String localOpenSoundEventId = null;
class="kw">protected class="kw">transient int localOpenSoundEventIndex = 0;
@Nullable
class="kw">protected String localCloseSoundEventId = null;
class="kw">protected class="kw">transient int localCloseSoundEventIndex = 0;
@Nullable
class="kw">protected String completedSoundEventId = null;
class="kw">protected class="kw">transient int completedSoundEventIndex = 0;
@Nullable
class="kw">protected String failedSoundEventId = null;
class="kw">protected class="kw">transient int failedSoundEventIndex = 0;
@Nullable
class="kw">protected String benchUpgradeSoundEventId = null;
class="kw">protected class="kw">transient int benchUpgradeSoundEventIndex = 0;
@Nullable
class="kw">protected String benchUpgradeCompletedSoundEventId = null;
class="kw">protected class="kw">transient int benchUpgradeCompletedSoundEventIndex = 0;
class="kw">public Bench() {
}
class="kw">public BenchType getType() {
class="kw">return this.type;
}
class="kw">public String getId() {
class="kw">return this.id;
}
class="kw">public String getDescriptiveLabel() {
class="kw">return this.descriptiveLabel;
}
class="kw">public BenchTierLevel getTierLevel(int var1) {
class="kw">return this.tierLevels != null && var1 >= 1 && var1 <= this.tierLevels.length ? this.tierLevels[var1 - 1] : null;
}
class="kw">public BenchUpgradeRequirement getUpgradeRequirement(int var1) {
BenchTierLevel var2 = this.getTierLevel(var1);
class="kw">return var2 == null ? null : var2.upgradeRequirement;
}
@Nullable
class="kw">public String getLocalOpenSoundEventId() {
class="kw">return this.localOpenSoundEventId;
}
class="kw">public int getLocalOpenSoundEventIndex() {
class="kw">return this.localOpenSoundEventIndex;
}
@Nullable
class="kw">public String getLocalCloseSoundEventId() {
class="kw">return this.localCloseSoundEventId;
}
class="kw">public int getLocalCloseSoundEventIndex() {
class="kw">return this.localCloseSoundEventIndex;
}
@Nullable
class="kw">public String getCompletedSoundEventId() {
class="kw">return this.completedSoundEventId;
}
class="kw">public int getCompletedSoundEventIndex() {
class="kw">return this.completedSoundEventIndex;
}
@Nullable
class="kw">public String getFailedSoundEventId() {
class="kw">return this.failedSoundEventId;
}
class="kw">public int getFailedSoundEventIndex() {
class="kw">return this.failedSoundEventIndex;
}
@Nullable
class="kw">public String getBenchUpgradeSoundEventId() {
class="kw">return this.benchUpgradeSoundEventId;
}
class="kw">public int getBenchUpgradeSoundEventIndex() {
class="kw">return this.benchUpgradeSoundEventIndex;
}
@Nullable
class="kw">public String getBenchUpgradeCompletedSoundEventId() {
class="kw">return this.benchUpgradeCompletedSoundEventId;
}
class="kw">public int getBenchUpgradeCompletedSoundEventIndex() {
class="kw">return this.benchUpgradeCompletedSoundEventIndex;
}
@Nullable
class="kw">public RootInteraction getRootInteraction() {
class="kw">return BENCH_INTERACTIONS.get(this.type);
}
class="kw">public com.hypixel.hytale.protocol.Bench toPacket() {
com.hypixel.hytale.protocol.Bench var1 = new com.hypixel.hytale.protocol.Bench();
if (this.tierLevels != null && this.tierLevels.length > 0) {
var1.benchTierLevels = new com.hypixel.hytale.protocol.BenchTierLevel[this.tierLevels.length];
for (int var2 = 0; var2 < this.tierLevels.length; var2++) {
var1.benchTierLevels[var2] = this.tierLevels[var2].toPacket();
}
}
class="kw">return var1;
}
@Override
class="kw">public boolean equals(Object var1) {
if (var1 != null && this.getClass() == var1.getClass()) {
Bench var2 = (Bench)var1;
class="kw">return this.localOpenSoundEventIndex == var2.localOpenSoundEventIndex
&& this.localCloseSoundEventIndex == var2.localCloseSoundEventIndex
&& this.completedSoundEventIndex == var2.completedSoundEventIndex
&& this.benchUpgradeSoundEventIndex == var2.benchUpgradeSoundEventIndex
&& this.benchUpgradeCompletedSoundEventIndex == var2.benchUpgradeCompletedSoundEventIndex
&& this.type == var2.type
&& Objects.equals(this.id, var2.id)
&& Objects.equals(this.descriptiveLabel, var2.descriptiveLabel)
&& Objects.deepEquals(this.tierLevels, var2.tierLevels)
&& Objects.equals(this.localOpenSoundEventId, var2.localOpenSoundEventId)
&& Objects.equals(this.localCloseSoundEventId, var2.localCloseSoundEventId)
&& Objects.equals(this.completedSoundEventId, var2.completedSoundEventId)
&& Objects.equals(this.failedSoundEventId, var2.failedSoundEventId)
&& Objects.equals(this.benchUpgradeSoundEventId, var2.benchUpgradeSoundEventId)
&& Objects.equals(this.benchUpgradeCompletedSoundEventId, var2.benchUpgradeCompletedSoundEventId);
} else {
class="kw">return false;
}
}
@Override
class="kw">public int hashCode() {
class="kw">return Objects.hash(
this.type,
this.id,
this.descriptiveLabel,
Arrays.hashCode(this.tierLevels),
this.localOpenSoundEventId,
this.localOpenSoundEventIndex,
this.localCloseSoundEventId,
this.localCloseSoundEventIndex,
this.completedSoundEventId,
this.completedSoundEventIndex,
this.failedSoundEventId,
this.failedSoundEventIndex,
this.benchUpgradeSoundEventId,
this.benchUpgradeSoundEventIndex,
this.benchUpgradeCompletedSoundEventId,
this.benchUpgradeCompletedSoundEventIndex
);
}
@Override
class="kw">public String toString() {
class="kw">return "Bench{type="
+ this.type
+ ", id='"
+ this.id
+ "', descriptiveLabel='"
+ this.descriptiveLabel
+ "', tierLevels="
+ Arrays.toString(this.tierLevels)
+ ", localOpenSoundEventId='"
+ this.localOpenSoundEventId
+ "', localOpenSoundEventIndex="
+ this.localOpenSoundEventIndex
+ ", localCloseSoundEventId='"
+ this.localCloseSoundEventId
+ "', localCloseSoundEventIndex="
+ this.localCloseSoundEventIndex
+ ", completedSoundEventId='"
+ this.completedSoundEventId
+ "', completedSoundEventIndex="
+ this.completedSoundEventIndex
+ ", failedSoundEventId='"
+ this.failedSoundEventId
+ "', failedSoundEventIndex="
+ this.failedSoundEventIndex
+ ", benchUpgradeSoundEventId='"
+ this.benchUpgradeSoundEventId
+ "', benchUpgradeSoundEventIndex="
+ this.benchUpgradeSoundEventIndex
+ ", benchUpgradeCompletedSoundEventId='"
+ this.benchUpgradeCompletedSoundEventId
+ "', benchUpgradeCompletedSoundEventIndex="
+ this.benchUpgradeCompletedSoundEventIndex
+ "}";
}
@Deprecated(forRemoval = true)
class="kw">public class="kw">static void registerRootInteraction(BenchType var0, RootInteraction var1) {
BENCH_INTERACTIONS.put(var0, var1);
}
class="kw">public class="kw">static class BenchSlot {
class="kw">public class="kw">static class="kw">final BuilderCodec<Bench.BenchSlot> CODEC = BuilderCodec.builder(Bench.BenchSlot.class, Bench.BenchSlot::new)
.append(new KeyedCodec<>("Icon", Codec.STRING), (var0, var1) -> var0.icon = var1, var0 -> var0.icon)
.add()
.build();
class="kw">protected String icon;
class="kw">protected BenchSlot() {
}
class="kw">public String getIcon() {
class="kw">return this.icon;
}
@Override
class="kw">public boolean equals(@Nullable Object var1) {
if (this == var1) {
class="kw">return true;
} else if (var1 != null && this.getClass() == var1.getClass()) {
Bench.BenchSlot var2 = (Bench.BenchSlot)var1;
class="kw">return this.icon != null ? this.icon.equals(var2.icon) : var2.icon == null;
} else {
class="kw">return false;
}
}
@Override
class="kw">public int hashCode() {
class="kw">return this.icon != null ? this.icon.hashCode() : 0;
}
@Nonnull
@Override
class="kw">public String toString() {
class="kw">return "BenchSlot{icon='" + this.icon + "'}";
}
}
}