mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-25 12:05:53 +01:00
c97ce029e9
PaperMC believes that 1.16.2 is now ready for general release as we fixed the main issue plagueing the 1.16.x release, the MapLike data conversion issues. Until now, it was not safe for a server to convert a world to 1.16.2 without data conversion issues around villages and potentially other things. If you did, those MapLike errors meant something went wrong. This is now resolved. Big thanks to all those that helped, notably @BillyGalbreath and @Proximyst who did large parts of the update process with me. Please as always, backup your worlds and test before updating to 1.16.2! If you update to 1.16.2, there is no going back to an older build than this. --------------------------------- Co-authored-by: William Blake Galbreath <Blake.Galbreath@GMail.com> Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com> Co-authored-by: krolik-exe <69214078+krolik-exe@users.noreply.github.com> Co-authored-by: BillyGalbreath <BillyGalbreath@users.noreply.github.com> Co-authored-by: stonar96 <minecraft.stonar96@gmail.com> Co-authored-by: Shane Freeder <theboyetronic@gmail.com> Co-authored-by: Jason <jasonpenilla2@me.com> Co-authored-by: kashike <kashike@vq.lc> Co-authored-by: Aurora <21148213+aurorasmiles@users.noreply.github.com> Co-authored-by: KennyTV <kennytv@t-online.de> Co-authored-by: commandblockguy <commandblockguy1@gmail.com> Co-authored-by: DigitalRegent <misterwener@gmail.com> Co-authored-by: ishland <ishlandmc@yeah.net>
284 lines
7.2 KiB
Diff
284 lines
7.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
|
Date: Fri, 28 Sep 2018 17:08:09 -0500
|
|
Subject: [PATCH] Turtle API
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/TurtleGoHomeEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/TurtleGoHomeEvent.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..021356d151ed638068e3e89b8cc77b3795883233
|
|
--- /dev/null
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleGoHomeEvent.java
|
|
@@ -0,0 +1,49 @@
|
|
+package com.destroystokyo.paper.event.entity;
|
|
+
|
|
+import org.bukkit.entity.Turtle;
|
|
+import org.bukkit.event.Cancellable;
|
|
+import org.bukkit.event.HandlerList;
|
|
+import org.bukkit.event.entity.EntityEvent;
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+
|
|
+/**
|
|
+ * Fired when a Turtle decides to go home
|
|
+ */
|
|
+public class TurtleGoHomeEvent extends EntityEvent implements Cancellable {
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
+ private boolean cancelled = false;
|
|
+
|
|
+ public TurtleGoHomeEvent(@NotNull Turtle turtle) {
|
|
+ super(turtle);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * The turtle going home
|
|
+ *
|
|
+ * @return The turtle
|
|
+ */
|
|
+ @NotNull
|
|
+ public Turtle getEntity() {
|
|
+ return (Turtle) entity;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isCancelled() {
|
|
+ return cancelled;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setCancelled(boolean cancel) {
|
|
+ cancelled = cancel;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public HandlerList getHandlers() {
|
|
+ return handlers;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public static HandlerList getHandlerList() {
|
|
+ return handlers;
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..a315c5185cd465dcf63c0ababef195da76dfc786
|
|
--- /dev/null
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleLayEggEvent.java
|
|
@@ -0,0 +1,87 @@
|
|
+package com.destroystokyo.paper.event.entity;
|
|
+
|
|
+import org.bukkit.Location;
|
|
+import org.bukkit.entity.Turtle;
|
|
+import org.bukkit.event.Cancellable;
|
|
+import org.bukkit.event.HandlerList;
|
|
+import org.bukkit.event.entity.EntityEvent;
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+
|
|
+/**
|
|
+ * Fired when a Turtle lays eggs
|
|
+ */
|
|
+public class TurtleLayEggEvent extends EntityEvent implements Cancellable {
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
+ private boolean cancelled = false;
|
|
+ @NotNull
|
|
+ private final Location location;
|
|
+ private int eggCount;
|
|
+
|
|
+ public TurtleLayEggEvent(@NotNull Turtle turtle, @NotNull Location location, int eggCount) {
|
|
+ super(turtle);
|
|
+ this.location = location;
|
|
+ this.eggCount = eggCount;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * The turtle laying the eggs
|
|
+ *
|
|
+ * @return The turtle
|
|
+ */
|
|
+ @NotNull
|
|
+ public Turtle getEntity() {
|
|
+ return (Turtle) entity;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Get the location where the eggs are being laid
|
|
+ *
|
|
+ * @return Location of eggs
|
|
+ */
|
|
+ @NotNull
|
|
+ public Location getLocation() {
|
|
+ return location;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Get the number of eggs being laid
|
|
+ *
|
|
+ * @return Number of eggs
|
|
+ */
|
|
+ public int getEggCount() {
|
|
+ return eggCount;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Set the number of eggs being laid
|
|
+ *
|
|
+ * @param eggCount Number of eggs
|
|
+ */
|
|
+ public void setEggCount(int eggCount) {
|
|
+ if (eggCount < 1) {
|
|
+ cancelled = true;
|
|
+ return;
|
|
+ }
|
|
+ eggCount = Math.min(eggCount, 4);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isCancelled() {
|
|
+ return cancelled;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setCancelled(boolean cancel) {
|
|
+ cancelled = cancel;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public HandlerList getHandlers() {
|
|
+ return handlers;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public static HandlerList getHandlerList() {
|
|
+ return handlers;
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..abeb24fccda2acfdb0dfdadacb8fe688bd97cf78
|
|
--- /dev/null
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/TurtleStartDiggingEvent.java
|
|
@@ -0,0 +1,62 @@
|
|
+package com.destroystokyo.paper.event.entity;
|
|
+
|
|
+import org.bukkit.Location;
|
|
+import org.bukkit.entity.Turtle;
|
|
+import org.bukkit.event.Cancellable;
|
|
+import org.bukkit.event.HandlerList;
|
|
+import org.bukkit.event.entity.EntityEvent;
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+
|
|
+/**
|
|
+ * Fired when a Turtle starts digging to lay eggs
|
|
+ */
|
|
+public class TurtleStartDiggingEvent extends EntityEvent implements Cancellable {
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
+ private boolean cancelled = false;
|
|
+ @NotNull private final Location location;
|
|
+
|
|
+ public TurtleStartDiggingEvent(@NotNull Turtle turtle, @NotNull Location location) {
|
|
+ super(turtle);
|
|
+ this.location = location;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * The turtle digging
|
|
+ *
|
|
+ * @return The turtle
|
|
+ */
|
|
+ @NotNull
|
|
+ public Turtle getEntity() {
|
|
+ return (Turtle) entity;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Get the location where the turtle is digging
|
|
+ *
|
|
+ * @return Location where digging
|
|
+ */
|
|
+ @NotNull
|
|
+ public Location getLocation() {
|
|
+ return location;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isCancelled() {
|
|
+ return cancelled;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setCancelled(boolean cancel) {
|
|
+ cancelled = cancel;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public HandlerList getHandlers() {
|
|
+ return handlers;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public static HandlerList getHandlerList() {
|
|
+ return handlers;
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/org/bukkit/entity/Turtle.java b/src/main/java/org/bukkit/entity/Turtle.java
|
|
index 0a4cd29930c2f1c28f5a3e6884c7dec45b5cac11..5375ea14097f4f10b2294488b92924a35a72d4d7 100644
|
|
--- a/src/main/java/org/bukkit/entity/Turtle.java
|
|
+++ b/src/main/java/org/bukkit/entity/Turtle.java
|
|
@@ -1,6 +1,55 @@
|
|
package org.bukkit.entity;
|
|
|
|
+import org.bukkit.Location;
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+
|
|
/**
|
|
* Represents a turtle.
|
|
*/
|
|
-public interface Turtle extends Animals { }
|
|
+public interface Turtle extends Animals {
|
|
+ // Paper start
|
|
+
|
|
+ /**
|
|
+ * Get the turtle's home location
|
|
+ *
|
|
+ * @return Home location
|
|
+ */
|
|
+ @NotNull
|
|
+ Location getHome();
|
|
+
|
|
+ /**
|
|
+ * Set the turtle's home location
|
|
+ *
|
|
+ * @param location Home location
|
|
+ */
|
|
+ void setHome(@NotNull Location location);
|
|
+
|
|
+ /**
|
|
+ * Check if turtle is currently pathfinding to it's home
|
|
+ *
|
|
+ * @return True if going home
|
|
+ */
|
|
+ boolean isGoingHome();
|
|
+
|
|
+ /**
|
|
+ * Get if turtle is digging to lay eggs
|
|
+ *
|
|
+ * @return True if digging
|
|
+ */
|
|
+ boolean isDigging();
|
|
+
|
|
+ /**
|
|
+ * Get if turtle is carrying egg
|
|
+ *
|
|
+ * @return True if carrying egg
|
|
+ */
|
|
+ boolean hasEgg();
|
|
+
|
|
+ /**
|
|
+ * Set if turtle is carrying egg
|
|
+ *
|
|
+ * @param hasEgg True if carrying egg
|
|
+ */
|
|
+ void setHasEgg(boolean hasEgg);
|
|
+ // Paper end
|
|
+}
|