fix: 请求量获取调整

This commit is contained in:
C-H716 2025-09-25 23:33:59 +08:00
parent 20bbce59fd
commit 28dfdaac78
2 changed files with 3 additions and 9 deletions

View File

@ -10,7 +10,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
@Mixin(value = CraftingTreeNode.class,remap = false)
@Mixin(value = CraftingTreeNode.class, remap = false)
public class CraftingTreeNodeMixin {
@Inject(method = "request(Lappeng/crafting/inv/CraftingSimulationState;JLappeng/api/stacks/KeyCounter;)V",
at = @At(value = "INVOKE",
@ -18,13 +18,6 @@ public class CraftingTreeNodeMixin {
locals = LocalCapture.CAPTURE_FAILHARD)
private void captureRequestedAmount(CraftingSimulationState inv, long requestedAmount, KeyCounter containerItems, CallbackInfo ci) {
// push the requestedAmount before addContainerItems is called
RequestedAmountHolder.push(requestedAmount);
}
@Inject(method = "request(Lappeng/crafting/inv/CraftingSimulationState;JLappeng/api/stacks/KeyCounter;)V",
at = @At(value = "RETURN"))
private void clearRequestedAmountOnReturn(CraftingSimulationState inv, long requestedAmount, KeyCounter containerItems, CallbackInfo ci) {
// pop the pushed requested amount on return
RequestedAmountHolder.pop();
RequestedAmountHolder.push(requestedAmount);
}
}

View File

@ -56,6 +56,7 @@ public abstract class CraftingTreeProcessMixin {
CraftingTreeNodeAccessor parentAcc = (CraftingTreeNodeAccessor) craftingTreeNode;
AEKey parentTarget = parentAcc.eap$getWhat();
long requested = RequestedAmountHolder.get();
RequestedAmountHolder.pop();
// 根据配置决定是否在 provider 间轮询分配请求量默认开启
long perProvider = 1L;