Class ForgeEventFactory
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addPackFindersServer
(Consumer<RepositorySource> consumer) static BlockState
alterGround
(LevelSimulatedReader level, RandomSource random, BlockPos pos, BlockState altered) static SaplingGrowTreeEvent
blockGrowFeature
(LevelAccessor level, RandomSource randomSource, BlockPos pos, @Nullable Holder<ConfiguredFeature<?, ?>> holder) static boolean
canCreateFluidSource
(Level level, BlockPos pos, BlockState state, boolean def) static net.minecraftforge.eventbus.api.Event.Result
canEntityDespawn
(Mob entity, ServerLevelAccessor level) static boolean
canLivingConvert
(LivingEntity entity, EntityType<? extends LivingEntity> outcome, Consumer<Integer> timer) static boolean
canMountEntity
(Entity entityMounting, Entity entityBeingMounted, boolean isMounting) static boolean
checkSpawnPlacements
(EntityType<?> entityType, ServerLevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random, boolean defaultResult) static boolean
checkSpawnPosition
(Mob mob, ServerLevelAccessor level, MobSpawnType 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.MobSpawnType)
andMob.checkSpawnObstruction(net.minecraft.world.level.LevelReader)
.static boolean
checkSpawnPositionSpawner
(Mob mob, ServerLevelAccessor level, MobSpawnType spawnType, SpawnData spawnData, BaseSpawner spawner) Specialized variant ofcheckSpawnPosition(net.minecraft.world.entity.Mob, net.minecraft.world.level.ServerLevelAccessor, net.minecraft.world.entity.MobSpawnType)
for spawners, as they have slightly different checks.static boolean
doPlayerHarvestCheck
(Player player, BlockState state, boolean success) private static <E extends net.minecraftforge.eventbus.api.Event>
Efire
(E e) Post an event to theMinecraftForge.EVENT_BUS
, then return the event objectstatic void
fireChunkTicketLevelUpdated
(ServerLevel level, long chunkPos, int oldTicketLevel, int newTicketLevel, @Nullable ChunkHolder chunkHolder) static void
fireChunkUnWatch
(ServerPlayer entity, ChunkPos chunkpos, ServerLevel level) static void
fireChunkWatch
(ServerPlayer entity, LevelChunk chunk, ServerLevel level) static BlockState
fireFluidPlaceBlockEvent
(LevelAccessor level, BlockPos pos, BlockPos liquidPos, BlockState state) 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 ZombieEvent.SummonAidEvent
fireZombieSummonAid
(Zombie zombie, Level level, int x, int y, int z, LivingEntity attacker, double summonChance) static <T extends ICapabilityProvider>
@Nullable CapabilityDispatchergatherCapabilities
(Class<? extends T> type, T provider) static <T extends ICapabilityProvider>
@Nullable CapabilityDispatchergatherCapabilities
(Class<? extends T> type, T provider, @Nullable ICapabilityProvider parent) private static @Nullable CapabilityDispatcher
gatherCapabilities
(AttachCapabilitiesEvent<?> event, @Nullable ICapabilityProvider parent) static GatherComponentsEvent.Item
gatherItemComponentsEvent
(Item item, DataComponentMap dataComponents) static void
gatherLoginConfigTasks
(Connection connection, Consumer<ConfigurationTask> add) static float
getBreakSpeed
(Player player, BlockState state, float original, BlockPos pos) static int
getExperienceDrop
(LivingEntity entity, Player attackingPlayer, int originalExperience) static int
getItemBurnTime
(@NotNull ItemStack itemStack, int burnTime, @Nullable RecipeType<?> recipeType) static int
getMaxSpawnPackSize
(Mob entity) static boolean
getMobGriefingEvent
(Level level, @Nullable 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 void
onAdvancementEarned
(Player player, AdvancementHolder holder) static void
onAdvancementGrant
(Player player, AdvancementHolder holder, AdvancementProgress advancementProgress, String criterion) static void
onAdvancementRevoke
(Player player, AdvancementHolder holder, AdvancementProgress advancementProgress, String criterion) static boolean
onAnimalTame
(Animal animal, Player tamer) static AnvilRepairEvent
onAnvilRepair
(Player player, @NotNull ItemStack output, @NotNull ItemStack left, @NotNull ItemStack right) static int
onApplyBonemeal
(@Nullable 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 BabyEntitySpawnEvent
onBabySpawn
(Mob parentA, Mob parentB, @Nullable AgeableMob proposedChild) static boolean
onBlockPlace
(@Nullable Entity entity, @NotNull BlockSnapshot blockSnapshot, @NotNull Direction direction) static void
onBrewingRecipeRegister
(PotionBrewing.Builder builder, FeatureFlagSet features) static @Nullable InteractionResultHolder
<ItemStack> onBucketUse
(@NotNull Player player, @NotNull Level level, @NotNull ItemStack stack, @Nullable HitResult target) static void
onChannelRegistrationChange
(Connection connection, ChannelRegistrationChangeEvent.Type changeType, HashSet<ResourceLocation> changed) onChorusFruitTeleport
(LivingEntity entity, double targetX, double targetY, double targetZ) static void
onChunkDataLoad
(ChunkAccess chunk, CompoundTag data, ChunkType status) static void
onChunkDataSave
(ChunkAccess chunk, LevelAccessor world, CompoundTag data) static void
onChunkLoad
(ChunkAccess chunk, boolean newChunk) static void
onChunkUnload
(ChunkAccess chunk) static void
onCommandRegister
(com.mojang.brigadier.CommandDispatcher<CommandSourceStack> dispatcher, Commands.CommandSelection environment, CommandBuildContext context) static void
onConnectionStart
(Connection connection) static boolean
onCreateWorldSpawn
(Level level, ServerLevelData settings) static void
onDifficultyChange
(Difficulty difficulty, Difficulty oldDifficulty) 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, HitResult hitResult) onEnderTeleport
(LivingEntity entity, double targetX, double targetY, double targetZ) static void
onEntityConstructing
(Entity entity) static boolean
onEntityDestroyBlock
(LivingEntity entity, BlockPos pos, BlockState state) static void
onEntityEnterSection
(Entity entity, long packedOldPos, long packedNewPos) onEntityInteract
(Player player, Entity entity, InteractionHand hand) onEntityInteractSpecific
(Player player, Entity entity, InteractionHand hand, Vec3 vec3d) static boolean
onEntityJoinLevel
(Entity entity, Level level) static boolean
onEntityJoinLevel
(Entity entity, Level level, boolean loadedFromDisk) static boolean
onEntityLeaveLevel
(Entity entity, Level level) 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 @Nullable SpawnGroupData
onFinalizeSpawn
(Mob mob, ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable SpawnGroupData spawnData) Vanilla calls toMob.finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor, net.minecraft.world.DifficultyInstance, net.minecraft.world.entity.MobSpawnType, net.minecraft.world.entity.SpawnGroupData)
are replaced with calls to this method via coremod.
Mods should call this method in place of callingMob.finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor, net.minecraft.world.DifficultyInstance, net.minecraft.world.entity.MobSpawnType, net.minecraft.world.entity.SpawnGroupData)
.static MobSpawnEvent.FinalizeSpawn
onFinalizeSpawnSpawner
(Mob mob, ServerLevelAccessor level, DifficultyInstance difficulty, @Nullable SpawnGroupData spawnData, @Nullable CompoundTag spawnTag, BaseSpawner spawner) Returns the FinalizeSpawn event instance, or null if it was canceled.
This 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 aBaseSpawner
instance.static void
static GrindstoneEvent.OnPlaceItem
onGrindstoneChange
(@NotNull ItemStack top, @NotNull ItemStack bottom, Container outputSlot, int xp) static int
onItemExpire
(ItemEntity entity, @NotNull ItemStack item) static int
onItemPickup
(ItemEntity entityItem, Player player) static boolean
onItemStackedOn
(ItemStack carriedItem, ItemStack stackedOnItem, Slot slot, ClickAction action, Player player, SlotAccess carriedSlotAccess) static ItemTooltipEvent
onItemTooltip
(ItemStack itemStack, @Nullable 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) onLeftClickBlock
(Player player, BlockPos pos, Direction face, ServerboundPlayerActionPacket.Action action) onLeftClickBlockHold
(Player player, BlockPos pos, Direction face) static void
onLeftClickEmpty
(Player player) static void
onLevelLoad
(Level level) static void
onLevelSave
(Level level) static void
onLevelUnload
(Level level) static boolean
onLivingAttackEntity
(LivingEntity entity, DamageSource src, float amount) static LivingBreatheEvent
onLivingBreathe
(LivingEntity entity, boolean canBreathe, int consumeAirAmount, int refillAirAmount, boolean canRefillAir) static LivingChangeTargetEvent
onLivingChangeTargetBehavior
(LivingEntity entity, LivingEntity originalTarget) static LivingChangeTargetEvent
onLivingChangeTargetMob
(LivingEntity entity, LivingEntity originalTarget) static void
onLivingConvert
(LivingEntity entity, LivingEntity outcome) static boolean
onLivingDeath
(LivingEntity entity, DamageSource src) static boolean
onLivingDrops
(LivingEntity entity, DamageSource source, Collection<ItemEntity> drops, int lootingLevel, boolean recentlyHit) static LivingDrownEvent
onLivingDrown
(LivingEntity entity, boolean isDrowning, float damageAmount, int bubbleCount) static boolean
onLivingEffectAdd
(LivingEntity entity, MobEffectInstance oldEffect, MobEffectInstance newEffect, Entity source) static MobEffectEvent.Applicable
onLivingEffectCanApply
(LivingEntity entity, MobEffectInstance effect) static boolean
onLivingEffectExpire
(LivingEntity entity, MobEffectInstance effect) static boolean
onLivingEffectRemove
(LivingEntity entity, MobEffect effect) static boolean
onLivingEffectRemove
(LivingEntity entity, MobEffectInstance effect) static void
onLivingEquipmentChange
(LivingEntity entity, EquipmentSlot slot, ItemStack from, ItemStack to) static LivingFallEvent
onLivingFall
(LivingEntity entity, float distance, float damageMultiplier) static float
onLivingHeal
(LivingEntity entity, float amount) static LivingKnockBackEvent
onLivingKnockBack
(LivingEntity target, float strength, double ratioX, double ratioZ) static LivingSwapItemsEvent.Hands
onLivingSwapHandItems
(LivingEntity entity) static boolean
onLivingTick
(LivingEntity entity) static @Nullable LootTable
onLoadLootTable
(ResourceLocation name, LootTable table) static boolean
onMultiBlockPlace
(@Nullable Entity entity, List<BlockSnapshot> blockSnapshots, Direction direction) onNeighborNotify
(Level level, BlockPos pos, BlockState state, EnumSet<Direction> notifiedSides, boolean forceRedstoneUpdate) static NoteBlockEvent.Play
onNotePlay
(Level world, BlockPos pos, BlockState state, int note, NoteBlockInstrument instrument) 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
onPlayerChangedDimension
(Player player, ResourceKey<Level> fromDim, ResourceKey<Level> toDim) static void
onPlayerClone
(Player player, Player oldPlayer, boolean wasDeath) static void
onPlayerCloseContainer
(ServerPlayer player, AbstractContainerMenu menu) static void
onPlayerDestroyItem
(Player player, @NotNull ItemStack stack, @Nullable InteractionHand hand) static void
onPlayerDestroyItem
(Player player, @NotNull ItemStack stack, @Nullable EquipmentSlot slot) static void
onPlayerFall
(Player player, float distance, float multiplier) static ItemFishedEvent
onPlayerFishedItem
(List<ItemStack> stacks, int rodDamage, FishingHook hook) static PlayerXpEvent.LevelChange
onPlayerLevelChange
(Player player, int levels) static void
onPlayerOpenContainer
(ServerPlayer player, AbstractContainerMenu menu) static boolean
onPlayerPickupXp
(Player player, ExperienceOrb orb) static void
onPlayerPostTick
(Player player) static void
onPlayerPreTick
(Player player) static Player.BedSleepingProblem
onPlayerSleepInBed
(Player player, Optional<BlockPos> pos) static PlayerSpawnPhantomsEvent
onPlayerSpawnPhantom
(Player player, int phantomsToSpawn) static boolean
onPlayerSpawnSet
(Player player, ResourceKey<Level> levelKey, BlockPos pos, boolean forced) static void
onPlayerTradeWithVillager
(Player player, MerchantOffer offer, AbstractVillager villager) static void
onPlayerWakeup
(Player player, boolean wakeImmediately, boolean updateLevel) static PlayerXpEvent.XpChange
onPlayerXpChange
(Player player, int xp) static PlayLevelSoundEvent.AtEntity
onPlaySoundAtEntity
(Entity entity, Holder<SoundEvent> name, SoundSource category, float volume, float pitch) onPlaySoundAtPosition
(Level level, double x, double y, double z, Holder<SoundEvent> name, SoundSource category, float volume, float pitch) static void
static void
onPostLevelTick
(Level level, BooleanSupplier haveTime) static void
onPostServerTick
(BooleanSupplier haveTime, MinecraftServer server) static boolean
onPotionAttemptBrew
(NonNullList<ItemStack> stacks) static void
onPotionBrewed
(NonNullList<ItemStack> brewingItemStacks) static void
static void
onPreLevelTick
(Level level, BooleanSupplier haveTime) static void
onPreServerTick
(BooleanSupplier haveTime, MinecraftServer server) static boolean
onProjectileImpact
(Projectile projectile, HitResult ray) onProjectileImpactResult
(Projectile projectile, HitResult ray) static void
onRenderTickEnd
(float timer) static void
onRenderTickStart
(float timer) static List
<PreparableReloadListener> onResourceReload
(ReloadableServerResources serverResources, RegistryAccess registryAccess) onRightClickBlock
(Player player, InteractionHand hand, BlockPos pos, BlockHitResult hitVec) static void
onRightClickEmpty
(Player player, InteractionHand hand) onRightClickItem
(Player player, InteractionHand hand) static ShieldBlockEvent
onShieldBlock
(LivingEntity blocker, DamageSource source, float blocked) static long
onSleepFinished
(ServerLevel level, long newTime, long minTime) static boolean
onSleepingTimeCheck
(Player player, Optional<BlockPos> sleepingLocation) static void
onStartEntityTracking
(Entity entity, Player player) static void
onStopEntityTracking
(Entity entity, Player player) static void
onTagsUpdated
(RegistryAccess registryAccess, boolean fromClientPacket, boolean isIntegratedServerConnection) static @Nullable BlockState
onToolUse
(BlockState originalState, UseOnContext context, ToolAction toolAction, boolean simulate) static boolean
onTravelToDimension
(Entity entity, ResourceKey<Level> dimension) static Optional
<PortalShape> onTrySpawnPortal
(LevelAccessor level, BlockPos pos, Optional<PortalShape> size) static boolean
onUseItemStop
(LivingEntity entity, ItemStack item, int duration) static boolean
onVanillaGameEvent
(Level level, Holder<GameEvent> vanillaEvent, Vec3 pos, GameEvent.Context context) private static boolean
post
(net.minecraftforge.eventbus.api.Event e) Post an event to theMinecraftForge.EVENT_BUS
private static <T extends net.minecraftforge.eventbus.api.Event & IModBusEvent>
voidpostModBus
(T e) Post an event to theModLoader.get()
event bus
-
Field Details
-
ML
-
-
Constructor Details
-
ForgeEventFactory
private ForgeEventFactory()
-
-
Method Details
-
post
private static boolean post(net.minecraftforge.eventbus.api.Event e) Post an event to theMinecraftForge.EVENT_BUS
- Returns:
- true if the event is
Cancelable
and has been canceled
-
fire
private static <E extends net.minecraftforge.eventbus.api.Event> E fire(E e) Post an event to theMinecraftForge.EVENT_BUS
, then return the event object- Returns:
- the event object passed in and possibly modified by listeners
-
postModBus
private static <T extends net.minecraftforge.eventbus.api.Event & IModBusEvent> void postModBus(T e) Post an event to theModLoader.get()
event bus -
onMultiBlockPlace
public static boolean onMultiBlockPlace(@Nullable @Nullable Entity entity, List<BlockSnapshot> blockSnapshots, Direction direction) -
onBlockPlace
public static boolean onBlockPlace(@Nullable @Nullable Entity entity, @NotNull @NotNull BlockSnapshot blockSnapshot, @NotNull @NotNull 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, @NotNull @NotNull ItemStack stack, @Nullable @Nullable InteractionHand hand) -
onPlayerDestroyItem
public static void onPlayerDestroyItem(Player player, @NotNull @NotNull ItemStack stack, @Nullable @Nullable EquipmentSlot slot) -
checkSpawnPlacements
public static boolean checkSpawnPlacements(EntityType<?> entityType, ServerLevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random, boolean defaultResult) -
checkSpawnPosition
public static boolean checkSpawnPosition(Mob mob, ServerLevelAccessor level, MobSpawnType 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.MobSpawnType)
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(Mob mob, ServerLevelAccessor level, MobSpawnType spawnType, SpawnData spawnData, BaseSpawner spawner) Specialized variant ofcheckSpawnPosition(net.minecraft.world.entity.Mob, net.minecraft.world.level.ServerLevelAccessor, net.minecraft.world.entity.MobSpawnType)
for spawners, as they have slightly different checks.- See Also:
- Implementation Note:
- See in-line comments about custom spawn rules.
-
onFinalizeSpawn
@Nullable public static @Nullable SpawnGroupData onFinalizeSpawn(Mob mob, ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType spawnType, @Nullable @Nullable SpawnGroupData spawnData) Vanilla calls toMob.finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor, net.minecraft.world.DifficultyInstance, net.minecraft.world.entity.MobSpawnType, net.minecraft.world.entity.SpawnGroupData)
are replaced with calls to this method via coremod.
Mods should call this method in place of callingMob.finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor, net.minecraft.world.DifficultyInstance, net.minecraft.world.entity.MobSpawnType, net.minecraft.world.entity.SpawnGroupData)
. Super calls (from within overrides) should not be wrapped.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.MobSpawnType, net.minecraft.world.entity.SpawnGroupData)
with a call to this method.As an example, the following code block:
Would become:var zombie = new Zombie(level); zombie.finalizeSpawn(level, difficulty, spawnType, spawnData, spawnTag); level.tryAddFreshEntityWithPassengers(zombie); if (zombie.isAddedToWorld()) { // Do stuff with your new zombie }
The only code that changes is thevar zombie = new Zombie(level); ForgeEventFactory.onFinalizeSpawn(zombie, level, difficulty, spawnType, spawnData, spawnTag); level.tryAddFreshEntityWithPassengers(zombie); if (zombie.isAddedToWorld()) { // Do stuff with your new zombie }
Mob.finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor, net.minecraft.world.DifficultyInstance, net.minecraft.world.entity.MobSpawnType, net.minecraft.world.entity.SpawnGroupData)
call.- Returns:
- The SpawnGroupData from this event, or null if it was canceled. The return value of this method has no bearing on if the entity will be spawned.
- See Also:
- API Note:
- Callers do not need to check if the entity's spawn was cancelled, as the spawn will be blocked by Forge.
- Implementation Note:
- Changes to the signature of this method must be reflected in the method redirector coremod.
-
onFinalizeSpawnSpawner
@Nullable public static MobSpawnEvent.FinalizeSpawn onFinalizeSpawnSpawner(Mob mob, ServerLevelAccessor level, DifficultyInstance difficulty, @Nullable @Nullable SpawnGroupData spawnData, @Nullable @Nullable CompoundTag spawnTag, BaseSpawner spawner) Returns the FinalizeSpawn event instance, or null if it was canceled.
This 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 aBaseSpawner
instance.- See Also:
-
canEntityDespawn
public static net.minecraftforge.eventbus.api.Event.Result canEntityDespawn(Mob entity, ServerLevelAccessor level) -
getItemBurnTime
public static int getItemBurnTime(@NotNull @NotNull ItemStack itemStack, int burnTime, @Nullable @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 @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) -
onToolUse
@Nullable public static @Nullable BlockState onToolUse(BlockState originalState, UseOnContext context, ToolAction toolAction, boolean simulate) -
onApplyBonemeal
public static int onApplyBonemeal(@Nullable @Nullable Player player, Level level, BlockPos pos, BlockState state, ItemStack stack) -
onBucketUse
-
onPlaySoundAtEntity
public static PlayLevelSoundEvent.AtEntity onPlaySoundAtEntity(Entity entity, Holder<SoundEvent> name, SoundSource category, float volume, float pitch) -
onPlaySoundAtPosition
public static PlayLevelSoundEvent.AtPosition onPlaySoundAtPosition(Level level, double x, double y, double z, Holder<SoundEvent> name, SoundSource category, float volume, float pitch) -
onItemExpire
-
onItemPickup
-
canMountEntity
-
onAnimalTame
-
onPlayerPickupXp
-
onPlayerSleepInBed
-
onPlayerWakeup
-
onPlayerFall
-
onPlayerSpawnSet
public static boolean onPlayerSpawnSet(Player player, ResourceKey<Level> levelKey, BlockPos pos, boolean forced) -
onPlayerSpawnPhantom
-
onPlayerClone
-
onExplosionStart
-
onExplosionDetonate
-
onCreateWorldSpawn
-
onLivingHeal
-
onPotionAttemptBrew
-
onPotionBrewed
-
onPlayerBrewedPotion
-
gatherCapabilities
@Nullable public static <T extends ICapabilityProvider> @Nullable CapabilityDispatcher gatherCapabilities(Class<? extends T> type, T provider) -
gatherCapabilities
@Nullable public static <T extends ICapabilityProvider> @Nullable CapabilityDispatcher gatherCapabilities(Class<? extends T> type, T provider, @Nullable @Nullable ICapabilityProvider parent) -
gatherCapabilities
@Nullable private static @Nullable CapabilityDispatcher gatherCapabilities(AttachCapabilitiesEvent<?> event, @Nullable @Nullable ICapabilityProvider parent) -
fireSleepingLocationCheck
-
onSleepingTimeCheck
-
onArrowNock
public static InteractionResultHolder<ItemStack> onArrowNock(ItemStack item, Level level, Player player, InteractionHand hand, boolean hasAmmo) -
onArrowLoose
-
onProjectileImpactResult
public static ProjectileImpactEvent.ImpactResult onProjectileImpactResult(Projectile projectile, HitResult ray) -
onProjectileImpact
-
onLoadLootTable
-
canCreateFluidSource
public static boolean canCreateFluidSource(Level level, BlockPos pos, BlockState state, boolean def) -
onTrySpawnPortal
public static Optional<PortalShape> onTrySpawnPortal(LevelAccessor level, BlockPos pos, Optional<PortalShape> size) -
onEnchantmentLevelSet
-
onEntityDestroyBlock
-
getMobGriefingEvent
-
blockGrowFeature
public static SaplingGrowTreeEvent blockGrowFeature(LevelAccessor level, RandomSource randomSource, BlockPos pos, @Nullable @Nullable Holder<ConfiguredFeature<?, ?>> holder) -
alterGround
public static BlockState alterGround(LevelSimulatedReader level, RandomSource random, BlockPos pos, BlockState altered) -
fireChunkTicketLevelUpdated
public static void fireChunkTicketLevelUpdated(ServerLevel level, long chunkPos, int oldTicketLevel, int newTicketLevel, @Nullable @Nullable ChunkHolder chunkHolder) -
fireChunkWatch
-
fireChunkUnWatch
-
onPistonMovePre
-
onPistonMovePost
-
onSleepFinished
-
onResourceReload
public static List<PreparableReloadListener> onResourceReload(ReloadableServerResources serverResources, RegistryAccess registryAccess) -
onCommandRegister
public static void onCommandRegister(com.mojang.brigadier.CommandDispatcher<CommandSourceStack> dispatcher, Commands.CommandSelection environment, CommandBuildContext context) -
canLivingConvert
public static boolean canLivingConvert(LivingEntity entity, EntityType<? extends LivingEntity> outcome, Consumer<Integer> timer) -
onLivingConvert
-
onBabySpawn
public static BabyEntitySpawnEvent onBabySpawn(Mob parentA, Mob parentB, @Nullable @Nullable AgeableMob proposedChild) -
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, HitResult hitResult) -
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) -
onPlayerChangedDimension
public static void onPlayerChangedDimension(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
-
onPreLevelTick
-
onPostLevelTick
-
onPreClientTick
public static void onPreClientTick() -
onPostClientTick
public static void onPostClientTick() -
onPreServerTick
-
onPostServerTick
-
getPotentialSpawns
public static WeightedRandomList<MobSpawnSettings.SpawnerData> getPotentialSpawns(LevelAccessor level, MobCategory category, BlockPos pos, WeightedRandomList<MobSpawnSettings.SpawnerData> oldList) -
onAdvancementEarned
-
onAdvancementGrant
public static void onAdvancementGrant(Player player, AdvancementHolder holder, AdvancementProgress advancementProgress, String criterion) -
onAdvancementRevoke
public static void onAdvancementRevoke(Player player, AdvancementHolder holder, AdvancementProgress advancementProgress, String criterion) -
onEntityConstructing
-
onPlayerOpenContainer
-
onPlayerCloseContainer
-
onTravelToDimension
-
onChunkUnload
-
onChunkLoad
-
onLevelUnload
-
onLevelLoad
-
onLevelSave
-
onChunkDataSave
-
onChunkDataLoad
-
onGameShuttingDown
public static void onGameShuttingDown() -
gatherLoginConfigTasks
-
onConnectionStart
-
onChannelRegistrationChange
public static void onChannelRegistrationChange(Connection connection, ChannelRegistrationChangeEvent.Type changeType, HashSet<ResourceLocation> changed) -
onLivingSwapHandItems
-
onShieldBlock
public static ShieldBlockEvent onShieldBlock(LivingEntity blocker, DamageSource source, float blocked) -
onEntityEnterSection
-
onLivingTick
-
onLivingFall
public static LivingFallEvent onLivingFall(LivingEntity entity, float distance, float damageMultiplier) -
onLivingBreathe
public static LivingBreatheEvent onLivingBreathe(LivingEntity entity, boolean canBreathe, int consumeAirAmount, int refillAirAmount, boolean canRefillAir) -
onLivingDrown
public static LivingDrownEvent onLivingDrown(LivingEntity entity, boolean isDrowning, float damageAmount, int bubbleCount) -
onLivingKnockBack
public static LivingKnockBackEvent onLivingKnockBack(LivingEntity target, float strength, double ratioX, double ratioZ) -
onLivingDeath
-
onLivingDrops
public static boolean onLivingDrops(LivingEntity entity, DamageSource source, Collection<ItemEntity> drops, int lootingLevel, boolean recentlyHit) -
onLeftClickEmpty
-
onLeftClickBlock
public static PlayerInteractEvent.LeftClickBlock onLeftClickBlock(Player player, BlockPos pos, Direction face, ServerboundPlayerActionPacket.Action action) -
onLeftClickBlockHold
public static PlayerInteractEvent.LeftClickBlock onLeftClickBlockHold(Player player, BlockPos pos, Direction face) -
onRightClickBlock
public static PlayerInteractEvent.RightClickBlock onRightClickBlock(Player player, InteractionHand hand, BlockPos pos, BlockHitResult hitVec) -
onRightClickItem
public static PlayerInteractEvent.RightClickItem onRightClickItem(Player player, InteractionHand hand) -
onEntityInteract
public static PlayerInteractEvent.EntityInteract onEntityInteract(Player player, Entity entity, InteractionHand hand) -
onEntityInteractSpecific
public static PlayerInteractEvent.EntityInteractSpecific onEntityInteractSpecific(Player player, Entity entity, InteractionHand hand, Vec3 vec3d) -
onRightClickEmpty
-
addPackFindersServer
-
onEntityJoinLevel
-
onEntityJoinLevel
-
onEntityLeaveLevel
-
onDifficultyChange
-
onTagsUpdated
public static void onTagsUpdated(RegistryAccess registryAccess, boolean fromClientPacket, boolean isIntegratedServerConnection) -
onLivingAttackEntity
-
onVanillaGameEvent
public static boolean onVanillaGameEvent(Level level, Holder<GameEvent> vanillaEvent, Vec3 pos, GameEvent.Context context) -
onLivingEffectExpire
-
onLivingEffectAdd
public static boolean onLivingEffectAdd(LivingEntity entity, MobEffectInstance oldEffect, MobEffectInstance newEffect, Entity source) -
onLivingEffectRemove
-
onLivingEffectRemove
-
onLivingEffectCanApply
public static MobEffectEvent.Applicable onLivingEffectCanApply(LivingEntity entity, MobEffectInstance effect) -
onLivingEquipmentChange
public static void onLivingEquipmentChange(LivingEntity entity, EquipmentSlot slot, ItemStack from, ItemStack to) -
onLivingChangeTargetMob
public static LivingChangeTargetEvent onLivingChangeTargetMob(LivingEntity entity, LivingEntity originalTarget) -
onLivingChangeTargetBehavior
public static LivingChangeTargetEvent onLivingChangeTargetBehavior(LivingEntity entity, LivingEntity originalTarget) -
onPlayerFishedItem
public static ItemFishedEvent onPlayerFishedItem(List<ItemStack> stacks, int rodDamage, FishingHook hook) -
onPlayerXpChange
-
onPlayerLevelChange
-
onGrindstoneChange
public static GrindstoneEvent.OnPlaceItem onGrindstoneChange(@NotNull @NotNull ItemStack top, @NotNull @NotNull ItemStack bottom, Container outputSlot, int xp) -
onBrewingRecipeRegister
-
onItemStackedOn
public static boolean onItemStackedOn(ItemStack carriedItem, ItemStack stackedOnItem, Slot slot, ClickAction action, Player player, SlotAccess carriedSlotAccess) -
onNotePlay
public static NoteBlockEvent.Play onNotePlay(Level world, BlockPos pos, BlockState state, int note, NoteBlockInstrument instrument) -
onAnvilRepair
public static AnvilRepairEvent onAnvilRepair(Player player, @NotNull @NotNull ItemStack output, @NotNull @NotNull ItemStack left, @NotNull @NotNull ItemStack right) -
onPlayerTradeWithVillager
public static void onPlayerTradeWithVillager(Player player, MerchantOffer offer, AbstractVillager villager) -
gatherItemComponentsEvent
public static GatherComponentsEvent.Item gatherItemComponentsEvent(Item item, DataComponentMap dataComponents)
-