Files
Purpur/patches/api/0038-Add-Bee-API.patch
granny 201e928fa6 Updated Upstream (Pufferfish) (#1575)
Upstream has released updates that appear to apply and compile correctly

Pufferfish Changes:
pufferfish-gg/Pufferfish@c9f4e20 Final 1.20.4 Update
pufferfish-gg/Pufferfish@1f3ad02 Final 1.20.4 update, for realzies
pufferfish-gg/Pufferfish@b1ab664 Enable SIMD on java 21
pufferfish-gg/Pufferfish@0674c2b 1.21 compiles
pufferfish-gg/Pufferfish@98ea973 Fix 1.21 version checkers
pufferfish-gg/Pufferfish@68f859c Fix lambda/tick guard patch
pufferfish-gg/Pufferfish@eaa18d5 Updated Upstream (Paper)
pufferfish-gg/Pufferfish@1d72eea Updated Upstream (Paper)
pufferfish-gg/Pufferfish@1d3c743 Update pufferfish version detector stuff
pufferfish-gg/Pufferfish@5e30963 Fix crash bug
pufferfish-gg/Pufferfish@12571eb Use mojmapped paperclip jar instead (CI only)
pufferfish-gg/Pufferfish@4d16ae0 Drop a patch - moonrise includes it
pufferfish-gg/Pufferfish@52c2d05 Revert "Drop a patch - moonrise includes it"
pufferfish-gg/Pufferfish@bdb56f1 Fix entity interactions with fluids
pufferfish-gg/Pufferfish@469e5c1 Updated Upstream (Paper)
pufferfish-gg/Pufferfish@d75961f 1.21.1 Update (Updated Upstream (Paper))
2024-08-15 14:07:11 -07:00

180 lines
5.0 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: SageSphinx63920 <sage@sagesphinx63920.dev>
Date: Mon, 25 Jul 2022 19:33:49 +0200
Subject: [PATCH] Add Bee API
diff --git a/src/main/java/org/purpurmc/purpur/event/entity/BeeFoundFlowerEvent.java b/src/main/java/org/purpurmc/purpur/event/entity/BeeFoundFlowerEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..833f46d1941f377765132fc528c45567ee0290d2
--- /dev/null
+++ b/src/main/java/org/purpurmc/purpur/event/entity/BeeFoundFlowerEvent.java
@@ -0,0 +1,48 @@
+package org.purpurmc.purpur.event.entity;
+
+import org.bukkit.Location;
+import org.bukkit.entity.Bee;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Called when a bee targets a flower
+ */
+public class BeeFoundFlowerEvent extends EntityEvent {
+ private static final HandlerList handlers = new HandlerList();
+ private final Location location;
+
+ public BeeFoundFlowerEvent(@NotNull Bee bee, @Nullable Location location) {
+ super(bee);
+ this.location = location;
+ }
+
+ @Override
+ @NotNull
+ public Bee getEntity() {
+ return (Bee) super.getEntity();
+ }
+
+ /**
+ * Returns the location of the flower that the bee targets
+ *
+ * @return The location of the flower
+ */
+ @Nullable
+ public Location getLocation() {
+ return location;
+ }
+
+ @Override
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/org/purpurmc/purpur/event/entity/BeeStartedPollinatingEvent.java b/src/main/java/org/purpurmc/purpur/event/entity/BeeStartedPollinatingEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..ae0bb654745724889c67fae9072ae90ea3778ba4
--- /dev/null
+++ b/src/main/java/org/purpurmc/purpur/event/entity/BeeStartedPollinatingEvent.java
@@ -0,0 +1,47 @@
+package org.purpurmc.purpur.event.entity;
+
+import org.bukkit.Location;
+import org.bukkit.entity.Bee;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Called when a bee starts pollinating
+ */
+public class BeeStartedPollinatingEvent extends EntityEvent {
+ private static final HandlerList handlers = new HandlerList();
+ private final Location location;
+
+ public BeeStartedPollinatingEvent(@NotNull Bee bee, @NotNull Location location) {
+ super(bee);
+ this.location = location;
+ }
+
+ @Override
+ @NotNull
+ public Bee getEntity() {
+ return (Bee) super.getEntity();
+ }
+
+ /**
+ * Returns the location of the flower that the bee pollinates
+ *
+ * @return The location of the flower
+ */
+ @NotNull
+ public Location getLocation() {
+ return this.location;
+ }
+
+ @Override
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/org/purpurmc/purpur/event/entity/BeeStopPollinatingEvent.java b/src/main/java/org/purpurmc/purpur/event/entity/BeeStopPollinatingEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..ff3c9f075be2f624af8b0ce5fffc5ea69a41f32e
--- /dev/null
+++ b/src/main/java/org/purpurmc/purpur/event/entity/BeeStopPollinatingEvent.java
@@ -0,0 +1,60 @@
+package org.purpurmc.purpur.event.entity;
+
+import org.bukkit.Location;
+import org.bukkit.entity.Bee;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Called when a bee stops pollinating
+ */
+public class BeeStopPollinatingEvent extends EntityEvent {
+ private static final HandlerList handlers = new HandlerList();
+ private final Location location;
+ private final boolean success;
+
+ public BeeStopPollinatingEvent(@NotNull Bee bee, @Nullable Location location, boolean success) {
+ super(bee);
+ this.location = location;
+ this.success = success;
+ }
+
+ @Override
+ @NotNull
+ public Bee getEntity() {
+ return (Bee) super.getEntity();
+ }
+
+ /**
+ * Returns the location of the flower that the bee stopped pollinating
+ *
+ * @return The location of the flower
+ */
+ @Nullable
+ public Location getLocation() {
+ return location;
+ }
+
+ /**
+ * Returns whether the bee successfully pollinated the flower
+ *
+ * @return True if the pollination was successful
+ */
+ public boolean wasSuccessful() {
+ return success;
+ }
+
+
+ @Override
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}