Class PlayerSpawnPhantomsEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.entity.EntityEvent
net.neoforged.neoforge.event.entity.living.LivingEvent
net.neoforged.neoforge.event.entity.player.PlayerEvent
net.neoforged.neoforge.event.entity.player.PlayerSpawnPhantomsEvent
This event is fired from
This event is not fired for spectating players.
PhantomSpawner.tick(net.minecraft.server.level.ServerLevel, boolean, boolean)
, once per player, when phantoms would attempt to be spawned.This event is not fired for spectating players.
This event is fired before any per-player checks (but after Player.isSpectator()
), but after all global checks.
The behavior of PhantomSpawner
is determined by the result of this event.
See setResult(net.neoforged.bus.api.Event.Result)
for documentation.
This event is fired on the NeoForge.EVENT_BUS
.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.player.PlayerEvent
PlayerEvent.BreakSpeed, PlayerEvent.Clone, PlayerEvent.HarvestCheck, PlayerEvent.ItemCraftedEvent, PlayerEvent.ItemPickupEvent, PlayerEvent.ItemSmeltedEvent, PlayerEvent.LoadFromFile, PlayerEvent.NameFormat, PlayerEvent.PlayerChangedDimensionEvent, PlayerEvent.PlayerChangeGameModeEvent, PlayerEvent.PlayerLoggedInEvent, PlayerEvent.PlayerLoggedOutEvent, PlayerEvent.PlayerRespawnEvent, PlayerEvent.SaveToFile, PlayerEvent.StartTracking, PlayerEvent.StopTracking, PlayerEvent.TabListNameFormat
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.living.LivingEvent
LivingEvent.LivingJumpEvent, LivingEvent.LivingTickEvent, LivingEvent.LivingVisibilityEvent
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.EntityEvent
EntityEvent.EnteringSection, EntityEvent.EntityConstructing, EntityEvent.Size
Nested classes/interfaces inherited from class net.neoforged.bus.api.Event
net.neoforged.bus.api.Event.HasResult, net.neoforged.bus.api.Event.Result
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
void
setPhantomsToSpawn
(int phantomsToSpawn) Sets the number of phantoms to be spawned.void
setResult
(net.neoforged.bus.api.Event.Result result) The result of this event controls if phantoms will be spawned.
If the result isEvent.Result.ALLOW
, phantoms will always be spawned; If the result isEvent.Result.DENY
, phantoms will never be spawned; If the result isEvent.Result.DEFAULT
, vanilla checks will be run to determine if the spawn may occur.Methods inherited from class net.neoforged.neoforge.event.entity.player.PlayerEvent
getEntity
Methods inherited from class net.neoforged.bus.api.Event
getResult, hasResult
-
Field Details
-
phantomsToSpawn
private int phantomsToSpawn
-
-
Constructor Details
-
PlayerSpawnPhantomsEvent
-
-
Method Details
-
getPhantomsToSpawn
public int getPhantomsToSpawn()- Returns:
- How many phantoms will be spawned, if spawning is successful. The default value is randomly generated.
-
setPhantomsToSpawn
public void setPhantomsToSpawn(int phantomsToSpawn) Sets the number of phantoms to be spawned.- Parameters:
phantomsToSpawn
- How many phantoms should spawn, given checks are passed.
-
setResult
public void setResult(@NotNull net.neoforged.bus.api.Event.Result result) The result of this event controls if phantoms will be spawned.
- If the result is
Event.Result.ALLOW
, phantoms will always be spawned; - If the result is
Event.Result.DENY
, phantoms will never be spawned; - If the result is
Event.Result.DEFAULT
, vanilla checks will be run to determine if the spawn may occur.
- Overrides:
setResult
in classnet.neoforged.bus.api.Event
- If the result is
-