Class ArtifactUtils

java.lang.Object
com.binaris.wizardry.core.ArtifactUtils

public final class ArtifactUtils extends Object
Various utility methods for use by artifacts. These are all static methods, so there is no need to ever instantiate this class. Normally we use these methods to make more good-looking QuickArtifactEffect lambdas and avoid creating loads of classes with the same logic (specially referred to predicates and similar).
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    findMatchingWandAndCast(net.minecraft.world.entity.player.Player player, Spell spell)
    Helper method that scans through all wands on the given player's hotbar and offhand and casts the given spell if it is bound to any of them.
    static boolean
    findMatchingWandAndExecute(net.minecraft.world.entity.player.Player player, Spell spell, Consumer<? super net.minecraft.world.item.ItemStack> action)
    Helper method that scans through all wands on the given player's hotbar and offhand and executes the given action if any of them have the given spell bound to them.
    static void
    handleLightningEffect(net.minecraft.world.entity.Entity player, net.minecraft.world.entity.LivingEntity target, EBLivingHurtEvent event)
     
    static boolean
    meleeRing(net.minecraft.world.damagesource.DamageSource source, Element element)
    Check if the source isn't melee (like a projectile, explosion or something like that), the direct entity isn't null and if it's a living one, and finally check the main hand for seeing the wand element.

    Methods inherited from class java.lang.Object

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

    • meleeRing

      public static boolean meleeRing(net.minecraft.world.damagesource.DamageSource source, Element element)
      Check if the source isn't melee (like a projectile, explosion or something like that), the direct entity isn't null and if it's a living one, and finally check the main hand for seeing the wand element. Quite weird but this logic is shared for a lot of artifacts
    • findMatchingWandAndCast

      public static boolean findMatchingWandAndCast(net.minecraft.world.entity.player.Player player, Spell spell)
      Helper method that scans through all wands on the given player's hotbar and offhand and casts the given spell if it is bound to any of them. This is a useful code pattern for artifact effects.
    • findMatchingWandAndExecute

      public static boolean findMatchingWandAndExecute(net.minecraft.world.entity.player.Player player, Spell spell, Consumer<? super net.minecraft.world.item.ItemStack> action)
      Helper method that scans through all wands on the given player's hotbar and offhand and executes the given action if any of them have the given spell bound to them. This is a useful code pattern for artifact effects.
    • handleLightningEffect

      public static void handleLightningEffect(net.minecraft.world.entity.Entity player, net.minecraft.world.entity.LivingEntity target, EBLivingHurtEvent event)