Compare commits
2 Commits
v7.0.0-beta.2
...
v7.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 98733844a6 | |||
| ef97381e5f |
@@ -53,6 +53,8 @@ public interface ICraftingHelper {
|
|||||||
* @param stack If null, a new item will be created to hold the encoded pattern.
|
* @param stack If null, a new item will be created to hold the encoded pattern.
|
||||||
* Otherwise the given item must already contains an encoded
|
* Otherwise the given item must already contains an encoded
|
||||||
* pattern that will be overwritten.
|
* pattern that will be overwritten.
|
||||||
|
* @throws IllegalArgumentException If either in or out contain only empty
|
||||||
|
* ItemStacks.
|
||||||
* @return A new encoded pattern, or the given stack with the pattern encoded in
|
* @return A new encoded pattern, or the given stack with the pattern encoded in
|
||||||
* it.
|
* it.
|
||||||
*/
|
*/
|
||||||
@@ -73,6 +75,8 @@ public interface ICraftingHelper {
|
|||||||
* operation by the ME system.
|
* operation by the ME system.
|
||||||
* @param allowSubstitutes Controls whether the ME system will allow the use of
|
* @param allowSubstitutes Controls whether the ME system will allow the use of
|
||||||
* equivalent items to craft this recipe.
|
* equivalent items to craft this recipe.
|
||||||
|
* @throws IllegalArgumentException If either in or out contain only empty
|
||||||
|
* ItemStacks.
|
||||||
*/
|
*/
|
||||||
ItemStack encodeCraftingPattern(@Nullable ItemStack stack, ICraftingRecipe recipe, ItemStack[] in, ItemStack out,
|
ItemStack encodeCraftingPattern(@Nullable ItemStack stack, ICraftingRecipe recipe, ItemStack[] in, ItemStack out,
|
||||||
boolean allowSubstitutes);
|
boolean allowSubstitutes);
|
||||||
|
|||||||
@@ -261,13 +261,19 @@ public class PatternTermContainer extends MEMonitorableContainer
|
|||||||
return new ItemStack[] { out };
|
return new ItemStack[] { out };
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
boolean hasValue = false;
|
||||||
final ItemStack[] list = new ItemStack[3];
|
final ItemStack[] list = new ItemStack[3];
|
||||||
|
|
||||||
for (int i = 0; i < this.outputSlots.length; i++) {
|
for (int i = 0; i < this.outputSlots.length; i++) {
|
||||||
final ItemStack out = this.outputSlots[i].getStack();
|
final ItemStack out = this.outputSlots[i].getStack();
|
||||||
list[i] = out;
|
list[i] = out;
|
||||||
|
if (!out.isEmpty()) {
|
||||||
|
hasValue = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hasValue) {
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -115,7 +115,12 @@ public class ApiCrafting implements ICraftingHelper {
|
|||||||
// We use the shared itemstack for an identity lookup.
|
// We use the shared itemstack for an identity lookup.
|
||||||
IAEItemStack ais = Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createStack(is);
|
IAEItemStack ais = Api.instance().storage().getStorageChannel(IItemStorageChannel.class).createStack(is);
|
||||||
|
|
||||||
return new CraftingPatternDetails(ais, world);
|
try {
|
||||||
|
return new CraftingPatternDetails(ais, world);
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
AELog.warn("Could not decode an invalid pattern %s: %s", is, e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean attemptRecovery(EncodedPatternItem patternItem, ItemStack itemStack, World world) {
|
private boolean attemptRecovery(EncodedPatternItem patternItem, ItemStack itemStack, World world) {
|
||||||
|
|||||||
@@ -309,14 +309,27 @@ public class EncodedPatternItem extends AEBaseItem {
|
|||||||
final ListNBT tagIn = new ListNBT();
|
final ListNBT tagIn = new ListNBT();
|
||||||
final ListNBT tagOut = new ListNBT();
|
final ListNBT tagOut = new ListNBT();
|
||||||
|
|
||||||
|
boolean hasInput = false;
|
||||||
for (final ItemStack i : in) {
|
for (final ItemStack i : in) {
|
||||||
tagIn.add(createItemTag(i));
|
tagIn.add(createItemTag(i));
|
||||||
|
if (!i.isEmpty()) {
|
||||||
|
hasInput = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Preconditions.checkArgument(hasInput, "cannot encode a pattern that has no inputs.");
|
||||||
|
|
||||||
|
boolean hasNonEmptyOutput = false;
|
||||||
for (final ItemStack i : out) {
|
for (final ItemStack i : out) {
|
||||||
tagOut.add(createItemTag(i));
|
tagOut.add(createItemTag(i));
|
||||||
|
if (!i.isEmpty()) {
|
||||||
|
hasNonEmptyOutput = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Patterns without any outputs are corrupt! Never encode such a pattern.
|
||||||
|
Preconditions.checkArgument(hasNonEmptyOutput, "cannot encode a pattern that has no output.");
|
||||||
|
|
||||||
encodedValue.put(EncodedPatternItem.NBT_INGREDIENTS, tagIn);
|
encodedValue.put(EncodedPatternItem.NBT_INGREDIENTS, tagIn);
|
||||||
encodedValue.put(EncodedPatternItem.NBT_PRODUCTS, tagOut);
|
encodedValue.put(EncodedPatternItem.NBT_PRODUCTS, tagOut);
|
||||||
return encodedValue;
|
return encodedValue;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"type": "appliedenergistics2:grinder",
|
"type": "appliedenergistics2:grinder",
|
||||||
"input": {
|
"input": {
|
||||||
"tag": "appliedenergistics2:crystals/fluix"
|
"item": "appliedenergistics2:fluix_crystal"
|
||||||
},
|
},
|
||||||
"result": {
|
"result": {
|
||||||
"primary": {
|
"primary": {
|
||||||
|
|||||||
Reference in New Issue
Block a user