Skip to content

Commit

Permalink
Remove PatternHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
Sampsa committed Aug 10, 2023
1 parent e044edf commit a3eccfb
Showing 1 changed file with 30 additions and 31 deletions.
61 changes: 30 additions & 31 deletions src/main/scala/li/cil/oc/integration/appeng/ConverterPattern.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,44 +17,43 @@ public void convert(final Object value, final Map<Object, Object> output) {
ItemStack is = (ItemStack) value;
try {
final NBTTagCompound encodedValue = is.getTagCompound();
final NBTTagList inTag = encodedValue.getTagList("in", 10);
final NBTTagList outTag = encodedValue.getTagList("out", 10);
if (encodedValue != null) {
final NBTTagList inTag = encodedValue.getTagList("in", 10);
final NBTTagList outTag = encodedValue.getTagList("out", 10);

Map[] inputs = new Map[inTag.tagCount()];
for (int i = 0; i < inTag.tagCount(); i++) {
inputs[i] = new HashMap<>();
final NBTTagCompound tag = inTag.getCompoundTagAt(i);
final ItemStack inputItem = Platform.loadItemStackFromNBT(tag);
if (inputItem != null) {
inputs[i].put("name", inputItem.getItem().getItemStackDisplayName(inputItem));
if (tag.getLong("Cnt") > 0) {
inputs[i].put("count", tag.getLong("Cnt"));
} else {
inputs[i].put("count", inputItem.stackSize);
Map[] inputs = new Map[inTag.tagCount()];
for (int i = 0; i < inTag.tagCount(); i++) {
inputs[i] = new HashMap<>();
final NBTTagCompound tag = inTag.getCompoundTagAt(i);
final ItemStack inputItem = Platform.loadItemStackFromNBT(tag);
if (inputItem != null) {
inputs[i].put("name", inputItem.getItem().getItemStackDisplayName(inputItem));
if (tag.getLong("Cnt") > 0) {
inputs[i].put("count", tag.getLong("Cnt"));
} else {
inputs[i].put("count", inputItem.stackSize);
}
}
}
}

Map[] results = new Map[outTag.tagCount()];
for (int i = 0; i < outTag.tagCount(); i++) {
results[i] = new HashMap<>();
final NBTTagCompound tag = outTag.getCompoundTagAt(i);
final ItemStack outputItem = Platform.loadItemStackFromNBT(tag);
if (outputItem != null) {
results[i].put("name", outputItem.getItem().getItemStackDisplayName(outputItem));
if (tag.getLong("Cnt") > 0) {
results[i].put("count", tag.getLong("Cnt"));
} else {
results[i].put("count", outputItem.stackSize);
Map[] results = new Map[outTag.tagCount()];
for (int i = 0; i < outTag.tagCount(); i++) {
results[i] = new HashMap<>();
final NBTTagCompound tag = outTag.getCompoundTagAt(i);
final ItemStack outputItem = Platform.loadItemStackFromNBT(tag);
if (outputItem != null) {
results[i].put("name", outputItem.getItem().getItemStackDisplayName(outputItem));
if (tag.getLong("Cnt") > 0) {
results[i].put("count", tag.getLong("Cnt"));
} else {
results[i].put("count", outputItem.stackSize);
}
}
}
output.put("inputs", inputs);
output.put("outputs", results);
output.put("isCraftable", encodedValue.getBoolean("crafting"));
}
output.put("inputs", inputs);
output.put("outputs", results);

PatternHelper p = new PatternHelper(is, null);
output.put("isCraftable", p.isCraftable());

} catch (final Throwable ignored) {

}
Expand Down

0 comments on commit a3eccfb

Please sign in to comment.