fix long array and string due to mistype in constructor
parent
6c7fab292c
commit
11408ea4cc
|
@ -191,7 +191,7 @@ namespace blt::nbt {
|
||||||
class tag_string : public tag<std::string> {
|
class tag_string : public tag<std::string> {
|
||||||
public:
|
public:
|
||||||
tag_string(): tag(nbt_tag::STRING) {}
|
tag_string(): tag(nbt_tag::STRING) {}
|
||||||
tag_string(const std::string& name, const std::string& s): tag(nbt_tag::BYTE_ARRAY, name, s) {}
|
tag_string(const std::string& name, const std::string& s): tag(nbt_tag::STRING, name, s) {}
|
||||||
void writePayload(blt::fs::block_writer& out) final {
|
void writePayload(blt::fs::block_writer& out) final {
|
||||||
writeUTF8String(out, t);
|
writeUTF8String(out, t);
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ namespace blt::nbt {
|
||||||
class tag_int_array : public tag<std::vector<int32_t>> {
|
class tag_int_array : public tag<std::vector<int32_t>> {
|
||||||
public:
|
public:
|
||||||
tag_int_array(): tag(nbt_tag::INT_ARRAY) {}
|
tag_int_array(): tag(nbt_tag::INT_ARRAY) {}
|
||||||
tag_int_array(const std::string& name, const std::vector<int32_t>& v): tag(nbt_tag::INT, name, v) {}
|
tag_int_array(const std::string& name, const std::vector<int32_t>& v): tag(nbt_tag::INT_ARRAY, name, v) {}
|
||||||
void writePayload(blt::fs::block_writer& out) final {
|
void writePayload(blt::fs::block_writer& out) final {
|
||||||
auto length = (int32_t) t.size();
|
auto length = (int32_t) t.size();
|
||||||
writeData(out, length);
|
writeData(out, length);
|
||||||
|
|
|
@ -229,7 +229,31 @@ int main(int argc, char** argv) {
|
||||||
new blt::nbt::tag_byte("super_byte", 8),
|
new blt::nbt::tag_byte("super_byte", 8),
|
||||||
new blt::nbt::tag_short("shortTest", 32767),
|
new blt::nbt::tag_short("shortTest", 32767),
|
||||||
new blt::nbt::tag_compound("SEXY_COMPOUND", {
|
new blt::nbt::tag_compound("SEXY_COMPOUND", {
|
||||||
|
new blt::nbt::tag_list("my list", {
|
||||||
|
new blt::nbt::tag_long("", 1230),
|
||||||
|
new blt::nbt::tag_long("", 2),
|
||||||
|
new blt::nbt::tag_long("", 50340535),
|
||||||
|
new blt::nbt::tag_long("", 55),
|
||||||
|
new blt::nbt::tag_long("", 256),
|
||||||
|
new blt::nbt::tag_long("", 512),
|
||||||
|
new blt::nbt::tag_long("", 9999999999),
|
||||||
|
}),
|
||||||
|
new blt::nbt::tag_double("OMG IT'S A DOUBLE", 1320.04324),
|
||||||
|
new blt::nbt::tag_float("OMG IT'S A FLOAT", 12.04324),
|
||||||
|
new blt::nbt::tag_compound("Triple", {
|
||||||
|
new blt::nbt::tag_int("Test int", 32),
|
||||||
|
new blt::nbt::tag_byte_array("super array", {
|
||||||
|
51, 23, 12, 04, 33, 53, 11, 22, 3, 93, 120
|
||||||
|
}),
|
||||||
|
new blt::nbt::tag_string("I am a string", "I have stringy contents"),
|
||||||
|
new blt::nbt::tag_string("name", "Bananrama"),
|
||||||
|
new blt::nbt::tag_int_array("int array", {
|
||||||
|
1230, 234023, 21300, 2309230, 2340230, 2, 1, 32, 3265, 12, 53, 123, 7, 56, 12
|
||||||
|
}),
|
||||||
|
new blt::nbt::tag_long_array("valid", {
|
||||||
|
1230, 5320, 323200234402304, 230023, 23042034, 230230, 2301203, 123010230, 12300123
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue