-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
917b73d
commit 73cad7e
Showing
8 changed files
with
865 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using namespace std; | ||
#include <iostream> | ||
#include <iomanip> | ||
#include <fstream> | ||
#include <string> | ||
#include <cmath> | ||
#include "nbs_file_structure.h" | ||
#include "nbs_v2.h" | ||
#include "model.h" | ||
|
||
int main(int argc, char* argv[]){ | ||
load_model(model); | ||
|
||
for (int a = argc; a > 1; a--) { | ||
string path(argv[a - 1]); | ||
int pos = path.find_last_of("\\"); | ||
string name(path, pos + 1, path.length() - pos - 5); | ||
string file_type(path, pos + name.length() + 2, path.length()); | ||
if (file_type != "nbs") continue; | ||
|
||
ifstream infile(path, ios::in | ios::binary); | ||
nbs_file nbs(infile); | ||
infile.close(); | ||
ofstream nbs_out(name + ".mcfunction", ios::out); | ||
ofstream nbs_out_txt(name + ".txt", ios::out); | ||
|
||
for (int i = 0; i < nbs.num_of_track; i++) { | ||
if (nbs.track[i].track_length >= 0) { | ||
nbs_track_v2 t(nbs.track[i]); | ||
if (t.err_report(nbs_out)) | ||
continue; | ||
else { | ||
shulker<vector<nbs_note_v2*>> pitch(t.notes, "pitch"), rhythm(t.notes, "rhythm"); | ||
generate_function(nbs_out, pitch.content, pitch.size, t.layer_name, 1); | ||
generate_function(nbs_out, rhythm.content, rhythm.size, t.layer_name, 0); | ||
generate_txt<vector<nbs_note_v2*>>(nbs_out_txt, t.notes, t.layer_name); | ||
} | ||
} | ||
} | ||
|
||
nbs_out.close(); | ||
nbs_out_txt.close(); | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using namespace std; | ||
#include <iostream> | ||
#include <fstream> | ||
#include <iomanip> | ||
#include <string> | ||
#include <cmath> | ||
|
||
#include "nbs_file_structure.h" | ||
#include "shulker_output.h" | ||
#include "nbs_v3.h" | ||
#include "model.h" | ||
|
||
//定义全局变量 | ||
int p_shulker[27][27][2], r_shulker[27][27][2]; //潜影盒内容[箱子号][格子号][物品,数量] | ||
int error[100], num_of_err; //针对每音轨每8gt只能有一个音高进行纠错 | ||
|
||
//string model[92]; | ||
|
||
|
||
int main(int argc, char* argv[]) { | ||
load_model(model); | ||
|
||
for (int a = argc; a > 1; a--) { | ||
string path(argv[a - 1]); | ||
int pos = path.find_last_of("\\"); | ||
string name(path, pos + 1, path.length() - pos - 5); | ||
string file_type(path, pos + name.length() + 2, path.length()); | ||
if (file_type != "nbs") continue; | ||
|
||
ifstream infile(path, ios::in | ios::binary); | ||
nbs_file_v3 nbs(infile); | ||
infile.close(); | ||
ofstream nbs_out(name + ".mcfunction", ios::out); | ||
ofstream nbs_out_txt(name + ".txt", ios::out); | ||
|
||
int inti_delay = 15; | ||
for (int i = 0; i < nbs.num_of_group; i++) { | ||
nbs_track_v3 p(nbs.track, nbs.group[i]); | ||
vector<output_track*> o; | ||
p.generate_outputs(o, inti_delay); | ||
for (int j = 0; j < o.size(); j++) { | ||
shulker<vector<nbs_note_v3*>> pitch(o[j]->notes, "pitch"), delay(o[j]->notes, "delay"); | ||
generate_function(nbs_out, pitch.content, pitch.size, p.layer_name + " " + to_string(j + 1), "pitch"); | ||
generate_function(nbs_out, delay.content, delay.size, p.layer_name + " " + to_string(j + 1), "delay"); | ||
generate_txt<vector<nbs_note_v3*>>(nbs_out_txt, o[j]->notes, p.layer_name + " " + to_string(j + 1)); | ||
} | ||
} | ||
nbs_out.close(); | ||
nbs_out_txt.close(); | ||
} | ||
|
||
return 0; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
#pragma once | ||
#include <string> | ||
using namespace std; | ||
|
||
string model[93]; | ||
|
||
|
||
void load_model(string* model) { | ||
model[0] = string("minecraft:chest{\"display\":{\"Name\":\"{\\\"text\\\":\\\""); | ||
model[1] = string("\\\"}\"},\"BlockEntityTag\":{\"Items\":["); | ||
model[2] = string("{\"id\":\"minecraft:shulker_box\",\"tag\":{\"BlockEntityTag\":{\"Items\":["); | ||
model[3] = string("{\"id\":"); | ||
model[4] = string(",\"tag\":{\"display\":{\"Name\":\"{\\\"text\\\":"); | ||
model[5] = string("\\\"}\"}},\"Slot\":"); | ||
model[6] = string(",\"Count\":"); | ||
model[7] = string("\"minecraft:spruce_fence\""); | ||
model[8] = string("\"minecraft:birch_fence\""); | ||
model[9] = string("\"minecraft:white_concrete\""); | ||
model[10] = string("\"minecraft:orange_concrete\""); | ||
model[11] = string("\"minecraft:magenta_concrete\""); | ||
model[12] = string("\"minecraft:light_blue_concrete\""); | ||
model[13] = string("\"minecraft:yellow_concrete\""); | ||
model[14] = string("\"minecraft:lime_concrete\""); | ||
model[15] = string("\"minecraft:pink_concrete\""); | ||
model[16] = string("\"minecraft:gray_concrete\""); | ||
model[17] = string("\"minecraft:light_gray_concrete\""); | ||
model[18] = string("\"minecraft:cyan_concrete\""); | ||
model[19] = string("\"minecraft:purple_concrete\""); | ||
model[20] = string("\"minecraft:blue_concrete\""); | ||
model[21] = string("\"minecraft:brown_concrete\""); | ||
model[22] = string("\"minecraft:green_concrete\""); | ||
model[23] = string("\"minecraft:red_concrete\""); | ||
model[24] = string("\"minecraft:black_concrete\""); | ||
model[25] = string("\"minecraft:white_concrete_powder\""); | ||
model[26] = string("\"minecraft:orange_concrete_powder\""); | ||
model[27] = string("\"minecraft:magenta_concrete_powder\""); | ||
model[28] = string("\"minecraft:light_blue_concrete_powder\""); | ||
model[29] = string("\"minecraft:yellow_concrete_powder\""); | ||
model[30] = string("\"minecraft:lime_concrete_powder\""); | ||
model[31] = string("\"minecraft:pink_concrete_powder\""); | ||
model[32] = string("\"minecraft:gray_concrete_powder\""); | ||
model[33] = string("\"minecraft:light_gray_concrete_powder\""); | ||
model[34] = string("dummy"); | ||
model[35] = string("dummy"); | ||
model[36] = string("0_F#"); | ||
model[37] = string("1_G"); | ||
model[38] = string("2_G#"); | ||
model[39] = string("3_A"); | ||
model[40] = string("4_A#"); | ||
model[41] = string("5_B"); | ||
model[42] = string("6_C"); | ||
model[43] = string("7_C#"); | ||
model[44] = string("8_D"); | ||
model[45] = string("9_D#"); | ||
model[46] = string("10_E"); | ||
model[47] = string("11_F"); | ||
model[48] = string("12_F#"); | ||
model[49] = string("13_G"); | ||
model[50] = string("14_G#"); | ||
model[51] = string("15_A"); | ||
model[52] = string("16_A#"); | ||
model[53] = string("17_B"); | ||
model[54] = string("18_C"); | ||
model[55] = string("19_C#"); | ||
model[56] = string("20_D"); | ||
model[57] = string("21_D#"); | ||
model[58] = string("22_E"); | ||
model[59] = string("23_F"); | ||
model[60] = string("24_F#"); | ||
model[61] = string("\"minecraft:white_carpet\""); | ||
model[62] = string("\"minecraft:orange_carpet\""); | ||
model[63] = string("\"minecraft:magenta_carpet\""); | ||
model[64] = string("\"minecraft:light_blue_carpet\""); | ||
model[65] = string("\"minecraft:yellow_carpet\""); | ||
model[66] = string("\"minecraft:lime_carpet\""); | ||
model[67] = string("\"minecraft:pink_carpet\""); | ||
model[68] = string("\"minecraft:gray_carpet\""); | ||
model[69] = string("\"minecraft:light_gray_carpet\""); | ||
model[70] = string("\"minecraft:cyan_carpet\""); | ||
model[71] = string("\"minecraft:purple_carpet\""); | ||
model[72] = string("\"minecraft:blue_carpet\""); | ||
model[73] = string("\"minecraft:brown_carpet\""); | ||
model[74] = string("\"minecraft:green_carpet\""); | ||
model[75] = string("\"minecraft:red_carpet\""); | ||
model[76] = string("\"minecraft:black_carpet\""); | ||
model[77] = string("0000"); | ||
model[78] = string("0001"); | ||
model[79] = string("0010"); | ||
model[80] = string("0011"); | ||
model[81] = string("0100"); | ||
model[82] = string("0101"); | ||
model[83] = string("0110"); | ||
model[84] = string("0111"); | ||
model[85] = string("1000"); | ||
model[86] = string("1001"); | ||
model[87] = string("1010"); | ||
model[88] = string("1011"); | ||
model[89] = string("1100"); | ||
model[90] = string("1101"); | ||
model[91] = string("1110"); | ||
model[92] = string("1111"); | ||
} |
Oops, something went wrong.