Class EventHooks
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final net.minecraft.util.random.WeightedList
<net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionalterGround
(net.minecraft.world.level.levelgen.feature.treedecorators.TreeDecorator.Context ctx, List<net.minecraft.core.BlockPos> positions, AlterGroundEvent.StateProvider provider) Fires theAlterGroundEvent
and retrieves the resultingAlterGroundEvent.StateProvider
.static boolean
canCreateFluidSource
(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) Checks if a fluid is allowed to create a fluid source.static boolean
canEntityContinueSleeping
(net.minecraft.world.entity.LivingEntity sleeper, @Nullable net.minecraft.world.entity.player.Player.BedSleepingProblem problem) Checks if a sleeping entity can continue sleeping with the given sleeping problem.static boolean
canEntityGrief
(net.minecraft.server.level.ServerLevel level, @Nullable net.minecraft.world.entity.Entity entity) Checks if an entity can perform a griefing action.static boolean
canLivingConvert
(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.LivingEntity> outcome, Consumer<Integer> timer) static boolean
canMountEntity
(net.minecraft.world.entity.Entity entityMounting, net.minecraft.world.entity.Entity entityBeingMounted, boolean isMounting) static com.mojang.datafixers.util.Either
<net.minecraft.world.entity.player.Player.BedSleepingProblem, net.minecraft.util.Unit> canPlayerStartSleeping
(net.minecraft.server.level.ServerPlayer player, net.minecraft.core.BlockPos pos, com.mojang.datafixers.util.Either<net.minecraft.world.entity.player.Player.BedSleepingProblem, net.minecraft.util.Unit> vanillaResult) static boolean
checkMobDespawn
(net.minecraft.world.entity.Mob mob) FiresMobDespawnEvent
and returns true if the default logic should be ignored.static boolean
checkSpawnPlacements
(net.minecraft.world.entity.EntityType<?> entityType, net.minecraft.world.level.ServerLevelAccessor level, net.minecraft.world.entity.EntitySpawnReason spawnType, net.minecraft.core.BlockPos pos, net.minecraft.util.RandomSource random, boolean defaultResult) Internal, should only be called viaSpawnPlacements.checkSpawnRules(net.minecraft.world.entity.EntityType<T>, net.minecraft.world.level.ServerLevelAccessor, net.minecraft.world.entity.EntitySpawnReason, net.minecraft.core.BlockPos, net.minecraft.util.RandomSource)
.static boolean
checkSpawnPosition
(net.minecraft.world.entity.Mob mob, net.minecraft.world.level.ServerLevelAccessor level, net.minecraft.world.entity.EntitySpawnReason spawnType) Checks if the current position of the passed mob is valid for spawning, by firingMobSpawnEvent.PositionCheck
.
The default check is to perform the logical and ofMob.checkSpawnRules(net.minecraft.world.level.LevelAccessor, net.minecraft.world.entity.EntitySpawnReason)
andMob.checkSpawnObstruction(net.minecraft.world.level.LevelReader)
.static boolean
checkSpawnPositionSpawner
(net.minecraft.world.entity.Mob mob, net.minecraft.world.level.ServerLevelAccessor level, net.minecraft.world.entity.EntitySpawnReason spawnType, net.minecraft.world.level.SpawnData spawnData, net.minecraft.world.level.BaseSpawner spawner) Specialized variant ofcheckSpawnPosition(net.minecraft.world.entity.Mob, net.minecraft.world.level.ServerLevelAccessor, net.minecraft.world.entity.EntitySpawnReason)
for spawners, as they have slightly different checks, and pass through theBaseSpawner
to the event.static boolean
doPlayerHarvestCheck
(net.minecraft.world.entity.player.Player player, net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos) static @Nullable net.minecraft.world.entity.SpawnGroupData
finalizeMobSpawn
(net.minecraft.world.entity.Mob mob, net.minecraft.world.level.ServerLevelAccessor level, net.minecraft.world.DifficultyInstance difficulty, net.minecraft.world.entity.EntitySpawnReason spawnType, @Nullable net.minecraft.world.entity.SpawnGroupData spawnData) Finalizes the spawn of a mob by firing theFinalizeSpawnEvent
and callingMob.finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor, net.minecraft.world.DifficultyInstance, net.minecraft.world.entity.EntitySpawnReason, net.minecraft.world.entity.SpawnGroupData)
with the result.static FinalizeSpawnEvent
finalizeMobSpawnSpawner
(net.minecraft.world.entity.Mob mob, net.minecraft.world.level.ServerLevelAccessor level, net.minecraft.world.DifficultyInstance difficulty, net.minecraft.world.entity.EntitySpawnReason spawnType, @Nullable net.minecraft.world.entity.SpawnGroupData spawnData, IOwnedSpawner spawner, boolean def) Finalizes the spawn of a mob by firing theFinalizeSpawnEvent
and callingMob.finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor, net.minecraft.world.DifficultyInstance, net.minecraft.world.entity.EntitySpawnReason, net.minecraft.world.entity.SpawnGroupData)
with the result.static BlockGrowFeatureEvent
fireBlockGrowFeature
(net.minecraft.world.level.LevelAccessor level, net.minecraft.util.RandomSource rand, net.minecraft.core.BlockPos pos, @Nullable net.minecraft.core.Holder<net.minecraft.world.level.levelgen.feature.ConfiguredFeature<?, ?>> holder) Fires theBlockGrowFeatureEvent
and returns the event object.static BonemealEvent
fireBonemealEvent
(@Nullable net.minecraft.world.entity.player.Player player, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.item.ItemStack stack) Called when bone meal (or equivalent) is used on a block.static void
fireChunkSent
(net.minecraft.server.level.ServerPlayer entity, net.minecraft.world.level.chunk.LevelChunk chunk, net.minecraft.server.level.ServerLevel level) static void
fireChunkTicketLevelUpdated
(net.minecraft.server.level.ServerLevel level, long chunkPos, int oldTicketLevel, int newTicketLevel, @Nullable net.minecraft.server.level.ChunkHolder chunkHolder) static void
fireChunkUnWatch
(net.minecraft.server.level.ServerPlayer entity, net.minecraft.world.level.ChunkPos chunkpos, net.minecraft.server.level.ServerLevel level) static void
fireChunkWatch
(net.minecraft.server.level.ServerPlayer entity, net.minecraft.world.level.chunk.LevelChunk chunk, net.minecraft.server.level.ServerLevel level) static void
fireEntityTickPost
(net.minecraft.world.entity.Entity entity) FiresEntityTickEvent.Post
.static EntityTickEvent.Pre
fireEntityTickPre
(net.minecraft.world.entity.Entity entity) FiresEntityTickEvent.Pre
.static net.minecraft.world.level.block.state.BlockState
fireFluidPlaceBlockEvent
(net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos, net.minecraft.core.BlockPos liquidPos, net.minecraft.world.level.block.state.BlockState state) static void
fireItemPickupPost
(net.minecraft.world.entity.item.ItemEntity itemEntity, net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack copy) Called inItemEntity.playerTouch(Player)
after an item was successfully picked up.static ItemEntityPickupEvent.Pre
fireItemPickupPre
(net.minecraft.world.entity.item.ItemEntity itemEntity, net.minecraft.world.entity.player.Player player) Called inItemEntity.playerTouch(Player)
before any other processing occurs.static void
fireLevelTickPost
(net.minecraft.world.level.Level level, BooleanSupplier haveTime) FiresLevelTickEvent.Post
.static void
fireLevelTickPre
(net.minecraft.world.level.Level level, BooleanSupplier haveTime) FiresLevelTickEvent.Pre
.static void
firePlayerChangedDimensionEvent
(net.minecraft.world.entity.player.Player player, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> fromDim, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> toDim) static void
firePlayerCraftingEvent
(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack crafted, net.minecraft.world.Container craftMatrix) static void
firePlayerLoadingEvent
(net.minecraft.world.entity.player.Player player, File playerDirectory, String uuidString) static void
firePlayerLoadingEvent
(net.minecraft.world.entity.player.Player player, net.minecraft.world.level.storage.PlayerDataStorage playerFileData, String uuidString) static void
firePlayerLoggedIn
(net.minecraft.world.entity.player.Player player) static void
firePlayerLoggedOut
(net.minecraft.world.entity.player.Player player) static void
firePlayerRespawnEvent
(net.minecraft.server.level.ServerPlayer player, boolean fromEndFight) Called byinvalid reference
PlayerList#respawn(ServerPlayer, boolean)
ServerPlayer
.static PlayerRespawnPositionEvent
firePlayerRespawnPositionEvent
(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.level.portal.TeleportTransition teleportTransition, boolean fromEndFight) Called byinvalid reference
PlayerList#respawn(ServerPlayer, boolean)
ServerPlayer
to fire thePlayerRespawnPositionEvent
static void
firePlayerSavingEvent
(net.minecraft.world.entity.player.Player player, File playerDirectory, String uuidString) static void
firePlayerSmeltedEvent
(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack smelted, int amountRemoved) static PlayerSpawnPhantomsEvent
firePlayerSpawnPhantoms
(net.minecraft.server.level.ServerPlayer player, net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos) Called fromPhantomSpawner.tick(net.minecraft.server.level.ServerLevel, boolean, boolean)
just before the spawn conditions for phantoms are evaluated.static void
firePlayerTickPost
(net.minecraft.world.entity.player.Player player) FiresPlayerTickEvent.Post
.static void
firePlayerTickPre
(net.minecraft.world.entity.player.Player player) FiresPlayerTickEvent.Pre
.static void
fireServerTickPost
(BooleanSupplier haveTime, net.minecraft.server.MinecraftServer server) FiresServerTickEvent.Post
.static void
fireServerTickPre
(BooleanSupplier haveTime, net.minecraft.server.MinecraftServer server) FiresServerTickEvent.Pre
.static net.minecraft.world.item.enchantment.ItemEnchantments
getAllEnchantmentLevels
(net.minecraft.world.item.enchantment.ItemEnchantments enchantments, net.minecraft.world.item.ItemStack stack, net.minecraft.core.HolderLookup.RegistryLookup<net.minecraft.world.item.enchantment.Enchantment> lookup) FiresGetEnchantmentLevelEvent
and for all enchantments, returning the (possibly event-modified) enchantment map.static float
getBreakSpeed
(net.minecraft.world.entity.player.Player player, net.minecraft.world.level.block.state.BlockState state, float original, net.minecraft.core.BlockPos pos) static List
<net.minecraft.world.level.CustomSpawner> getCustomSpawners
(net.minecraft.server.level.ServerLevel serverLevel, List<net.minecraft.world.level.CustomSpawner> customSpawners) Fires theModifyCustomSpawnersEvent
.static int
getEnchantmentLevelSpecific
(int level, net.minecraft.world.item.ItemStack stack, net.minecraft.core.Holder<net.minecraft.world.item.enchantment.Enchantment> ench) FiresGetEnchantmentLevelEvent
and for a single enchantment, returning the (possibly event-modified) level.static EntityEvent.Size
getEntitySizeForge
(net.minecraft.world.entity.Entity entity, net.minecraft.world.entity.Pose pose, net.minecraft.world.entity.EntityDimensions size) static EntityEvent.Size
getEntitySizeForge
(net.minecraft.world.entity.Entity entity, net.minecraft.world.entity.Pose pose, net.minecraft.world.entity.EntityDimensions oldSize, net.minecraft.world.entity.EntityDimensions newSize) static int
getExperienceDrop
(net.minecraft.world.entity.LivingEntity entity, @Nullable net.minecraft.world.entity.player.Player attackingPlayer, int originalExperience) static net.minecraft.world.phys.Vec3
getExplosionKnockback
(net.minecraft.world.level.Level level, net.minecraft.world.level.ServerExplosion explosion, net.minecraft.world.entity.Entity entity, net.minecraft.world.phys.Vec3 initialVelocity, List<net.minecraft.core.BlockPos> blocks) To be called when an explosion has calculated the knockback velocity but has not yet added the knockback to the entity caught in blast.static int
getItemBurnTime
(net.minecraft.world.item.ItemStack itemStack, int burnTime, @Nullable net.minecraft.world.item.crafting.RecipeType<?> recipeType, net.minecraft.world.level.block.entity.FuelValues fuelValues) static int
getMaxSpawnClusterSize
(net.minecraft.world.entity.Mob entity) FiresSpawnClusterSizeEvent
and returns the size as a result of the event.static net.minecraft.network.chat.Component
getPlayerDisplayName
(net.minecraft.world.entity.player.Player player, net.minecraft.network.chat.Component username) static net.minecraft.network.chat.Component
getPlayerTabListDisplayName
(net.minecraft.world.entity.player.Player player) static net.minecraft.util.random.WeightedList
<net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData> getPotentialSpawns
(net.minecraft.world.level.LevelAccessor level, net.minecraft.world.entity.MobCategory category, net.minecraft.core.BlockPos pos, net.minecraft.util.random.WeightedList<net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData> oldList) static @Nullable net.minecraft.world.level.storage.loot.LootTable
loadLootTable
(net.minecraft.core.HolderLookup.Provider registries, net.minecraft.resources.ResourceLocation name, net.minecraft.world.level.storage.loot.LootTable table) Fires theLootTableLoadEvent
for non-empty loot tables and returns the table if the event was not canceled and the table was not set toLootTable.EMPTY
in the event.static void
onAdvancementEarnedEvent
(net.minecraft.world.entity.player.Player player, net.minecraft.advancements.AdvancementHolder earned) static void
onAdvancementProgressedEvent
(net.minecraft.world.entity.player.Player player, net.minecraft.advancements.AdvancementHolder progressed, net.minecraft.advancements.AdvancementProgress advancementProgress, String criterion, AdvancementEvent.AdvancementProgressEvent.ProgressType progressType) static boolean
onAnimalTame
(net.minecraft.world.entity.animal.Animal animal, net.minecraft.world.entity.player.Player tamer) static int
onArrowLoose
(net.minecraft.world.item.ItemStack stack, net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player, int charge, boolean hasAmmo) static net.minecraft.world.InteractionResult
onArrowNock
(net.minecraft.world.item.ItemStack item, net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand, boolean hasAmmo) static boolean
onBlockPlace
(@Nullable net.minecraft.world.entity.Entity entity, BlockSnapshot blockSnapshot, net.minecraft.core.Direction direction) static void
onCommandRegister
(com.mojang.brigadier.CommandDispatcher<net.minecraft.commands.CommandSourceStack> dispatcher, net.minecraft.commands.Commands.CommandSelection environment, net.minecraft.commands.CommandBuildContext context) static boolean
onCreateWorldSpawn
(net.minecraft.world.level.Level level, net.minecraft.world.level.storage.ServerLevelData settings) static void
onCreativeModeTabBuildContents
(net.minecraft.world.item.CreativeModeTab tab, net.minecraft.resources.ResourceKey<net.minecraft.world.item.CreativeModeTab> tabKey, net.minecraft.world.item.CreativeModeTab.DisplayItemsGenerator originalGenerator, net.minecraft.world.item.CreativeModeTab.ItemDisplayParameters params, net.minecraft.world.item.CreativeModeTab.Output output) Fires theBuildCreativeModeTabContentsEvent
.static boolean
onEffectRemoved
(net.minecraft.world.entity.LivingEntity entity, net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect> effect) static boolean
onEffectRemoved
(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.effect.MobEffectInstance effectInstance) static int
onEnchantmentLevelSet
(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, int enchantRow, int power, net.minecraft.world.item.ItemStack itemStack, int enchantmentLevel) onEnderPearlLand
(net.minecraft.server.level.ServerPlayer entity, double targetX, double targetY, double targetZ, net.minecraft.world.entity.projectile.ThrownEnderpearl pearlEntity, float attackDamage, net.minecraft.world.phys.HitResult hitResult) onEnderTeleport
(net.minecraft.world.entity.LivingEntity entity, double targetX, double targetY, double targetZ) static boolean
onEntityDestroyBlock
(net.minecraft.world.entity.LivingEntity entity, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) static boolean
onEntityStruckByLightning
(net.minecraft.world.entity.Entity entity, net.minecraft.world.entity.LightningBolt bolt) onEntityTeleportCommand
(net.minecraft.world.entity.Entity entity, double targetX, double targetY, double targetZ) onEntityTeleportSpreadPlayersCommand
(net.minecraft.world.entity.Entity entity, double targetX, double targetY, double targetZ) static void
onExplosionDetonate
(net.minecraft.world.level.Level level, net.minecraft.world.level.ServerExplosion explosion, List<net.minecraft.world.entity.Entity> entities, List<net.minecraft.core.BlockPos> blocks) static boolean
onExplosionStart
(net.minecraft.world.level.Level level, net.minecraft.world.level.ServerExplosion explosion) onItemConsumptionTeleport
(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.item.ItemStack itemStack, double targetX, double targetY, double targetZ) static int
onItemExpire
(net.minecraft.world.entity.item.ItemEntity entity) static ItemTooltipEvent
onItemTooltip
(net.minecraft.world.item.ItemStack itemStack, @Nullable net.minecraft.world.entity.player.Player entityPlayer, List<net.minecraft.network.chat.Component> list, net.minecraft.world.item.TooltipFlag flags, net.minecraft.world.item.Item.TooltipContext context) static net.minecraft.world.item.ItemStack
onItemUseFinish
(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.item.ItemStack item, int duration, net.minecraft.world.item.ItemStack result) static int
onItemUseStart
(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.item.ItemStack item, int duration) Deprecated, for removal: This API element is subject to removal in a future version.static int
onItemUseStart
(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.item.ItemStack item, net.minecraft.world.InteractionHand hand, int duration) static int
onItemUseTick
(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.item.ItemStack item, int duration) static void
onLivingConvert
(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.entity.LivingEntity outcome) static float
onLivingHeal
(net.minecraft.world.entity.LivingEntity entity, float amount) static MobSplitEvent
onMobSplit
(net.minecraft.world.entity.Mob parent, List<net.minecraft.world.entity.Mob> children) Fires the mob split event.static boolean
onMultiBlockPlace
(@Nullable net.minecraft.world.entity.Entity entity, List<BlockSnapshot> blockSnapshots, net.minecraft.core.Direction direction) onNeighborNotify
(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, EnumSet<net.minecraft.core.Direction> notifiedSides, boolean forceRedstoneUpdate) static boolean
onPermissionChanged
(com.mojang.authlib.GameProfile gameProfile, int newLevel, net.minecraft.server.players.PlayerList playerList) static void
onPistonMovePost
(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction direction, boolean extending) static boolean
onPistonMovePre
(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction direction, boolean extending) static void
onPlayerBrewedPotion
(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack) static void
onPlayerClone
(net.minecraft.world.entity.player.Player player, net.minecraft.world.entity.player.Player oldPlayer, boolean wasDeath) static void
onPlayerDestroyItem
(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack, @Nullable net.minecraft.world.InteractionHand hand) static void
onPlayerFall
(net.minecraft.world.entity.player.Player player, float distance, float multiplier) static boolean
onPlayerSpawnSet
(net.minecraft.world.entity.player.Player player, net.minecraft.server.level.ServerPlayer.RespawnConfig respawnConfig) static void
onPlayerWakeup
(net.minecraft.world.entity.player.Player player, boolean wakeImmediately, boolean updateLevel) static PlayLevelSoundEvent.AtEntity
onPlaySoundAtEntity
(net.minecraft.world.entity.Entity entity, net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> name, net.minecraft.sounds.SoundSource category, float volume, float pitch) onPlaySoundAtPosition
(net.minecraft.world.level.Level level, double x, double y, double z, net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> name, net.minecraft.sounds.SoundSource category, float volume, float pitch) static boolean
onPotionAttemptBrew
(net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> stacks) static void
onPotionBrewed
(net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> brewingItemStacks) static boolean
onProjectileImpact
(net.minecraft.world.entity.projectile.Projectile projectile, net.minecraft.world.phys.HitResult ray) static List
<net.minecraft.server.packs.resources.PreparableReloadListener> onResourceReload
(net.minecraft.server.ReloadableServerResources serverResources, net.minecraft.core.RegistryAccess registryAccess) Fires theAddServerReloadListenersEvent
and returns the sorted list of reload listeners.static long
onSleepFinished
(net.minecraft.server.level.ServerLevel level, long newTime, long minTime) static void
onStartEntityTracking
(net.minecraft.world.entity.Entity entity, net.minecraft.world.entity.player.Player player) static StatAwardEvent
onStatAward
(net.minecraft.world.entity.player.Player player, net.minecraft.stats.Stat<?> stat, int value) static void
onStopEntityTracking
(net.minecraft.world.entity.Entity entity, net.minecraft.world.entity.player.Player player) static @Nullable net.minecraft.world.level.block.state.BlockState
onToolUse
(net.minecraft.world.level.block.state.BlockState originalState, net.minecraft.world.item.context.UseOnContext context, ItemAbility itemAbility, boolean simulate) static Optional
<net.minecraft.world.level.portal.PortalShape> onTrySpawnPortal
(net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos, Optional<net.minecraft.world.level.portal.PortalShape> size) static boolean
onUseItemStop
(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.item.ItemStack item, int duration)
-
Field Details
-
NO_SPAWNS
private static final net.minecraft.util.random.WeightedList<net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData> NO_SPAWNS
-
-
Constructor Details
-
EventHooks
public EventHooks()
-
-
Method Details
-
onMultiBlockPlace
public static boolean onMultiBlockPlace(@Nullable @Nullable net.minecraft.world.entity.Entity entity, List<BlockSnapshot> blockSnapshots, net.minecraft.core.Direction direction) -
onBlockPlace
public static boolean onBlockPlace(@Nullable @Nullable net.minecraft.world.entity.Entity entity, BlockSnapshot blockSnapshot, net.minecraft.core.Direction direction) -
onNeighborNotify
public static BlockEvent.NeighborNotifyEvent onNeighborNotify(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, EnumSet<net.minecraft.core.Direction> notifiedSides, boolean forceRedstoneUpdate) -
doPlayerHarvestCheck
public static boolean doPlayerHarvestCheck(net.minecraft.world.entity.player.Player player, net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos) -
getBreakSpeed
public static float getBreakSpeed(net.minecraft.world.entity.player.Player player, net.minecraft.world.level.block.state.BlockState state, float original, net.minecraft.core.BlockPos pos) -
onPlayerDestroyItem
public static void onPlayerDestroyItem(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack, @Nullable @Nullable net.minecraft.world.InteractionHand hand) -
checkSpawnPlacements
@Internal public static boolean checkSpawnPlacements(net.minecraft.world.entity.EntityType<?> entityType, net.minecraft.world.level.ServerLevelAccessor level, net.minecraft.world.entity.EntitySpawnReason spawnType, net.minecraft.core.BlockPos pos, net.minecraft.util.RandomSource random, boolean defaultResult) Internal, should only be called viaSpawnPlacements.checkSpawnRules(net.minecraft.world.entity.EntityType<T>, net.minecraft.world.level.ServerLevelAccessor, net.minecraft.world.entity.EntitySpawnReason, net.minecraft.core.BlockPos, net.minecraft.util.RandomSource)
.- See Also:
-
checkSpawnPosition
public static boolean checkSpawnPosition(net.minecraft.world.entity.Mob mob, net.minecraft.world.level.ServerLevelAccessor level, net.minecraft.world.entity.EntitySpawnReason spawnType) Checks if the current position of the passed mob is valid for spawning, by firingMobSpawnEvent.PositionCheck
.
The default check is to perform the logical and ofMob.checkSpawnRules(net.minecraft.world.level.LevelAccessor, net.minecraft.world.entity.EntitySpawnReason)
andMob.checkSpawnObstruction(net.minecraft.world.level.LevelReader)
.- Parameters:
mob
- The mob being spawned.level
- The level the mob will be added to, if successful.spawnType
- The spawn type of the spawn.- Returns:
- True, if the position is valid, as determined by the contract of
MobSpawnEvent.PositionCheck
. - See Also:
-
checkSpawnPositionSpawner
public static boolean checkSpawnPositionSpawner(net.minecraft.world.entity.Mob mob, net.minecraft.world.level.ServerLevelAccessor level, net.minecraft.world.entity.EntitySpawnReason spawnType, net.minecraft.world.level.SpawnData spawnData, net.minecraft.world.level.BaseSpawner spawner) Specialized variant ofcheckSpawnPosition(net.minecraft.world.entity.Mob, net.minecraft.world.level.ServerLevelAccessor, net.minecraft.world.entity.EntitySpawnReason)
for spawners, as they have slightly different checks, and pass through theBaseSpawner
to the event.- See Also:
-
finalizeMobSpawn
@Nullable public static @Nullable net.minecraft.world.entity.SpawnGroupData finalizeMobSpawn(net.minecraft.world.entity.Mob mob, net.minecraft.world.level.ServerLevelAccessor level, net.minecraft.world.DifficultyInstance difficulty, net.minecraft.world.entity.EntitySpawnReason spawnType, @Nullable @Nullable net.minecraft.world.entity.SpawnGroupData spawnData) Finalizes the spawn of a mob by firing theFinalizeSpawnEvent
and callingMob.finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor, net.minecraft.world.DifficultyInstance, net.minecraft.world.entity.EntitySpawnReason, net.minecraft.world.entity.SpawnGroupData)
with the result.Mods should call this method in place of calling
Mob.finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor, net.minecraft.world.DifficultyInstance, net.minecraft.world.entity.EntitySpawnReason, net.minecraft.world.entity.SpawnGroupData)
, unless calling super from within an override. Vanilla calls toMob.finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor, net.minecraft.world.DifficultyInstance, net.minecraft.world.entity.EntitySpawnReason, net.minecraft.world.entity.SpawnGroupData)
are replaced with calls to this method via coremod, so calls to this method will not show in an IDE.When interfacing with this event, write all code as normal, and replace the call to
Mob.finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor, net.minecraft.world.DifficultyInstance, net.minecraft.world.entity.EntitySpawnReason, net.minecraft.world.entity.SpawnGroupData)
with a call to this method.As an example, the following code block:
var zombie = new Zombie(level); zombie.finalizeSpawn(level, difficulty, spawnType, spawnData); level.tryAddFreshEntityWithPassengers(zombie); if (zombie.isAddedToLevel()) { // Do stuff with your new zombie }
var zombie = new Zombie(level); EventHooks.finalizeMobSpawn(zombie, level, difficulty, spawnType, spawnData); level.tryAddFreshEntityWithPassengers(zombie); if (zombie.isAddedToLevel()) { // Do stuff with your new zombie }
Mob.finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor, net.minecraft.world.DifficultyInstance, net.minecraft.world.entity.EntitySpawnReason, net.minecraft.world.entity.SpawnGroupData)
call.- Parameters:
mob
- The mob whose spawn is being finalizedlevel
- The level the mob will be spawned indifficulty
- The local difficulty at the position of the mobspawnType
- The type of spawn that is occuringspawnData
- Optional spawn data relevant to the mob being spawned- Returns:
- The SpawnGroupData from the finalize, or null if it was canceled. The return value of this method has no bearing on if the entity will be spawned
- See Also:
-
finalizeMobSpawnSpawner
public static FinalizeSpawnEvent finalizeMobSpawnSpawner(net.minecraft.world.entity.Mob mob, net.minecraft.world.level.ServerLevelAccessor level, net.minecraft.world.DifficultyInstance difficulty, net.minecraft.world.entity.EntitySpawnReason spawnType, @Nullable @Nullable net.minecraft.world.entity.SpawnGroupData spawnData, IOwnedSpawner spawner, boolean def) Finalizes the spawn of a mob by firing theFinalizeSpawnEvent
and callingMob.finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor, net.minecraft.world.DifficultyInstance, net.minecraft.world.entity.EntitySpawnReason, net.minecraft.world.entity.SpawnGroupData)
with the result.This method is separate since mob spawners perform special finalizeSpawn handling when NBT data is present, but we still want to fire the event.
This overload is also the only way to pass through an
IOwnedSpawner
instance.- Parameters:
mob
- The mob whose spawn is being finalizedlevel
- The level the mob will be spawned indifficulty
- The local difficulty at the position of the mobspawnType
- The type of spawn that is occuringspawnData
- Optional spawn data relevant to the mob being spawnedspawner
- The spawner that is attempting to spawn the mobdef
- If the spawner would normally call finalizeSpawn, regardless of the event
-
firePlayerSpawnPhantoms
public static PlayerSpawnPhantomsEvent firePlayerSpawnPhantoms(net.minecraft.server.level.ServerPlayer player, net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos) Called fromPhantomSpawner.tick(net.minecraft.server.level.ServerLevel, boolean, boolean)
just before the spawn conditions for phantoms are evaluated. Fires thePlayerSpawnPhantomsEvent
and returns the event.- Parameters:
player
- The player for whom a spawn attempt is being madelevel
- The level of the playerpos
- The block position of the player
-
checkMobDespawn
public static boolean checkMobDespawn(net.minecraft.world.entity.Mob mob) FiresMobDespawnEvent
and returns true if the default logic should be ignored.- Parameters:
mob
- The entity being despawned.- Returns:
- True if the event result is not
MobDespawnEvent.Result.DEFAULT
, and the vanilla logic should be ignored.
-
getItemBurnTime
public static int getItemBurnTime(net.minecraft.world.item.ItemStack itemStack, int burnTime, @Nullable @Nullable net.minecraft.world.item.crafting.RecipeType<?> recipeType, net.minecraft.world.level.block.entity.FuelValues fuelValues) -
getExperienceDrop
public static int getExperienceDrop(net.minecraft.world.entity.LivingEntity entity, @Nullable @Nullable net.minecraft.world.entity.player.Player attackingPlayer, int originalExperience) -
getMaxSpawnClusterSize
public static int getMaxSpawnClusterSize(net.minecraft.world.entity.Mob entity) FiresSpawnClusterSizeEvent
and returns the size as a result of the event.Called in
NaturalSpawner.spawnCategoryForPosition(net.minecraft.world.entity.MobCategory, net.minecraft.server.level.ServerLevel, net.minecraft.core.BlockPos)
whereMob.getMaxSpawnClusterSize()
would normally be called.- Parameters:
entity
- The entity whose max spawn cluster size is being queried.- Returns:
- The new spawn cluster size.
-
getPlayerDisplayName
public static net.minecraft.network.chat.Component getPlayerDisplayName(net.minecraft.world.entity.player.Player player, net.minecraft.network.chat.Component username) -
getPlayerTabListDisplayName
public static net.minecraft.network.chat.Component getPlayerTabListDisplayName(net.minecraft.world.entity.player.Player player) -
fireFluidPlaceBlockEvent
public static net.minecraft.world.level.block.state.BlockState fireFluidPlaceBlockEvent(net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos, net.minecraft.core.BlockPos liquidPos, net.minecraft.world.level.block.state.BlockState state) -
onItemTooltip
public static ItemTooltipEvent onItemTooltip(net.minecraft.world.item.ItemStack itemStack, @Nullable @Nullable net.minecraft.world.entity.player.Player entityPlayer, List<net.minecraft.network.chat.Component> list, net.minecraft.world.item.TooltipFlag flags, net.minecraft.world.item.Item.TooltipContext context) -
onEntityStruckByLightning
public static boolean onEntityStruckByLightning(net.minecraft.world.entity.Entity entity, net.minecraft.world.entity.LightningBolt bolt) -
onItemUseStart
@Deprecated(since="1.21.5", forRemoval=true) public static int onItemUseStart(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.item.ItemStack item, int duration) Deprecated, for removal: This API element is subject to removal in a future version.Usethe hand sensitive version
as this version provides wrong hand information -
onItemUseStart
public static int onItemUseStart(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.item.ItemStack item, net.minecraft.world.InteractionHand hand, int duration) -
onItemUseTick
public static int onItemUseTick(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.item.ItemStack item, int duration) -
onUseItemStop
public static boolean onUseItemStop(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.item.ItemStack item, int duration) -
onItemUseFinish
public static net.minecraft.world.item.ItemStack onItemUseFinish(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.item.ItemStack item, int duration, net.minecraft.world.item.ItemStack result) -
onStartEntityTracking
public static void onStartEntityTracking(net.minecraft.world.entity.Entity entity, net.minecraft.world.entity.player.Player player) -
onStopEntityTracking
public static void onStopEntityTracking(net.minecraft.world.entity.Entity entity, net.minecraft.world.entity.player.Player player) -
firePlayerLoadingEvent
-
firePlayerSavingEvent
-
firePlayerLoadingEvent
public static void firePlayerLoadingEvent(net.minecraft.world.entity.player.Player player, net.minecraft.world.level.storage.PlayerDataStorage playerFileData, String uuidString) -
onToolUse
@Nullable public static @Nullable net.minecraft.world.level.block.state.BlockState onToolUse(net.minecraft.world.level.block.state.BlockState originalState, net.minecraft.world.item.context.UseOnContext context, ItemAbility itemAbility, boolean simulate) -
fireBonemealEvent
public static BonemealEvent fireBonemealEvent(@Nullable @Nullable net.minecraft.world.entity.player.Player player, net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.item.ItemStack stack) Called when bone meal (or equivalent) is used on a block. Fires theBonemealEvent
and returns the event.- Parameters:
player
- The player who used the item, if anylevel
- The levelpos
- The position of the target blockstate
- The state of the target blockstack
- The bone meal item stack- Returns:
- The event
-
onPlaySoundAtEntity
public static PlayLevelSoundEvent.AtEntity onPlaySoundAtEntity(net.minecraft.world.entity.Entity entity, net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> name, net.minecraft.sounds.SoundSource category, float volume, float pitch) -
onPlaySoundAtPosition
public static PlayLevelSoundEvent.AtPosition onPlaySoundAtPosition(net.minecraft.world.level.Level level, double x, double y, double z, net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> name, net.minecraft.sounds.SoundSource category, float volume, float pitch) -
onItemExpire
public static int onItemExpire(net.minecraft.world.entity.item.ItemEntity entity) -
fireItemPickupPre
public static ItemEntityPickupEvent.Pre fireItemPickupPre(net.minecraft.world.entity.item.ItemEntity itemEntity, net.minecraft.world.entity.player.Player player) Called inItemEntity.playerTouch(Player)
before any other processing occurs.Fires
ItemEntityPickupEvent.Pre
and returns the event.- Parameters:
itemEntity
- The item entity that a player collided withplayer
- The player that collided with the item entity
-
fireItemPickupPost
public static void fireItemPickupPost(net.minecraft.world.entity.item.ItemEntity itemEntity, net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack copy) Called inItemEntity.playerTouch(Player)
after an item was successfully picked up.Fires
ItemEntityPickupEvent.Post
.- Parameters:
itemEntity
- The item entity that a player collided withplayer
- The player that collided with the item entitycopy
- A copy of the item entity's item stack before the pickup
-
canMountEntity
public static boolean canMountEntity(net.minecraft.world.entity.Entity entityMounting, net.minecraft.world.entity.Entity entityBeingMounted, boolean isMounting) -
onAnimalTame
public static boolean onAnimalTame(net.minecraft.world.entity.animal.Animal animal, net.minecraft.world.entity.player.Player tamer) -
canPlayerStartSleeping
public static com.mojang.datafixers.util.Either<net.minecraft.world.entity.player.Player.BedSleepingProblem,net.minecraft.util.Unit> canPlayerStartSleeping(net.minecraft.server.level.ServerPlayer player, net.minecraft.core.BlockPos pos, com.mojang.datafixers.util.Either<net.minecraft.world.entity.player.Player.BedSleepingProblem, net.minecraft.util.Unit> vanillaResult) -
onPlayerWakeup
public static void onPlayerWakeup(net.minecraft.world.entity.player.Player player, boolean wakeImmediately, boolean updateLevel) -
onPlayerFall
public static void onPlayerFall(net.minecraft.world.entity.player.Player player, float distance, float multiplier) -
onPlayerSpawnSet
public static boolean onPlayerSpawnSet(net.minecraft.world.entity.player.Player player, @Nullable net.minecraft.server.level.ServerPlayer.RespawnConfig respawnConfig) -
onPlayerClone
public static void onPlayerClone(net.minecraft.world.entity.player.Player player, net.minecraft.world.entity.player.Player oldPlayer, boolean wasDeath) -
onExplosionStart
public static boolean onExplosionStart(net.minecraft.world.level.Level level, net.minecraft.world.level.ServerExplosion explosion) -
onExplosionDetonate
-
getExplosionKnockback
public static net.minecraft.world.phys.Vec3 getExplosionKnockback(net.minecraft.world.level.Level level, net.minecraft.world.level.ServerExplosion explosion, net.minecraft.world.entity.Entity entity, net.minecraft.world.phys.Vec3 initialVelocity, List<net.minecraft.core.BlockPos> blocks) To be called when an explosion has calculated the knockback velocity but has not yet added the knockback to the entity caught in blast.- Parameters:
level
- The level that the explosion is inexplosion
- Explosion that is happeningentity
- The entity caught in the explosion's blastinitialVelocity
- The explosion calculated velocity for the entity- Returns:
- The new explosion velocity to add to the entity's existing velocity
-
onCreateWorldSpawn
public static boolean onCreateWorldSpawn(net.minecraft.world.level.Level level, net.minecraft.world.level.storage.ServerLevelData settings) -
onLivingHeal
public static float onLivingHeal(net.minecraft.world.entity.LivingEntity entity, float amount) -
onPotionAttemptBrew
public static boolean onPotionAttemptBrew(net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> stacks) -
onPotionBrewed
public static void onPotionBrewed(net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> brewingItemStacks) -
onPlayerBrewedPotion
public static void onPlayerBrewedPotion(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack) -
canEntityContinueSleeping
public static boolean canEntityContinueSleeping(net.minecraft.world.entity.LivingEntity sleeper, @Nullable @Nullable net.minecraft.world.entity.player.Player.BedSleepingProblem problem) Checks if a sleeping entity can continue sleeping with the given sleeping problem.- Returns:
- true if the entity may continue sleeping
-
onArrowNock
public static net.minecraft.world.InteractionResult onArrowNock(net.minecraft.world.item.ItemStack item, net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand, boolean hasAmmo) -
onArrowLoose
public static int onArrowLoose(net.minecraft.world.item.ItemStack stack, net.minecraft.world.level.Level level, net.minecraft.world.entity.player.Player player, int charge, boolean hasAmmo) -
onProjectileImpact
public static boolean onProjectileImpact(net.minecraft.world.entity.projectile.Projectile projectile, net.minecraft.world.phys.HitResult ray) -
loadLootTable
@Nullable @Internal public static @Nullable net.minecraft.world.level.storage.loot.LootTable loadLootTable(net.minecraft.core.HolderLookup.Provider registries, net.minecraft.resources.ResourceLocation name, net.minecraft.world.level.storage.loot.LootTable table) Fires theLootTableLoadEvent
for non-empty loot tables and returns the table if the event was not canceled and the table was not set toLootTable.EMPTY
in the event. Otherwise returnsnull
which maps to an emptyOptional
ininvalid reference
LootDataType#deserialize(ResourceLocation, DynamicOps, Object)
-
canCreateFluidSource
public static boolean canCreateFluidSource(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) Checks if a fluid is allowed to create a fluid source. This fires theCreateFluidSourceEvent
. By default, a fluid can create a source if it returns true toinvalid reference
IFluidStateExtension#canConvertToSource(Level, BlockPos)
-
onTrySpawnPortal
-
onEnchantmentLevelSet
public static int onEnchantmentLevelSet(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, int enchantRow, int power, net.minecraft.world.item.ItemStack itemStack, int enchantmentLevel) -
onEntityDestroyBlock
public static boolean onEntityDestroyBlock(net.minecraft.world.entity.LivingEntity entity, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) -
canEntityGrief
public static boolean canEntityGrief(net.minecraft.server.level.ServerLevel level, @Nullable @Nullable net.minecraft.world.entity.Entity entity) Checks if an entity can perform a griefing action.If an entity is provided, this method fires
EntityMobGriefingEvent
. If an entity is not provided, this method returns the value ofGameRules.RULE_MOBGRIEFING
.- Parameters:
level
- The level of the actionentity
- The entity performing the action, or null if unknown.- Returns:
-
fireBlockGrowFeature
public static BlockGrowFeatureEvent fireBlockGrowFeature(net.minecraft.world.level.LevelAccessor level, net.minecraft.util.RandomSource rand, net.minecraft.core.BlockPos pos, @Nullable @Nullable net.minecraft.core.Holder<net.minecraft.world.level.levelgen.feature.ConfiguredFeature<?, ?>> holder) Fires theBlockGrowFeatureEvent
and returns the event object.- Parameters:
level
- The level the feature will be grown inrand
- The random sourcepos
- The position the feature will be grown atholder
- The feature to be grown, if any
-
alterGround
public static AlterGroundEvent.StateProvider alterGround(net.minecraft.world.level.levelgen.feature.treedecorators.TreeDecorator.Context ctx, List<net.minecraft.core.BlockPos> positions, AlterGroundEvent.StateProvider provider) Fires theAlterGroundEvent
and retrieves the resultingAlterGroundEvent.StateProvider
.- Parameters:
ctx
- The tree decoration context for the current alteration.positions
- The list of positions that are considered roots.provider
- The originalBlockStateProvider
from theAlterGroundDecorator
.- Returns:
- The (possibly event-modified)
AlterGroundEvent.StateProvider
to be used for ground alteration.
-
fireChunkTicketLevelUpdated
public static void fireChunkTicketLevelUpdated(net.minecraft.server.level.ServerLevel level, long chunkPos, int oldTicketLevel, int newTicketLevel, @Nullable @Nullable net.minecraft.server.level.ChunkHolder chunkHolder) -
fireChunkWatch
public static void fireChunkWatch(net.minecraft.server.level.ServerPlayer entity, net.minecraft.world.level.chunk.LevelChunk chunk, net.minecraft.server.level.ServerLevel level) -
fireChunkSent
public static void fireChunkSent(net.minecraft.server.level.ServerPlayer entity, net.minecraft.world.level.chunk.LevelChunk chunk, net.minecraft.server.level.ServerLevel level) -
fireChunkUnWatch
public static void fireChunkUnWatch(net.minecraft.server.level.ServerPlayer entity, net.minecraft.world.level.ChunkPos chunkpos, net.minecraft.server.level.ServerLevel level) -
onPistonMovePre
public static boolean onPistonMovePre(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction direction, boolean extending) -
onPistonMovePost
public static void onPistonMovePost(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction direction, boolean extending) -
onSleepFinished
public static long onSleepFinished(net.minecraft.server.level.ServerLevel level, long newTime, long minTime) -
onResourceReload
public static List<net.minecraft.server.packs.resources.PreparableReloadListener> onResourceReload(net.minecraft.server.ReloadableServerResources serverResources, net.minecraft.core.RegistryAccess registryAccess) Fires theAddServerReloadListenersEvent
and returns the sorted list of reload listeners.- Parameters:
serverResources
- The just-createdReloadableServerResources
instance.registryAccess
- The registry access from theReloadableServerRegistries.LoadResult
.- Returns:
- The sorted list of reload listeners.
- Throws:
IllegalArgumentException
- ifReloadListenerSort.sort(SortedReloadListenerEvent)
detects a cycle.
-
onCommandRegister
public static void onCommandRegister(com.mojang.brigadier.CommandDispatcher<net.minecraft.commands.CommandSourceStack> dispatcher, net.minecraft.commands.Commands.CommandSelection environment, net.minecraft.commands.CommandBuildContext context) -
getEntitySizeForge
public static EntityEvent.Size getEntitySizeForge(net.minecraft.world.entity.Entity entity, net.minecraft.world.entity.Pose pose, net.minecraft.world.entity.EntityDimensions size) -
getEntitySizeForge
public static EntityEvent.Size getEntitySizeForge(net.minecraft.world.entity.Entity entity, net.minecraft.world.entity.Pose pose, net.minecraft.world.entity.EntityDimensions oldSize, net.minecraft.world.entity.EntityDimensions newSize) -
canLivingConvert
-
onLivingConvert
public static void onLivingConvert(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.entity.LivingEntity outcome) -
onEntityTeleportCommand
public static EntityTeleportEvent.TeleportCommand onEntityTeleportCommand(net.minecraft.world.entity.Entity entity, double targetX, double targetY, double targetZ) -
onEntityTeleportSpreadPlayersCommand
public static EntityTeleportEvent.SpreadPlayersCommand onEntityTeleportSpreadPlayersCommand(net.minecraft.world.entity.Entity entity, double targetX, double targetY, double targetZ) -
onEnderTeleport
public static EntityTeleportEvent.EnderEntity onEnderTeleport(net.minecraft.world.entity.LivingEntity entity, double targetX, double targetY, double targetZ) -
onEnderPearlLand
@Internal public static EntityTeleportEvent.EnderPearl onEnderPearlLand(net.minecraft.server.level.ServerPlayer entity, double targetX, double targetY, double targetZ, net.minecraft.world.entity.projectile.ThrownEnderpearl pearlEntity, float attackDamage, net.minecraft.world.phys.HitResult hitResult) -
onItemConsumptionTeleport
public static EntityTeleportEvent.ItemConsumption onItemConsumptionTeleport(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.item.ItemStack itemStack, double targetX, double targetY, double targetZ) -
onPermissionChanged
public static boolean onPermissionChanged(com.mojang.authlib.GameProfile gameProfile, int newLevel, net.minecraft.server.players.PlayerList playerList) -
firePlayerChangedDimensionEvent
public static void firePlayerChangedDimensionEvent(net.minecraft.world.entity.player.Player player, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> fromDim, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> toDim) -
firePlayerLoggedIn
public static void firePlayerLoggedIn(net.minecraft.world.entity.player.Player player) -
firePlayerLoggedOut
public static void firePlayerLoggedOut(net.minecraft.world.entity.player.Player player) -
firePlayerRespawnPositionEvent
public static PlayerRespawnPositionEvent firePlayerRespawnPositionEvent(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.level.portal.TeleportTransition teleportTransition, boolean fromEndFight) Called byinvalid reference
PlayerList#respawn(ServerPlayer, boolean)
ServerPlayer
to fire thePlayerRespawnPositionEvent
- Parameters:
player
- The oldServerPlayer
that is being respawnedfromEndFight
- Whether the player is respawning because they jumped through the End return portalrespawnLevel
- The default level the player will respawn intorespawnAngle
- The angle the player will face when they respawnrespawnPosition
- The position in the level the player will respawn at- Returns:
- The event
-
firePlayerRespawnEvent
public static void firePlayerRespawnEvent(net.minecraft.server.level.ServerPlayer player, boolean fromEndFight) Called byinvalid reference
PlayerList#respawn(ServerPlayer, boolean)
ServerPlayer
.- Parameters:
player
- The new player instance created by the respawn processfromEndFight
- Whether the player is respawning because they jumped through the End return portal
-
firePlayerCraftingEvent
public static void firePlayerCraftingEvent(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack crafted, net.minecraft.world.Container craftMatrix) -
firePlayerSmeltedEvent
public static void firePlayerSmeltedEvent(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack smelted, int amountRemoved) -
fireEntityTickPre
FiresEntityTickEvent.Pre
. Called from the head ofLivingEntity.tick()
.- Parameters:
entity
- The entity being ticked- Returns:
- The event
-
fireEntityTickPost
public static void fireEntityTickPost(net.minecraft.world.entity.Entity entity) FiresEntityTickEvent.Post
. Called from the tail ofLivingEntity.tick()
.- Parameters:
entity
- The entity being ticked
-
firePlayerTickPre
public static void firePlayerTickPre(net.minecraft.world.entity.player.Player player) FiresPlayerTickEvent.Pre
. Called from the head ofPlayer.tick()
.- Parameters:
player
- The player being ticked
-
firePlayerTickPost
public static void firePlayerTickPost(net.minecraft.world.entity.player.Player player) FiresPlayerTickEvent.Post
. Called from the tail ofPlayer.tick()
.- Parameters:
player
- The player being ticked
-
fireLevelTickPre
public static void fireLevelTickPre(net.minecraft.world.level.Level level, BooleanSupplier haveTime) FiresLevelTickEvent.Pre
. Called frominvalid reference
Minecraft#tick()
MinecraftServer.tickChildren(BooleanSupplier)
just before the try block for level tick is entered.- Parameters:
level
- The level being tickedhaveTime
- The time supplier, indicating if there is remaining time to do work in the current tick.
-
fireLevelTickPost
public static void fireLevelTickPost(net.minecraft.world.level.Level level, BooleanSupplier haveTime) FiresLevelTickEvent.Post
. Called frominvalid reference
Minecraft#tick()
MinecraftServer.tickChildren(BooleanSupplier)
just after the try block for level tick is exited.- Parameters:
level
- The level being tickedhaveTime
- The time supplier, indicating if there is remaining time to do work in the current tick.
-
fireServerTickPre
public static void fireServerTickPre(BooleanSupplier haveTime, net.minecraft.server.MinecraftServer server) FiresServerTickEvent.Pre
. Called from the head ofMinecraftServer.tickServer(BooleanSupplier)
.- Parameters:
haveTime
- The time supplier, indicating if there is remaining time to do work in the current tick.server
- The current server
-
fireServerTickPost
public static void fireServerTickPost(BooleanSupplier haveTime, net.minecraft.server.MinecraftServer server) FiresServerTickEvent.Post
. Called from the tail ofMinecraftServer.tickServer(BooleanSupplier)
.- Parameters:
haveTime
- The time supplier, indicating if there is remaining time to do work in the current tick.server
- The current server
-
getPotentialSpawns
public static net.minecraft.util.random.WeightedList<net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData> getPotentialSpawns(net.minecraft.world.level.LevelAccessor level, net.minecraft.world.entity.MobCategory category, net.minecraft.core.BlockPos pos, net.minecraft.util.random.WeightedList<net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData> oldList) -
onStatAward
public static StatAwardEvent onStatAward(net.minecraft.world.entity.player.Player player, net.minecraft.stats.Stat<?> stat, int value) -
onAdvancementEarnedEvent
@Internal public static void onAdvancementEarnedEvent(net.minecraft.world.entity.player.Player player, net.minecraft.advancements.AdvancementHolder earned) -
onAdvancementProgressedEvent
@Internal public static void onAdvancementProgressedEvent(net.minecraft.world.entity.player.Player player, net.minecraft.advancements.AdvancementHolder progressed, net.minecraft.advancements.AdvancementProgress advancementProgress, String criterion, AdvancementEvent.AdvancementProgressEvent.ProgressType progressType) -
onEffectRemoved
public static boolean onEffectRemoved(net.minecraft.world.entity.LivingEntity entity, net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect> effect) -
onEffectRemoved
public static boolean onEffectRemoved(net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.effect.MobEffectInstance effectInstance) -
getEnchantmentLevelSpecific
public static int getEnchantmentLevelSpecific(int level, net.minecraft.world.item.ItemStack stack, net.minecraft.core.Holder<net.minecraft.world.item.enchantment.Enchantment> ench) FiresGetEnchantmentLevelEvent
and for a single enchantment, returning the (possibly event-modified) level.- Parameters:
level
- The original level of the enchantment as provided by the Item.stack
- The stack being queried against.ench
- The enchantment being queried for.- Returns:
- The new level of the enchantment.
-
getAllEnchantmentLevels
public static net.minecraft.world.item.enchantment.ItemEnchantments getAllEnchantmentLevels(net.minecraft.world.item.enchantment.ItemEnchantments enchantments, net.minecraft.world.item.ItemStack stack, net.minecraft.core.HolderLookup.RegistryLookup<net.minecraft.world.item.enchantment.Enchantment> lookup) FiresGetEnchantmentLevelEvent
and for all enchantments, returning the (possibly event-modified) enchantment map.- Parameters:
enchantments
- The original enchantment map as provided by the Item.stack
- The stack being queried against.- Returns:
- The new enchantment map.
-
onCreativeModeTabBuildContents
@Internal public static void onCreativeModeTabBuildContents(net.minecraft.world.item.CreativeModeTab tab, net.minecraft.resources.ResourceKey<net.minecraft.world.item.CreativeModeTab> tabKey, net.minecraft.world.item.CreativeModeTab.DisplayItemsGenerator originalGenerator, net.minecraft.world.item.CreativeModeTab.ItemDisplayParameters params, net.minecraft.world.item.CreativeModeTab.Output output) Fires theBuildCreativeModeTabContentsEvent
.- Parameters:
tab
- The tab that contents are being collected for.tabKey
- The resource key of the tab.originalGenerator
- The display items generator that populates vanilla entries.params
- Display parameters, controlling if certain items are hidden.output
- The output acceptor.
-
onMobSplit
public static MobSplitEvent onMobSplit(net.minecraft.world.entity.Mob parent, List<net.minecraft.world.entity.Mob> children) Fires the mob split event. Returns the event for cancellation checking.- Parameters:
parent
- The parent mob, which is in the process of being removed.children
- All child mobs that would have normally spawned.- Returns:
- The event object.
-
getCustomSpawners
public static List<net.minecraft.world.level.CustomSpawner> getCustomSpawners(net.minecraft.server.level.ServerLevel serverLevel, List<net.minecraft.world.level.CustomSpawner> customSpawners) Fires theModifyCustomSpawnersEvent
. Returns the custom spawners list.- Parameters:
serverLevel
- The server level.customSpawners
- The original custom spawners.- Returns:
- The new custom spawners list.
-
the hand sensitive version
as this version provides wrong hand information