aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0272-Add-sun-related-API.patch
blob: 52e76a976ff1e783218a63c9709cec740c2bc68d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 8451baff82cb7ec7615ab50a409724897ccf4d95..32e8ae0d2a0f78af671a632c4d1be58a0b38a392 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1561,7 +1561,7 @@ public abstract class Mob extends LivingEntity {
 
     }
 
-    protected boolean isSunBurnTick() {
+    public boolean isSunBurnTick() { // Paper - protected -> public
         if (this.level.isDay() && !this.level.isClientSide) {
             float f = this.getBrightness();
             BlockPos blockposition = new BlockPos(this.getX(), this.getEyeY(), this.getZ());
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index a19de8405de8ee29afc112556e4684b042c6f4ab..be4c05259f176e9ef5c25db2b1745df5ea4d5789 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -867,6 +867,13 @@ public class CraftWorld implements World {
         }
     }
 
+    // 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 9c9fa83615cd06539ce5e4e3d4feaa69f65b7931..317b6abd2764cf34ef5c42bdbf48ab0bc5a03d27 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
@@ -77,4 +77,11 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
     public long getSeed() {
         return this.getHandle().lootTableSeed;
     }
+
+    // Paper start
+    @Override
+    public boolean isInDaylight() {
+        return getHandle().isSunBurnTick();
+    }
+    // Paper end
 }