Skip to content

Commit

Permalink
- item != item?
Browse files Browse the repository at this point in the history
- 尝试改进 IC2 的线程调用。
  • Loading branch information
KasumiNova committed Oct 1, 2024
1 parent 7dd6631 commit 38b8384
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ dependencies {
implementation(rfg.deobf("curse.maven:lolasm-460609:5257348"))
runtimeOnly(rfg.deobf("curse.maven:spark-361579:3245793"))
compileOnly(rfg.deobf("curse.maven:dme-737252:5043404"))
implementation(rfg.deobf("curse.maven:bountifulbaubles-313536:3568240"))
}

// IDE Settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ void startTransferCalc(final CallbackInfo ci) {
int tasks = grids.size();
ForkJoinPool.commonPool().submit(() -> {
int concurrency = Math.min(tasks, Math.max(Runtime.getRuntime().availableProcessors(), 2));
IntStream.range(0, concurrency).forEach(i -> ForkJoinPool.commonPool().submit(() -> {
IntStream.range(0, concurrency).parallel().forEach(i -> {
Grid grid;
while ((grid = calculateQueue.poll()) != null) {
stellar_core$syncTaskQueue.offer(stellarCalculator.doParallelCalc(grid));
}
}));
});
});

stellar_core$executeSyncTasks(tasks, stellarCalculator, calculateQueue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ public abstract class MixinItemStack implements StellarItemStackCapLoader {
@Shadow
public abstract int getAnimationsToGo();

@Shadow
public abstract Item getItem();

@Unique
private ItemStackCapInitTask stellar_core$capInitTask = null;

Expand Down Expand Up @@ -88,7 +91,7 @@ private void forgeInit() {
@Override
@SuppressWarnings("DataFlowIssue")
public void stellar_core$initCap() {
ICapabilityProvider provider = item.initCapabilities((ItemStack) (Object) this, this.capNBT);
ICapabilityProvider provider = getItem().initCapabilities((ItemStack) (Object) this, this.capNBT);
this.stellar_core$capabilities = ForgeEventFactory.gatherCapabilities((ItemStack) (Object) this, provider);
}

Expand Down

0 comments on commit 38b8384

Please # to comment.