1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-02-17 10:41:41 +01:00

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: 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
@ -23,13 +23,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- // Spigot start
- private AxisAlignedBB groundCheck = AxisAlignedBB.a( 0, 0, 0, 0, 0, 0 );
-
+ private boolean playerTickMainLoop = PaperSpigotConfig.playerTickMainLoop;
public void h() {
- groundCheck.b( locX - 0.3, locY - 0.1, locZ - 0.3, locX + 0.3, locY, locZ + 0.3 );
- onGround = world.c(groundCheck);
- // Spigot end
+ // PaperSpigot start - Make player tick in main loop configurable
+ if (PaperSpigotConfig.playerTickMainLoop) {
+ if (playerTickMainLoop) {
+ // Spigot start
+ 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 );
@ -50,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- {
+
+ // PaperSpigot start - Make player tick in main loop configurable
+ if (PaperSpigotConfig.playerTickMainLoop) {
+ if (playerTickMainLoop) {
+ // Spigot start
+ this.i();
+ 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
--- a/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 {
f1 = packetplayinflying.h();
}
+ // PaperSpigot start - Make player tick in main loop configurable
+ if (!PaperSpigotConfig.playerTickMainLoop) {
+ if (!playerTickMainLoop) {
+ this.player.onGround = packetplayinflying.i();
+ this.player.i();
+ }
@ -88,7 +98,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (this.player.isSleeping()) {
+ // PaperSpigot start - Make player tick in main loop configurable
+ if (!PaperSpigotConfig.playerTickMainLoop) {
+ if (!playerTickMainLoop) {
+ this.player.i();
+ }
+ // PaperSpigot end
@ -100,7 +110,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+ // PaperSpigot start - Make player tick in main loop configurable
+ if (!PaperSpigotConfig.playerTickMainLoop) {
+ if (!playerTickMainLoop) {
+ this.player.i();
+ }
+ // PaperSpigot end
@ -112,7 +122,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.player.move(d4, d5, d6);
+ // PaperSpigot start - Make player tick in main loop configurable
+ if (!PaperSpigotConfig.playerTickMainLoop) {
+ if (!playerTickMainLoop) {
+ this.player.onGround = packetplayinflying.i();
+ }
+ // PaperSpigot end
@ -124,13 +134,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+ // PaperSpigot start - Make player tick in main loop configurable
+ if (!PaperSpigotConfig.playerTickMainLoop) {
+ if (!playerTickMainLoop) {
+ this.player.onGround = packetplayinflying.i();
+ }
+ // PaperSpigot end
this.minecraftServer.getPlayerList().d(this.player);
+ // PaperSpigot start - Make player tick in main loop configurable
+ if (!PaperSpigotConfig.playerTickMainLoop) {
+ if (!playerTickMainLoop) {
+ this.player.b(this.player.locY - d0, packetplayinflying.i());
+ }
+ // PaperSpigot end