类 SweepAttackEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.entity.EntityEvent
net.neoforged.neoforge.event.entity.living.LivingEvent
net.neoforged.neoforge.event.entity.player.PlayerEvent
net.neoforged.neoforge.event.entity.player.SweepAttackEvent
- 所有已实现的接口:
net.neoforged.bus.api.ICancellableEvent
public class SweepAttackEvent
extends PlayerEvent
implements net.neoforged.bus.api.ICancellableEvent
The SweepAttackEvent is fired when a
Player
attacks a target, after the CriticalHitEvent
has been fired.
This event can be used to force an attack to trigger a sweep, or to prevent a sweep from occurring.
This event is fired on both the logical client and logical server.
-
嵌套类概要
从类继承的嵌套类/接口 net.neoforged.neoforge.event.entity.player.PlayerEvent
PlayerEvent.BreakSpeed, PlayerEvent.Clone, PlayerEvent.HarvestCheck, PlayerEvent.ItemCraftedEvent, PlayerEvent.ItemSmeltedEvent, PlayerEvent.LoadFromFile, PlayerEvent.NameFormat, PlayerEvent.PlayerChangedDimensionEvent, PlayerEvent.PlayerChangeGameModeEvent, PlayerEvent.PlayerLoggedInEvent, PlayerEvent.PlayerLoggedOutEvent, PlayerEvent.PlayerRespawnEvent, PlayerEvent.SaveToFile, PlayerEvent.StartTracking, PlayerEvent.StopTracking, PlayerEvent.TabListNameFormat
从类继承的嵌套类/接口 net.neoforged.neoforge.event.entity.living.LivingEvent
LivingEvent.LivingJumpEvent, LivingEvent.LivingVisibilityEvent
从类继承的嵌套类/接口 net.neoforged.neoforge.event.entity.EntityEvent
EntityEvent.EnteringSection, EntityEvent.EntityConstructing, EntityEvent.Size
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明Returns the target of the attack, which is guaranteed to be a valid attack target.boolean
Returns true if the attack will be trigger a sweep.boolean
Returns true if the attack would cause a sweep by utilizing the vanilla rules.void
setCanceled
(boolean canceled) Cancels the event, preventing further event handlers from acting.void
setSweeping
(boolean sweep) 从类继承的方法 net.neoforged.neoforge.event.entity.player.PlayerEvent
getEntity
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 net.neoforged.bus.api.ICancellableEvent
isCanceled
-
字段详细资料
-
target
-
isVanillaSweep
private final boolean isVanillaSweep -
isSweeping
private boolean isSweeping
-
-
构造器详细资料
-
SweepAttackEvent
-
-
方法详细资料
-
getTarget
Returns the target of the attack, which is guaranteed to be a valid attack target. -
isVanillaSweep
public boolean isVanillaSweep()Returns true if the attack would cause a sweep by utilizing the vanilla rules.The vanilla rules are as follows. All of them must be true for a vanilla sweep to occur:
- The player's attack strength is greater than 90%.
- The attack is not a critical hit, or is a critical hit which does not disable the sweep attack.
- The player is on the ground.
- The distance the player has traveled this tick is less than their speed.
- The player's weapon supports sweep attacks via
ItemAbilities.SWORD_SWEEP
.
-
isSweeping
public boolean isSweeping()Returns true if the attack will be trigger a sweep. -
setSweeping
public void setSweeping(boolean sweep) - 参数:
sweep
- Whether to enable a sweep for this attack.
-
setCanceled
public void setCanceled(boolean canceled) Cancels the event, preventing further event handlers from acting. Canceling the event will use the current value ofisSweeping()
.If you intend to perform a custom sweep attack, you should cancel the event and
setSweeping(boolean)
to false before performing your handling.- 指定者:
setCanceled
在接口中net.neoforged.bus.api.ICancellableEvent
-