From 8590492680b58ca5aa3e5743052d4c3e0b4fab24 Mon Sep 17 00:00:00 2001 From: Travis Watkins Date: Fri, 12 Apr 2013 14:46:16 -0500 Subject: Add delay to hopper even if it doesn't do anything. Fixes BUKKIT-4061 If a hopper is unable to perform any action during a tick it attempts to do so every tick from then on. Once it is able to do so it then sets a delay before attempting to do something again. To avoid excessive CPU usage for hoppers sitting idle we now apply this delay regardless of the success of the action. --- src/main/java/net/minecraft/server/TileEntityHopper.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java index f6d269d6..faeafef5 100644 --- a/src/main/java/net/minecraft/server/TileEntityHopper.java +++ b/src/main/java/net/minecraft/server/TileEntityHopper.java @@ -180,8 +180,11 @@ public class TileEntityHopper extends TileEntity implements IHopper { if (!this.l() && BlockHopper.d(this.p())) { boolean flag = this.u() | suckInItems(this); + // CraftBukkit start - Move delay out of if block + this.c(8); + if (flag) { - this.c(8); + // CraftBukkit end this.update(); return true; } -- cgit v1.2.3