Paper/Spigot-Server-Patches/0320-Add-sun-related-API.patch

68 lines
2.5 KiB
Diff
Raw Normal View History

From 0ddb4dccfa1ed3f5598a1a48100fa1ebcab8ad3f 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/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index c20374d77b..5e88367d3c 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -1327,6 +1327,7 @@ public abstract class EntityInsentient extends EntityLiving {
return flag;
}
+ public boolean isInDaylight() { return dT(); } // Paper - OBFHELPER
protected boolean dT() {
2019-05-05 10:33:44 +02:00
if (this.world.J() && !this.world.isClientSide) {
float f = this.aF();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 7c39846c16..26f3b47208 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
2019-06-22 20:06:08 +02:00
@@ -705,6 +705,7 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
}
}
2019-05-05 10:33:44 +02:00
+ public boolean isDayTime() { return J(); } // Paper - OBFHELPER
public boolean J() {
return this.d < 4;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index d74b3c42da..8ae1b506f1 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -738,6 +738,13 @@ public class CraftWorld implements World {
}
}
+ // Paper start
2019-05-06 04:58:04 +02:00
+ @Override
+ public boolean isDayTime() {
+ return getHandle().isDayTime();
+ }
+ // Paper end
+
2019-05-06 04:58:04 +02:00
@Override
public boolean createExplosion(double x, double y, double z, float power) {
return createExplosion(x, y, z, power, false, true);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
index 53c2d154ed..56c233872b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
2019-05-06 04:58:04 +02:00
@@ -68,4 +68,11 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
public long getSeed() {
return getHandle().lootTableSeed;
}
+
+ // Paper start
2019-05-06 04:58:04 +02:00
+ @Override
+ public boolean isInDaylight() {
+ return getHandle().isInDaylight();
+ }
+ // Paper end
}
--
2019-06-22 20:06:08 +02:00
2.22.0