-
-
Notifications
You must be signed in to change notification settings - Fork 44
/
PatchMinecraftServerForge.java
49 lines (40 loc) · 1.48 KB
/
PatchMinecraftServerForge.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package me.nallar.patched;
import java.io.File;
import me.nallar.tickthreading.minecraft.TickThreading;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.WorldServer;
public abstract class PatchMinecraftServerForge extends MinecraftServer {
public PatchMinecraftServerForge(File par1File) {
super(par1File);
}
@Override
public String getServerModName() {
return "tickthreading,forge,fml";
}
@Override
protected void initialWorldChunkLoad() {
if (!TickThreading.instance.shouldLoadSpawn) {
return;
}
int loadedChunks = 0;
this.setUserMessage("menu.generatingTerrain");
byte dimension = 0;
long startTime = System.currentTimeMillis();
logger.info("Preparing start region for level " + dimension);
WorldServer worldServer = this.worldServers[dimension];
ChunkCoordinates spawnPoint = worldServer.getSpawnPoint();
for (int var11 = -192; var11 <= 192 && this.isServerRunning(); var11 += 16) {
for (int var12 = -192; var12 <= 192 && this.isServerRunning(); var12 += 16) {
long currentTime = System.currentTimeMillis();
if (currentTime - startTime > 1000L) {
this.outputPercentRemaining("Preparing spawn area", loadedChunks * 100 / 625);
startTime = currentTime;
}
++loadedChunks;
worldServer.theChunkProviderServer.loadChunk(spawnPoint.posX + var11 >> 4, spawnPoint.posZ + var12 >> 4);
}
}
this.clearCurrentTask();
}
}