Paper/Spigot-Server-Patches/0322-Add-sun-related-API.patch
Zach Brown 70ce6ce831
Move version command update checking to the implementation
This makes it easier for downstream projects (forks) to replace the
version fetching system with their own. It is as simple as implementing
an interface and overriding the default implementation of
org.bukkit.UnsafeValues#getVersionFetcher()

It also makes it easier for us to organize things like the version
history feature.

Lastly I have updated the paper implementation to check against the site
API rather than against jenkins.
2019-05-27 04:13:41 -05:00

68 lines
2.5 KiB
Diff

From a531f99a0c6b8b2236658d2b56d3ad8775b73819 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 11652628b..90923c753 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -1326,6 +1326,7 @@ public abstract class EntityInsentient extends EntityLiving {
return flag;
}
+ public boolean isInDaylight() { return dS(); } // Paper - OBFHELPER
protected boolean dS() {
if (this.world.J() && !this.world.isClientSide) {
float f = this.aE();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 1f2e2cd87..163d7f37c 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -667,6 +667,7 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
}
}
+ 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 1b2c5012e..3ebea9693 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -739,6 +739,13 @@ public class CraftWorld implements World {
}
}
+ // Paper start
+ @Override
+ public boolean isDayTime() {
+ return getHandle().isDayTime();
+ }
+ // 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 53c2d154e..56c233872 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
@@ -68,4 +68,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
}
--
2.21.0