TriggerVolume class
Пакет: com.hypixel.hytale.builtin.triggervolumes.component
Файл: com/hypixel/hytale/builtin/triggervolumes/component/TriggerVolume.java
implements: Component<EntityStore>
Поля (4)
| Модификаторы | Тип | Имя |
|---|---|---|
|
TriggerVolume |
var1 |
|
TriggerVolume |
var1 |
|
TriggerVolumeShape |
var5 |
|
VolumeEntry |
var6 |
Методы (9)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
int |
getPrefabIndexint getPrefabIndex() |
|
|
if if(this.conditions != null) |
|
|
if if(this.rejectionEffects != null) |
|
|
if if(this.rules != null) |
|
|
if if(this.color != null) |
public |
boolean |
isEnabledboolean isEnabled() |
public |
void |
setEnabledvoid setEnabled(boolean var1) |
public |
void |
setGroupLinkIdvoid setGroupLinkId(@Nullable String var1) |
public |
void |
setPrefabIndexvoid setPrefabIndex(int var1) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.triggervolumes.component;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.EntityTargetType;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.effect.TriggerCondition;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.effect.TriggerEffect;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.effect.TriggerRule;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.effect.TriggerVolumeCodecs;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.manager.ConditionTiming;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.manager.CooldownMode;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.manager.ProjectileSource;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.manager.RejectionDelayMode;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.manager.VolumeEntry;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.shape.BoxShape;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.shape.TriggerVolumeShape;
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.component.Component;
class="kw">import com.hypixel.hytale.math.vector.Vector3fUtil;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import java.util.ArrayList;
class="kw">import java.util.Collections;
class="kw">import java.util.EnumSet;
class="kw">import java.util.HashMap;
class="kw">import java.util.List;
class="kw">import java.util.Locale;
class="kw">import java.util.Map;
class="kw">import java.util.Set;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">import org.joml.Vector3d;
class="kw">import org.joml.Vector3f;
class="kw">public class TriggerVolume class="kw">implements Component<EntityStore> {
@Nonnull
class="kw">public class="kw">static class="kw">final BuilderCodec<TriggerVolume> CODEC = BuilderCodec.builder(TriggerVolume.class, TriggerVolume::new)
.append(new KeyedCodec<>("Shape", TriggerVolumeShape.CODEC), (var0, var1) -> var0.shape = var1, var0 -> var0.shape)
.add()
.append(
new KeyedCodec<>("Effects", TriggerVolumeCodecs.TOLERANT_EFFECTS, false),
(var0, var1) -> var0.effects = var1 != null ? List.of(var1) : null,
var0 -> var0.effects != null ? var0.effects.toArray(TriggerEffect[]::new) : null
)
.add()
.append(
new KeyedCodec<>("Conditions", TriggerVolumeCodecs.TOLERANT_CONDITIONS, false),
(var0, var1) -> var0.conditions = var1 != null ? List.of(var1) : null,
var0 -> var0.conditions != null ? var0.conditions.toArray(TriggerCondition[]::new) : null
)
.add()
.append(
new KeyedCodec<>("RejectionEffects", TriggerVolumeCodecs.TOLERANT_EFFECTS, false),
(var0, var1) -> var0.rejectionEffects = var1 != null ? List.of(var1) : null,
var0 -> var0.rejectionEffects != null ? var0.rejectionEffects.toArray(TriggerEffect[]::new) : null
)
.add()
.append(
new KeyedCodec<>("Rules", TriggerVolumeCodecs.TOLERANT_RULES, false),
(var0, var1) -> var0.rules = var1 != null ? List.of(var1) : null,
var0 -> var0.rules != null ? var0.rules.toArray(TriggerRule[]::new) : null
)
.add()
.append(new KeyedCodec<>("RulesActive", Codec.BOOLEAN, false), (var0, var1) -> var0.rulesActive = var1, var0 -> var0.rulesActive ? null : Boolean.FALSE)
.add()
.append(
new KeyedCodec<>("ConditionTiming", new EnumCodec<>(ConditionTiming.class), false),
(var0, var1) -> var0.conditionTiming = var1,
var0 -> var0.conditionTiming != ConditionTiming.AFTER_VOLUME_DELAY ? var0.conditionTiming : null
)
.add()
.append(
new KeyedCodec<>("RejectionDelayMode", new EnumCodec<>(RejectionDelayMode.class, EnumCodec.EnumStyle.LEGACY), false),
(var0, var1) -> var0.rejectionDelayMode = var1,
var0 -> var0.rejectionDelayMode != RejectionDelayMode.USE_VOLUME_DELAY ? var0.rejectionDelayMode : null
)
.add()
.append(new KeyedCodec<>("Enabled", Codec.BOOLEAN, false), (var0, var1) -> var0.enabled = var1, var0 -> var0.enabled)
.add()
.append(new KeyedCodec<>("TargetTypes", new ArrayCodec<>(new EnumCodec<>(EntityTargetType.class), EntityTargetType[]::new), false), (var0, var1) -> {
var0.targetTypes.clear();
Collections.addAll(var0.targetTypes, var1);
}, var0 -> var0.targetTypes.isEmpty() ? null : var0.targetTypes.toArray(EntityTargetType[]::new))
.add()
.append(new KeyedCodec<>("EffectAsset", Codec.STRING, false), (var0, var1) -> var0.effectAssetRef = var1, var0 -> var0.effectAssetRef)
.add()
.append(
new KeyedCodec<>("ProjectileSource", new EnumCodec<>(ProjectileSource.class), false),
(var0, var1) -> var0.projectileSource = var1 != null ? var1 : ProjectileSource.SHOOTER,
var0 -> var0.projectileSource != ProjectileSource.SHOOTER ? var0.projectileSource : null
)
.add()
.append(
new KeyedCodec<>("Tags", TriggerVolumeCodecs.TAGS, false), (var0, var1) -> var0.rawTags = var1, var0 -> var0.rawTags.isEmpty() ? null : var0.rawTags
)
.add()
.append(new KeyedCodec<>("KeepLoaded", Codec.BOOLEAN, false), (var0, var1) -> var0.keepLoaded = var1, var0 -> var0.keepLoaded)
.add()
.append(
new KeyedCodec<>("RotateEffectsOnPaste", Codec.BOOLEAN, false),
(var0, var1) -> var0.rotateEffectsOnPaste = var1,
var0 -> var0.rotateEffectsOnPaste ? null : Boolean.FALSE
)
.add()
.append(new KeyedCodec<>("Color", Vector3fUtil.CODEC, false), (var0, var1) -> var0.color = var1, var0 -> var0.color)
.add()
.append(
new KeyedCodec<>("ActivationDelay", Codec.FLOAT, false),
(var0, var1) -> var0.activationDelay = var1,
var0 -> var0.activationDelay > 0.0F ? var0.activationDelay : null
)
.add()
.append(
new KeyedCodec<>("CancelDelayedOnExit", Codec.BOOLEAN, false),
(var0, var1) -> var0.cancelDelayedEffectsOnExit = var1,
var0 -> var0.cancelDelayedEffectsOnExit ? Boolean.TRUE : null
)
.add()
.append(new KeyedCodec<>("Cooldown", Codec.FLOAT, false), (var0, var1) -> var0.cooldown = var1, var0 -> var0.cooldown > 0.0F ? var0.cooldown : null)
.add()
.append(new KeyedCodec<>("CooldownMode", Codec.STRING, false), (var0, var1) -> {
try {
var0.cooldownMode = CooldownMode.valueOf(var1.toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException var3) {
}
}, var0 -> var0.cooldownMode != CooldownMode.PER_ENTITY ? var0.cooldownMode.name() : null)
.add()
.append(new KeyedCodec<>("GroupLinkId", Codec.STRING, false), (var0, var1) -> var0.groupLinkId = var1, var0 -> var0.groupLinkId)
.add()
.append(
new KeyedCodec<>("PrefabIndex", Codec.INTEGER, false),
(var0, var1) -> var0.prefabIndex = var1,
var0 -> var0.prefabIndex >= 0 ? var0.prefabIndex : null
)
.add()
.append(new KeyedCodec<>("Name", Codec.STRING, false), (var0, var1) -> var0.name = var1, var0 -> var0.name)
.add()
.build();
@Nullable
class="kw">private TriggerVolumeShape shape;
@Nullable
class="kw">private List<TriggerEffect> effects;
@Nullable
class="kw">private List<TriggerCondition> conditions;
@Nullable
class="kw">private List<TriggerEffect> rejectionEffects;
@Nullable
class="kw">private List<TriggerRule> rules;
class="kw">private boolean rulesActive = true;
@Nonnull
class="kw">private ConditionTiming conditionTiming = ConditionTiming.AFTER_VOLUME_DELAY;
@Nonnull
class="kw">private RejectionDelayMode rejectionDelayMode = RejectionDelayMode.USE_VOLUME_DELAY;
class="kw">private boolean enabled = true;
@Nonnull
class="kw">private Set<EntityTargetType> targetTypes = EnumSet.of(EntityTargetType.PLAYER);
@Nonnull
class="kw">private ProjectileSource projectileSource = ProjectileSource.SHOOTER;
@Nullable
class="kw">private String effectAssetRef;
@Nonnull
class="kw">private Map<String, String> rawTags = Collections.emptyMap();
class="kw">private boolean keepLoaded;
class="kw">private boolean rotateEffectsOnPaste = true;
@Nullable
class="kw">private Vector3f color;
class="kw">private boolean cancelDelayedEffectsOnExit;
class="kw">private float activationDelay;
class="kw">private float cooldown;
@Nonnull
class="kw">private CooldownMode cooldownMode = CooldownMode.PER_ENTITY;
@Nullable
class="kw">private String groupLinkId;
class="kw">private int prefabIndex = -1;
@Nullable
class="kw">private String name;
class="kw">public TriggerVolume() {
}
@Nonnull
class="kw">public class="kw">static TriggerVolume fromVolumeEntry(@Nonnull VolumeEntry var0) {
TriggerVolume var1 = new TriggerVolume();
var1.shape = var0.getShape().copy();
var1.effects = var0.getEffects().isEmpty() ? null : TriggerEffect.deepCopyList(var0.getEffects());
var1.conditions = var0.getConditions().isEmpty() ? null : TriggerCondition.deepCopyList(var0.getConditions());
var1.rejectionEffects = var0.getRejectionEffects().isEmpty() ? null : TriggerEffect.deepCopyList(var0.getRejectionEffects());
var1.rules = var0.getRules().isEmpty() ? null : TriggerRule.deepCopyList(var0.getRules());
var1.rulesActive = var0.isRulesActive();
var1.conditionTiming = var0.getConditionTiming();
var1.rejectionDelayMode = var0.getRejectionDelayMode();
var1.enabled = var0.isEnabled();
var1.targetTypes = EnumSet.copyOf(var0.getTargetTypes());
var1.projectileSource = var0.getProjectileSource();
var1.effectAssetRef = var0.getEffectAssetRef();
var1.rawTags = var0.getRawTags();
var1.keepLoaded = var0.isKeepLoaded();
var1.rotateEffectsOnPaste = var0.isRotateEffectsOnPaste();
var1.color = var0.getColor() != null ? new Vector3f(var0.getColor()) : null;
var1.cancelDelayedEffectsOnExit = var0.isCancelDelayedEffectsOnExit();
var1.activationDelay = var0.getActivationDelay();
var1.cooldown = var0.getCooldown();
var1.cooldownMode = var0.getCooldownMode();
var1.groupLinkId = null;
var1.name = var0.getName();
class="kw">return var1;
}
@Nonnull
class="kw">public VolumeEntry toVolumeEntry(@Nonnull String var1, @Nonnull String var2, @Nonnull Vector3d var3) {
class="kw">return this.toVolumeEntry(var1, var2, var3, 0.0F);
}
@Nonnull
class="kw">public VolumeEntry toVolumeEntry(@Nonnull String var1, @Nonnull String var2, @Nonnull Vector3d var3, float var4) {
TriggerVolumeShape var5 = this.shape != null ? this.shape.copy() : new BoxShape();
var5.rotateInPlace(var4);
VolumeEntry var6 = new VolumeEntry(
var1,
var2,
var3,
var5,
this.effects != null ? TriggerEffect.deepCopyList(this.effects) : new ArrayList<>(),
EnumSet.copyOf(this.targetTypes),
this.enabled
);
if (this.conditions != null) {
var6.getConditions().addAll(TriggerCondition.deepCopyList(this.conditions));
}
if (this.rejectionEffects != null) {
var6.getRejectionEffects().addAll(TriggerEffect.deepCopyList(this.rejectionEffects));
}
if (this.rules != null) {
var6.getRules().addAll(TriggerRule.deepCopyList(this.rules));
}
var6.setRulesActive(this.rulesActive);
var6.setConditionTiming(this.conditionTiming);
var6.setRejectionDelayMode(this.rejectionDelayMode);
var6.setEffectAssetRef(this.effectAssetRef);
var6.setKeepLoaded(this.keepLoaded);
if (this.color != null) {
var6.setColor(new Vector3f(this.color));
}
var6.setProjectileSource(this.projectileSource);
var6.setActivationDelay(this.activationDelay);
var6.setCancelDelayedEffectsOnExit(this.cancelDelayedEffectsOnExit);
var6.setCooldown(this.cooldown);
var6.setCooldownMode(this.cooldownMode);
var6.setRotateEffectsOnPaste(this.rotateEffectsOnPaste);
if (!this.rawTags.isEmpty()) {
var6.setTags(this.rawTags);
}
if (this.rotateEffectsOnPaste && Math.abs(var4) > 1.0E-6) {
var6.getEffects().forEach(var2x -> var2x.rotateInPlace(var4, var3));
var6.getRejectionEffects().forEach(var2x -> var2x.rotateInPlace(var4, var3));
var6.getConditions().forEach(var2x -> var2x.rotateInPlace(var4, var3));
var6.getRules().forEach(var2x -> var2x.rotateInPlace(var4, var3));
}
var6.setName(this.name);
class="kw">return var6;
}
@Nullable
class="kw">public String getGroupLinkId() {
class="kw">return this.groupLinkId;
}
class="kw">public void setGroupLinkId(@Nullable String var1) {
this.groupLinkId = var1;
}
class="kw">public int getPrefabIndex() {
class="kw">return this.prefabIndex;
}
class="kw">public void setPrefabIndex(int var1) {
this.prefabIndex = var1;
}
@Nonnull
@Override
class="kw">public Component<EntityStore> clone() {
TriggerVolume var1 = new TriggerVolume();
var1.shape = this.shape != null ? this.shape.copy() : null;
var1.effects = this.effects != null ? TriggerEffect.deepCopyList(this.effects) : null;
var1.conditions = this.conditions != null ? TriggerCondition.deepCopyList(this.conditions) : null;
var1.rejectionEffects = this.rejectionEffects != null ? TriggerEffect.deepCopyList(this.rejectionEffects) : null;
var1.rules = this.rules != null ? TriggerRule.deepCopyList(this.rules) : null;
var1.rulesActive = this.rulesActive;
var1.conditionTiming = this.conditionTiming;
var1.rejectionDelayMode = this.rejectionDelayMode;
var1.enabled = this.enabled;
var1.targetTypes = EnumSet.copyOf(this.targetTypes);
var1.projectileSource = this.projectileSource;
var1.effectAssetRef = this.effectAssetRef;
var1.rawTags = this.rawTags.isEmpty() ? Collections.emptyMap() : new HashMap<>(this.rawTags);
var1.keepLoaded = this.keepLoaded;
var1.rotateEffectsOnPaste = this.rotateEffectsOnPaste;
var1.color = this.color != null ? new Vector3f(this.color) : null;
var1.cancelDelayedEffectsOnExit = this.cancelDelayedEffectsOnExit;
var1.activationDelay = this.activationDelay;
var1.cooldown = this.cooldown;
var1.cooldownMode = this.cooldownMode;
var1.groupLinkId = this.groupLinkId;
var1.prefabIndex = this.prefabIndex;
var1.name = this.name;
class="kw">return var1;
}
@Nullable
class="kw">public TriggerVolumeShape getShape() {
class="kw">return this.shape;
}
@Nullable
class="kw">public List<TriggerEffect> getEffects() {
class="kw">return this.effects;
}
class="kw">public boolean isEnabled() {
class="kw">return this.enabled;
}
class="kw">public void setEnabled(boolean var1) {
this.enabled = var1;
}
}