Class ThrownEggHatchEvent
java.lang.Object
org.bukkit.event.Event
com.destroystokyo.paper.event.entity.ThrownEggHatchEvent
Called when a thrown egg might hatch.
 
This event fires for all thrown eggs that may hatch, players, dispensers, etc.
- 
Nested Class SummaryNested classes/interfaces inherited from class org.bukkit.event.EventEvent.Result
- 
Constructor SummaryConstructorsConstructorDescriptionThrownEggHatchEvent(Egg egg, boolean hatching, byte numHatches, EntityType hatchingType) 
- 
Method SummaryModifier and TypeMethodDescriptiongetEgg()Gets the egg involved in this event.static HandlerListGet the type of the mob being hatched (EntityType.CHICKENby default)byteGet the number of mob hatches from the egg.booleanGets whether the egg is hatching or not.voidsetHatching(boolean hatching) Sets whether the egg will hatch or not.voidsetHatchingType(EntityType hatchType) Change the type of mob being hatched by the eggvoidsetNumHatches(byte numHatches) Change the number of mobs coming out of the hatched eggMethods inherited from class org.bukkit.event.EventcallEvent, getEventName, isAsynchronous
- 
Constructor Details- 
ThrownEggHatchEvent@Internal public ThrownEggHatchEvent(Egg egg, boolean hatching, byte numHatches, EntityType hatchingType) 
 
- 
- 
Method Details- 
getEggGets the egg involved in this event.- Returns:
- the egg involved in this event
 
- 
isHatchingpublic boolean isHatching()Gets whether the egg is hatching or not. Will be what the server would've done without interaction.- Returns:
- boolean Whether the egg is going to hatch or not
 
- 
setHatchingpublic void setHatching(boolean hatching) Sets whether the egg will hatch or not.- Parameters:
- hatching-- trueif you want the egg to hatch,- falseif you want it not to
 
- 
getHatchingTypeGet the type of the mob being hatched (EntityType.CHICKENby default)- Returns:
- The type of the mob being hatched by the egg
 
- 
setHatchingTypeChange the type of mob being hatched by the egg- Parameters:
- hatchType- The type of the mob being hatched by the egg
 
- 
getNumHatchespublic byte getNumHatches()Get the number of mob hatches from the egg. By default, the number will be the number the server would've done- 7/8 chance of being 0
- 31/256 ~= 1/8 chance to be 1
- 1/256 chance to be 4
 - Returns:
- The number of mobs going to be hatched by the egg
 
- 
setNumHatchespublic void setNumHatches(byte numHatches) Change the number of mobs coming out of the hatched eggThe boolean hatching will override this number. I.e. If hatching is false, this number will not matter- Parameters:
- numHatches- The number of mobs coming out of the egg
 
- 
getHandlers- Specified by:
- getHandlersin class- Event
 
- 
getHandlerList
 
-