mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-11 17:31:06 +01:00
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:
parent
5cc4fbd712
commit
8590492680
1 changed files with 4 additions and 1 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue