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

53 lines
2.2 KiB
Diff
Raw Normal View History

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/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 38bf49da2cc6b2f7068462ea8b57cf3a76ae1779..d91503b3e46c6ded3d77da4feeb8350df5bf924c 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -1529,6 +1529,7 @@ public abstract class EntityInsentient extends EntityLiving {
2020-06-25 16:09:55 +02:00
}
+ public boolean isInDaylight() { return this.eG(); } // Paper - OBFHELPER
protected boolean eG() {
if (this.world.isDay() && !this.world.isClientSide) {
float f = this.aR();
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index d193667beca3da156d8ae17cd80f4bf4c1dbfc8c..98af366848dba468d526d037a5e78fde4a4eda59 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -858,6 +858,13 @@ public class CraftWorld implements World {
}
}
+ // Paper start
2019-05-06 04:58:04 +02:00
+ @Override
+ public boolean isDayTime() {
+ return getHandle().isDay();
+ }
+ // 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 c89bc7024b650c3b6d2c551f0e4e156975570cca..eaad222fd38a4db4074db04c931bcff7a9ca5e24 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
@@ -78,4 +78,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
}