Package com.binaris.wizardry.core
Class ArtifactUtils
java.lang.Object
com.binaris.wizardry.core.ArtifactUtils
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 TypeMethodDescriptionstatic booleanfindMatchingWandAndCast(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 booleanfindMatchingWandAndExecute(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 voidhandleLightningEffect(net.minecraft.world.entity.Entity player, net.minecraft.world.entity.LivingEntity target, EBLivingHurtEvent event) static booleanCheck 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.
-
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)
-