PathManager class

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

Файл: com/hypixel/hytale/server/npc/entities/PathManager.java

Поля (3)

МодификаторыТипИмя
WorldPathData var3
WorldGenId var4
int var5

Методы (5)

МодификаторыВозвратСигнатура
if if(this.currentPath == null)
if if(this.currentPathHint == null)
public boolean isFollowingPathboolean isFollowingPath()
public void setPrefabPathvoid setPrefabPath(@Nonnull UUID var1, @Nonnull IPrefabPath var2)
public void setTransientPathvoid setTransientPath(@Nonnull IPath<?> var1)

Исходный код

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

class="kw">import com.hypixel.hytale.builtin.path.WorldPathData;
class="kw">import com.hypixel.hytale.builtin.path.path.IPrefabPath;
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.component.ComponentAccessor;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.WorldGenId;
class="kw">import com.hypixel.hytale.server.core.universe.world.path.IPath;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import java.util.UUID;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;

class="kw">public class PathManager {
   @Nonnull
   class="kw">public class="kw">static class="kw">final BuilderCodec<PathManager> CODEC = BuilderCodec.builder(PathManager.class, PathManager::new)
      .append(new KeyedCodec<>("CurrentPath", Codec.UUID_BINARY), (var0, var1) -> var0.currentPathHint = var1, var0 -> var0.currentPathHint)
      .setVersionRange(5, 5)
      .add()
      .build();
   @Nullable
   class="kw">private UUID currentPathHint;
   @Nullable
   class="kw">private IPath<?> currentPath;

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

   class="kw">public void setPrefabPath(@Nonnull UUID var1, @Nonnull IPrefabPath var2) {
      this.currentPathHint = var1;
      this.currentPath = var2;
   }

   class="kw">public void setTransientPath(@Nonnull IPath<?> var1) {
      this.currentPathHint = null;
      this.currentPath = var1;
   }

   class="kw">public boolean isFollowingPath() {
      class="kw">return this.currentPathHint != null || this.currentPath != null;
   }

   @Nullable
   class="kw">public UUID getCurrentPathHint() {
      class="kw">return this.currentPathHint;
   }

   @Nullable
   class="kw">public IPath<?> getPath(@Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2) {
      if (this.currentPath == null) {
         if (this.currentPathHint == null) {
            class="kw">return null;
         }

         WorldPathData var3 = var2.getResource(WorldPathData.getResourceType());
         WorldGenId var4 = var2.getComponent(var1, WorldGenId.getComponentType());
         int var5 = var4 != null ? var4.getWorldGenId() : 0;
         this.currentPath = var3.getPrefabPath(var5, this.currentPathHint, false);
      }

      class="kw">return this.currentPath;
   }
}