Package net.minecraftforge.event
Class ForgeEventFactory
java.lang.Object
net.minecraftforge.event.ForgeEventFactory
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic SaplingGrowTreeEvent
blockGrowFeature
(LevelAccessor level, Random rand, BlockPos pos, Holder<? extends ConfiguredFeature<?, ?>> holder) static boolean
canCreateFluidSource
(LevelReader level, BlockPos pos, BlockState state, boolean def) static net.minecraftforge.eventbus.api.Event.Result
canEntityDespawn
(Mob entity) static net.minecraftforge.eventbus.api.Event.Result
canEntitySpawn
(Mob entity, LevelAccessor level, double x, double y, double z, BaseSpawner spawner, MobSpawnType spawnReason) static boolean
canEntitySpawnSpawner
(Mob entity, Level level, float x, float y, float z, BaseSpawner spawner) Deprecated, for removal: This API element is subject to removal in a future version.static boolean
canEntityUpdate
(Entity entity) static boolean
canLivingConvert
(LivingEntity entity, EntityType<? extends LivingEntity> outcome, Consumer<Integer> timer) static boolean
canMountEntity
(Entity entityMounting, Entity entityBeingMounted, boolean isMounting) static boolean
doPlayerHarvestCheck
(Player player, BlockState state, boolean success) static boolean
doSpecialSpawn
(Mob entity, LevelAccessor level, float x, float y, float z, BaseSpawner spawner, MobSpawnType spawnReason) static boolean
doSpecialSpawn
(Mob entity, Level level, float x, float y, float z, BaseSpawner spawner, MobSpawnType spawnReason) Deprecated, for removal: This API element is subject to removal in a future version.static void
fireChunkWatch
(boolean wasLoaded, boolean load, ServerPlayer entity, ChunkPos chunkpos, ServerLevel level) static void
fireChunkWatch
(boolean watch, ServerPlayer entity, ChunkPos chunkpos, ServerLevel level) static BlockState
fireFluidPlaceBlockEvent
(LevelAccessor level, BlockPos pos, BlockPos liquidPos, BlockState state) static void
firePlayerChangedDimensionEvent
(Player player, ResourceKey<Level> fromDim, ResourceKey<Level> toDim) static void
firePlayerCraftingEvent
(Player player, ItemStack crafted, Container craftMatrix) static void
firePlayerItemPickupEvent
(Player player, ItemEntity item, ItemStack clone) static void
firePlayerLoadingEvent
(Player player, File playerDirectory, String uuidString) static void
firePlayerLoadingEvent
(Player player, PlayerDataStorage playerFileData, String uuidString) static void
firePlayerLoggedIn
(Player player) static void
firePlayerLoggedOut
(Player player) static void
firePlayerRespawnEvent
(Player player, boolean endConquered) static void
firePlayerSavingEvent
(Player player, File playerDirectory, String uuidString) static void
firePlayerSmeltedEvent
(Player player, ItemStack smelted) static boolean
fireSleepingLocationCheck
(LivingEntity player, BlockPos sleepingLocation) static boolean
fireSleepingTimeCheck
(Player player, Optional<BlockPos> sleepingLocation) static ZombieEvent.SummonAidEvent
fireZombieSummonAid
(Zombie zombie, Level level, int x, int y, int z, LivingEntity attacker, double summonChance) static <T extends ICapabilityProvider>
CapabilityDispatchergatherCapabilities
(Class<? extends T> type, T provider) static <T extends ICapabilityProvider>
CapabilityDispatchergatherCapabilities
(Class<? extends T> type, T provider, ICapabilityProvider parent) private static CapabilityDispatcher
gatherCapabilities
(AttachCapabilitiesEvent<?> event, ICapabilityProvider parent) static float
getBreakSpeed
(Player player, BlockState state, float original, BlockPos pos) static EntityEvent.Size
getEntitySizeForge
(Entity entity, Pose pose, EntityDimensions size, float eyeHeight) static EntityEvent.Size
getEntitySizeForge
(Entity entity, Pose pose, EntityDimensions oldSize, EntityDimensions newSize, float newEyeHeight) static int
getExperienceDrop
(LivingEntity entity, Player attackingPlayer, int originalExperience) static int
getItemBurnTime
(ItemStack itemStack, int burnTime, RecipeType<?> recipeType) static int
getMaxSpawnPackSize
(Mob entity) static boolean
getMobGriefingEvent
(Level level, Entity entity) static Component
getPlayerDisplayName
(Player player, Component username) static Component
getPlayerTabListDisplayName
(Player player) getPotentialSpawns
(LevelAccessor level, MobCategory category, BlockPos pos, WeightedRandomList<MobSpawnSettings.SpawnerData> oldList) static LootTable
loadLootTable
(ResourceLocation name, LootTable table, LootTables lootTableManager) static boolean
onAnimalTame
(Animal animal, Player tamer) static int
onApplyBonemeal
(Player player, Level level, BlockPos pos, BlockState state, ItemStack stack) static int
onArrowLoose
(ItemStack stack, Level level, Player player, int charge, boolean hasAmmo) static InteractionResultHolder<ItemStack>
onArrowNock
(ItemStack item, Level level, Player player, InteractionHand hand, boolean hasAmmo) static boolean
onBlockPlace
(Entity entity, BlockSnapshot blockSnapshot, Direction direction) static InteractionResultHolder<ItemStack>
onBucketUse
(Player player, Level level, ItemStack stack, HitResult target) onChorusFruitTeleport
(LivingEntity entity, double targetX, double targetY, double targetZ) static Component
onClientChat
(ChatType type, Component message, UUID senderUUID) static String
onClientSendMessage
(String message) static void
onCommandRegister
(com.mojang.brigadier.CommandDispatcher<CommandSourceStack> dispatcher, Commands.CommandSelection environment) static boolean
onCreateWorldSpawn
(Level level, ServerLevelData settings) static int
onEnchantmentLevelSet
(Level level, BlockPos pos, int enchantRow, int power, ItemStack itemStack, int enchantmentLevel) onEnderPearlLand
(ServerPlayer entity, double targetX, double targetY, double targetZ, ThrownEnderpearl pearlEntity, float attackDamage) onEnderTeleport
(LivingEntity entity, double targetX, double targetY, double targetZ) static boolean
onEntityDestroyBlock
(LivingEntity entity, BlockPos pos, BlockState state) static boolean
onEntityStruckByLightning
(Entity entity, LightningBolt bolt) onEntityTeleportCommand
(Entity entity, double targetX, double targetY, double targetZ) onEntityTeleportSpreadPlayersCommand
(Entity entity, double targetX, double targetY, double targetZ) static void
onExplosionDetonate
(Level level, Explosion explosion, List<Entity> list, double diameter) static boolean
onExplosionStart
(Level level, Explosion explosion) static int
onHoeUse
(UseOnContext context) Deprecated, for removal: This API element is subject to removal in a future version.static int
onItemExpire
(ItemEntity entity, ItemStack item) static int
onItemPickup
(ItemEntity entityItem, Player player) static ItemTooltipEvent
onItemTooltip
(ItemStack itemStack, Player entityPlayer, List<Component> list, TooltipFlag flags) static ItemStack
onItemUseFinish
(LivingEntity entity, ItemStack item, int duration, ItemStack result) static int
onItemUseStart
(LivingEntity entity, ItemStack item, int duration) static int
onItemUseTick
(LivingEntity entity, ItemStack item, int duration) static void
onLivingConvert
(LivingEntity entity, LivingEntity outcome) static float
onLivingHeal
(LivingEntity entity, float amount) static boolean
onMultiBlockPlace
(Entity entity, List<BlockSnapshot> blockSnapshots, Direction direction) onNeighborNotify
(Level level, BlockPos pos, BlockState state, EnumSet<Direction> notifiedSides, boolean forceRedstoneUpdate) static boolean
onPermissionChanged
(com.mojang.authlib.GameProfile gameProfile, int newLevel, PlayerList playerList) static boolean
onPistonMovePost
(Level level, BlockPos pos, Direction direction, boolean extending) static boolean
onPistonMovePre
(Level level, BlockPos pos, Direction direction, boolean extending) static void
onPlayerBrewedPotion
(Player player, ItemStack stack) static void
onPlayerClone
(Player player, Player oldPlayer, boolean wasDeath) static void
onPlayerDestroyItem
(Player player, ItemStack stack, InteractionHand hand) static void
onPlayerFall
(Player player, float distance, float multiplier) static void
onPlayerPostTick
(Player player) static void
onPlayerPreTick
(Player player) static Player.BedSleepingProblem
onPlayerSleepInBed
(Player player, Optional<BlockPos> pos) static boolean
onPlayerSpawnSet
(Player player, ResourceKey<Level> levelKey, BlockPos pos, boolean forced) static void
onPlayerWakeup
(Player player, boolean wakeImmediately, boolean updateWorldFlag) static PlaySoundAtEntityEvent
onPlaySoundAtEntity
(Entity entity, SoundEvent name, SoundSource category, float volume, float pitch) static void
static void
Deprecated, for removal: This API element is subject to removal in a future version.static void
onPostServerTick
(BooleanSupplier haveTime) static void
onPostWorldTick
(Level level) Deprecated, for removal: This API element is subject to removal in a future version.static void
onPostWorldTick
(Level level, BooleanSupplier haveTime) static boolean
onPotionAttemptBrew
(NonNullList<ItemStack> stacks) static void
onPotionBrewed
(NonNullList<ItemStack> brewingItemStacks) static void
static void
Deprecated, for removal: This API element is subject to removal in a future version.static void
onPreServerTick
(BooleanSupplier haveTime) static void
onPreWorldTick
(Level level) Deprecated, for removal: This API element is subject to removal in a future version.static void
onPreWorldTick
(Level level, BooleanSupplier haveTime) static boolean
onProjectileImpact
(Projectile projectile, HitResult ray) static void
onRenderTickEnd
(float timer) static void
onRenderTickStart
(float timer) static List<PreparableReloadListener>
onResourceReload
(ReloadableServerResources serverResources) static long
onSleepFinished
(ServerLevel level, long newTime, long minTime) static void
onStartEntityTracking
(Entity entity, Player player) static void
onStopEntityTracking
(Entity entity, Player player) static BlockState
onToolUse
(BlockState originalState, UseOnContext context, ToolAction toolAction, boolean simulate) static BlockState
onToolUse
(BlockState originalState, Level level, BlockPos pos, Player player, ItemStack stack, ToolAction toolAction) Deprecated, for removal: This API element is subject to removal in a future version.static Optional<PortalShape>
onTrySpawnPortal
(LevelAccessor level, BlockPos pos, Optional<PortalShape> size) static boolean
onUseItemStop
(LivingEntity entity, ItemStack item, int duration) static boolean
renderBlockOverlay
(Player player, PoseStack mat, RenderBlockOverlayEvent.OverlayType type, BlockState block, BlockPos pos) static boolean
renderFireOverlay
(Player player, PoseStack mat) static boolean
renderWaterOverlay
(Player player, PoseStack mat) static boolean
saplingGrowTree
(LevelAccessor level, Random rand, BlockPos pos) Deprecated, for removal: This API element is subject to removal in a future version.
-
Constructor Details
-
ForgeEventFactory
public ForgeEventFactory()
-
-
Method Details
-
onMultiBlockPlace
public static boolean onMultiBlockPlace(@Nullable Entity entity, List<BlockSnapshot> blockSnapshots, Direction direction) -
onBlockPlace
public static boolean onBlockPlace(@Nullable Entity entity, @Nonnull BlockSnapshot blockSnapshot, @Nonnull Direction direction) -
onNeighborNotify
public static BlockEvent.NeighborNotifyEvent onNeighborNotify(Level level, BlockPos pos, BlockState state, EnumSet<Direction> notifiedSides, boolean forceRedstoneUpdate) -
doPlayerHarvestCheck
-
getBreakSpeed
-
onPlayerDestroyItem
public static void onPlayerDestroyItem(Player player, @Nonnull ItemStack stack, @Nullable InteractionHand hand) -
canEntitySpawn
public static net.minecraftforge.eventbus.api.Event.Result canEntitySpawn(Mob entity, LevelAccessor level, double x, double y, double z, BaseSpawner spawner, MobSpawnType spawnReason) -
canEntitySpawnSpawner
@Deprecated(forRemoval=true, since="1.18.1") public static boolean canEntitySpawnSpawner(Mob entity, Level level, float x, float y, float z, BaseSpawner spawner) Deprecated, for removal: This API element is subject to removal in a future version. -
doSpecialSpawn
@Deprecated(forRemoval=true, since="1.18.1") public static boolean doSpecialSpawn(Mob entity, Level level, float x, float y, float z, BaseSpawner spawner, MobSpawnType spawnReason) Deprecated, for removal: This API element is subject to removal in a future version. -
doSpecialSpawn
public static boolean doSpecialSpawn(Mob entity, LevelAccessor level, float x, float y, float z, BaseSpawner spawner, MobSpawnType spawnReason) -
canEntityDespawn
-
getItemBurnTime
public static int getItemBurnTime(@Nonnull ItemStack itemStack, int burnTime, @Nullable RecipeType<?> recipeType) -
getExperienceDrop
public static int getExperienceDrop(LivingEntity entity, Player attackingPlayer, int originalExperience) -
getMaxSpawnPackSize
-
getPlayerDisplayName
-
getPlayerTabListDisplayName
-
fireFluidPlaceBlockEvent
public static BlockState fireFluidPlaceBlockEvent(LevelAccessor level, BlockPos pos, BlockPos liquidPos, BlockState state) -
onItemTooltip
public static ItemTooltipEvent onItemTooltip(ItemStack itemStack, @Nullable Player entityPlayer, List<Component> list, TooltipFlag flags) -
fireZombieSummonAid
public static ZombieEvent.SummonAidEvent fireZombieSummonAid(Zombie zombie, Level level, int x, int y, int z, LivingEntity attacker, double summonChance) -
onEntityStruckByLightning
-
onItemUseStart
-
onItemUseTick
-
onUseItemStop
-
onItemUseFinish
public static ItemStack onItemUseFinish(LivingEntity entity, ItemStack item, int duration, ItemStack result) -
onStartEntityTracking
-
onStopEntityTracking
-
firePlayerLoadingEvent
-
firePlayerSavingEvent
-
firePlayerLoadingEvent
public static void firePlayerLoadingEvent(Player player, PlayerDataStorage playerFileData, String uuidString) -
onClientChat
-
onClientSendMessage
-
onHoeUse
Deprecated, for removal: This API element is subject to removal in a future version. -
onToolUse
@Nullable public static BlockState onToolUse(BlockState originalState, UseOnContext context, ToolAction toolAction, boolean simulate) -
onToolUse
@Nullable @Deprecated(forRemoval=true, since="1.18.2") public static BlockState onToolUse(BlockState originalState, Level level, BlockPos pos, Player player, ItemStack stack, ToolAction toolAction) Deprecated, for removal: This API element is subject to removal in a future version. -
onApplyBonemeal
public static int onApplyBonemeal(@Nonnull Player player, @Nonnull Level level, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull ItemStack stack) -
onBucketUse
-
canEntityUpdate
-
onPlaySoundAtEntity
public static PlaySoundAtEntityEvent onPlaySoundAtEntity(Entity entity, SoundEvent name, SoundSource category, float volume, float pitch) -
onItemExpire
-
onItemPickup
-
canMountEntity
-
onAnimalTame
-
onPlayerSleepInBed
-
onPlayerWakeup
-
onPlayerFall
-
onPlayerSpawnSet
public static boolean onPlayerSpawnSet(Player player, ResourceKey<Level> levelKey, BlockPos pos, boolean forced) -
onPlayerClone
-
onExplosionStart
-
onExplosionDetonate
-
onCreateWorldSpawn
-
onLivingHeal
-
onPotionAttemptBrew
-
onPotionBrewed
-
onPlayerBrewedPotion
-
renderFireOverlay
-
renderWaterOverlay
-
renderBlockOverlay
public static boolean renderBlockOverlay(Player player, PoseStack mat, RenderBlockOverlayEvent.OverlayType type, BlockState block, BlockPos pos) -
gatherCapabilities
@Nullable public static <T extends ICapabilityProvider> CapabilityDispatcher gatherCapabilities(Class<? extends T> type, T provider) -
gatherCapabilities
@Nullable public static <T extends ICapabilityProvider> CapabilityDispatcher gatherCapabilities(Class<? extends T> type, T provider, @Nullable ICapabilityProvider parent) -
gatherCapabilities
@Nullable private static CapabilityDispatcher gatherCapabilities(AttachCapabilitiesEvent<?> event, @Nullable ICapabilityProvider parent) -
fireSleepingLocationCheck
-
fireSleepingTimeCheck
-
onArrowNock
public static InteractionResultHolder<ItemStack> onArrowNock(ItemStack item, Level level, Player player, InteractionHand hand, boolean hasAmmo) -
onArrowLoose
-
onProjectileImpact
-
loadLootTable
public static LootTable loadLootTable(ResourceLocation name, LootTable table, LootTables lootTableManager) -
canCreateFluidSource
public static boolean canCreateFluidSource(LevelReader level, BlockPos pos, BlockState state, boolean def) -
onTrySpawnPortal
public static Optional<PortalShape> onTrySpawnPortal(LevelAccessor level, BlockPos pos, Optional<PortalShape> size) -
onEnchantmentLevelSet
-
onEntityDestroyBlock
-
getMobGriefingEvent
-
saplingGrowTree
@Deprecated(forRemoval=true, since="1.18.2") public static boolean saplingGrowTree(LevelAccessor level, Random rand, BlockPos pos) Deprecated, for removal: This API element is subject to removal in a future version. -
blockGrowFeature
public static SaplingGrowTreeEvent blockGrowFeature(LevelAccessor level, Random rand, BlockPos pos, Holder<? extends ConfiguredFeature<?, ?>> holder) -
fireChunkWatch
public static void fireChunkWatch(boolean watch, ServerPlayer entity, ChunkPos chunkpos, ServerLevel level) -
fireChunkWatch
public static void fireChunkWatch(boolean wasLoaded, boolean load, ServerPlayer entity, ChunkPos chunkpos, ServerLevel level) -
onPistonMovePre
-
onPistonMovePost
-
onSleepFinished
-
onResourceReload
public static List<PreparableReloadListener> onResourceReload(ReloadableServerResources serverResources) -
onCommandRegister
public static void onCommandRegister(com.mojang.brigadier.CommandDispatcher<CommandSourceStack> dispatcher, Commands.CommandSelection environment) -
getEntitySizeForge
public static EntityEvent.Size getEntitySizeForge(Entity entity, Pose pose, EntityDimensions size, float eyeHeight) -
getEntitySizeForge
public static EntityEvent.Size getEntitySizeForge(Entity entity, Pose pose, EntityDimensions oldSize, EntityDimensions newSize, float newEyeHeight) -
canLivingConvert
public static boolean canLivingConvert(LivingEntity entity, EntityType<? extends LivingEntity> outcome, Consumer<Integer> timer) -
onLivingConvert
-
onEntityTeleportCommand
public static EntityTeleportEvent.TeleportCommand onEntityTeleportCommand(Entity entity, double targetX, double targetY, double targetZ) -
onEntityTeleportSpreadPlayersCommand
public static EntityTeleportEvent.SpreadPlayersCommand onEntityTeleportSpreadPlayersCommand(Entity entity, double targetX, double targetY, double targetZ) -
onEnderTeleport
public static EntityTeleportEvent.EnderEntity onEnderTeleport(LivingEntity entity, double targetX, double targetY, double targetZ) -
onEnderPearlLand
public static EntityTeleportEvent.EnderPearl onEnderPearlLand(ServerPlayer entity, double targetX, double targetY, double targetZ, ThrownEnderpearl pearlEntity, float attackDamage) -
onChorusFruitTeleport
public static EntityTeleportEvent.ChorusFruit onChorusFruitTeleport(LivingEntity entity, double targetX, double targetY, double targetZ) -
onPermissionChanged
public static boolean onPermissionChanged(com.mojang.authlib.GameProfile gameProfile, int newLevel, PlayerList playerList) -
firePlayerChangedDimensionEvent
public static void firePlayerChangedDimensionEvent(Player player, ResourceKey<Level> fromDim, ResourceKey<Level> toDim) -
firePlayerLoggedIn
-
firePlayerLoggedOut
-
firePlayerRespawnEvent
-
firePlayerItemPickupEvent
-
firePlayerCraftingEvent
-
firePlayerSmeltedEvent
-
onRenderTickStart
public static void onRenderTickStart(float timer) -
onRenderTickEnd
public static void onRenderTickEnd(float timer) -
onPlayerPreTick
-
onPlayerPostTick
-
onPreWorldTick
Deprecated, for removal: This API element is subject to removal in a future version.TODO: Remove in 1.19 -
onPreWorldTick
-
onPostWorldTick
Deprecated, for removal: This API element is subject to removal in a future version.TODO: Remove in 1.19 -
onPostWorldTick
-
onPreClientTick
public static void onPreClientTick() -
onPostClientTick
public static void onPostClientTick() -
onPreServerTick
Deprecated, for removal: This API element is subject to removal in a future version.TODO: Remove in 1.19 -
onPreServerTick
-
onPostServerTick
Deprecated, for removal: This API element is subject to removal in a future version.TODO: Remove in 1.19 -
onPostServerTick
-
getPotentialSpawns
public static WeightedRandomList<MobSpawnSettings.SpawnerData> getPotentialSpawns(LevelAccessor level, MobCategory category, BlockPos pos, WeightedRandomList<MobSpawnSettings.SpawnerData> oldList)
-
onPostServerTick(BooleanSupplier)