Class EntityUtils

java.lang.Object
com.github.skriptdev.skript.api.hytale.utils.EntityUtils

public class EntityUtils extends Object
Quick utility class for accessing entity components.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static @NotNull Pair<com.hypixel.hytale.server.core.entity.Entity, com.hypixel.hytale.server.core.modules.entity.item.ItemComponent>
    dropItem(com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store, com.hypixel.hytale.server.core.inventory.ItemStack itemStack, com.hypixel.hytale.math.vector.Location location, com.hypixel.hytale.math.vector.Vector3f velocity, float pickupDelay)
     
    static <ECS_TYPE, T extends com.hypixel.hytale.component.Component<ECS_TYPE>>
    T
    getComponent(com.hypixel.hytale.server.core.entity.Entity entity, com.hypixel.hytale.component.ComponentType<ECS_TYPE,T> type)
    Get a component from an Entity
    static @Nullable com.hypixel.hytale.server.core.modules.entitystats.EntityStatMap
    getEntityStatMap(com.hypixel.hytale.server.core.entity.LivingEntity entity)
    Get the EntityStatMap component of an entity.
    static @Nullable com.hypixel.hytale.server.core.entity.movement.MovementStatesComponent
    getMovementStatesComponent(com.hypixel.hytale.server.core.entity.Entity entity)
    Get the MovementStatesComponent of an entity.
    getName(com.hypixel.hytale.server.core.entity.Entity entity)
    Get the name of an Entity.
    getUUID(@NotNull com.hypixel.hytale.server.core.entity.Entity entity)
    Get the UUID of an Entity
    getVariableName(com.hypixel.hytale.server.core.entity.Entity entity)
     
    static void
    setNameplateName(com.hypixel.hytale.server.core.entity.Entity entity, @Nullable String name)
    Set the name of an Entity.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • EntityUtils

      public EntityUtils()
  • Method Details

    • getUUID

      @Nullable public static @Nullable UUID getUUID(@NotNull @NotNull com.hypixel.hytale.server.core.entity.Entity entity)
      Get the UUID of an Entity
      Parameters:
      entity - Entity to get UUID from
      Returns:
      UUID of the entity, or null if the entity has no UUID component
    • getName

      @NotNull public static @NotNull String getName(com.hypixel.hytale.server.core.entity.Entity entity)
      Get the name of an Entity.
      Parameters:
      entity - Entity to get name from
      Returns:
      Name of the entity, or null if the entity has no name component
    • getVariableName

      @NotNull public static @NotNull String getVariableName(com.hypixel.hytale.server.core.entity.Entity entity)
    • setNameplateName

      public static void setNameplateName(com.hypixel.hytale.server.core.entity.Entity entity, @Nullable @Nullable String name)
      Set the name of an Entity.
      Parameters:
      entity - Entity to set name on
      name - New name for the entity
    • getComponent

      @Nullable public static <ECS_TYPE, T extends com.hypixel.hytale.component.Component<ECS_TYPE>> T getComponent(com.hypixel.hytale.server.core.entity.Entity entity, com.hypixel.hytale.component.ComponentType<ECS_TYPE,T> type)
      Get a component from an Entity
      Type Parameters:
      ECS_TYPE - EntityStore Type
      T - Type of returned component
      Parameters:
      entity - Entity to get component from
      type - Component type to get
      Returns:
      Component from entity if available otherwise null
    • getEntityStatMap

      @Nullable public static @Nullable com.hypixel.hytale.server.core.modules.entitystats.EntityStatMap getEntityStatMap(com.hypixel.hytale.server.core.entity.LivingEntity entity)
      Get the EntityStatMap component of an entity.
      Parameters:
      entity - Entity to get component from
      Returns:
      EntityStatMap component of the entity, or null if not found
    • getMovementStatesComponent

      @Nullable public static @Nullable com.hypixel.hytale.server.core.entity.movement.MovementStatesComponent getMovementStatesComponent(com.hypixel.hytale.server.core.entity.Entity entity)
      Get the MovementStatesComponent of an entity.
      Parameters:
      entity - Entity to get component from
      Returns:
      MovementStatesComponent of the entity, or null if not found
    • dropItem

      @NotNull public static @NotNull Pair<com.hypixel.hytale.server.core.entity.Entity, com.hypixel.hytale.server.core.modules.entity.item.ItemComponent> dropItem(com.hypixel.hytale.component.Store<com.hypixel.hytale.server.core.universe.world.storage.EntityStore> store, com.hypixel.hytale.server.core.inventory.ItemStack itemStack, com.hypixel.hytale.math.vector.Location location, com.hypixel.hytale.math.vector.Vector3f velocity, float pickupDelay)