Class PlayerSpawnPhantomsEvent
java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.event.entity.EntityEvent
net.minecraftforge.event.entity.living.LivingEvent
net.minecraftforge.event.entity.player.PlayerEvent
net.minecraftforge.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.minecraftforge.eventbus.api.Event.Result)
for documentation.
This event is fired on the MinecraftForge.EVENT_BUS
.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraftforge.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.minecraftforge.event.entity.living.LivingEvent
LivingEvent.LivingJumpEvent, LivingEvent.LivingTickEvent, LivingEvent.LivingVisibilityEvent
Nested classes/interfaces inherited from class net.minecraftforge.event.entity.EntityEvent
EntityEvent.EnteringSection, EntityEvent.EntityConstructing, EntityEvent.EyeHeight, EntityEvent.Size
Nested classes/interfaces inherited from class net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.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
(@NotNull net.minecraftforge.eventbus.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.minecraftforge.event.entity.player.PlayerEvent
getEntity
Methods inherited from class net.minecraftforge.eventbus.api.Event
getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase
-
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 @NotNull net.minecraftforge.eventbus.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.minecraftforge.eventbus.api.Event
- If the result is
-