Class LodestoneEnchantmentEffectCommonsHelper

java.lang.Object
team.lodestar.lodestone.systems.enchanting.LodestoneEnchantmentEffectCommonsHelper

public class LodestoneEnchantmentEffectCommonsHelper extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Predicate<net.minecraft.world.entity.LivingEntity>
    attackPredicate(net.minecraft.world.entity.LivingEntity attacker)
    Creates a predicate to determine valid attack targets for the given attacker.
    static boolean
    disableShield(net.minecraft.world.entity.LivingEntity shieldUser, net.minecraft.world.item.ItemStack stack, int duration)
    Disables the shield for the given duration.
    static boolean
    disableShield(net.minecraft.world.entity.LivingEntity shieldUser, net.minecraft.world.item.ItemStack stack, int duration, boolean swing)
    Disables the shield for the given duration.
    static boolean
    isChargedAttack(net.minecraft.world.entity.LivingEntity attacker)
    Determines if the attack from the attacker is a charged attack using the default vanilla threshold of 0.9.
    static boolean
    isChargedAttack(net.minecraft.world.entity.LivingEntity attacker, float threshold)
    Determines if the attack from the attacker is a charged attack based on the given threshold.

    Methods inherited from class java.lang.Object

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

    • LodestoneEnchantmentEffectCommonsHelper

      public LodestoneEnchantmentEffectCommonsHelper()
  • Method Details

    • isChargedAttack

      public static boolean isChargedAttack(net.minecraft.world.entity.LivingEntity attacker)
      Determines if the attack from the attacker is a charged attack using the default vanilla threshold of 0.9.
      Parameters:
      attacker - the entity performing the attack
      Returns:
      true if the attack is charged, false otherwise
    • isChargedAttack

      public static boolean isChargedAttack(net.minecraft.world.entity.LivingEntity attacker, float threshold)
      Determines if the attack from the attacker is a charged attack based on the given threshold.
      Parameters:
      attacker - the entity performing the attack
      threshold - the threshold for considering an attack as charged (between 0 and 1, vanilla uses 0.9)
      Returns:
      true if the attack is charged, false otherwise
    • disableShield

      public static boolean disableShield(net.minecraft.world.entity.LivingEntity shieldUser, net.minecraft.world.item.ItemStack stack, int duration)
      Disables the shield for the given duration. If the user is a player, it adds a cooldown to the shield item.
      Parameters:
      shieldUser - the entity using the shield
      stack - the shield item
      duration - the duration of the cooldown
      Returns:
      true if the shield was successfully disabled, false if it was already on cooldown
    • disableShield

      public static boolean disableShield(net.minecraft.world.entity.LivingEntity shieldUser, net.minecraft.world.item.ItemStack stack, int duration, boolean swing)
      Disables the shield for the given duration. If the user is a player, it adds a cooldown to the shield item.
      Parameters:
      shieldUser - the entity using the shield
      stack - the shield item
      duration - the duration of the cooldown
      swing - whether to make the entity swing their arm
      Returns:
      true if the shield was successfully disabled, false if it was already on cooldown
    • attackPredicate

      public static Predicate<net.minecraft.world.entity.LivingEntity> attackPredicate(net.minecraft.world.entity.LivingEntity attacker)
      Creates a predicate to determine valid attack targets for the given attacker. Seeks to be somewhat fair when used for area of effect damage
      Parameters:
      attacker - the entity performing the attack
      Returns:
      a predicate that returns true for valid attack targets