Paper/patches/server/0272-Add-sun-related-API.patch

54 Zeilen
2.2 KiB
Diff

2021-06-11 14:02:28 +02:00
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/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
2021-06-13 08:48:25 +02:00
index 8451baff82cb7ec7615ab50a409724897ccf4d95..32e8ae0d2a0f78af671a632c4d1be58a0b38a392 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
2021-06-13 08:48:25 +02:00
@@ -1561,7 +1561,7 @@ public abstract class Mob extends LivingEntity {
2021-06-11 14:02:28 +02:00
}
2021-06-13 08:48:25 +02:00
- protected boolean isSunBurnTick() {
+ public boolean isSunBurnTick() { // Paper - protected -> public
2021-06-11 14:02:28 +02:00
if (this.level.isDay() && !this.level.isClientSide) {
float f = this.getBrightness();
2021-06-13 08:48:25 +02:00
BlockPos blockposition = new BlockPos(this.getX(), this.getEyeY(), this.getZ());
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
2021-06-13 08:48:25 +02:00
index b8565aa86b478adb6fca6d433637ddb342ce6dcb..fda8858375a08e0aac15ca00751df5a34ed6a0f2 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
2021-06-13 08:48:25 +02:00
@@ -866,6 +866,13 @@ public class CraftWorld implements World {
2021-06-11 14:02:28 +02:00
}
}
+ // Paper start
+ @Override
+ public boolean isDayTime() {
+ return getHandle().isDay();
+ }
+ // Paper end
+
@Override
public long getGameTime() {
return world.levelData.getGameTime();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
2021-06-13 08:48:25 +02:00
index 9c9fa83615cd06539ce5e4e3d4feaa69f65b7931..317b6abd2764cf34ef5c42bdbf48ab0bc5a03d27 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
@@ -77,4 +77,11 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
public long getSeed() {
2021-06-13 08:48:25 +02:00
return this.getHandle().lootTableSeed;
2021-06-11 14:02:28 +02:00
}
+
+ // Paper start
+ @Override
+ public boolean isInDaylight() {
2021-06-13 08:48:25 +02:00
+ return getHandle().isSunBurnTick();
2021-06-11 14:02:28 +02:00
+ }
+ // Paper end
}