Class EntityUtil
java.lang.Object
com.binaris.wizardry.api.content.util.EntityUtil
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidapplyStandardKnockback(net.minecraft.world.entity.Entity attacker, net.minecraft.world.entity.LivingEntity target, float strength) static booleanattackEntityWithoutKnockback(net.minecraft.world.entity.Entity entity, net.minecraft.world.damagesource.DamageSource source, float amount) static booleancanDamageBlocks(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.Vec3findSpaceForTeleport(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 intgetDefaultAimingError(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.EntitygetEntityByUUID(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.EntitygetRider(net.minecraft.world.entity.Entity entity) static net.minecraft.world.item.ItemStackgetWandInUse(net.minecraft.world.entity.player.Player player) static booleanstatic booleanisLiving(net.minecraft.world.entity.Entity entity) static voidplaySoundAtPlayer(net.minecraft.world.entity.player.Player player, net.minecraft.sounds.SoundEvent sound, float volume, float pitch) static SpellTierpopulateSpells(List<Spell> spells, Element e, boolean master, int n, net.minecraft.util.RandomSource random) Adds n random spells to the given list.static voidundoGravity(net.minecraft.world.entity.Entity entity)
-
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
-
getEntitiesWithinRadius
-
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 teleporteddestination- The target position to search aroundaccountForPassengers- 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
-
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
-
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, orElements.MAGICfor 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)
-