InteractionTarget enum
Пакет: com.hypixel.hytale.server.core.modules.interaction.interaction.util
Файл: com/hypixel/hytale/server/core/modules/interaction/interaction/util/InteractionTarget.java
Поля (1)
| Модификаторы | Тип | Имя |
|---|---|---|
|
USER,
OWNER, |
TARGET |
Методы (2)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
return |
switchreturn switch(this) |
|
return |
switchreturn switch(this) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.modules.interaction.interaction.util;
class="kw">import com.hypixel.hytale.codec.codecs.EnumCodec;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.server.core.entity.InteractionContext;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">public enum InteractionTarget {
USER,
OWNER,
TARGET;
@Nonnull
class="kw">public class="kw">static class="kw">final EnumCodec<InteractionTarget> CODEC = new EnumCodec<>(InteractionTarget.class)
.documentKey(USER, "Causes the interaction to target the entity that triggered/owns the interaction chain.")
.documentKey(OWNER, "Causes the interaction to target the entity that owns the interaction chain.")
.documentKey(TARGET, "Causes the interaction to target the entity that is the target of the interaction chain.");
InteractionTarget() {
}
@Nullable
class="kw">public Ref<EntityStore> getEntity(@Nonnull InteractionContext var1, @Nonnull Ref<EntityStore> var2) {
class="kw">return class="kw">switch (this) {
case USER -> var1.getEntity();
case OWNER -> var1.getOwningEntity();
case TARGET -> var1.getTargetEntity();
};
}
@Nonnull
class="kw">public com.hypixel.hytale.protocol.InteractionTarget toProtocol() {
class="kw">return class="kw">switch (this) {
case USER -> com.hypixel.hytale.protocol.InteractionTarget.User;
case OWNER -> com.hypixel.hytale.protocol.InteractionTarget.Owner;
case TARGET -> com.hypixel.hytale.protocol.InteractionTarget.Target;
};
}
}