|
| 1 | +From b1abadfae17d9045a98d9c940ed2ba5daa57b583 Mon Sep 17 00:00:00 2001 |
| 2 | + |
| 3 | +Date: Thu, 4 Aug 2022 00:34:23 +0200 |
| 4 | +Subject: [PATCH] Implement [PaperBin-????] Optimise |
| 5 | + WorldServer#everyoneDeeplySleeping |
| 6 | + |
| 7 | + |
| 8 | +diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java |
| 9 | +index 111a25632..247c0ae3a 100644 |
| 10 | +--- a/src/main/java/net/minecraft/server/EntityHuman.java |
| 11 | ++++ b/src/main/java/net/minecraft/server/EntityHuman.java |
| 12 | +@@ -1781,6 +1781,16 @@ public abstract class EntityHuman extends EntityLiving { |
| 13 | + } |
| 14 | + } |
| 15 | + |
| 16 | ++ // Titanium start |
| 17 | ++ public boolean isNether() { |
| 18 | ++ return this.world.getBiome(new BlockPosition(this.locX, this.locY, this.locZ)) == BiomeBase.HELL; |
| 19 | ++ } |
| 20 | ++ |
| 21 | ++ public boolean isEnd() { |
| 22 | ++ return this.world.getBiome(new BlockPosition(this.locX, this.locY, this.locZ)) == BiomeBase.SKY; |
| 23 | ++ } |
| 24 | ++ // Titanium end |
| 25 | ++ |
| 26 | + static class SyntheticClass_1 { |
| 27 | + |
| 28 | + static final int[] a = new int[EnumDirection.values().length]; |
| 29 | +diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java |
| 30 | +index 137c84a58..02c90ea85 100644 |
| 31 | +--- a/src/main/java/net/minecraft/server/WorldServer.java |
| 32 | ++++ b/src/main/java/net/minecraft/server/WorldServer.java |
| 33 | +@@ -357,7 +357,25 @@ public class WorldServer extends World implements IAsyncTaskHandler { |
| 34 | + } |
| 35 | + |
| 36 | + public boolean everyoneDeeplySleeping() { |
| 37 | +- if (this.O && !this.isClientSide) { |
| 38 | ++ // PaperBin start - WorldServer#everyoneDeeplySleeping optimization |
| 39 | ++ if (this.players.isEmpty() || this.isClientSide || !this.O) { |
| 40 | ++ return false; |
| 41 | ++ } |
| 42 | ++ |
| 43 | ++ for (EntityHuman human : this.players) { |
| 44 | ++ if (!human.isSpectator() && !human.isDeeplySleeping() && !human.fauxSleeping) { |
| 45 | ++ return false; |
| 46 | ++ } |
| 47 | ++ |
| 48 | ++ // Titanium start - ignore players who are not in overworld |
| 49 | ++ if (!human.isNether() && !human.isEnd()) { |
| 50 | ++ return false; |
| 51 | ++ } |
| 52 | ++ // Titanium end |
| 53 | ++ } |
| 54 | ++ |
| 55 | ++ return true; |
| 56 | ++ /*if (this.O && !this.isClientSide) { |
| 57 | + Iterator iterator = this.players.iterator(); |
| 58 | + |
| 59 | + // CraftBukkit - This allows us to assume that some people are in bed but not really, allowing time to pass in spite of AFKers |
| 60 | +@@ -382,7 +400,8 @@ public class WorldServer extends World implements IAsyncTaskHandler { |
| 61 | + return false; |
| 62 | + } else { |
| 63 | + return false; |
| 64 | +- } |
| 65 | ++ }*/ |
| 66 | ++ // PaperBin end |
| 67 | + } |
| 68 | + |
| 69 | + protected void h() { |
| 70 | +-- |
| 71 | +2.36.0.windows.1 |
| 72 | + |
0 commit comments