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

66 Zeilen
2.5 KiB
Diff

2019-05-05 13:12:32 +02:00
From b588ba389f00390b2f1972896804aeea504d07a7 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
2019-05-05 10:33:44 +02:00
index f1621a9e9..a8318c88a 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
2019-05-05 10:33:44 +02:00
@@ -1330,6 +1330,7 @@ public abstract class EntityInsentient extends EntityLiving {
return flag;
}
2019-05-05 10:33:44 +02:00
+ 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
2019-05-05 10:33:44 +02:00
index cfab578df..c917c39b9 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
2019-05-05 10:33:44 +02:00
@@ -666,6 +666,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
2019-05-05 10:33:44 +02:00
index a6f6046c6..5e672ae2e 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
2019-05-05 10:33:44 +02:00
@@ -699,6 +699,12 @@ public class CraftWorld implements World {
}
}
+ // Paper start
+ public boolean isDayTime() {
+ return getHandle().isDayTime();
+ }
+ // Paper end
+
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
2019-05-05 10:33:44 +02:00
index 53c2d154e..40a429942 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
@@ -68,4 +68,10 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
public long getSeed() {
return getHandle().lootTableSeed;
}
+
+ // Paper start
+ public boolean isInDaylight() {
+ return getHandle().isInDaylight();
+ }
+ // Paper end
}
--
2019-05-05 10:33:44 +02:00
2.20.1