testserver/Spigot-Server-Patches/0311-Add-sun-related-API.patch

68 lines
2.6 KiB
Diff
Raw Normal View History

From 97dd941a53daeecad5edbeb9e55cd4d5c858e6b3 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 eadac07f6..cbaed08f5 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -1334,6 +1334,7 @@ public abstract class EntityInsentient extends EntityLiving {
return flag;
}
+ public boolean isInDaylight() { return this.en(); } // Paper - OBFHELPER
protected boolean en() {
2019-05-05 08:33:44 +00:00
if (this.world.J() && !this.world.isClientSide) {
float f = this.aI();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 9c23060bb..8e3367435 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -619,6 +619,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
}
}
2019-05-05 08:33:44 +00:00
+ public boolean isDayTime() { return J(); } // Paper - OBFHELPER
public boolean J() {
return this.worldProvider.getDimensionManager() == DimensionManager.OVERWORLD && this.c < 4;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 182322752..578fe8d19 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -855,6 +855,13 @@ public class CraftWorld implements World {
}
}
+ // Paper start
2019-05-06 02:58:04 +00:00
+ @Override
+ public boolean isDayTime() {
+ return getHandle().isDayTime();
+ }
+ // Paper end
+
2019-05-06 02:58:04 +00: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 53c2d154e..56c233872 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
2019-05-06 02:58:04 +00:00
@@ -68,4 +68,11 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
public long getSeed() {
return getHandle().lootTableSeed;
}
+
+ // Paper start
2019-05-06 02:58:04 +00:00
+ @Override
+ public boolean isInDaylight() {
+ return getHandle().isInDaylight();
+ }
+ // Paper end
}
--
2.17.1