TriggerVolumeSnapshot class
Пакет: com.hypixel.hytale.builtin.triggervolumes.snapshot
Файл: com/hypixel/hytale/builtin/triggervolumes/snapshot/TriggerVolumeSnapshot.java
implements: SelectionSnapshot<TriggerVolumeSnapshot>
Поля (15)
| Модификаторы | Тип | Имя |
|---|---|---|
|
CREATE,
DELETE, |
MUTATE |
|
yield |
null |
|
yield |
null |
|
yield |
null |
final |
TriggerVolumeSnapshot.SnapshotType |
type |
|
HashMap |
var1 |
|
VolumeEntry |
var10 |
|
TriggerVolumeSnapshot |
var11 |
|
yield |
var11 |
|
TriggerVolumesPlugin |
var5 |
|
TriggerVolumeManager |
var6 |
|
VolumeEntry |
var7 |
|
TriggerVolumeSnapshot |
var8 |
|
yield |
var8 |
|
VolumeEntry |
var9 |
Методы (26)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
|
SnapshotType SnapshotType() |
static |
TriggerVolumeSnapshot |
captureStateTriggerVolumeSnapshot captureState(@Nonnull TriggerVolumeSnapshot.SnapshotType var0, @Nonnull VolumeEntry var1) |
abstract |
return |
captureStatereturn captureState(TriggerVolumeSnapshot.SnapshotType.DELETE, var0) |
abstract |
return |
captureStatereturn captureState(TriggerVolumeSnapshot.SnapshotType.MUTATE, var0) |
|
|
if if(var6 == null) |
|
|
if if(var10 == null) |
|
|
if if(this.position != null
&& this.shape != null
&& this.conditions != null
&& this.effects != null
&& this.rejectionEffects != null
&& this.conditionTiming != null
&& this.rejectionDelayMode != null
&& this.targetTypes != null
&& this.projectileSource != null) |
|
|
if if(this.cooldownMode != null) |
|
|
if if(this.rawTags != null) |
|
|
if if(var7 == null) |
|
|
if if(this.position != null) |
|
|
if if(this.shape != null) |
|
|
if if(this.effects != null) |
|
|
if if(this.conditions != null) |
|
|
if if(this.rejectionEffects != null) |
|
|
if if(this.conditionTiming != null) |
|
|
if if(this.rejectionDelayMode != null) |
|
|
if if(this.targetTypes != null) |
|
|
if if(this.projectileSource != null) |
|
|
if if(this.cooldownMode != null) |
|
|
if if(this.rawTags != null) |
static |
TriggerVolumeSnapshot |
ofCreateTriggerVolumeSnapshot ofCreate(@Nonnull VolumeEntry var0) |
abstract |
yield |
ofCreateyield ofCreate(var9) |
static |
TriggerVolumeSnapshot |
ofDeleteTriggerVolumeSnapshot ofDelete(@Nonnull VolumeEntry var0) |
static |
TriggerVolumeSnapshot |
ofMutateTriggerVolumeSnapshot ofMutate(@Nonnull VolumeEntry var0) |
|
return |
switchreturn switch(this.type) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.triggervolumes.snapshot;
class="kw">import com.hypixel.hytale.builtin.buildertools.snapshot.SelectionSnapshot;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.EntityTargetType;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.TriggerVolumesPlugin;
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.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.TriggerVolumeManager;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.manager.VolumeEntry;
class="kw">import com.hypixel.hytale.builtin.triggervolumes.shape.TriggerVolumeShape;
class="kw">import com.hypixel.hytale.component.ComponentAccessor;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.server.core.universe.PlayerRef;
class="kw">import com.hypixel.hytale.server.core.universe.world.World;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import java.util.EnumSet;
class="kw">import java.util.HashMap;
class="kw">import java.util.List;
class="kw">import java.util.Map;
class="kw">import java.util.Set;
class="kw">import java.util.Map.Entry;
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 TriggerVolumeSnapshot class="kw">implements SelectionSnapshot<TriggerVolumeSnapshot> {
class="kw">private class="kw">final TriggerVolumeSnapshot.SnapshotType type;
class="kw">private class="kw">final String volumeId;
class="kw">private class="kw">final String worldName;
@Nullable
class="kw">private class="kw">final Vector3d position;
@Nullable
class="kw">private class="kw">final TriggerVolumeShape shape;
@Nullable
class="kw">private class="kw">final List<TriggerCondition> conditions;
@Nullable
class="kw">private class="kw">final List<TriggerEffect> effects;
@Nullable
class="kw">private class="kw">final List<TriggerEffect> rejectionEffects;
@Nullable
class="kw">private class="kw">final ConditionTiming conditionTiming;
@Nullable
class="kw">private class="kw">final RejectionDelayMode rejectionDelayMode;
@Nullable
class="kw">private class="kw">final Set<EntityTargetType> targetTypes;
@Nullable
class="kw">private class="kw">final ProjectileSource projectileSource;
class="kw">private class="kw">final boolean enabled;
class="kw">private class="kw">final boolean keepLoaded;
class="kw">private class="kw">final boolean rotateEffectsOnPaste;
class="kw">private class="kw">final boolean fromWorldGen;
class="kw">private class="kw">final boolean cancelDelayedEffectsOnExit;
class="kw">private class="kw">final float activationDelay;
class="kw">private class="kw">final float cooldown;
@Nullable
class="kw">private class="kw">final CooldownMode cooldownMode;
@Nullable
class="kw">private class="kw">final String effectAssetRef;
@Nullable
class="kw">private class="kw">final String groupId;
@Nullable
class="kw">private class="kw">final Vector3f color;
@Nullable
class="kw">private class="kw">final Map<String, String> rawTags;
@Nullable
class="kw">private class="kw">final String name;
class="kw">private TriggerVolumeSnapshot(
@Nonnull TriggerVolumeSnapshot.SnapshotType var1,
@Nonnull String var2,
@Nonnull String var3,
@Nullable Vector3d var4,
@Nullable TriggerVolumeShape var5,
@Nullable List<TriggerCondition> var6,
@Nullable List<TriggerEffect> var7,
@Nullable List<TriggerEffect> var8,
@Nullable ConditionTiming var9,
@Nullable RejectionDelayMode var10,
@Nullable Set<EntityTargetType> var11,
@Nullable ProjectileSource var12,
boolean var13,
boolean var14,
boolean var15,
boolean var16,
boolean var17,
float var18,
float var19,
@Nullable CooldownMode var20,
@Nullable String var21,
@Nullable String var22,
@Nullable Vector3f var23,
@Nullable Map<String, String> var24,
@Nullable String var25
) {
this.type = var1;
this.volumeId = var2;
this.worldName = var3;
this.position = var4;
this.shape = var5;
this.conditions = var6;
this.effects = var7;
this.rejectionEffects = var8;
this.conditionTiming = var9;
this.rejectionDelayMode = var10;
this.targetTypes = var11;
this.projectileSource = var12;
this.enabled = var13;
this.keepLoaded = var14;
this.rotateEffectsOnPaste = var15;
this.fromWorldGen = var16;
this.cancelDelayedEffectsOnExit = var17;
this.activationDelay = var18;
this.cooldown = var19;
this.cooldownMode = var20;
this.effectAssetRef = var21;
this.groupId = var22;
this.color = var23;
this.rawTags = var24;
this.name = var25;
}
class="kw">public class="kw">static TriggerVolumeSnapshot ofCreate(@Nonnull VolumeEntry var0) {
class="kw">return new TriggerVolumeSnapshot(
TriggerVolumeSnapshot.SnapshotType.CREATE,
var0.getId(),
var0.getWorldName(),
null,
null,
null,
null,
null,
null,
null,
null,
ProjectileSource.SHOOTER,
true,
false,
true,
false,
true,
0.0F,
0.0F,
CooldownMode.PER_ENTITY,
null,
null,
null,
null,
null
);
}
class="kw">public class="kw">static TriggerVolumeSnapshot ofDelete(@Nonnull VolumeEntry var0) {
class="kw">return captureState(TriggerVolumeSnapshot.SnapshotType.DELETE, var0);
}
class="kw">public class="kw">static TriggerVolumeSnapshot ofMutate(@Nonnull VolumeEntry var0) {
class="kw">return captureState(TriggerVolumeSnapshot.SnapshotType.MUTATE, var0);
}
class="kw">private class="kw">static TriggerVolumeSnapshot captureState(@Nonnull TriggerVolumeSnapshot.SnapshotType var0, @Nonnull VolumeEntry var1) {
class="kw">return new TriggerVolumeSnapshot(
var0,
var1.getId(),
var1.getWorldName(),
new Vector3d(var1.getPosition()),
var1.getShape().copy(),
TriggerCondition.deepCopyList(var1.getConditions()),
TriggerEffect.deepCopyList(var1.getEffects()),
TriggerEffect.deepCopyList(var1.getRejectionEffects()),
var1.getConditionTiming(),
var1.getRejectionDelayMode(),
EnumSet.copyOf(var1.getTargetTypes()),
var1.getProjectileSource(),
var1.isEnabled(),
var1.isKeepLoaded(),
var1.isRotateEffectsOnPaste(),
var1.isFromWorldGen(),
var1.isCancelDelayedEffectsOnExit(),
var1.getActivationDelay(),
var1.getCooldown(),
var1.getCooldownMode(),
var1.getEffectAssetRef(),
var1.getGroupId(),
var1.getColor() != null ? new Vector3f(var1.getColor()) : null,
deepCopyTags(var1.getRawTags()),
var1.getName()
);
}
@Nonnull
class="kw">private class="kw">static Map<String, String> deepCopyTags(@Nonnull Map<String, String> var0) {
HashMap var1 = new HashMap<>(var0.size());
for (Entry var3 : var0.entrySet()) {
var1.put(var3.getKey(), var3.getValue());
}
class="kw">return var1;
}
@Nullable
class="kw">public TriggerVolumeSnapshot restore(@Nonnull Ref<EntityStore> var1, PlayerRef var2, World var3, ComponentAccessor<EntityStore> var4) {
TriggerVolumesPlugin var5 = TriggerVolumesPlugin.get();
TriggerVolumeManager var6 = var3.getEntityStore().getStore().getResource(var5.getManagerResourceType());
if (var6 == null) {
class="kw">return null;
}
class="kw">return class="kw">switch (this.type) {
case CREATE -> {
VolumeEntry var10 = var6.getVolume(this.volumeId);
if (var10 == null) {
yield null;
} else {
TriggerVolumeSnapshot var11 = ofDelete(var10);
var6.unregister(this.volumeId);
var6.notifyViewersRemove(this.volumeId);
yield var11;
}
}
case DELETE -> {
if (this.position != null
&& this.shape != null
&& this.conditions != null
&& this.effects != null
&& this.rejectionEffects != null
&& this.conditionTiming != null
&& this.rejectionDelayMode != null
&& this.targetTypes != null
&& this.projectileSource != null) {
VolumeEntry var9 = new VolumeEntry(
this.volumeId,
this.worldName,
new Vector3d(this.position),
this.shape.copy(),
TriggerEffect.deepCopyList(this.effects),
EnumSet.copyOf(this.targetTypes),
this.enabled
);
var9.getConditions().addAll(TriggerCondition.deepCopyList(this.conditions));
var9.getRejectionEffects().addAll(TriggerEffect.deepCopyList(this.rejectionEffects));
var9.setConditionTiming(this.conditionTiming);
var9.setRejectionDelayMode(this.rejectionDelayMode);
var9.setProjectileSource(this.projectileSource);
var9.setKeepLoaded(this.keepLoaded);
var9.setRotateEffectsOnPaste(this.rotateEffectsOnPaste);
var9.setFromWorldGen(this.fromWorldGen);
var9.setCancelDelayedEffectsOnExit(this.cancelDelayedEffectsOnExit);
var9.setActivationDelay(this.activationDelay);
var9.setCooldown(this.cooldown);
if (this.cooldownMode != null) {
var9.setCooldownMode(this.cooldownMode);
}
var9.setEffectAssetRef(this.effectAssetRef);
var9.setGroupId(this.groupId);
var9.setColor(this.color != null ? new Vector3f(this.color) : null);
if (this.rawTags != null) {
var9.setTags(deepCopyTags(this.rawTags));
}
var9.setName(this.name);
var6.register(this.volumeId, var9);
var6.notifyViewersAdd(var9);
yield ofCreate(var9);
} else {
yield null;
}
}
case MUTATE -> {
VolumeEntry var7 = var6.getVolume(this.volumeId);
if (var7 == null) {
yield null;
} else {
TriggerVolumeSnapshot var8 = ofMutate(var7);
if (this.position != null) {
var7.setPosition(new Vector3d(this.position));
}
if (this.shape != null) {
var7.setShape(this.shape.copy());
}
if (this.effects != null) {
var7.getEffects().clear();
var7.getEffects().addAll(TriggerEffect.deepCopyList(this.effects));
}
if (this.conditions != null) {
var7.getConditions().clear();
var7.getConditions().addAll(TriggerCondition.deepCopyList(this.conditions));
}
if (this.rejectionEffects != null) {
var7.getRejectionEffects().clear();
var7.getRejectionEffects().addAll(TriggerEffect.deepCopyList(this.rejectionEffects));
}
if (this.conditionTiming != null) {
var7.setConditionTiming(this.conditionTiming);
}
if (this.rejectionDelayMode != null) {
var7.setRejectionDelayMode(this.rejectionDelayMode);
}
if (this.targetTypes != null) {
var7.getTargetTypes().clear();
var7.getTargetTypes().addAll(this.targetTypes);
}
if (this.projectileSource != null) {
var7.setProjectileSource(this.projectileSource);
}
var7.setEnabled(this.enabled);
var7.setKeepLoaded(this.keepLoaded);
var7.setRotateEffectsOnPaste(this.rotateEffectsOnPaste);
var7.setFromWorldGen(this.fromWorldGen);
var7.setCancelDelayedEffectsOnExit(this.cancelDelayedEffectsOnExit);
var7.setActivationDelay(this.activationDelay);
var7.setCooldown(this.cooldown);
if (this.cooldownMode != null) {
var7.setCooldownMode(this.cooldownMode);
}
var7.setEffectAssetRef(this.effectAssetRef);
var7.setGroupId(this.groupId);
var7.setColor(this.color != null ? new Vector3f(this.color) : null);
if (this.rawTags != null) {
var7.setTags(deepCopyTags(this.rawTags));
}
var7.setName(this.name);
var6.markSpatialDirty();
var6.notifyViewersAdd(var7);
yield var8;
}
}
};
}
class="kw">public enum SnapshotType {
CREATE,
DELETE,
MUTATE;
SnapshotType() {
}
}
}