2016-07-28 00:46:02 +02:00
|
|
|
From ecdca7963b3facd652fc2a6a60e3c49c3018e8f8 Mon Sep 17 00:00:00 2001
|
2016-04-28 04:15:57 +02:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Wed, 27 Apr 2016 22:09:52 -0400
|
|
|
|
Subject: [PATCH] Improve Minecraft Hopper Performance
|
|
|
|
|
|
|
|
Removes unnecessary extra calls to .update() that are very expensive
|
|
|
|
Also reset cooldown each hopper tick that a hopper is full.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
|
2016-06-09 05:57:14 +02:00
|
|
|
index 9fa93ed..cd39fe5 100644
|
2016-04-28 04:15:57 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/TileEntity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/TileEntity.java
|
|
|
|
@@ -36,6 +36,7 @@ public abstract class TileEntity {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ static boolean IGNORE_TILE_UPDATES = false; // Paper
|
|
|
|
public World getWorld() {
|
|
|
|
return this.world;
|
|
|
|
}
|
2016-06-09 05:57:14 +02:00
|
|
|
@@ -113,6 +114,7 @@ public abstract class TileEntity {
|
2016-04-28 04:15:57 +02:00
|
|
|
|
|
|
|
public void update() {
|
|
|
|
if (this.world != null) {
|
|
|
|
+ if (IGNORE_TILE_UPDATES) return; // Paper
|
|
|
|
IBlockData iblockdata = this.world.getType(this.position);
|
|
|
|
|
|
|
|
this.h = iblockdata.getBlock().toLegacyData(iblockdata);
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java
|
2016-07-28 00:46:02 +02:00
|
|
|
index d1ce2b9..a651961 100644
|
2016-04-28 04:15:57 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/TileEntityHopper.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/TileEntityHopper.java
|
2016-07-17 03:10:43 +02:00
|
|
|
@@ -188,6 +188,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
|
|
|
|
return true;
|
2016-04-28 04:15:57 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
+
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
return false;
|
2016-07-17 03:10:43 +02:00
|
|
|
@@ -499,7 +500,9 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
|
2016-04-28 04:15:57 +02:00
|
|
|
boolean flag = false;
|
|
|
|
|
|
|
|
if (itemstack1 == null) {
|
|
|
|
+ IGNORE_TILE_UPDATES = true; // Paper
|
|
|
|
iinventory.setItem(i, itemstack);
|
|
|
|
+ IGNORE_TILE_UPDATES = false; // Paper
|
|
|
|
itemstack = null;
|
|
|
|
flag = true;
|
|
|
|
} else if (a(itemstack1, itemstack)) {
|
2016-07-17 03:10:43 +02:00
|
|
|
@@ -519,7 +522,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
|
2016-04-28 04:22:35 +02:00
|
|
|
tileentityhopper.setCooldown(tileentityhopper.world.spigotConfig.hopperTransfer); // Spigot
|
|
|
|
}
|
2016-04-28 04:15:57 +02:00
|
|
|
|
2016-04-28 04:22:35 +02:00
|
|
|
- iinventory.update();
|
|
|
|
+ //iinventory.update(); // Paper
|
|
|
|
}
|
2016-04-28 04:15:57 +02:00
|
|
|
|
2016-04-28 04:22:35 +02:00
|
|
|
iinventory.update();
|
2016-07-17 03:10:43 +02:00
|
|
|
@@ -594,6 +597,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
|
2016-04-28 04:15:57 +02:00
|
|
|
this.g = i;
|
|
|
|
}
|
|
|
|
|
2016-07-28 00:46:02 +02:00
|
|
|
+ boolean isCooledDown() { return o(); } // Paper - OBFHELPER
|
2016-04-28 04:15:57 +02:00
|
|
|
public boolean o() {
|
|
|
|
return this.g > 0;
|
|
|
|
}
|
|
|
|
--
|
2016-07-28 00:46:02 +02:00
|
|
|
2.9.2.windows.1
|
2016-04-28 04:15:57 +02:00
|
|
|
|