Paper/patches/server/0270-Add-sun-related-API.patch

41 lines
1.5 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sun, 7 Oct 2018 00:54:21 -0500
Subject: [PATCH] Add sun related API
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 3c4f06c9446dd769999e8f52bd43709cdd5cf9b0..6871ee1f69b2dced4874c0d28b27b6ba11ef1c9f 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -683,6 +683,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
2021-06-11 14:02:28 +02:00
}
}
+ // Paper start
+ @Override
+ public boolean isDayTime() {
+ return getHandle().isDay();
+ }
+ // Paper end
+
@Override
public long getGameTime() {
return world.levelData.getGameTime();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
index 28d6e31bfdf31d3e56024c731b833c4424313307..881bb11507eafe87522ad4131ea7859f42918b3e 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
@@ -76,4 +76,11 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
2021-06-11 14:02:28 +02:00
public long getSeed() {
2021-06-13 08:48:25 +02:00
return this.getHandle().lootTableSeed;
2021-06-11 14:02:28 +02:00
}
+
+ // Paper start
+ @Override
+ public boolean isInDaylight() {
2021-06-13 08:48:25 +02:00
+ return getHandle().isSunBurnTick();
2021-06-11 14:02:28 +02:00
+ }
+ // Paper end
}