Class EntityUtil

java.lang.Object
com.binaris.wizardry.api.content.util.EntityUtil

public final class EntityUtil extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    applyStandardKnockback(net.minecraft.world.entity.Entity attacker, net.minecraft.world.entity.LivingEntity target, float strength)
     
    static boolean
    attackEntityWithoutKnockback(net.minecraft.world.entity.Entity entity, net.minecraft.world.damagesource.DamageSource source, float amount)
     
    static boolean
    canDamageBlocks(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.level.Level world)
    Determines whether the given entity is allowed to damage blocks in the given world, this doesn't check specific block properties, just whether the entity in general can damage blocks.
    static net.minecraft.world.phys.Vec3
    findSpaceForTeleport(net.minecraft.world.entity.Entity entity, net.minecraft.world.phys.Vec3 destination, boolean accountForPassengers)
    Finds the nearest space to the specified position that the given entity can teleport to without being inside one or more solid blocks.
    static int
    getDefaultAimingError(net.minecraft.world.Difficulty difficulty)
     
    static <T extends net.minecraft.world.entity.Entity>
    List<T>
    getEntitiesInRange(net.minecraft.world.level.Level world, double x, double y, double z, double range, Class<T> entityClass)
     
    static <T extends net.minecraft.world.entity.Entity>
    List<T>
    getEntitiesWithinCylinder(double radius, double x, double y, double z, double height, net.minecraft.world.level.Level world, Class<T> entityType)
     
    static <T extends net.minecraft.world.entity.Entity>
    List<T>
    getEntitiesWithinRadius(double radius, double x, double y, double z, net.minecraft.world.level.Level world, Class<T> entityType)
     
    static @Nullable net.minecraft.world.entity.Entity
    getEntityByUUID(net.minecraft.world.level.Level world, @Nullable UUID id)
     
    static List<net.minecraft.world.entity.LivingEntity>
    getLivingEntitiesInRange(net.minecraft.world.level.Level world, double x, double y, double z, double range)
     
    static List<net.minecraft.world.entity.LivingEntity>
    getLivingWithinCylinder(double radius, double x, double y, double z, double height, net.minecraft.world.level.Level world)
     
    static List<net.minecraft.world.entity.LivingEntity>
    getLivingWithinRadius(double radius, double x, double y, double z, net.minecraft.world.level.Level world)
     
    static @Nullable net.minecraft.world.entity.Entity
    getRider(net.minecraft.world.entity.Entity entity)
     
    static net.minecraft.world.item.ItemStack
    getWandInUse(net.minecraft.world.entity.player.Player player)
     
    static boolean
    isCasting(net.minecraft.world.entity.LivingEntity caster, Spell spell)
     
    static boolean
    isLiving(net.minecraft.world.entity.Entity entity)
     
    static void
    playSoundAtPlayer(net.minecraft.world.entity.player.Player player, net.minecraft.sounds.SoundEvent sound, float volume, float pitch)
     
    static SpellTier
    populateSpells(List<Spell> spells, Element e, boolean master, int n, net.minecraft.util.RandomSource random)
    Adds n random spells to the given list.
    static void
    undoGravity(net.minecraft.world.entity.Entity entity)
     

    Methods inherited from class java.lang.Object

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

    • undoGravity

      public static void undoGravity(net.minecraft.world.entity.Entity entity)
    • getEntityByUUID

      @Nullable public static @Nullable net.minecraft.world.entity.Entity getEntityByUUID(net.minecraft.world.level.Level world, @Nullable @Nullable UUID id)
    • getLivingEntitiesInRange

      public static List<net.minecraft.world.entity.LivingEntity> getLivingEntitiesInRange(net.minecraft.world.level.Level world, double x, double y, double z, double range)
    • getLivingWithinRadius

      public static List<net.minecraft.world.entity.LivingEntity> getLivingWithinRadius(double radius, double x, double y, double z, net.minecraft.world.level.Level world)
    • getEntitiesInRange

      public static <T extends net.minecraft.world.entity.Entity> List<T> getEntitiesInRange(net.minecraft.world.level.Level world, double x, double y, double z, double range, Class<T> entityClass)
    • getEntitiesWithinRadius

      public static <T extends net.minecraft.world.entity.Entity> List<T> getEntitiesWithinRadius(double radius, double x, double y, double z, net.minecraft.world.level.Level world, Class<T> entityType)
    • isLiving

      public static boolean isLiving(net.minecraft.world.entity.Entity entity)
    • attackEntityWithoutKnockback

      public static boolean attackEntityWithoutKnockback(net.minecraft.world.entity.Entity entity, net.minecraft.world.damagesource.DamageSource source, float amount)
    • getRider

      @Nullable public static @Nullable net.minecraft.world.entity.Entity getRider(net.minecraft.world.entity.Entity entity)
    • findSpaceForTeleport

      public static net.minecraft.world.phys.Vec3 findSpaceForTeleport(net.minecraft.world.entity.Entity entity, net.minecraft.world.phys.Vec3 destination, boolean accountForPassengers)
      Finds the nearest space to the specified position that the given entity can teleport to without being inside one or more solid blocks. The search volume is twice the size of the entity's bounding box (meaning that when teleported to the returned position, the original destination remains within the entity's bounding box).
      Parameters:
      entity - The entity being teleported
      destination - The target position to search around
      accountForPassengers - True to take passengers into account when searching for a space, false to ignore them
      Returns:
      The resulting position, or null if no space was found.
    • getLivingWithinCylinder

      public static List<net.minecraft.world.entity.LivingEntity> getLivingWithinCylinder(double radius, double x, double y, double z, double height, net.minecraft.world.level.Level world)
    • getEntitiesWithinCylinder

      public static <T extends net.minecraft.world.entity.Entity> List<T> getEntitiesWithinCylinder(double radius, double x, double y, double z, double height, net.minecraft.world.level.Level world, Class<T> entityType)
    • canDamageBlocks

      public static boolean canDamageBlocks(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.level.Level world)
      Determines whether the given entity is allowed to damage blocks in the given world, this doesn't check specific block properties, just whether the entity in general can damage blocks.
      Parameters:
      entity - The entity to check.
      world - The world in which the entity is attempting to damage blocks.
      Returns:
      True if the entity can damage blocks, false otherwise.
    • getDefaultAimingError

      public static int getDefaultAimingError(net.minecraft.world.Difficulty difficulty)
    • playSoundAtPlayer

      public static void playSoundAtPlayer(net.minecraft.world.entity.player.Player player, net.minecraft.sounds.SoundEvent sound, float volume, float pitch)
    • isCasting

      public static boolean isCasting(net.minecraft.world.entity.LivingEntity caster, Spell spell)
    • populateSpells

      public static SpellTier populateSpells(List<Spell> spells, Element e, boolean master, int n, net.minecraft.util.RandomSource random)
      Adds n random spells to the given list. The spells will be of the given element if possible. Extracted as a separate function since it was the same in both EntityWizard and EntityEvilWizard.
      Parameters:
      spells - The spell list to be populated.
      e - The element that the spells should belong to, or Elements.MAGIC for a random element each time.
      master - Whether to include master spells.
      n - The number of spells to add.
      random - A random number generator to use.
      Returns:
      The tier of the highest-tier spell that was added to the list.
    • getWandInUse

      public static net.minecraft.world.item.ItemStack getWandInUse(net.minecraft.world.entity.player.Player player)
    • applyStandardKnockback

      public static void applyStandardKnockback(net.minecraft.world.entity.Entity attacker, net.minecraft.world.entity.LivingEntity target, float strength)