mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Optimize NavigationListener
This commit is contained in:
parent
d78781c869
commit
b65586112b
1 changed files with 46 additions and 0 deletions
46
Spigot-Server-Patches/Optimize-NavigationListener.patch
Normal file
46
Spigot-Server-Patches/Optimize-NavigationListener.patch
Normal file
|
@ -0,0 +1,46 @@
|
|||
From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ 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;
|
||||
@@ -0,0 +0,0 @@ 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;
|
||||
@@ -0,0 +0,0 @@ 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
|
||||
|
||||
--
|
Loading…
Reference in a new issue