Skip to content

Commit 37c6dcc

Browse files
committed
feat:initialise running
1 parent b659406 commit 37c6dcc

15 files changed

Lines changed: 833 additions & 194 deletions

File tree

patches/net/minecraft/server/MinecraftServer.java.patch

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
public static final Logger LOGGER = LogUtils.getLogger();
4242
public static final String VANILLA_BRAND = "vanilla";
4343
private static final float AVERAGE_TICK_TIME_SMOOTHING = 0.8F;
44-
@@ -261,10 +_,27 @@
44+
@@ -261,10 +_,29 @@
4545
private final PotionBrewing potionBrewing;
4646
private volatile boolean isSaving;
4747
private static final AtomicReference<RuntimeException> fatalException = new AtomicReference<>();
@@ -62,6 +62,8 @@
6262
+ new com.google.common.util.concurrent.ThreadFactoryBuilder().setDaemon(true).setNameFormat("Async Chat Thread - #%d").build());
6363
+ // CraftBukkit end
6464
+ public final double[] recentTps = new double[ 4 ];
65+
+ private final Object stopLock = new Object();
66+
+ private boolean hasStopped = false;
6567

6668
public static <S extends MinecraftServer> S spin(Function<Thread, S> p_129873_) {
6769
AtomicReference<S> atomicreference = new AtomicReference<>();
@@ -266,8 +268,14 @@
266268
}
267269

268270
public void forceTimeSynchronization() {
269-
@@ -1118,7 +_,7 @@
271+
@@ -1116,9 +_,13 @@
272+
return this.playerList.getPlayerNamesArray();
273+
}
270274

275+
+ public static double calcTps(double avg, double exp, double tps) {
276+
+ return (avg * exp) + (tps * (1 - exp));
277+
+ }
278+
+
271279
@DontObfuscate
272280
public String getServerModName() {
273281
- return "vanilla";

patches/net/minecraft/server/players/PlayerList.java.patch

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
--- a/net/minecraft/server/players/PlayerList.java
22
+++ b/net/minecraft/server/players/PlayerList.java
3-
@@ -99,8 +_,9 @@
3+
@@ -98,9 +_,11 @@
4+
import net.minecraft.world.scores.Objective;
45
import net.minecraft.world.scores.PlayerTeam;
56
import net.minecraft.world.scores.Team;
7+
+import org.bukkit.craftbukkit.CraftServer;
68
import org.slf4j.Logger;
79
+import org.taiyitistmc.injection.server.players.InjectionPlayerList;
810

@@ -11,11 +13,13 @@
1113
public static final File USERBANLIST_FILE = new File("banned-players.json");
1214
public static final File IPBANLIST_FILE = new File("banned-ips.json");
1315
public static final File OPLIST_FILE = new File("ops.json");
14-
@@ -128,6 +_,7 @@
16+
@@ -128,6 +_,9 @@
1517
private boolean allowCommandsForAllPlayers;
1618
private static final boolean ALLOW_LOGOUTIVATOR = false;
1719
private int sendAllPlayerInfoIn;
1820
+ private final List<ServerPlayer> playersView = java.util.Collections.unmodifiableList(players);
21+
+ // CraftBukkit start
22+
+ private CraftServer cserver;
1923

2024
public PlayerList(MinecraftServer p_203842_, LayeredRegistryAccess<RegistryLayer> p_251844_, PlayerDataStorage p_203844_, int p_203845_) {
2125
this.server = p_203842_;

0 commit comments

Comments
 (0)