mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-24 04:50:30 -04:00
Remove PatternHelper
This commit is contained in:
parent
e044edf483
commit
a3eccfb23c
@ -17,44 +17,43 @@ public final class ConverterPattern implements Converter {
|
||||
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) {
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user