-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgen.cpp
41 lines (34 loc) · 1.12 KB
/
gen.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ifstream input("input.txt");
string line;
int i = 0;
int fileNum = 0;
cout << "Initialized";
// Loop through text file and write to new files
while (getline(input, line) && i < 30)
{
// Open File
ofstream outFile("frames/frame" + to_string(fileNum) + ".mcfunction", std::fstream::app);
// Write Lines
outFile << "data modify block " << (i + 1) << " -48 20 HeldItem.Item.tag.display.Name set value '{\"text\":\"" << line << "\"}'" << endl;
cout << "\n Line" << i;
// Increment Loop #
i++;
// Detect if Line 30 Has Been Reached
if (i == 30)
{
// Add Schedule and Scoreboard Commands to Bottom of Each File
outFile << "scoreboard players set Frame: BadApple " + to_string(fileNum) << endl;
outFile << "schedule function lev:frames/frame" + to_string(fileNum + 1) + " 3s" << endl;
// Reset Counter & File Number
i = 0;
fileNum++;
}
}
return 0;
}