diff options
Diffstat (limited to 'patches/api/0388-Add-EntityFertilizeEggEvent.patch')
-rw-r--r-- | patches/api/0388-Add-EntityFertilizeEggEvent.patch | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/patches/api/0388-Add-EntityFertilizeEggEvent.patch b/patches/api/0388-Add-EntityFertilizeEggEvent.patch index 4ae6ff9f0f..8c15e656f8 100644 --- a/patches/api/0388-Add-EntityFertilizeEggEvent.patch +++ b/patches/api/0388-Add-EntityFertilizeEggEvent.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add EntityFertilizeEggEvent diff --git a/src/main/java/io/papermc/paper/event/entity/EntityFertilizeEggEvent.java b/src/main/java/io/papermc/paper/event/entity/EntityFertilizeEggEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..35d54650c53bc64dd7c440240ad2f2b9b87d7ae8 +index 0000000000000000000000000000000000000000..a96c28678c5f6a52710ae287d3bbc25e180d058e --- /dev/null +++ b/src/main/java/io/papermc/paper/event/entity/EntityFertilizeEggEvent.java -@@ -0,0 +1,139 @@ +@@ -0,0 +1,133 @@ +package io.papermc.paper.event.entity; + +import org.bukkit.Material; @@ -21,8 +21,8 @@ index 0000000000000000000000000000000000000000..35d54650c53bc64dd7c440240ad2f2b9 +import org.bukkit.event.entity.EntityEvent; +import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.ApiStatus; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; ++import org.jspecify.annotations.NullMarked; ++import org.jspecify.annotations.Nullable; + +/** + * Called when two entities mate and the mating process results in a fertilization. @@ -35,23 +35,24 @@ index 0000000000000000000000000000000000000000..35d54650c53bc64dd7c440240ad2f2b9 + * <li>Sniffers producing the {@link Material#SNIFFER_EGG} item, which needs to be placed before it can begin to hatch.</li> + * <li>A turtle being marked with "HasEgg" and laying a {@link Material#TURTLE_EGG} later.</li> + * </ul> -+ * ++ * <p> + * The event hence only exposes the two parent entities in the fertilization process and cannot provide the child entity, as it will only exist at a later point in time. + */ ++@NullMarked +public class EntityFertilizeEggEvent extends EntityEvent implements Cancellable { + + private static final HandlerList HANDLER_LIST = new HandlerList(); + + private final LivingEntity mother; + private final LivingEntity father; -+ private final Player breeder; -+ private final ItemStack bredWith; ++ private final @Nullable Player breeder; ++ private final @Nullable ItemStack bredWith; + private int experience; + + private boolean cancelled; + + @ApiStatus.Internal -+ public EntityFertilizeEggEvent(@NotNull LivingEntity mother, @NotNull LivingEntity father, @Nullable Player breeder, @Nullable ItemStack bredWith, int experience) { ++ public EntityFertilizeEggEvent(final LivingEntity mother, final LivingEntity father, final @Nullable Player breeder, final @Nullable ItemStack bredWith, final int experience) { + super(mother); + this.mother = mother; + this.father = father; @@ -60,7 +61,6 @@ index 0000000000000000000000000000000000000000..35d54650c53bc64dd7c440240ad2f2b9 + this.experience = experience; + } + -+ @NotNull + @Override + public LivingEntity getEntity() { + return (LivingEntity) super.getEntity(); @@ -72,7 +72,6 @@ index 0000000000000000000000000000000000000000..35d54650c53bc64dd7c440240ad2f2b9 + * + * @return The "mother" entity. + */ -+ @NotNull + public LivingEntity getMother() { + return this.mother; + } @@ -83,7 +82,6 @@ index 0000000000000000000000000000000000000000..35d54650c53bc64dd7c440240ad2f2b9 + * + * @return the other parent + */ -+ @NotNull + public LivingEntity getFather() { + return this.father; + } @@ -94,8 +92,7 @@ index 0000000000000000000000000000000000000000..35d54650c53bc64dd7c440240ad2f2b9 + * + * @return The Entity who initiated fertilization. + */ -+ @Nullable -+ public Player getBreeder() { ++ public @Nullable Player getBreeder() { + return this.breeder; + } + @@ -104,8 +101,7 @@ index 0000000000000000000000000000000000000000..35d54650c53bc64dd7c440240ad2f2b9 + * + * @return ItemStack used to initiate fertilization. + */ -+ @Nullable -+ public ItemStack getBredWith() { ++ public @Nullable ItemStack getBredWith() { + return this.bredWith; + } + @@ -124,7 +120,7 @@ index 0000000000000000000000000000000000000000..35d54650c53bc64dd7c440240ad2f2b9 + * + * @param experience experience amount + */ -+ public void setExperience(int experience) { ++ public void setExperience(final int experience) { + this.experience = experience; + } + @@ -134,17 +130,15 @@ index 0000000000000000000000000000000000000000..35d54650c53bc64dd7c440240ad2f2b9 + } + + @Override -+ public void setCancelled(boolean cancel) { ++ public void setCancelled(final boolean cancel) { + this.cancelled = cancel; + } + -+ @NotNull + @Override + public HandlerList getHandlers() { + return HANDLER_LIST; + } + -+ @NotNull + public static HandlerList getHandlerList() { + return HANDLER_LIST; + } |