Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/Spigot-Server-Patches/0078-Optimize-NavigationListener.patch
2016-03-07 20:45:17 -06:00

49 Zeilen
2.3 KiB
Diff

From 18aa79ba6e1de6ef27606f71a06aa35768470161 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 7 Mar 2016 20:41:27 -0500
Subject: [PATCH] Optimize NavigationListener
I believe Mojang intended to call the NavigationListener Block Update
method anytime a block is changed, but accidently added it for every
block physics event instead.
This code is massively ineffecient, and physics is so super hot, it
destroys server performance.
This patch moves the block update call to setTypeAndData instead of
on Physics.
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 1db5334..cae2873 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -89,7 +89,7 @@ public abstract class World implements IBlockAccess {
private int K;
public final Random random = new Random();
public WorldProvider worldProvider;
- protected NavigationListener t = new NavigationListener();
+ protected NavigationListener t = new NavigationListener(); public NavigationListener getNavListener() { return this.t; } // Paper
protected List<IWorldAccess> u;
protected IChunkProvider chunkProvider;
protected final IDataManager dataManager;
@@ -168,7 +168,7 @@ public abstract class World implements IBlockAccess {
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit
// CraftBukkit end
- this.u = Lists.newArrayList(new IWorldAccess[] { this.t});
+ this.u = Lists.newArrayList(new IWorldAccess[] {}); // Paper
this.L = Calendar.getInstance();
this.scoreboard = new Scoreboard();
this.allowMonsters = true;
@@ -412,6 +412,7 @@ public abstract class World implements IBlockAccess {
if (!this.captureBlockStates) { // Don't notify clients or update physics while capturing blockstates
// Modularize client and physic updates
notifyAndUpdatePhysics(blockposition, chunk, iblockdata1, iblockdata, i);
+ this.getNavListener().a(this, blockposition, iblockdata1, iblockdata, i); // Paper
}
// CraftBukkit end
--
2.7.2