private static void GetItemsWithNameTags(string hqmInput, string hqmOutput) { QuestLine questLine; using (var inputStream = File.OpenRead(hqmInput)) { questLine = new HQMQuestLineReader().ReadQuestLine(inputStream); } BlockingCollection <ItemStack> items = new BlockingCollection <ItemStack>(); MyItemStackVisitor visitor = new MyItemStackVisitor(items); Task.Run(() => questLine.Accept(visitor)); foreach (var item in items.GetConsumingEnumerable().Where(item => item.ItemId != null && item.NameTag != null)) { // breakpoint int xx = 0; } using (var outputStream = File.OpenWrite(hqmOutput)) { new HQMQuestLineWriter().WriteQuestLine(questLine, outputStream); } }
private static void RenameChris(string hqmInput, string hqmOutput) { // Just a test to make sure that we can make changes here that // Minecraft will accept. By default, we just re-save the original // serialized NBT byte array, and this library doesn't seem to // guarantee that the data will be bitwise identical if unchanged. QuestLine questLine; using (var inputStream = File.OpenRead(hqmInput)) { questLine = new HQMQuestLineReader().ReadQuestLine(inputStream); } questLine.Accept(new RenameChrisItemStackVisitor()); using (var outputStream = File.OpenWrite(hqmOutput)) { new HQMQuestLineWriter().WriteQuestLine(questLine, outputStream); } }