fix: 请求量获取调整
This commit is contained in:
parent
20bbce59fd
commit
28dfdaac78
|
|
@ -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.CallbackInfo;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||||
|
|
||||||
@Mixin(value = CraftingTreeNode.class,remap = false)
|
@Mixin(value = CraftingTreeNode.class, remap = false)
|
||||||
public class CraftingTreeNodeMixin {
|
public class CraftingTreeNodeMixin {
|
||||||
@Inject(method = "request(Lappeng/crafting/inv/CraftingSimulationState;JLappeng/api/stacks/KeyCounter;)V",
|
@Inject(method = "request(Lappeng/crafting/inv/CraftingSimulationState;JLappeng/api/stacks/KeyCounter;)V",
|
||||||
at = @At(value = "INVOKE",
|
at = @At(value = "INVOKE",
|
||||||
|
|
@ -18,13 +18,6 @@ public class CraftingTreeNodeMixin {
|
||||||
locals = LocalCapture.CAPTURE_FAILHARD)
|
locals = LocalCapture.CAPTURE_FAILHARD)
|
||||||
private void captureRequestedAmount(CraftingSimulationState inv, long requestedAmount, KeyCounter containerItems, CallbackInfo ci) {
|
private void captureRequestedAmount(CraftingSimulationState inv, long requestedAmount, KeyCounter containerItems, CallbackInfo ci) {
|
||||||
// push the requestedAmount before addContainerItems is called
|
// push the requestedAmount before addContainerItems is called
|
||||||
RequestedAmountHolder.push(requestedAmount);
|
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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ public abstract class CraftingTreeProcessMixin {
|
||||||
CraftingTreeNodeAccessor parentAcc = (CraftingTreeNodeAccessor) craftingTreeNode;
|
CraftingTreeNodeAccessor parentAcc = (CraftingTreeNodeAccessor) craftingTreeNode;
|
||||||
AEKey parentTarget = parentAcc.eap$getWhat();
|
AEKey parentTarget = parentAcc.eap$getWhat();
|
||||||
long requested = RequestedAmountHolder.get();
|
long requested = RequestedAmountHolder.get();
|
||||||
|
RequestedAmountHolder.pop();
|
||||||
|
|
||||||
// 根据配置决定是否在 provider 间轮询分配请求量(默认开启)
|
// 根据配置决定是否在 provider 间轮询分配请求量(默认开启)
|
||||||
long perProvider = 1L;
|
long perProvider = 1L;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user