Updated Upstream (Paper)

Upstream has released updates that appears to apply and compile correctly

Paper Changes:
df0d7b0d Update upstream CB
6ea3c2cf [CI-SKIP] Rebuild patches
d7bed4cb Heavily optimise random block ticking (#2914)
b66d9ff8 Update upstream CB
ba71c5d6 Stop stripping private use block Unicode from signs
28d9dcfc Entity Jump API (#1587)
9976a768 Fix PlayerNaturallySpawnCreaturesEvent boolean inversion
054e20da Clean up imports on ThrownEggHatchEvent
a8984ccb Add ThrownEggHatchEvent (#1982)
9f24d495 Allow nerfed blazes, endermen to take water damage (#2847)
This commit is contained in:
William Blake Galbreath
2020-02-12 21:21:34 -06:00
parent e52e23265f
commit 4757060211
159 changed files with 6166 additions and 4642 deletions

View File

@@ -0,0 +1,77 @@
From 5290786e816577b65635c4bf4f19a5c0161cbd01 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Sat, 1 Feb 2020 22:22:07 -0600
Subject: [PATCH] Add moon phase API
---
src/main/java/net/pl3x/purpur/MoonPhase.java | 36 ++++++++++++++++++++
src/main/java/org/bukkit/World.java | 10 ++++++
2 files changed, 46 insertions(+)
create mode 100644 src/main/java/net/pl3x/purpur/MoonPhase.java
diff --git a/src/main/java/net/pl3x/purpur/MoonPhase.java b/src/main/java/net/pl3x/purpur/MoonPhase.java
new file mode 100644
index 00000000..f5ad98c6
--- /dev/null
+++ b/src/main/java/net/pl3x/purpur/MoonPhase.java
@@ -0,0 +1,36 @@
+package net.pl3x.purpur;
+
+import org.jetbrains.annotations.NotNull;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public enum MoonPhase {
+ FULL_MOON(0L),
+ WANING_GIBBOUS(1L),
+ LAST_QUARTER(2L),
+ WANING_CRESCENT(3L),
+ NEW_MOON(4L),
+ WAXING_CRESCENT(5L),
+ FIRST_QUARTER(6L),
+ WAXING_GIBBOUS(7L);
+
+ private final long day;
+
+ MoonPhase(long day) {
+ this.day = day;
+ }
+
+ private static final Map<Long, MoonPhase> BY_DAY = new HashMap<>();
+
+ static {
+ for (MoonPhase phase : values()) {
+ BY_DAY.put(phase.day, phase);
+ }
+ }
+
+ @NotNull
+ public static MoonPhase getPhase(long day) {
+ return BY_DAY.get(day % 8L);
+ }
+}
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 5047be15..80d63e25 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -3117,6 +3117,16 @@ public interface World extends PluginMessageRecipient, Metadatable {
@NotNull
public List<Raid> getRaids();
+ // Purpur start
+ /**
+ * Get the moon phase of the world at the current time
+ *
+ * @return Current moon phase
+ */
+ @NotNull
+ net.pl3x.purpur.MoonPhase getMoonPhase();
+ // Purpur end
+
/**
* Represents various map environment types that a world may be
*/
--
2.24.0