mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-24 09:58:00 +01:00
49 lines
2.3 KiB
Diff
49 lines
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
|
|
|