Paper/Spigot-Server-Patches/0294-Add-sun-related-API.patch
Gabscap 7ae47d4eb3
[CI-SKIP] Remove Waving banner fix (#4786)
Mojang fixed it in MC-63720
2020-11-19 10:15:16 -05:00

53 lines
2.2 KiB
Diff

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 {
}
+ 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
+ @Override
+ public boolean isDayTime() {
+ return getHandle().isDay();
+ }
+ // Paper end
+
@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
+ @Override
+ public boolean isInDaylight() {
+ return getHandle().isInDaylight();
+ }
+ // Paper end
}