Let's not check the config value every time

Once is enough
This commit is contained in:
Zach Brown
2014-07-06 01:50:02 -05:00
parent ff2628ed01
commit 35f2082d10

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com> From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Sat, 5 Jul 2014 22:54:54 -0500 Date: Sun, 6 Jul 2014 01:49:28 -0500
Subject: [PATCH] Make players in main tick loop feature configurable Subject: [PATCH] Make players in main tick loop feature configurable
@@ -23,13 +23,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- // Spigot start - // Spigot start
- private AxisAlignedBB groundCheck = AxisAlignedBB.a( 0, 0, 0, 0, 0, 0 ); - private AxisAlignedBB groundCheck = AxisAlignedBB.a( 0, 0, 0, 0, 0, 0 );
- + private boolean playerTickMainLoop = PaperSpigotConfig.playerTickMainLoop;
public void h() { public void h() {
- groundCheck.b( locX - 0.3, locY - 0.1, locZ - 0.3, locX + 0.3, locY, locZ + 0.3 ); - groundCheck.b( locX - 0.3, locY - 0.1, locZ - 0.3, locX + 0.3, locY, locZ + 0.3 );
- onGround = world.c(groundCheck); - onGround = world.c(groundCheck);
- // Spigot end - // Spigot end
+ // PaperSpigot start - Make player tick in main loop configurable + // PaperSpigot start - Make player tick in main loop configurable
+ if (PaperSpigotConfig.playerTickMainLoop) { + if (playerTickMainLoop) {
+ // Spigot start + // Spigot start
+ AxisAlignedBB groundCheck = AxisAlignedBB.a( 0, 0, 0, 0, 0, 0 ); + AxisAlignedBB groundCheck = AxisAlignedBB.a( 0, 0, 0, 0, 0, 0 );
+ groundCheck.b( locX - 0.3, locY - 0.1, locZ - 0.3, locX + 0.3, locY, locZ + 0.3 ); + groundCheck.b( locX - 0.3, locY - 0.1, locZ - 0.3, locX + 0.3, locY, locZ + 0.3 );
@@ -50,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- { - {
+ +
+ // PaperSpigot start - Make player tick in main loop configurable + // PaperSpigot start - Make player tick in main loop configurable
+ if (PaperSpigotConfig.playerTickMainLoop) { + if (playerTickMainLoop) {
+ // Spigot start + // Spigot start
+ this.i(); + this.i();
+ if ( Double.isNaN( previousY ) ) + if ( Double.isNaN( previousY ) )
@@ -70,12 +71,21 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener {
this.player.a(packetplayinsteervehicle.c(), packetplayinsteervehicle.d(), packetplayinsteervehicle.e(), packetplayinsteervehicle.f());
}
+ private boolean playerTickMainLoop = PaperSpigotConfig.playerTickMainLoop;
+
public void a(PacketPlayInFlying packetplayinflying) {
// CraftBukkit start - Check for NaN
if (Double.isNaN(packetplayinflying.x) || Double.isNaN(packetplayinflying.y) || Double.isNaN(packetplayinflying.z) || Double.isNaN(packetplayinflying.stance)) {
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener { @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketPlayInListener {
f1 = packetplayinflying.h(); f1 = packetplayinflying.h();
} }
+ // PaperSpigot start - Make player tick in main loop configurable + // PaperSpigot start - Make player tick in main loop configurable
+ if (!PaperSpigotConfig.playerTickMainLoop) { + if (!playerTickMainLoop) {
+ this.player.onGround = packetplayinflying.i(); + this.player.onGround = packetplayinflying.i();
+ this.player.i(); + this.player.i();
+ } + }
@@ -88,7 +98,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (this.player.isSleeping()) { if (this.player.isSleeping()) {
+ // PaperSpigot start - Make player tick in main loop configurable + // PaperSpigot start - Make player tick in main loop configurable
+ if (!PaperSpigotConfig.playerTickMainLoop) { + if (!playerTickMainLoop) {
+ this.player.i(); + this.player.i();
+ } + }
+ // PaperSpigot end + // PaperSpigot end
@@ -100,7 +110,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
+ // PaperSpigot start - Make player tick in main loop configurable + // PaperSpigot start - Make player tick in main loop configurable
+ if (!PaperSpigotConfig.playerTickMainLoop) { + if (!playerTickMainLoop) {
+ this.player.i(); + this.player.i();
+ } + }
+ // PaperSpigot end + // PaperSpigot end
@@ -112,7 +122,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.player.move(d4, d5, d6); this.player.move(d4, d5, d6);
+ // PaperSpigot start - Make player tick in main loop configurable + // PaperSpigot start - Make player tick in main loop configurable
+ if (!PaperSpigotConfig.playerTickMainLoop) { + if (!playerTickMainLoop) {
+ this.player.onGround = packetplayinflying.i(); + this.player.onGround = packetplayinflying.i();
+ } + }
+ // PaperSpigot end + // PaperSpigot end
@@ -124,13 +134,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
+ // PaperSpigot start - Make player tick in main loop configurable + // PaperSpigot start - Make player tick in main loop configurable
+ if (!PaperSpigotConfig.playerTickMainLoop) { + if (!playerTickMainLoop) {
+ this.player.onGround = packetplayinflying.i(); + this.player.onGround = packetplayinflying.i();
+ } + }
+ // PaperSpigot end + // PaperSpigot end
this.minecraftServer.getPlayerList().d(this.player); this.minecraftServer.getPlayerList().d(this.player);
+ // PaperSpigot start - Make player tick in main loop configurable + // PaperSpigot start - Make player tick in main loop configurable
+ if (!PaperSpigotConfig.playerTickMainLoop) { + if (!playerTickMainLoop) {
+ this.player.b(this.player.locY - d0, packetplayinflying.i()); + this.player.b(this.player.locY - d0, packetplayinflying.i());
+ } + }
+ // PaperSpigot end + // PaperSpigot end