feat: seperated ICraftingCPU from Cluster
This commit is contained in:
parent
493dc5aa1d
commit
af7d9f6f0e
|
@ -23,9 +23,14 @@
|
||||||
|
|
||||||
package appeng.api.networking.crafting;
|
package appeng.api.networking.crafting;
|
||||||
|
|
||||||
|
import appeng.api.config.Actionable;
|
||||||
|
import appeng.api.networking.IGrid;
|
||||||
|
import appeng.api.networking.energy.IEnergyGrid;
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
import appeng.api.networking.security.BaseActionSource;
|
||||||
import appeng.api.networking.storage.IBaseMonitor;
|
import appeng.api.networking.storage.IBaseMonitor;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.api.storage.data.IAEStack;
|
||||||
|
import appeng.api.storage.data.IItemList;
|
||||||
|
|
||||||
public interface ICraftingCPU extends IBaseMonitor<IAEItemStack> {
|
public interface ICraftingCPU extends IBaseMonitor<IAEItemStack> {
|
||||||
/**
|
/**
|
||||||
|
@ -52,4 +57,38 @@ public interface ICraftingCPU extends IBaseMonitor<IAEItemStack> {
|
||||||
* @return an empty string or the name of the cpu.
|
* @return an empty string or the name of the cpu.
|
||||||
*/
|
*/
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
|
void getListOfItem(final IItemList<IAEItemStack> list, final CraftingItemList whichList);
|
||||||
|
|
||||||
|
void cancel();
|
||||||
|
|
||||||
|
IAEItemStack getItemStack(final IAEItemStack what, final CraftingItemList storage2);
|
||||||
|
|
||||||
|
long getElapsedTime();
|
||||||
|
|
||||||
|
long getRemainingItemCount();
|
||||||
|
|
||||||
|
long getStartItemCount();
|
||||||
|
|
||||||
|
void addCrafting(final ICraftingPatternDetails details, final long crafts);
|
||||||
|
|
||||||
|
void addStorage(final IAEItemStack extractItems);
|
||||||
|
|
||||||
|
void addEmitable(final IAEItemStack i);
|
||||||
|
|
||||||
|
void updateCraftingLogic(final IGrid grid, final IEnergyGrid eg, final ICraftingGrid cc);
|
||||||
|
|
||||||
|
ICraftingLink getLastCraftingLink();
|
||||||
|
|
||||||
|
boolean canAccept(final IAEStack<?> input);
|
||||||
|
|
||||||
|
IAEStack<?> injectItems(final IAEStack<?> input, final Actionable type, final BaseActionSource src);
|
||||||
|
|
||||||
|
ICraftingLink submitJob(final IGrid g, final ICraftingJob job, final BaseActionSource src, final ICraftingRequester requestingMachine);
|
||||||
|
|
||||||
|
boolean isMaking(final IAEItemStack what);
|
||||||
|
|
||||||
|
boolean isActive();
|
||||||
|
|
||||||
|
boolean isDestroyed();
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,6 @@ import appeng.core.sync.packets.PacketMEInventoryUpdate;
|
||||||
import appeng.core.sync.packets.PacketValueConfig;
|
import appeng.core.sync.packets.PacketValueConfig;
|
||||||
import appeng.helpers.ICustomNameObject;
|
import appeng.helpers.ICustomNameObject;
|
||||||
import appeng.me.cluster.IAEMultiBlock;
|
import appeng.me.cluster.IAEMultiBlock;
|
||||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
|
||||||
import appeng.tile.crafting.TileCraftingTile;
|
import appeng.tile.crafting.TileCraftingTile;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -53,7 +52,7 @@ public class ContainerCraftingCPU extends AEBaseContainer
|
||||||
private final IItemList<IAEItemStack> list
|
private final IItemList<IAEItemStack> list
|
||||||
= AEApi.instance().storage().createItemList();
|
= AEApi.instance().storage().createItemList();
|
||||||
private IGrid network;
|
private IGrid network;
|
||||||
private CraftingCPUCluster monitor = null;
|
private ICraftingCPU monitor = null;
|
||||||
private String cpuName = null;
|
private String cpuName = null;
|
||||||
|
|
||||||
@GuiSync(0)
|
@GuiSync(0)
|
||||||
|
@ -110,9 +109,9 @@ public class ContainerCraftingCPU extends AEBaseContainer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c instanceof CraftingCPUCluster) {
|
if (c instanceof ICraftingCPU) {
|
||||||
this.cpuName = c.getName();
|
this.cpuName = c.getName();
|
||||||
this.setMonitor((CraftingCPUCluster) c);
|
this.setMonitor((ICraftingCPU) c);
|
||||||
this.list.resetStatus();
|
this.list.resetStatus();
|
||||||
this.getMonitor().getListOfItem(this.list, CraftingItemList.ALL);
|
this.getMonitor().getListOfItem(this.list, CraftingItemList.ALL);
|
||||||
this.getMonitor().addListener(this, null);
|
this.getMonitor().addListener(this, null);
|
||||||
|
@ -242,11 +241,11 @@ public class ContainerCraftingCPU extends AEBaseContainer
|
||||||
this.eta = eta;
|
this.eta = eta;
|
||||||
}
|
}
|
||||||
|
|
||||||
CraftingCPUCluster getMonitor() {
|
ICraftingCPU getMonitor() {
|
||||||
return this.monitor;
|
return this.monitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setMonitor(final CraftingCPUCluster monitor) {
|
private void setMonitor(final ICraftingCPU monitor) {
|
||||||
this.monitor = monitor;
|
this.monitor = monitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,12 +26,12 @@ import java.util.List;
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.config.FuzzyMode;
|
import appeng.api.config.FuzzyMode;
|
||||||
|
import appeng.api.networking.crafting.ICraftingCPU;
|
||||||
import appeng.api.networking.crafting.ICraftingGrid;
|
import appeng.api.networking.crafting.ICraftingGrid;
|
||||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
import appeng.api.networking.security.BaseActionSource;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ public class CraftingTreeNode {
|
||||||
|
|
||||||
public void setJob(
|
public void setJob(
|
||||||
final MECraftingInventory storage,
|
final MECraftingInventory storage,
|
||||||
final CraftingCPUCluster craftingCPUCluster,
|
final ICraftingCPU ICraftingCPU,
|
||||||
final BaseActionSource src
|
final BaseActionSource src
|
||||||
) throws CraftBranchFailure {
|
) throws CraftBranchFailure {
|
||||||
for (final IAEItemStack i : this.used) {
|
for (final IAEItemStack i : this.used) {
|
||||||
|
@ -323,17 +323,17 @@ public class CraftingTreeNode {
|
||||||
throw new CraftBranchFailure(i, i.getStackSize());
|
throw new CraftBranchFailure(i, i.getStackSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
craftingCPUCluster.addStorage(ex);
|
ICraftingCPU.addStorage(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.howManyEmitted > 0) {
|
if (this.howManyEmitted > 0) {
|
||||||
final IAEItemStack i = this.what.copy();
|
final IAEItemStack i = this.what.copy();
|
||||||
i.setStackSize(this.howManyEmitted);
|
i.setStackSize(this.howManyEmitted);
|
||||||
craftingCPUCluster.addEmitable(i);
|
ICraftingCPU.addEmitable(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final CraftingTreeProcess pro : this.nodes) {
|
for (final CraftingTreeProcess pro : this.nodes) {
|
||||||
pro.setJob(storage, craftingCPUCluster, src);
|
pro.setJob(storage, ICraftingCPU, src);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,13 +24,13 @@ import java.util.Map.Entry;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
|
import appeng.api.networking.crafting.ICraftingCPU;
|
||||||
import appeng.api.networking.crafting.ICraftingGrid;
|
import appeng.api.networking.crafting.ICraftingGrid;
|
||||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
import appeng.api.networking.security.BaseActionSource;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
import appeng.container.ContainerNull;
|
import appeng.container.ContainerNull;
|
||||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
import net.minecraft.inventory.InventoryCrafting;
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
|
@ -287,13 +287,13 @@ public class CraftingTreeProcess {
|
||||||
|
|
||||||
void setJob(
|
void setJob(
|
||||||
final MECraftingInventory storage,
|
final MECraftingInventory storage,
|
||||||
final CraftingCPUCluster craftingCPUCluster,
|
final ICraftingCPU ICraftingCPU,
|
||||||
final BaseActionSource src
|
final BaseActionSource src
|
||||||
) throws CraftBranchFailure {
|
) throws CraftBranchFailure {
|
||||||
craftingCPUCluster.addCrafting(this.details, this.crafts);
|
ICraftingCPU.addCrafting(this.details, this.crafts);
|
||||||
|
|
||||||
for (final CraftingTreeNode pro : this.nodes.keySet()) {
|
for (final CraftingTreeNode pro : this.nodes.keySet()) {
|
||||||
pro.setJob(storage, craftingCPUCluster, src);
|
pro.setJob(storage, ICraftingCPU, src);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,6 @@ import appeng.crafting.CraftingJob;
|
||||||
import appeng.crafting.CraftingLink;
|
import appeng.crafting.CraftingLink;
|
||||||
import appeng.crafting.CraftingLinkNexus;
|
import appeng.crafting.CraftingLinkNexus;
|
||||||
import appeng.crafting.CraftingWatcher;
|
import appeng.crafting.CraftingWatcher;
|
||||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
|
||||||
import appeng.me.helpers.GenericInterestManager;
|
import appeng.me.helpers.GenericInterestManager;
|
||||||
import appeng.tile.crafting.TileCraftingStorageTile;
|
import appeng.tile.crafting.TileCraftingStorageTile;
|
||||||
import appeng.tile.crafting.TileCraftingTile;
|
import appeng.tile.crafting.TileCraftingTile;
|
||||||
|
@ -82,8 +81,8 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||||
CRAFTING_POOL = Executors.newCachedThreadPool(factory);
|
CRAFTING_POOL = Executors.newCachedThreadPool(factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Set<CraftingCPUCluster> craftingCPUClusters
|
private final Set<ICraftingCPU> ICraftingCPUs
|
||||||
= new HashSet<CraftingCPUCluster>();
|
= new HashSet<ICraftingCPU>();
|
||||||
private final Set<ICraftingProvider> craftingProviders
|
private final Set<ICraftingProvider> craftingProviders
|
||||||
= new HashSet<ICraftingProvider>();
|
= new HashSet<ICraftingProvider>();
|
||||||
private final Map<IGridNode, ICraftingWatcher> craftingWatchers
|
private final Map<IGridNode, ICraftingWatcher> craftingWatchers
|
||||||
|
@ -131,7 +130,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final CraftingCPUCluster cpu : this.craftingCPUClusters) {
|
for (final ICraftingCPU cpu : this.ICraftingCPUs) {
|
||||||
cpu.updateCraftingLogic(this.grid, this.energyGrid, this);
|
cpu.updateCraftingLogic(this.grid, this.energyGrid, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -259,14 +258,14 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateCPUClusters() {
|
private void updateCPUClusters() {
|
||||||
this.craftingCPUClusters.clear();
|
this.ICraftingCPUs.clear();
|
||||||
|
|
||||||
for (final IGridNode cst : this.grid.getMachines(TileCraftingStorageTile.class)) {
|
for (final IGridNode cst : this.grid.getMachines(TileCraftingStorageTile.class)) {
|
||||||
final TileCraftingStorageTile tile
|
final TileCraftingStorageTile tile
|
||||||
= (TileCraftingStorageTile) cst.getMachine();
|
= (TileCraftingStorageTile) cst.getMachine();
|
||||||
final CraftingCPUCluster cluster = (CraftingCPUCluster) tile.getCluster();
|
final ICraftingCPU cluster = (ICraftingCPU) tile.getCluster();
|
||||||
if (cluster != null) {
|
if (cluster != null) {
|
||||||
this.craftingCPUClusters.add(cluster);
|
this.ICraftingCPUs.add(cluster);
|
||||||
|
|
||||||
if (cluster.getLastCraftingLink() != null) {
|
if (cluster.getLastCraftingLink() != null) {
|
||||||
this.addLink((CraftingLink) cluster.getLastCraftingLink());
|
this.addLink((CraftingLink) cluster.getLastCraftingLink());
|
||||||
|
@ -346,7 +345,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAccept(final IAEStack input) {
|
public boolean canAccept(final IAEStack input) {
|
||||||
for (final CraftingCPUCluster cpu : this.craftingCPUClusters) {
|
for (final ICraftingCPU cpu : this.ICraftingCPUs) {
|
||||||
if (cpu.canAccept(input)) {
|
if (cpu.canAccept(input)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -368,7 +367,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||||
@Override
|
@Override
|
||||||
public IAEStack
|
public IAEStack
|
||||||
injectItems(IAEStack input, final Actionable type, final BaseActionSource src) {
|
injectItems(IAEStack input, final Actionable type, final BaseActionSource src) {
|
||||||
for (final CraftingCPUCluster cpu : this.craftingCPUClusters) {
|
for (final ICraftingCPU cpu : this.ICraftingCPUs) {
|
||||||
input = cpu.injectItems(input, type, src);
|
input = cpu.injectItems(input, type, src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,27 +460,27 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
CraftingCPUCluster cpuCluster = null;
|
ICraftingCPU cpuCluster = null;
|
||||||
|
|
||||||
if (target instanceof CraftingCPUCluster) {
|
if (target instanceof ICraftingCPU) {
|
||||||
cpuCluster = (CraftingCPUCluster) target;
|
cpuCluster = (ICraftingCPU) target;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
final List<CraftingCPUCluster> validCpusClusters
|
final List<ICraftingCPU> validCpusClusters
|
||||||
= new ArrayList<CraftingCPUCluster>();
|
= new ArrayList<ICraftingCPU>();
|
||||||
for (final CraftingCPUCluster cpu : this.craftingCPUClusters) {
|
for (final ICraftingCPU cpu : this.ICraftingCPUs) {
|
||||||
if (cpu.isActive() && !cpu.isBusy()
|
if (cpu.isActive() && !cpu.isBusy()
|
||||||
&& cpu.getAvailableStorage() >= job.getByteTotal()) {
|
&& cpu.getAvailableStorage() >= job.getByteTotal()) {
|
||||||
validCpusClusters.add(cpu);
|
validCpusClusters.add(cpu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Collections.sort(validCpusClusters, new Comparator<CraftingCPUCluster>() {
|
Collections.sort(validCpusClusters, new Comparator<ICraftingCPU>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(
|
public int compare(
|
||||||
final CraftingCPUCluster firstCluster,
|
final ICraftingCPU firstCluster,
|
||||||
final CraftingCPUCluster nextCluster
|
final ICraftingCPU nextCluster
|
||||||
) {
|
) {
|
||||||
if (prioritizePower) {
|
if (prioritizePower) {
|
||||||
final int comparison = ItemSorters.compareLong(
|
final int comparison = ItemSorters.compareLong(
|
||||||
|
@ -523,7 +522,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ImmutableSet<ICraftingCPU> getCpus() {
|
public ImmutableSet<ICraftingCPU> getCpus() {
|
||||||
return ImmutableSet.copyOf(new ActiveCpuIterator(this.craftingCPUClusters));
|
return ImmutableSet.copyOf(new ActiveCpuIterator(this.ICraftingCPUs));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -533,7 +532,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isRequesting(final IAEItemStack what) {
|
public boolean isRequesting(final IAEItemStack what) {
|
||||||
for (final CraftingCPUCluster cluster : this.craftingCPUClusters) {
|
for (final ICraftingCPU cluster : this.ICraftingCPUs) {
|
||||||
if (cluster.isMaking(what)) {
|
if (cluster.isMaking(what)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -553,7 +552,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasCpu(final ICraftingCPU cpu) {
|
public boolean hasCpu(final ICraftingCPU cpu) {
|
||||||
return this.craftingCPUClusters.contains(cpu);
|
return this.ICraftingCPUs.contains(cpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GenericInterestManager<CraftingWatcher> getInterestManager() {
|
public GenericInterestManager<CraftingWatcher> getInterestManager() {
|
||||||
|
@ -561,10 +560,10 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ActiveCpuIterator implements Iterator<ICraftingCPU> {
|
private static class ActiveCpuIterator implements Iterator<ICraftingCPU> {
|
||||||
private final Iterator<CraftingCPUCluster> iterator;
|
private final Iterator<ICraftingCPU> iterator;
|
||||||
private CraftingCPUCluster cpuCluster;
|
private ICraftingCPU cpuCluster;
|
||||||
|
|
||||||
public ActiveCpuIterator(final Collection<CraftingCPUCluster> o) {
|
public ActiveCpuIterator(final Collection<ICraftingCPU> o) {
|
||||||
this.iterator = o.iterator();
|
this.iterator = o.iterator();
|
||||||
this.cpuCluster = null;
|
this.cpuCluster = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,10 +104,12 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
|
||||||
this.max = max;
|
this.max = max;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isDestroyed() {
|
public boolean isDestroyed() {
|
||||||
return this.isDestroyed;
|
return this.isDestroyed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICraftingLink getLastCraftingLink() {
|
public ICraftingLink getLastCraftingLink() {
|
||||||
return this.myLastLink;
|
return this.myLastLink;
|
||||||
}
|
}
|
||||||
|
@ -189,6 +191,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean canAccept(final IAEStack input) {
|
public boolean canAccept(final IAEStack input) {
|
||||||
if (input instanceof IAEItemStack) {
|
if (input instanceof IAEItemStack) {
|
||||||
final IAEItemStack is = this.waitingFor.findPrecise((IAEItemStack) input);
|
final IAEItemStack is = this.waitingFor.findPrecise((IAEItemStack) input);
|
||||||
|
@ -199,6 +202,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IAEStack
|
public IAEStack
|
||||||
injectItems(final IAEStack input, final Actionable type, final BaseActionSource src) {
|
injectItems(final IAEStack input, final Actionable type, final BaseActionSource src) {
|
||||||
if (!(input instanceof IAEItemStack)) {
|
if (!(input instanceof IAEItemStack)) {
|
||||||
|
@ -456,6 +460,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void cancel() {
|
public void cancel() {
|
||||||
if (this.myLastLink != null) {
|
if (this.myLastLink != null) {
|
||||||
this.myLastLink.cancel();
|
this.myLastLink.cancel();
|
||||||
|
@ -487,8 +492,9 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
|
||||||
this.storeItems(); // marks dirty
|
this.storeItems(); // marks dirty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void updateCraftingLogic(
|
public void updateCraftingLogic(
|
||||||
final IGrid grid, final IEnergyGrid eg, final CraftingGridCache cc
|
final IGrid grid, final IEnergyGrid eg, final ICraftingGrid cc
|
||||||
) {
|
) {
|
||||||
if (!this.getCore().isActive()) {
|
if (!this.getCore().isActive()) {
|
||||||
return;
|
return;
|
||||||
|
@ -523,7 +529,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
|
||||||
if (this.remainingOperations > 0) {
|
if (this.remainingOperations > 0) {
|
||||||
do {
|
do {
|
||||||
this.somethingChanged = false;
|
this.somethingChanged = false;
|
||||||
this.executeCrafting(eg, cc);
|
this.executeCrafting(eg, (CraftingGridCache)cc);
|
||||||
} while (this.somethingChanged && this.remainingOperations > 0);
|
} while (this.somethingChanged && this.remainingOperations > 0);
|
||||||
}
|
}
|
||||||
this.usedOps[2] = this.usedOps[1];
|
this.usedOps[2] = this.usedOps[1];
|
||||||
|
@ -754,6 +760,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICraftingLink submitJob(
|
public ICraftingLink submitJob(
|
||||||
final IGrid g,
|
final IGrid g,
|
||||||
final ICraftingJob job,
|
final ICraftingJob job,
|
||||||
|
@ -862,6 +869,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
|
||||||
return this.myName;
|
return this.myName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isActive() {
|
public boolean isActive() {
|
||||||
final TileCraftingTile core = this.getCore();
|
final TileCraftingTile core = this.getCore();
|
||||||
|
|
||||||
|
@ -908,6 +916,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void
|
public void
|
||||||
getListOfItem(final IItemList<IAEItemStack> list, final CraftingItemList whichList) {
|
getListOfItem(final IItemList<IAEItemStack> list, final CraftingItemList whichList) {
|
||||||
switch (whichList) {
|
switch (whichList) {
|
||||||
|
@ -949,15 +958,18 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addStorage(final IAEItemStack extractItems) {
|
public void addStorage(final IAEItemStack extractItems) {
|
||||||
this.inventory.injectItems(extractItems, Actionable.MODULATE, null);
|
this.inventory.injectItems(extractItems, Actionable.MODULATE, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addEmitable(final IAEItemStack i) {
|
public void addEmitable(final IAEItemStack i) {
|
||||||
this.waitingFor.add(i);
|
this.waitingFor.add(i);
|
||||||
this.postCraftingStatusChange(i);
|
this.postCraftingStatusChange(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addCrafting(final ICraftingPatternDetails details, final long crafts) {
|
public void addCrafting(final ICraftingPatternDetails details, final long crafts) {
|
||||||
TaskProgress i = this.tasks.get(details);
|
TaskProgress i = this.tasks.get(details);
|
||||||
|
|
||||||
|
@ -968,6 +980,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
|
||||||
i.value += crafts;
|
i.value += crafts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IAEItemStack
|
public IAEItemStack
|
||||||
getItemStack(final IAEItemStack what, final CraftingItemList storage2) {
|
getItemStack(final IAEItemStack what, final CraftingItemList storage2) {
|
||||||
IAEItemStack is;
|
IAEItemStack is;
|
||||||
|
@ -1153,6 +1166,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
|
||||||
return this.getCore().getWorldObj();
|
return this.getCore().getWorldObj();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isMaking(final IAEItemStack what) {
|
public boolean isMaking(final IAEItemStack what) {
|
||||||
final IAEItemStack wat = this.waitingFor.findPrecise(what);
|
final IAEItemStack wat = this.waitingFor.findPrecise(what);
|
||||||
return wat != null && wat.getStackSize() > 0;
|
return wat != null && wat.getStackSize() > 0;
|
||||||
|
@ -1191,14 +1205,17 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
|
||||||
this.remainingItemCount = this.getRemainingItemCount() - is.getStackSize();
|
this.remainingItemCount = this.getRemainingItemCount() - is.getStackSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long getElapsedTime() {
|
public long getElapsedTime() {
|
||||||
return this.elapsedTime;
|
return this.elapsedTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long getRemainingItemCount() {
|
public long getRemainingItemCount() {
|
||||||
return this.remainingItemCount;
|
return this.remainingItemCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long getStartItemCount() {
|
public long getStartItemCount() {
|
||||||
return this.startItemCount;
|
return this.startItemCount;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package appeng.me.legacy;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
public class CraftingJobPacket
|
||||||
|
{
|
||||||
|
public ItemStack Target;
|
||||||
|
public List<ItemStack> Dependencies;
|
||||||
|
public List<ItemStack> Missing;
|
||||||
|
|
||||||
|
public CraftingJobPacket() {
|
||||||
|
this.Dependencies = new ArrayList<ItemStack>();
|
||||||
|
this.Missing = new ArrayList<ItemStack>();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue