Fixes #1905: Export bus now considers failed crafting requests
The export bus will now no longer speed up, if more than 1 of the last crafting requests failed and slow down, if more then 5 failed. Some code cleanup and moved the custom iterator into the helper package as it is clearly related to the craftingtracker and not the export bus.
This commit is contained in:
@@ -175,6 +175,13 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
||||
// :P
|
||||
}
|
||||
|
||||
final int failedAttempts = this.craftingTracker.getFailedCraftingAttempts();
|
||||
|
||||
if( this.isCraftingEnabled() && failedAttempts > 0 )
|
||||
{
|
||||
return this.getFailedCraftingPenalty( failedAttempts );
|
||||
}
|
||||
|
||||
return this.didSomething ? TickRateModulation.FASTER : TickRateModulation.SLOWER;
|
||||
}
|
||||
|
||||
@@ -379,4 +386,18 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
||||
this.nextSlot = ( this.nextSlot + x ) % this.availableSlots();
|
||||
}
|
||||
}
|
||||
|
||||
private TickRateModulation getFailedCraftingPenalty( int failedAttempts )
|
||||
{
|
||||
if( failedAttempts > 5 )
|
||||
{
|
||||
return TickRateModulation.SLOWER;
|
||||
}
|
||||
else if( failedAttempts > 1 )
|
||||
{
|
||||
return TickRateModulation.SAME;
|
||||
}
|
||||
|
||||
return TickRateModulation.FASTER;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user