|
1 | 1 | --- a/net/minecraft/server/MinecraftServer.java |
2 | 2 | +++ b/net/minecraft/server/MinecraftServer.java |
3 | | -@@ -1,5 +1,19 @@ |
| 3 | +@@ -1,5 +1,20 @@ |
4 | 4 | package net.minecraft.server; |
5 | 5 |
|
6 | 6 | +import carpet.CarpetServer; |
|
14 | 14 | +import carpet.settings.CarpetSettings; |
15 | 15 | +import carpet.spark.CarpetSparkAccess; |
16 | 16 | +import carpet.utils.CarpetProfiler; |
| 17 | ++import carpet.utils.Log4j2JndiPatch; |
17 | 18 | +import carpet.utils.Messenger; |
18 | 19 | +import carpet.utils.TISCMConfig; |
19 | 20 | +import carpet.worldedit.CarpetWorldEditAccess; |
20 | 21 | import com.google.common.base.Stopwatch; |
21 | 22 | import com.google.common.collect.Lists; |
22 | 23 | import com.google.common.collect.Maps; |
23 | | -@@ -178,6 +192,7 @@ |
| 24 | +@@ -178,6 +193,7 @@ |
24 | 25 | public final Queue < FutureTask<? >> futureTaskQueue = Queues.newConcurrentLinkedQueue(); |
25 | 26 | private Thread serverThread; |
26 | 27 | private long serverTime = Util.milliTime(); |
27 | 28 | + public long actualServerTime = Util.milliTime(); |
28 | 29 | @OnlyIn(Dist.CLIENT) |
29 | 30 | private boolean worldIconSet; |
30 | 31 | private final IReloadableResourceManager resourceManager = new SimpleReloadableResourceManager(ResourcePackType.SERVER_DATA); |
31 | | -@@ -212,6 +227,8 @@ |
| 32 | +@@ -212,6 +228,8 @@ |
32 | 33 | this.resourceManager.addReloadListener(this.lootTableManager); |
33 | 34 | this.resourceManager.addReloadListener(this.functionManager); |
34 | 35 | this.resourceManager.addReloadListener(this.advancementManager); |
|
37 | 38 | } |
38 | 39 |
|
39 | 40 | public abstract boolean init() throws IOException; |
40 | | -@@ -571,7 +588,13 @@ |
| 41 | +@@ -571,7 +589,13 @@ |
41 | 42 | public void stopServer() |
42 | 43 | { |
43 | 44 | LOGGER.info("Stopping server"); |
|
51 | 52 | if (this.getNetworkSystem() != null) |
52 | 53 | { |
53 | 54 | this.getNetworkSystem().terminateEndpoints(); |
54 | | -@@ -639,34 +662,64 @@ |
| 55 | +@@ -639,34 +663,64 @@ |
55 | 56 | { |
56 | 57 | try |
57 | 58 | { |
|
133 | 134 | } |
134 | 135 | } |
135 | 136 | else |
136 | | -@@ -782,7 +835,16 @@ |
| 137 | +@@ -782,7 +836,16 @@ |
137 | 138 | { |
138 | 139 | long i = Util.nanoTime(); |
139 | 140 | ++this.tickCounter; |
|
150 | 151 | if (this.startProfiling) |
151 | 152 | { |
152 | 153 | this.startProfiling = false; |
153 | | -@@ -790,6 +852,9 @@ |
| 154 | +@@ -790,6 +853,9 @@ |
154 | 155 | } |
155 | 156 |
|
156 | 157 | this.profiler.startSection("root"); |
|
160 | 161 | this.updateTimeLightAndEntities(hasTimeLeft); |
161 | 162 |
|
162 | 163 | if (i - this.nanoTimeSinceStatusRefresh >= 5000000000L) |
163 | | -@@ -810,10 +875,26 @@ |
| 164 | +@@ -810,10 +876,26 @@ |
164 | 165 |
|
165 | 166 | if (this.tickCounter % 900 == 0) |
166 | 167 | { |
|
187 | 188 | } |
188 | 189 |
|
189 | 190 | this.profiler.startSection("snooper"); |
190 | | -@@ -829,16 +910,30 @@ |
| 191 | +@@ -829,16 +911,30 @@ |
191 | 192 | } |
192 | 193 |
|
193 | 194 | this.profiler.endSection(); |
|
218 | 219 | FutureTask<?> futuretask; |
219 | 220 |
|
220 | 221 | while ((futuretask = this.futureTaskQueue.poll()) != null) |
221 | | -@@ -847,6 +942,7 @@ |
| 222 | +@@ -847,6 +943,7 @@ |
222 | 223 | } |
223 | 224 |
|
224 | 225 | this.profiler.endStartSection("commandFunctions"); |
225 | 226 | + MicroTimingLoggerManager.setTickStage(TickStage.COMMAND_FUNCTION); // TISCM Micro Timing logger |
226 | 227 | this.getFunctionManager().tick(); |
227 | 228 | this.profiler.endStartSection("levels"); |
228 | 229 |
|
229 | | -@@ -870,6 +966,7 @@ |
| 230 | +@@ -870,6 +967,7 @@ |
230 | 231 |
|
231 | 232 | this.profiler.startSection("tick"); |
232 | 233 |
|
233 | 234 | + // Update suppression fix |
234 | 235 | try |
235 | 236 | { |
236 | 237 | worldserver.tick(hasTimeLeft); |
237 | | -@@ -878,9 +975,15 @@ |
| 238 | +@@ -878,9 +976,15 @@ |
238 | 239 | { |
239 | 240 | CrashReport crashreport = CrashReport.makeCrashReport(throwable1, "Exception ticking world"); |
240 | 241 | worldserver.fillCrashReport(crashreport); |
|
251 | 252 | try |
252 | 253 | { |
253 | 254 | worldserver.tickEntities(); |
254 | | -@@ -889,7 +992,12 @@ |
| 255 | +@@ -889,7 +993,12 @@ |
255 | 256 | { |
256 | 257 | CrashReport crashreport1 = CrashReport.makeCrashReport(throwable, "Exception ticking world entities"); |
257 | 258 | worldserver.fillCrashReport(crashreport1); |
|
265 | 266 | } |
266 | 267 |
|
267 | 268 | this.profiler.endSection(); |
268 | | -@@ -905,10 +1013,13 @@ |
| 269 | +@@ -905,10 +1014,13 @@ |
269 | 270 | }))[this.tickCounter % 100] = Util.nanoTime() - i; |
270 | 271 | } |
271 | 272 |
|
|
279 | 280 | this.profiler.endStartSection("tickables"); |
280 | 281 |
|
281 | 282 | for (int j = 0; j < this.tickables.size(); ++j) |
282 | | -@@ -1004,6 +1115,11 @@ |
| 283 | +@@ -929,6 +1041,12 @@ |
| 284 | + this.tickables.add(tickable); |
| 285 | + } |
| 286 | + |
| 287 | ++ static |
| 288 | ++ { |
| 289 | ++ // TISCM LOG4J2-3201 PATCH |
| 290 | ++ Log4j2JndiPatch.patch(); |
| 291 | ++ } |
| 292 | ++ |
| 293 | + public static void main(String[] p_main_0_) |
| 294 | + { |
| 295 | + Bootstrap.register(); |
| 296 | +@@ -1004,6 +1122,11 @@ |
283 | 297 | } |
284 | 298 | } |
285 | 299 |
|
|
291 | 305 | YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(Proxy.NO_PROXY, UUID.randomUUID().toString()); |
292 | 306 | MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService(); |
293 | 307 | GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository(); |
294 | | -@@ -1142,7 +1258,8 @@ |
| 308 | +@@ -1142,7 +1265,8 @@ |
295 | 309 |
|
296 | 310 | public String getServerModName() |
297 | 311 | { |
|
301 | 315 | } |
302 | 316 |
|
303 | 317 | public CrashReport addServerInfoToCrashReport(CrashReport report) |
304 | | -@@ -1605,6 +1722,12 @@ |
| 318 | +@@ -1605,6 +1729,12 @@ |
305 | 319 | { |
306 | 320 | return this.serverTime; |
307 | 321 | } |
|
314 | 328 |
|
315 | 329 | public Thread getServerThread() |
316 | 330 | { |
317 | | -@@ -1825,4 +1948,17 @@ |
| 331 | +@@ -1825,4 +1955,17 @@ |
318 | 332 | return 0; |
319 | 333 | } |
320 | 334 | } |
|
0 commit comments