ObjectiveLocationAreaRadius class

Пакет: com.hypixel.hytale.builtin.adventure.objectives.config.markerarea

Файл: com/hypixel/hytale/builtin/adventure/objectives/config/markerarea/ObjectiveLocationAreaRadius.java

extends: ObjectiveLocationMarkerArea

Поля (2)

МодификаторыТипИмя
Ref var5
TransformComponent var6

Методы (8)

МодификаторыВозвратСигнатура
public int getEntryAreaint getEntryArea()
public int getExitAreaint getExitArea()
static void getPlayersInAreavoid getPlayersInArea(@Nonnull SpatialResource<Ref<EntityStore>, EntityStore> var0, @Nonnull List<Ref<EntityStore>> var1, @Nonnull Vector3d var2, int var3)
abstract getPlayersInArea getPlayersInArea(var1, var2, var3, this.entryArea)
abstract getPlayersInArea getPlayersInArea(var1, var2, var3, this.exitArea)
if if(var0.exitArea < var0.entryArea)
if if(var5 == null)
abstract this this(5, 10)

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.adventure.objectives.config.markerarea;

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.validation.Validators;
class="kw">import com.hypixel.hytale.component.CommandBuffer;
class="kw">import com.hypixel.hytale.component.ComponentType;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.spatial.SpatialResource;
class="kw">import com.hypixel.hytale.math.shape.Box;
class="kw">import com.hypixel.hytale.math.vector.VectorSphereUtil;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
class="kw">import com.hypixel.hytale.server.core.universe.PlayerRef;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import java.util.List;
class="kw">import javax.annotation.Nonnull;
class="kw">import org.joml.Vector3d;

class="kw">public class ObjectiveLocationAreaRadius class="kw">extends ObjectiveLocationMarkerArea {
   @Nonnull
   class="kw">public class="kw">static class="kw">final BuilderCodec<ObjectiveLocationAreaRadius> CODEC = BuilderCodec.builder(
         ObjectiveLocationAreaRadius.class, ObjectiveLocationAreaRadius::new
      )
      .append(new KeyedCodec<>("EntryRadius", Codec.INTEGER), (var0, var1) -> var0.entryArea = var1, var0 -> var0.entryArea)
      .addValidator(Validators.greaterThan(0))
      .add()
      .<Integer>append(new KeyedCodec<>("ExitRadius", Codec.INTEGER), (var0, var1) -> var0.exitArea = var1, var0 -> var0.exitArea)
      .addValidator(Validators.greaterThan(0))
      .add()
      .validator((var0, var1) -> {
         if (var0.exitArea < var0.entryArea) {
            var1.fail("ExitRadius needs to be greater than EntryRadius");
         }
      })
      .afterDecode(ObjectiveLocationAreaRadius::computeAreaBoxes)
      .build();
   class="kw">public class="kw">static class="kw">final int DEFAULT_ENTRY_RADIUS = 5;
   class="kw">public class="kw">static class="kw">final int DEFAULT_EXIT_RADIUS = 10;
   class="kw">protected int entryArea;
   class="kw">protected int exitArea;

   class="kw">public ObjectiveLocationAreaRadius(int var1, int var2) {
      this.entryArea = var1;
      this.exitArea = var2;
      this.computeAreaBoxes();
   }

   class="kw">protected ObjectiveLocationAreaRadius() {
      this(5, 10);
   }

   class="kw">public int getEntryArea() {
      class="kw">return this.entryArea;
   }

   class="kw">public int getExitArea() {
      class="kw">return this.exitArea;
   }

   @Override
   class="kw">public void getPlayersInEntryArea(@Nonnull SpatialResource<Ref<EntityStore>, EntityStore> var1, @Nonnull List<Ref<EntityStore>> var2, @Nonnull Vector3d var3) {
      getPlayersInArea(var1, var2, var3, this.entryArea);
   }

   @Override
   class="kw">public void getPlayersInExitArea(@Nonnull SpatialResource<Ref<EntityStore>, EntityStore> var1, @Nonnull List<Ref<EntityStore>> var2, @Nonnull Vector3d var3) {
      getPlayersInArea(var1, var2, var3, this.exitArea);
   }

   @Override
   class="kw">public boolean hasPlayerInExitArea(
      @Nonnull SpatialResource<Ref<EntityStore>, EntityStore> var1,
      @Nonnull ComponentType<EntityStore, PlayerRef> var2,
      @Nonnull Vector3d var3,
      @Nonnull CommandBuffer<EntityStore> var4
   ) {
      Ref var5 = var1.getSpatialStructure().closest(var3);
      if (var5 == null) {
         class="kw">return false;
      }

      TransformComponent var6 = var4.getComponent(var5, TransformComponent.getComponentType());
      assert var6 != null;
      class="kw">return VectorSphereUtil.isInside(var3.x, var3.y, var3.z, this.exitArea, this.exitArea, this.exitArea, var6.getPosition());
   }

   @Override
   class="kw">public boolean isPlayerInEntryArea(@Nonnull Vector3d var1, @Nonnull Vector3d var2) {
      class="kw">return VectorSphereUtil.isInside(var2.x, var2.y, var2.z, this.entryArea, var1);
   }

   @Override
   class="kw">protected void computeAreaBoxes() {
      this.entryAreaBox = new Box(-this.entryArea, -this.entryArea, -this.entryArea, this.entryArea, this.entryArea, this.entryArea);
      this.exitAreaBox = new Box(-this.exitArea, -this.exitArea, -this.exitArea, this.exitArea, this.exitArea, this.exitArea);
   }

   class="kw">private class="kw">static void getPlayersInArea(
      @Nonnull SpatialResource<Ref<EntityStore>, EntityStore> var0, @Nonnull List<Ref<EntityStore>> var1, @Nonnull Vector3d var2, int var3
   ) {
      var0.getSpatialStructure().collect(var2, var3, var1);
   }

   @Nonnull
   @Override
   class="kw">public String toString() {
      class="kw">return "ObjectiveLocationAreaRadius{} " + super.toString();
   }
}