Fix some bugs
This commit is contained in:
@@ -34,7 +34,7 @@ public class CraftingPattern implements ICraftingPattern {
|
||||
this.oredict = ItemPattern.isOredict(stack);
|
||||
|
||||
if (processing) {
|
||||
this.valid = true;
|
||||
this.valid = false; // TODO
|
||||
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
ItemStack input = ItemPattern.getSlot(stack, i);
|
||||
|
||||
@@ -4,15 +4,18 @@ import com.raoulvdberge.refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
import com.raoulvdberge.refinedstorage.api.network.INetwork;
|
||||
import com.raoulvdberge.refinedstorage.api.util.IStackList;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
public class CraftingStepCraft implements ICraftingStep {
|
||||
private INetwork network;
|
||||
private IStackList<ItemStack> toExtract;
|
||||
private NonNullList<ItemStack> took;
|
||||
private ICraftingPattern pattern;
|
||||
|
||||
public CraftingStepCraft(INetwork network, IStackList<ItemStack> toExtract, ICraftingPattern pattern) {
|
||||
public CraftingStepCraft(INetwork network, IStackList<ItemStack> toExtract, NonNullList<ItemStack> took, ICraftingPattern pattern) {
|
||||
this.network = network;
|
||||
this.toExtract = toExtract;
|
||||
this.took = took;
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
@@ -27,14 +30,18 @@ public class CraftingStepCraft implements ICraftingStep {
|
||||
}
|
||||
|
||||
for (ItemStack toExtractItem : toExtract.getStacks()) {
|
||||
network.extractItem(toExtractItem, toExtractItem.getCount(), false);
|
||||
ItemStack extracted = network.extractItem(toExtractItem, toExtractItem.getCount(), false);
|
||||
|
||||
if (extracted == null) {
|
||||
throw new IllegalStateException("Did not extract anything");
|
||||
}
|
||||
}
|
||||
|
||||
for (ItemStack output : pattern.getOutputs()) {
|
||||
network.insertItem(output, output.getCount(), false);
|
||||
}
|
||||
ItemStack output = pattern.getOutput(took);
|
||||
|
||||
for (ItemStack byproduct : pattern.getByproducts()) {
|
||||
network.insertItem(output, output.getCount(), false);
|
||||
|
||||
for (ItemStack byproduct : pattern.getByproducts(took)) {
|
||||
network.insertItem(byproduct, byproduct.getCount(), false);
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public class CraftingTask implements ICraftingTask {
|
||||
|
||||
ItemStack fromSelf = results.get(possibleInput);
|
||||
if (fromSelf != null) {
|
||||
results.remove(possibleInput, Math.min(possibleInput.getCount(), fromSelf.getCount()));
|
||||
results.remove(fromSelf, Math.min(possibleInput.getCount(), fromSelf.getCount()));
|
||||
|
||||
toExtract -= fromSelf.getCount();
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public class CraftingTask implements ICraftingTask {
|
||||
|
||||
int fromNetworkCount = fromNetwork == null ? 0 : Math.min(toExtract, fromNetwork.getCount());
|
||||
|
||||
itemsToExtract.add(possibleInput);
|
||||
itemsToExtract.add(possibleInput, toExtract);
|
||||
|
||||
if (fromNetworkCount > 0) {
|
||||
this.toTake.add(possibleInput, fromNetworkCount);
|
||||
@@ -123,7 +123,7 @@ public class CraftingTask implements ICraftingTask {
|
||||
}
|
||||
}
|
||||
|
||||
return new CraftingStepCraft(network, itemsToExtract, pattern);
|
||||
return new CraftingStepCraft(network, itemsToExtract, took, pattern);
|
||||
}
|
||||
|
||||
private int getQuantityPerCraft(ICraftingPattern pattern, ItemStack requested) {
|
||||
@@ -181,6 +181,8 @@ public class CraftingTask implements ICraftingTask {
|
||||
|
||||
@Override
|
||||
public List<ICraftingMonitorElement> getCraftingMonitorElements() {
|
||||
// TODO
|
||||
|
||||
ICraftingMonitorElementList elements = API.instance().createCraftingMonitorElementList();
|
||||
|
||||
elements.directAdd(new CraftingMonitorElementItemRender(network.getCraftingManager().getTasks().indexOf(this), requested, quantity, 0));
|
||||
|
||||
@@ -60,7 +60,7 @@ gui.refinedstorage:crafting_preview.error.2=itself.
|
||||
gui.refinedstorage:crafting_preview.error.3=You need to remove the pattern or make sure
|
||||
gui.refinedstorage:crafting_preview.error.4=the pattern is not used during crafting.
|
||||
gui.refinedstorage:crafting_preview.error.5=Offending pattern:
|
||||
gui.refinedstorage:crafting_preview.force_start=Press CTRL + SHIFT to start anyway
|
||||
gui.refinedstorage:crafting_preview.force_start=Press CTRL + SHIFT to ignore
|
||||
gui.refinedstorage:reader=Reader
|
||||
gui.refinedstorage:writer=Writer
|
||||
gui.refinedstorage:security_manager=Security Manager
|
||||
|
||||
Reference in New Issue
Block a user