Set lastTick to prevent first few ticks from being too quick

This commit is contained in:
md_5 2014-02-13 17:34:01 +11:00
parent d44874ea0b
commit a08d1e540d

View File

@ -1,11 +1,11 @@
From fefaf743d90b67d61c488d9c664aba1021049810 Mon Sep 17 00:00:00 2001 From 30e1269996adb48b469645a79a15d32c4e4e9df8 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net> From: md_5 <git@md-5.net>
Date: Sat, 25 Jan 2014 14:08:35 +1100 Date: Sat, 25 Jan 2014 14:08:35 +1100
Subject: [PATCH] Highly Optimized Tick Loop Subject: [PATCH] Highly Optimized Tick Loop
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 588ce0a..2f273ee 100644 index 588ce0a..5a83c45 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -101,6 +101,12 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo @@ -101,6 +101,12 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
@ -41,7 +41,7 @@ index 588ce0a..2f273ee 100644
+ // Spigot start + // Spigot start
+ Arrays.fill( recentTps, 20 ); + Arrays.fill( recentTps, 20 );
+ long lastTick = 0, catchupTime = 0, curTime, wait, tickSection = System.nanoTime(); + long lastTick = System.nanoTime(), catchupTime = 0, curTime, wait, tickSection = lastTick;
while (this.isRunning) { while (this.isRunning) {
- long k = ap(); - long k = ap();
- long l = k - i; - long l = k - i;
@ -96,7 +96,7 @@ index 588ce0a..2f273ee 100644
this.a((CrashReport) null); this.a((CrashReport) null);
} }
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 049d88a..9b6243a 100755 index eaafc2d..713b351 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java --- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -233,4 +233,9 @@ public class SpigotConfig @@ -233,4 +233,9 @@ public class SpigotConfig
@ -161,5 +161,5 @@ index 0000000..2b8343d
+ } + }
+} +}
-- --
1.8.4.msysgit.0 1.8.3.2