类 BlockEvent.BreakEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.level.BlockEvent
net.neoforged.neoforge.event.level.BlockEvent.BreakEvent
- 所有已实现的接口:
net.neoforged.bus.api.ICancellableEvent
- 封闭类:
BlockEvent
public static class BlockEvent.BreakEvent
extends BlockEvent
implements net.neoforged.bus.api.ICancellableEvent
This event is fired on the server when a player attempts to break a block, upon receipt of a block break packet.
The following conditions may cause this event to fire in a cancelled state:
.
- If
Player.blockActionRestricted(net.minecraft.world.level.Level, net.minecraft.core.BlockPos, net.minecraft.world.level.GameType)
is true. - If the target block is a
GameMasterBlock
andPlayer.canUseGameMasterBlocks()
is false. - If the the player is holding an item, and
引用无效
Item#canAttackBlock
引用无效
Item#canAttackBlock
-
嵌套类概要
从类继承的嵌套类/接口 net.neoforged.neoforge.event.level.BlockEvent
BlockEvent.BlockToolModificationEvent, BlockEvent.BreakEvent, BlockEvent.EntityMultiPlaceEvent, BlockEvent.EntityPlaceEvent, BlockEvent.FarmlandTrampleEvent, BlockEvent.FluidPlaceBlockEvent, BlockEvent.NeighborNotifyEvent, BlockEvent.PortalSpawnEvent
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明返回 the player who is attempting to break the block。void
setCanceled
(boolean canceled) Cancelling this event will prevent the block from being broken, and notifies the client of the refusal.从类继承的方法 net.neoforged.neoforge.event.level.BlockEvent
getLevel, getPos, getState
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 net.neoforged.bus.api.ICancellableEvent
isCanceled
-
字段详细资料
-
player
-
-
构造器详细资料
-
BreakEvent
-
-
方法详细资料
-
getPlayer
返回 the player who is attempting to break the block。- 返回:
- the player who is attempting to break the block
-
setCanceled
public void setCanceled(boolean canceled) Cancelling this event will prevent the block from being broken, and notifies the client of the refusal.- 指定者:
setCanceled
在接口中net.neoforged.bus.api.ICancellableEvent
-