Paper/Spigot-Server-Patches/0318-Add-sun-related-API.patch
Shane Freeder e8c82f4eee
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
0399d9d6 SPIGOT-5341: Add Material.isAir
547f5709 SPIGOT-5353: Expand explosion API by adding source entity

CraftBukkit Changes:
7deb3728 SPIGOT-5309: Call cancelled EntityDamageEvent when damaging invisible armor stands
46351e17 SPIGOT-5341: Add Material.isAir
683bae06 SPIGOT-5342: Lore lost when deserializing items with no version stored
c2d12011 SPIGOT-5353: Expand explosion API by adding source entity
2019-10-08 19:37:02 +01:00

68 lines
2.5 KiB
Diff

From 0c04ae960b9a3046050c46705f321599882c1353 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 a14d490ade..09112a8b0e 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -1327,6 +1327,7 @@ public abstract class EntityInsentient extends EntityLiving {
return flag;
}
+ public boolean isInDaylight() { return this.dS(); } // Paper - OBFHELPER
protected boolean dS() {
if (this.world.J() && !this.world.isClientSide) {
float f = this.aF();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index c60279da8f..1c3285f5c0 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -705,6 +705,7 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
}
}
+ public boolean isDayTime() { return J(); } // Paper - OBFHELPER
public boolean J() {
return this.u < 4;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index dc0a07c7cd..78a2c47c5a 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -840,6 +840,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 53c2d154ed..56c233872b 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.23.0