Skip to content

Commit

Permalink
feat: outsourced code from Cluster to AbstractCPU
Browse files Browse the repository at this point in the history
  • Loading branch information
leytilera committed Jan 27, 2023
1 parent af7d9f6 commit e373486
Show file tree
Hide file tree
Showing 4 changed files with 989 additions and 973 deletions.
20 changes: 10 additions & 10 deletions src/main/java/appeng/me/cache/CraftingGridCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public Thread newThread(final Runnable ar) {
CRAFTING_POOL = Executors.newCachedThreadPool(factory);
}

private final Set<ICraftingCPU> ICraftingCPUs
private final Set<ICraftingCPU> craftingCPUs
= new HashSet<ICraftingCPU>();
private final Set<ICraftingProvider> craftingProviders
= new HashSet<ICraftingProvider>();
Expand Down Expand Up @@ -130,7 +130,7 @@ public void onUpdateTick() {
}
}

for (final ICraftingCPU cpu : this.ICraftingCPUs) {
for (final ICraftingCPU cpu : this.craftingCPUs) {
cpu.updateCraftingLogic(this.grid, this.energyGrid, this);
}
}
Expand Down Expand Up @@ -258,14 +258,14 @@ private void updatePatterns() {
}

private void updateCPUClusters() {
this.ICraftingCPUs.clear();
this.craftingCPUs.clear();

for (final IGridNode cst : this.grid.getMachines(TileCraftingStorageTile.class)) {
final TileCraftingStorageTile tile
= (TileCraftingStorageTile) cst.getMachine();
final ICraftingCPU cluster = (ICraftingCPU) tile.getCluster();
if (cluster != null) {
this.ICraftingCPUs.add(cluster);
this.craftingCPUs.add(cluster);

if (cluster.getLastCraftingLink() != null) {
this.addLink((CraftingLink) cluster.getLastCraftingLink());
Expand Down Expand Up @@ -345,7 +345,7 @@ public boolean isPrioritized(final IAEStack input) {

@Override
public boolean canAccept(final IAEStack input) {
for (final ICraftingCPU cpu : this.ICraftingCPUs) {
for (final ICraftingCPU cpu : this.craftingCPUs) {
if (cpu.canAccept(input)) {
return true;
}
Expand All @@ -367,7 +367,7 @@ public boolean validForPass(final int i) {
@Override
public IAEStack
injectItems(IAEStack input, final Actionable type, final BaseActionSource src) {
for (final ICraftingCPU cpu : this.ICraftingCPUs) {
for (final ICraftingCPU cpu : this.craftingCPUs) {
input = cpu.injectItems(input, type, src);
}

Expand Down Expand Up @@ -469,7 +469,7 @@ public ICraftingLink submitJob(
if (target == null) {
final List<ICraftingCPU> validCpusClusters
= new ArrayList<ICraftingCPU>();
for (final ICraftingCPU cpu : this.ICraftingCPUs) {
for (final ICraftingCPU cpu : this.craftingCPUs) {
if (cpu.isActive() && !cpu.isBusy()
&& cpu.getAvailableStorage() >= job.getByteTotal()) {
validCpusClusters.add(cpu);
Expand Down Expand Up @@ -522,7 +522,7 @@ public int compare(

@Override
public ImmutableSet<ICraftingCPU> getCpus() {
return ImmutableSet.copyOf(new ActiveCpuIterator(this.ICraftingCPUs));
return ImmutableSet.copyOf(new ActiveCpuIterator(this.craftingCPUs));
}

@Override
Expand All @@ -532,7 +532,7 @@ public boolean canEmitFor(final IAEItemStack someItem) {

@Override
public boolean isRequesting(final IAEItemStack what) {
for (final ICraftingCPU cluster : this.ICraftingCPUs) {
for (final ICraftingCPU cluster : this.craftingCPUs) {
if (cluster.isMaking(what)) {
return true;
}
Expand All @@ -552,7 +552,7 @@ public List<ICraftingMedium> getMediums(final ICraftingPatternDetails key) {
}

public boolean hasCpu(final ICraftingCPU cpu) {
return this.ICraftingCPUs.contains(cpu);
return this.craftingCPUs.contains(cpu);
}

public GenericInterestManager<CraftingWatcher> getInterestManager() {
Expand Down
Loading

0 comments on commit e373486

Please sign in to comment.