GroupEntry class

Пакет: com.hypixel.hytale.builtin.triggervolumes.manager

Файл: com/hypixel/hytale/builtin/triggervolumes/manager/GroupEntry.java

Поля (5)

МодификаторыТипИмя
IntOpenHashSet var1
LinkedHashMap var1
String var4
String var4
String var5

Методы (25)

МодификаторыВозвратСигнатура
public void addMembervoid addMember(@Nonnull String var1)
void expandTagsvoid expandTags()
for for(TriggerCondition var5 : var1)
for for(TriggerEffect var5 : var1)
for for(TriggerEffect var5 : var1)
for for(TriggerRule var5 : var1)
public int getColorint getColor()
public boolean hasTagboolean hasTag(int var1)
if if(var5 != null)
if if(var5 != null)
if if(var5 != null)
if if(var5 != null)
public boolean isEnabledboolean isEnabled()
public boolean isRotateEffectsOnPasteboolean isRotateEffectsOnPaste()
public void removeMembervoid removeMember(@Nonnull String var1)
public void setColorvoid setColor(int var1)
public void setConditionTimingvoid setConditionTiming(@Nonnull ConditionTiming var1)
public void setEnabledvoid setEnabled(boolean var1)
public void setIdvoid setId(@Nonnull String var1)
public void setNamevoid setName(@Nullable String var1)
public void setOriginvoid setOrigin(@Nonnull Vector3d var1)
public void setRejectionDelayModevoid setRejectionDelayMode(@Nonnull RejectionDelayMode var1)
public void setRotateEffectsOnPastevoid setRotateEffectsOnPaste(boolean var1)
public void setTagsvoid setTags(@Nonnull Map<String, String> var1)
public void setWorldNamevoid setWorldName(@Nonnull String var1)

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.triggervolumes.manager;

class="kw">import com.hypixel.hytale.assetstore.AssetRegistry;
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.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.math.vector.Vector3dUtil;
class="kw">import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
class="kw">import it.unimi.dsi.fastutil.ints.IntSet;
class="kw">import it.unimi.dsi.fastutil.ints.IntSets;
class="kw">import java.util.ArrayList;
class="kw">import java.util.Collections;
class="kw">import java.util.EnumSet;
class="kw">import java.util.LinkedHashMap;
class="kw">import java.util.LinkedHashSet;
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">public class GroupEntry {
   @Nonnull
   class="kw">public class="kw">static class="kw">final BuilderCodec<GroupEntry> CODEC = BuilderCodec.builder(GroupEntry.class, GroupEntry::new)
      .append(new KeyedCodec<>("Origin", Vector3dUtil.CODEC), (var0, var1) -> var0.origin = var1, var0 -> var0.origin)
      .add()
      .append(new KeyedCodec<>("Conditions", TriggerVolumeCodecs.TOLERANT_CONDITIONS, false), (var0, var1) -> {
         for (TriggerCondition var5 : var1) {
            if (var5 != null) {
               var0.conditions.add(var5);
            }
         }
      }, var0 -> var0.conditions.isEmpty() ? null : var0.conditions.toArray(TriggerCondition[]::new))
      .add()
      .append(new KeyedCodec<>("Effects", TriggerVolumeCodecs.TOLERANT_EFFECTS, false), (var0, var1) -> {
         for (TriggerEffect var5 : var1) {
            if (var5 != null) {
               var0.effects.add(var5);
            }
         }
      }, var0 -> var0.effects.isEmpty() ? null : var0.effects.toArray(TriggerEffect[]::new))
      .add()
      .append(new KeyedCodec<>("RejectionEffects", TriggerVolumeCodecs.TOLERANT_EFFECTS, false), (var0, var1) -> {
         for (TriggerEffect var5 : var1) {
            if (var5 != null) {
               var0.rejectionEffects.add(var5);
            }
         }
      }, var0 -> var0.rejectionEffects.isEmpty() ? null : var0.rejectionEffects.toArray(TriggerEffect[]::new))
      .add()
      .append(new KeyedCodec<>("Rules", TriggerVolumeCodecs.TOLERANT_RULES, false), (var0, var1) -> {
         for (TriggerRule var5 : var1) {
            if (var5 != null) {
               var0.rules.add(var5);
            }
         }
      }, var0 -> var0.rules.isEmpty() ? null : var0.rules.toArray(TriggerRule[]::new))
      .add()
      .append(
         new KeyedCodec<>("ConditionTiming", new EnumCodec<>(ConditionTiming.class, EnumCodec.EnumStyle.LEGACY), 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<>("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<>("Enabled", Codec.BOOLEAN, false), (var0, var1) -> var0.enabled = var1, var0 -> var0.enabled)
      .add()
      .append(new KeyedCodec<>("Color", Codec.INTEGER, false), (var0, var1) -> var0.color = var1, var0 -> var0.color)
      .add()
      .append(new KeyedCodec<>("Tags", TriggerVolumeCodecs.TAGS, false), GroupEntry::setTags, var0 -> var0.rawTags.isEmpty() ? null : var0.rawTags)
      .add()
      .append(new KeyedCodec<>("Name", Codec.STRING, false), (var0, var1) -> var0.name = var1, var0 -> var0.name)
      .add()
      .append(
         new KeyedCodec<>("RotateEffectsOnPaste", Codec.BOOLEAN, false),
         (var0, var1) -> var0.rotateEffectsOnPaste = var1,
         var0 -> var0.rotateEffectsOnPaste ? null : Boolean.FALSE
      )
      .add()
      .build();
   @Nonnull
   class="kw">private String groupId = "";
   @Nullable
   class="kw">private String name;
   @Nonnull
   class="kw">private String worldName = "";
   @Nonnull
   class="kw">private Vector3d origin = new Vector3d();
   @Nonnull
   class="kw">private class="kw">final List<TriggerCondition> conditions;
   @Nonnull
   class="kw">private class="kw">final List<TriggerEffect> effects;
   @Nonnull
   class="kw">private class="kw">final List<TriggerEffect> rejectionEffects;
   @Nonnull
   class="kw">private class="kw">final List<TriggerRule> rules = new ArrayList<>();
   @Nonnull
   class="kw">private class="kw">final Set<EntityTargetType> targetTypes;
   @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;
   class="kw">private int color;
   @Nonnull
   class="kw">private Map<String, String> rawTags = Collections.emptyMap();
   @Nonnull
   class="kw">private IntSet expandedTagIndexes = IntSets.EMPTY_SET;
   class="kw">private boolean rotateEffectsOnPaste = true;
   @Nonnull
   class="kw">private class="kw">final Set<String> memberVolumeIds = new LinkedHashSet<>();

   GroupEntry() {
      this.conditions = new ArrayList<>();
      this.effects = new ArrayList<>();
      this.rejectionEffects = new ArrayList<>();
      this.targetTypes = EnumSet.of(EntityTargetType.PLAYER);
   }

   class="kw">public GroupEntry(
      @Nonnull String var1,
      @Nonnull String var2,
      @Nonnull Vector3d var3,
      @Nonnull List<TriggerEffect> var4,
      @Nonnull Set<EntityTargetType> var5,
      boolean var6,
      int var7
   ) {
      this.groupId = var1;
      this.worldName = var2;
      this.origin = var3;
      this.conditions = new ArrayList<>();
      this.effects = var4;
      this.rejectionEffects = new ArrayList<>();
      this.targetTypes = var5;
      this.enabled = var6;
      this.color = var7;
   }

   class="kw">public void setId(@Nonnull String var1) {
      this.groupId = var1;
   }

   class="kw">public void setWorldName(@Nonnull String var1) {
      this.worldName = var1;
   }

   @Nonnull
   class="kw">public String getId() {
      class="kw">return this.groupId;
   }

   @Nullable
   class="kw">public String getName() {
      class="kw">return this.name;
   }

   class="kw">public void setName(@Nullable String var1) {
      this.name = var1;
   }

   @Nonnull
   class="kw">public String getWorldName() {
      class="kw">return this.worldName;
   }

   @Nonnull
   class="kw">public Vector3d getOrigin() {
      class="kw">return this.origin;
   }

   class="kw">public void setOrigin(@Nonnull Vector3d var1) {
      this.origin = var1;
   }

   @Nonnull
   class="kw">public List<TriggerEffect> getEffects() {
      class="kw">return this.effects;
   }

   @Nonnull
   class="kw">public List<TriggerCondition> getConditions() {
      class="kw">return this.conditions;
   }

   @Nonnull
   class="kw">public List<TriggerEffect> getRejectionEffects() {
      class="kw">return this.rejectionEffects;
   }

   @Nonnull
   class="kw">public List<TriggerRule> getRules() {
      class="kw">return this.rules;
   }

   @Nonnull
   class="kw">public ConditionTiming getConditionTiming() {
      class="kw">return this.conditionTiming;
   }

   class="kw">public void setConditionTiming(@Nonnull ConditionTiming var1) {
      this.conditionTiming = var1;
   }

   @Nonnull
   class="kw">public RejectionDelayMode getRejectionDelayMode() {
      class="kw">return this.rejectionDelayMode;
   }

   class="kw">public void setRejectionDelayMode(@Nonnull RejectionDelayMode var1) {
      this.rejectionDelayMode = var1;
   }

   @Nonnull
   class="kw">public Set<EntityTargetType> getTargetTypes() {
      class="kw">return this.targetTypes;
   }

   class="kw">public boolean isRotateEffectsOnPaste() {
      class="kw">return this.rotateEffectsOnPaste;
   }

   class="kw">public void setRotateEffectsOnPaste(boolean var1) {
      this.rotateEffectsOnPaste = var1;
   }

   class="kw">public boolean isEnabled() {
      class="kw">return this.enabled;
   }

   class="kw">public void setEnabled(boolean var1) {
      this.enabled = var1;
   }

   class="kw">public int getColor() {
      class="kw">return this.color;
   }

   class="kw">public void setColor(int var1) {
      this.color = var1;
   }

   @Nonnull
   class="kw">public Set<String> getMemberVolumeIds() {
      class="kw">return this.memberVolumeIds;
   }

   class="kw">public void addMember(@Nonnull String var1) {
      this.memberVolumeIds.add(var1);
   }

   class="kw">public void removeMember(@Nonnull String var1) {
      this.memberVolumeIds.remove(var1);
   }

   @Nonnull
   class="kw">public Map<String, String> getRawTags() {
      class="kw">return this.rawTags;
   }

   class="kw">public void setTags(@Nonnull Map<String, String> var1) {
      this.rawTags = normalizeTags(var1);
      this.expandTags();
   }

   class="kw">public boolean hasTag(int var1) {
      class="kw">return this.expandedTagIndexes.contains(var1);
   }

   void expandTags() {
      if (this.rawTags.isEmpty()) {
         this.expandedTagIndexes = IntSets.EMPTY_SET;
      } else {
         IntOpenHashSet var1 = new IntOpenHashSet();

         for (Entry var3 : this.rawTags.entrySet()) {
            String var4 = var3.getKey();
            var1.add(AssetRegistry.getOrCreateTagIndex(var4));
            String var5 = var3.getValue();
            var1.add(AssetRegistry.getOrCreateTagIndex(var5));
            var1.add(AssetRegistry.getOrCreateTagIndex(var4 + "=" + var5));
         }

         this.expandedTagIndexes = IntSets.unmodifiable(var1);
      }
   }

   @Nonnull
   class="kw">private class="kw">static Map<String, String> normalizeTags(@Nonnull Map<String, String> var0) {
      if (var0.isEmpty()) {
         class="kw">return Collections.emptyMap();
      }

      LinkedHashMap var1 = new LinkedHashMap<>();

      for (Entry var3 : var0.entrySet()) {
         String var4 = var3.getKey().trim();
         if (!var4.isEmpty()) {
            var1.put(var4, TriggerVolumeCodecs.TaggedValue.normalize(var3.getValue()));
         }
      }

      class="kw">return var1.isEmpty() ? Collections.emptyMap() : Collections.unmodifiableMap(var1);
   }
}