Create Ore Excavation

Create Ore Excavation

8M Downloads

[BUG] [1.18.2] Drill continuously adds outputs beyond the limit of its inventory

Tidy-Bear opened this issue ยท 0 comments

commented

Description

I played on a server with a modpack that required many drills to obtain various ores. After a long period of time, the server became very laggy (13 TPS). Upon profiling, I found that the server was spending a lot of time on array querying (NonNullList#removeIf) because drills were continuously producing outputs beyond the limit of their internal inventory.

Additionally, breaking the drill may lead to server crashing due to the drop of numerous item entities.

Reason

protected boolean canExtract() {
return inventory.hasSpace() && current.getDrillingFluid().getRequiredAmount() == 0 ||
(current.getDrillingFluid().test(fluidTank.getFluid()) &&
fluidTank.getFluidAmount() >= current.getDrillingFluid().getRequiredAmount());
}

should be A and ( B or C )

1.19 and newer may not have the bug because related codes have been refactored.