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.
This commit is contained in:
Travis Watkins 2013-04-12 14:46:16 -05:00 committed by Wesley Wolfe
parent 5cc4fbd712
commit 8590492680

View file

@ -180,8 +180,11 @@ public class TileEntityHopper extends TileEntity implements IHopper {
if (!this.l() && BlockHopper.d(this.p())) { if (!this.l() && BlockHopper.d(this.p())) {
boolean flag = this.u() | suckInItems(this); boolean flag = this.u() | suckInItems(this);
// CraftBukkit start - Move delay out of if block
this.c(8);
if (flag) { if (flag) {
this.c(8); // CraftBukkit end
this.update(); this.update();
return true; return true;
} }