Class LodestoneEnchantmentEffectCommonsHelper
java.lang.Object
team.lodestar.lodestone.modules.toolkit.enchanting.LodestoneEnchantmentEffectCommonsHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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 booleandisableShield(net.minecraft.world.entity.LivingEntity shieldUser, net.minecraft.world.item.ItemStack stack, int duration) Disables the shield for the given duration.static booleandisableShield(net.minecraft.world.entity.LivingEntity shieldUser, net.minecraft.world.item.ItemStack stack, int duration, boolean swing) Disables the shield for the given duration.static booleanisChargedAttack(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 booleanisChargedAttack(net.minecraft.world.entity.LivingEntity attacker, float threshold) Determines if the attack from the attacker is a charged attack based on the given threshold.
-
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 attackthreshold- 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 shieldstack- the shield itemduration- 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 shieldstack- the shield itemduration- the duration of the cooldownswing- 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
-