mirror of
https://github.com/cabaletta/baritone
synced 2025-02-25 16:41:02 +00:00
recalculate on allocation size change
This commit is contained in:
parent
c79f40a5f1
commit
8ece179912
@ -32,7 +32,12 @@ public abstract class QuantizedTaskPriorityAllocationCache extends QuantizedTask
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final double priorityAllocatedTo(IQuantizedParentTaskRelationship child, int quantity) {
|
public final double priorityAllocatedTo(IQuantizedParentTaskRelationship child, int quantity) {
|
||||||
return allocationByQuantity.computeIfAbsent(quantity, this::allocationStrategy).allocatedTo(child);
|
Allocation allocation = allocationByQuantity.get(quantity);
|
||||||
|
if (allocation == null || allocation.total != effectiveAllocationSize(quantity)) {
|
||||||
|
allocation = allocationStrategy(quantity);
|
||||||
|
allocationByQuantity.put(quantity, allocation);
|
||||||
|
}
|
||||||
|
return allocation.allocatedTo(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Allocation allocationStrategy(int quantity) { // overridable
|
protected Allocation allocationStrategy(int quantity) { // overridable
|
||||||
|
Loading…
Reference in New Issue
Block a user