User Tools

Site Tools


tutorial:event_index

Event Index

This page is an index of all the events/callbacks provided in Fabric API, sorted by category. This page is a work in progress. Please help by contributing!

Descriptions for events should not begin with “An event…” as that is implied, and events should be sorted alphabetically in each category. Deprecated events should not be listed unless they have no replacement, in which case they should be marked as such.

You can get a list of all events in your IDE by getting a call hierarchy of fabric.api.event.EventFactory.createArrayBacked(Class<? super T>, Function<T[], T>). In IntelliJ you can use the hot-key Ctrl + Alt + H (Windows/Linux), ⌥ + ^ + H (macOS) with the method selected/hovered over; In Visual Studio, right-click → Show Call Hierarchy.

Client

  • ClientBlockEntityEvents.BLOCK_ENTITY_LOAD: Called when a BlockEntity is loaded into a ClientWorld. When this event is called, the block entity is already in the world.
  • ClientBlockEntityEvents.BLOCK_ENTITY_UNLOAD: Called when a BlockEntity is about to be unloaded from a ClientWorld. When this event is called, the block entity is still present in the world.
  • ClientChunkEvents.CHUNK_LOAD: Called when a chunk is loaded into a ClientWorld. When this event is called, the chunk is already in the world.
  • ClientChunkEvents.CHUNK_UNLOAD: Called when a chunk is about to be unloaded from a ClientWorld. When this event is called, the chunk is still present in the world.
  • ClientCommandRegistrationCallback.EVENT: For when client commands are registered to the dispatcher.
  • ClientEntityEvents.ENTITY_LOAD: Called when an Entity is loaded into a ClientWorld. When this event is called, the entity is already in the world.
  • ClientEntityEvents.ENTITY_UNLOAD: Called when an Entity is about to be unloaded from a ClientWorld. When this event is called, the entity is still present in the world.
  • ClientLifecycleEvents.CLIENT_STARTED: Called when Minecraft has started and it's client about to tick for the first time.
  • ClientLifecycleEvents.CLIENT_STOPPING: Called when Minecraft's client begins to stop.
  • ClientPickBlockApplyCallback.EVENT: Emitted during the block-picking process; can be used to modify the returned ItemStack, as well as nullify it.
  • ClientPickBlockGatherCallback.EVENT: Emitted at the beginning of the block-picking process to find any applicable ItemStack.
  • ClientTickEvents.END_CLIENT_TICK: Called at the end of the client tick.
  • ClientTickEvents.END_WORLD_TICK: Called at the end of the ClientWorld's tick.
  • ClientTickEvents.START_CLIENT_TICK: Called at the start of the client tick.
  • ClientTickEvents.START_WORLD_TICK: Called at the start of the ClientWorld's tick.
  • ItemTooltipCallback.EVENT: Called when an item stack's tooltip is rendered.
  • ScreenEvents.AFTER_INIT: Called after a screen is initialized to it's default state.
  • ScreenEvents.BEFORE_INIT: Called before a screen is initialized to it's default state.
  • TooltipComponentCallback.EVENT: Allows registering a mapping from TooltipData to TooltipComponent. This allows custom tooltips for items.

Commands

  • CommandRegistrationCallback: Called when a server registers all commands.

Entities (General)

  • EntityElytraEvents.ALLOW: For checking whether elytra flight is allowed.
  • EntityElytraEvents.CUSTOM: For granting elytra flight to entities not wearing an elytra.
  • EntitySleepEvents.ALLOW_BED: For checking whether a block is bed-like.
  • EntitySleepEvents.ALLOW_NEARBY_MONSTERS: For checking whether a player can sleep when monsters are nearby.
  • EntitySleepEvents.ALLOW_RESETTING_TIME: For checking whether a sleeping player allows for skipping the current day and resetting the time to 0.
  • EntitySleepEvents.ALLOW_SETTING_SPAWN: For checking whether a player's spawn can be set when sleeping.
  • EntitySleepEvents.ALLOW_SLEEPING: For checking whether a player can start to sleep in a bed-like block. Recommended to use the more specific ALLOW_SLEEP_TIME or ALLOW_NEARBY_MONSTERS for mod compatibility.
  • EntitySleepEvents.ALLOW_SLEEP_TIME: For checking whether the current time of day is valid for sleeping.
  • EntitySleepEvents.MODIFY_SLEEPING_DIRECTION: For modifying or providing a sleeping direction for a bed-like block. The sleeping direction is where the player's head is pointing when they're sleeping.
  • EntitySleepEvents.MODIFY_WAKE_UP_POSITION: For modifying or providing a wake-up position for an entity waking up.
  • EntitySleepEvents.SET_BED_OCCUPATION_STATE: For setting whether a bed block is occupied.
  • EntitySleepEvents.START_SLEEPING: Called when an entity starts to sleep.
  • EntitySleepEvents.STOP_SLEEPING: Called when an entity stops sleeping and wakes up.
  • EntityTrackingEvents.START_TRACKING: Called before a player starts tracking an entity.
  • EntityTrackingEvents.STOP_TRACKING: Called after a player has stopped tracking an entity.

Item

  • ModifyItemAttributeModifiersCallback.EVENT: Stack-aware attribute modifier callback for foreign items. Instead of using Mixin to change attribute modifiers in items not in your mod, you can use this instead, either checking the Item itself or using a tag. This event provides you with a guaranteed mutable map you can put attribute modifiers in. Do not use for your own Item classes

Lifecycle

  • CommonLifecycleEvents.TAGS_LOADED: Called when tags are loaded or updated.
  • ServerLifecycleEvents.END_DATA_PACK_RELOAD: Called after a Minecraft server has reloaded data packs. If reloading data packs was unsuccessful, the current data packs will be kept.
  • ServerLifecycleEvents.SERVER_STARTED: Called when a Minecraft server has started and is about to tick for the first time. At this stage, all worlds are live.
  • ServerLifecycleEvents.SERVER_STARTING: Called when a Minecraft server is starting. This occurs before the player manager and any worlds are loaded.
  • ServerLifecycleEvents.SERVER_STOPPED: Called when a Minecraft server has stopped. All worlds have been closed and all (block)entities and players have been unloaded.
  • ServerLifecycleEvents.SERVER_STOPPING: Called when a Minecraft server has started shutting down. This occurs before the server's network channel is closed and before any players are disconnected.
  • ServerLifecycleEvents.START_DATA_PACK_RELOAD: Called before a Minecraft server reloads data packs.
  • ServerLifecycleEvents.SYNC_DATA_PACK_CONTENTS: Called when a Minecraft server is about to send tag and recipe data to a player.

Loot

  • LootTableEvents.MODIFY: Called when a loot table is loading to modify loot tables.
  • LootTableEvents.REPLACE: Replaces loot tables.

Messages

  • ServerMessageEvents.ALLOW_CHAT_MESSAGE: Checks whether chat messages are allowed on the server. Will be called only if ALLOW_COMMAND_MESSAGE event did not block the message, and after triggering COMMAND_MESSAGE event.
  • ServerMessageEvents.ALLOW_COMMAND_MESSAGE: Checks whether command messages are allowed on the server. ALLOW_CHAT_MESSAGE and CHAT_MESSAGE events will also be triggered after triggering COMMAND_MESSAGE.
  • ServerMessageEvents.ALLOW_GAME_MESSAGE: Checks whether game messages are allowed on the server.
  • ServerMessageEvents.CHAT_MESSAGE: Triggered when the server broadcasts a chat message sent by a player, typically from a client GUI or a player-executed command. Will be called only if ALLOW_COMMAND_MESSAGE event did not block the message, and after triggering COMMAND_MESSAGE event.
  • ServerMessageEvents.COMMAND_MESSAGE: Triggered when the server broadcasts a command message to all players, such as one from /me, /msg, /say, and /tellraw. ALLOW_CHAT_MESSAGE and CHAT_MESSAGE events will also be triggered afterwards.
  • ServerMessageEvents.GAME_MESSAGE: Triggered when the server broadcasts a game message to all players. Game messages include death messages, join/leave messages, and advancement messages.

Networking

  • C2SPlayChannelEvents.REGISTER: For the client play network handler receiving an update indicating the connected server's ability to receive packets in certain channels.
  • C2SPlayChannelEvents.UNREGISTER: For the client play network handler receiving an update indicating the connected server's lack of ability to receive packets in certain channels.
  • ClientLogicConnectionEvents.DISCONNECT: Called when the client's login process has ended due to disconnection.
  • ClientLogicConnectionEvents.INIT: Called to indicate a connection has entered the LOGIN state, ready for registering query request handlers. May be used by mods to prepare their client side state. Does not guarantee that a login attempt will be successful.
  • ClientLogicConnectionEvents.QUERY_START: Called when the client has started receiving login queries. A client can only start receiving login queries when a server has sent the first login query.
  • ClientPlayConnectionEvents.DISCONNECT: Called for the disconnection of the client play network handler.
  • ClientPlayConnectionEvents.INIT: Called to indicate a connection entered the PLAY state, ready for registering channel handlers.
  • ClientPlayConnectionEvents.JOIN: Called to notify when the client play network handler is ready to send packets to the server.
  • S2CPlayChannelEvents.REGISTER: For the server play network handler receiving an update indicating the connected client's ability to receive packets in certain channels.
  • S2CPlayChannelEvents.UNREGISTER: For the server play network handler receiving an update indicating the connected client's lack of ability to receive packets in certain channels.
  • ServerLoginConnectionEvents.DISCONNECT: Called for the disconnection of the server login network handler.
  • ServerLoginConnectionEvents.INIT: Called to indicate a connection entered the LOGIN state, ready for registering query response handlers.
  • ServerLoginConnectionEvents.QUERY_START: Called for the start of login queries of the server login network handler.
  • ServerPlayConnectionEvents.DISCONNECT: Called for the disconnection of the server play network handler.
  • ServerPlayConnectionEvents.INIT: Called to indicate a connection has entered the PLAY state, ready for registering channel handlers.
  • ServerPlayConnectionEvents.JOIN: Called to notify when the server play network handler is ready to send packets to the client.

Players

  • AttackBlockCallback.EVENT: Called when left-clicking (“attacking”) a block. Is hooked before the spectator check, so check for player's gamemode.
  • AttackEntityCallback.EVENT: Called when left-clicking (“attacking”) an entity. Is hooked before the spectator check, so check for player's gamemode.
  • PlayerBreakBlockEvents.AFTER: Called after a block is successfully broken.
  • PlayerBreakBlockEvents.BEFORE: Called before a block is broken and allows cancelling the block breaking.
  • PlayerBreakBlockEvents.CANCELED: Called when a block break is cancelled.
  • UseBlockCallback.EVENT: Called when right-clicking (“using”) a block. Is hooked before the spectator check, so check for player's gamemode.
  • UseEntityCallback.EVENT: Called when right-clicking (“using”) an entity. Is hooked before the spectator check, so check for player's gamemode.
  • UseItemCallback.EVENT: Called when right-clicking (“using”) an item. Is hooked before the spectator check, so check for player's gamemode.

Registry

  • DynamicRegistrySetupCallback.EVENT:Triggered when a new DynamicRegistryManager gets created, but before it gets filled. The ideal place to register callbacks to dynamic registries.

Rendering

  • HudRenderCallback.EVENT: Called after rendering the whole hud, which is displayed in game, in a world.
  • InvalidateRenderStateCallback.EVENT: Called when the world renderer reloads, usually as result of changing resource pack or video configuration, or when the player types F3+A in the debug screen. Afterwards all render chunks will be reset and reloaded.
  • LivingEntityFeatureRendererRegistrationCallback.EVENT: Called when feature renderers for a living entity renderer are registered.
  • LivingEntityFeatureRenderEvents.ALLOW_CAPE_RENDER: Can prevent capes from rendering.

Server

  • ServerBlockEntityEvents.BLOCK_ENTITY_LOAD: Called when a BlockEntity is loaded into a ServerWorld. When this event is called, the block entity is already in the world.
  • ServerBlockEntityEvents.BLOCK_ENTITY_UNLOAD: Called when a BlockEntity is about to be unloaded from a ServerWorld. When this event is called, the block entity is still present in the world.
  • ServerChunkEvents.CHUNK_LOAD: Called when a chunk is loaded into a ServerWorld. When this event is called, the chunk is already in the world.
  • ServerChunkEvents.CHUNK_UNLOAD: Called when a chunk is about to be unloaded from a ServerWorld. When this event is called, the chunk is still present in the world.
  • ServerEntityCombatEvents.AFTER_KILLED_OTHER_ENTITY: Called after an entity has killed another entity.
  • ServerEntityEvents.ENTITY_LOAD: Called when an Entity is loaded into a ServerWorld. When this event is called, the entity is already in the world.
  • ServerEntityEvents.ENTITY_UNLOAD: Called when an Entity is about to be unloaded from a ServerWorld. When this event is called, the entity is still present in the world.
  • ServerEntityWorldChangeEvents.AFTER_ENTITY_CHANGE_WORLD: Called after an entity is transferred to a new world. Not called for players.
  • ServerEntityWorldChangeEvents.AFTER_PLAYER_CHANGE_WORLD: Called after a player has been moved to a different world.
  • ServerPlayerEvents.AFTER_RESPAWN: Called after a player has been respawned.
  • ServerPlayerEvents.ALLOW_DEATH: Called when a player takes fatal damage, before totems of undying can take effect.
  • ServerPlayerEvents.COPY_FROM: Called when player data is copied to a new player.
  • ServerTickEvents.END_SERVER_TICK: Called at the end of the server tick.
  • ServerTickEvents.END_WORLD_TICK: Called at the end of the ServerWorld's tick.
  • ServerTickEvents.START_SERVER_TICK: Called at the start of the server tick.
  • ServerTickEvents.START_WORLD_TICK: Called at the start of the ServerWorld's tick.
  • ServerWorldEvents.LOAD: Called just after a world is loaded by a Minecraft server
  • ServerWorldEvents.UNLOAD: Called before a world is unloaded by a Minecraft server.
tutorial/event_index.txt · Last modified: 2023/05/06 01:40 by pandoricavi