DisplayNameSupport class

Пакет: com.hypixel.hytale.server.npc.role.support

Файл: com/hypixel/hytale/server/npc/role/support/DisplayNameSupport.java

implements: Component<EntityStore>

Поля (11)

МодификаторыТипИмя
return
return
DisplayNameSupport var2
PersistentDisplayName var3
Message var4
PersistentDisplayName var4
Nameplate var5
Message var5
Message var6
Nameplate var6
Message var7

Методы (23)

МодификаторыВозвратСигнатура
public void handleNominatedDisplayNamevoid handleNominatedDisplayName(@Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2)
if if(this.nominatedDisplayName != null)
if if(var3 != null)
if if(var1 != null)
if if(var1 != null && var1.length != 0)
if if(var1 != null && var1.length != 0)
if if(var4 != null)
if if(var1 != null)
public void nominateDisplayNamevoid nominateDisplayName(@Nonnull String var1)
public void pickRandomDisplayNamevoid pickRandomDisplayName(@Nonnull Holder<EntityStore> var1, boolean var2)
public void pickRandomDisplayNamevoid pickRandomDisplayName(@Nonnull Ref<EntityStore> var1, boolean var2, @Nonnull ComponentAccessor<EntityStore> var3)
static void setDisplayNamevoid setDisplayName(@Nonnull Holder<EntityStore> var0, @Nonnull String var1)
static void setDisplayNamevoid setDisplayName(@Nonnull Holder<EntityStore> var0, @Nullable String var1, boolean var2)
static void setDisplayNamevoid setDisplayName(@Nonnull Ref<EntityStore> var0, @Nonnull String var1, @Nonnull ComponentAccessor<EntityStore> var2)
static void setDisplayNamevoid setDisplayName(@Nonnull Ref<EntityStore> var0, @Nullable String var1, boolean var2, @Nonnull ComponentAccessor<EntityStore> var3)
abstract setDisplayName setDisplayName(var1, this.nominatedDisplayName, var2)
abstract setDisplayName setDisplayName(var0, var1, true)
abstract setDisplayName setDisplayName(var0, var1, true, var2)
public void setDisplayNamesvoid setDisplayNames(@Nullable String[] var1)
static void setRandomDisplayNamevoid setRandomDisplayName(@Nonnull Ref<EntityStore> var0, @Nullable String[] var1, boolean var2, @Nonnull ComponentAccessor<EntityStore> var3)
static void setRandomDisplayNamevoid setRandomDisplayName(@Nonnull Holder<EntityStore> var0, @Nullable String[] var1, boolean var2)
abstract setRandomDisplayName setRandomDisplayName(var1, this.displayNames, var2)
abstract setRandomDisplayName setRandomDisplayName(var1, this.displayNames, var2, var3)

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.server.npc.role.support;

class="kw">import com.hypixel.hytale.component.Component;
class="kw">import com.hypixel.hytale.component.ComponentAccessor;
class="kw">import com.hypixel.hytale.component.ComponentType;
class="kw">import com.hypixel.hytale.component.Holder;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.math.util.MathUtil;
class="kw">import com.hypixel.hytale.server.core.Message;
class="kw">import com.hypixel.hytale.server.core.entity.nameplate.Nameplate;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.DisplayNameComponent;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.PersistentDisplayName;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import com.hypixel.hytale.server.npc.NPCPlugin;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;

class="kw">public class DisplayNameSupport class="kw">implements Component<EntityStore> {
   @Nullable
   class="kw">private String[] displayNames;
   @Nullable
   class="kw">private String nominatedDisplayName;

   @Nonnull
   class="kw">public class="kw">static ComponentType<EntityStore, DisplayNameSupport> getComponentType() {
      class="kw">return NPCPlugin.get().getDisplayNameSupportComponentType();
   }

   @Nonnull
   class="kw">public class="kw">static DisplayNameSupport get(@Nonnull Ref<EntityStore> var0, @Nonnull ComponentAccessor<EntityStore> var1) {
      DisplayNameSupport var2 = var1.getComponent(var0, getComponentType());
      assert var2 != null : "Missing DisplayNameSupport on entity " + var0;
      class="kw">return var2;
   }

   class="kw">public DisplayNameSupport() {
   }

   class="kw">public void setDisplayNames(@Nullable String[] var1) {
      this.displayNames = var1;
   }

   @Nullable
   class="kw">public String[] getDisplayNames() {
      class="kw">return this.displayNames;
   }

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

   class="kw">public void handleNominatedDisplayName(@Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2) {
      if (this.nominatedDisplayName != null) {
         setDisplayName(var1, this.nominatedDisplayName, var2);
      }

      this.nominatedDisplayName = null;
   }

   class="kw">public void pickRandomDisplayName(@Nonnull Holder<EntityStore> var1, boolean var2) {
      setRandomDisplayName(var1, this.displayNames, var2);
   }

   class="kw">public void pickRandomDisplayName(@Nonnull Ref<EntityStore> var1, boolean var2, @Nonnull ComponentAccessor<EntityStore> var3) {
      setRandomDisplayName(var1, this.displayNames, var2, var3);
   }

   class="kw">public class="kw">static void setDisplayName(@Nonnull Holder<EntityStore> var0, @Nonnull String var1) {
      setDisplayName(var0, var1, true);
   }

   class="kw">public class="kw">static void setDisplayName(@Nonnull Holder<EntityStore> var0, @Nullable String var1, boolean var2) {
      PersistentDisplayName var3 = var0.getComponent(PersistentDisplayName.getComponentType());
      if (var3 != null) {
         Message var4 = var3.getDisplayName();
         if (var4 != null && !var4.getAnsiMessage().isEmpty() && !var2) {
            class="kw">return;
         }
      }

      Message var6 = var1 != null ? Message.raw(var1) : null;
      var0.putComponent(PersistentDisplayName.getComponentType(), new PersistentDisplayName(var6));
      var0.putComponent(DisplayNameComponent.getComponentType(), new DisplayNameComponent(var6));
      if (var1 != null) {
         Nameplate var5 = var0.ensureAndGetComponent(Nameplate.getComponentType());
         var5.setText(var1);
      } else {
         var0.removeComponent(Nameplate.getComponentType());
      }
   }

   class="kw">public class="kw">static void setRandomDisplayName(@Nonnull Ref<EntityStore> var0, @Nullable String[] var1, boolean var2, @Nonnull ComponentAccessor<EntityStore> var3) {
      if (var1 != null && var1.length != 0) {
         setDisplayName(var0, var1[MathUtil.randomInt(0, var1.length)], var2, var3);
      }
   }

   class="kw">public class="kw">static void setRandomDisplayName(@Nonnull Holder<EntityStore> var0, @Nullable String[] var1, boolean var2) {
      if (var1 != null && var1.length != 0) {
         setDisplayName(var0, var1[MathUtil.randomInt(0, var1.length)], var2);
      }
   }

   class="kw">public class="kw">static void setDisplayName(@Nonnull Ref<EntityStore> var0, @Nonnull String var1, @Nonnull ComponentAccessor<EntityStore> var2) {
      setDisplayName(var0, var1, true, var2);
   }

   class="kw">public class="kw">static void setDisplayName(@Nonnull Ref<EntityStore> var0, @Nullable String var1, boolean var2, @Nonnull ComponentAccessor<EntityStore> var3) {
      if (var0.isValid()) {
         PersistentDisplayName var4 = var3.getComponent(var0, PersistentDisplayName.getComponentType());
         if (var4 != null) {
            Message var5 = var4.getDisplayName();
            if (var5 != null && !var5.getAnsiMessage().isEmpty() && !var2) {
               class="kw">return;
            }
         }

         Message var7 = var1 != null ? Message.raw(var1) : null;
         var3.putComponent(var0, PersistentDisplayName.getComponentType(), new PersistentDisplayName(var7));
         var3.putComponent(var0, DisplayNameComponent.getComponentType(), new DisplayNameComponent(var7));
         if (var1 != null) {
            Nameplate var6 = var3.ensureAndGetComponent(var0, Nameplate.getComponentType());
            var6.setText(var1);
         } else {
            var3.removeComponent(var0, Nameplate.getComponentType());
         }
      }
   }

   @Override
   class="kw">public Component<EntityStore> clone() {
      class="kw">return this;
   }
}