1
1
#include " api/NbtAPI.h"
2
2
3
3
#include " api/APIHelp.h"
4
- #include " api/BlockAPI.h"
5
- #include " api/ItemAPI.h"
6
4
#include " legacyapi/Base64.h"
7
5
#include " mc/nbt/ByteArrayTag.h"
8
6
#include " mc/nbt/ByteTag.h"
@@ -345,6 +343,7 @@ NbtByteClass* NbtByteClass::constructor(const Arguments& args) {
345
343
CATCH_C (" Fail in Create ByteTag!" );
346
344
}
347
345
346
+ // Because the class must own the Tag, so we return Tag's raw pointer
348
347
ByteTag* NbtByteClass::extract (Local<Value> v) {
349
348
if (EngineScope::currentEngine ()->isInstanceOf <NbtByteClass>(v))
350
349
return EngineScope::currentEngine ()->getNativeInstance <NbtByteClass>(v)->nbt .get ();
@@ -353,7 +352,7 @@ ByteTag* NbtByteClass::extract(Local<Value> v) {
353
352
354
353
Local<Value> NbtByteClass::pack (ByteTag* tag, bool noDelete) {
355
354
try {
356
- if (noDelete) // unique_ptr 共享指针 + noDelete
355
+ if (noDelete) // unique_ptr shared pointer + noDelete
357
356
{
358
357
NbtByteClass* nbtObj = new NbtByteClass (std::unique_ptr<ByteTag>(tag));
359
358
nbtObj->canDelete = false ;
@@ -423,7 +422,7 @@ IntTag* NbtIntClass::extract(Local<Value> v) {
423
422
424
423
Local<Value> NbtIntClass::pack (IntTag* tag, bool noDelete) {
425
424
try {
426
- if (noDelete) // unique_ptr 共享指针 + noDelete
425
+ if (noDelete) // unique_ptr shared pointer + noDelete
427
426
{
428
427
NbtIntClass* nbtObj = new NbtIntClass (std::unique_ptr<IntTag>(tag));
429
428
nbtObj->canDelete = false ;
@@ -494,7 +493,7 @@ ShortTag* NbtShortClass::extract(Local<Value> v) {
494
493
495
494
Local<Value> NbtShortClass::pack (ShortTag* tag, bool noDelete) {
496
495
try {
497
- if (noDelete) // unique_ptr 共享指针 + noDelete
496
+ if (noDelete) // unique_ptr shared pointer + noDelete
498
497
{
499
498
NbtShortClass* nbtObj = new NbtShortClass (std::unique_ptr<ShortTag>(tag));
500
499
nbtObj->canDelete = false ;
@@ -564,7 +563,7 @@ Int64Tag* NbtLongClass::extract(Local<Value> v) {
564
563
565
564
Local<Value> NbtLongClass::pack (Int64Tag* tag, bool noDelete) {
566
565
try {
567
- if (noDelete) // unique_ptr 共享指针 + noDelete
566
+ if (noDelete) // unique_ptr shared pointer + noDelete
568
567
{
569
568
NbtLongClass* nbtObj = new NbtLongClass (std::unique_ptr<Int64Tag>(tag));
570
569
nbtObj->canDelete = false ;
@@ -635,7 +634,7 @@ FloatTag* NbtFloatClass::extract(Local<Value> v) {
635
634
636
635
Local<Value> NbtFloatClass::pack (FloatTag* tag, bool noDelete) {
637
636
try {
638
- if (noDelete) // unique_ptr 共享指针 + noDelete
637
+ if (noDelete) // unique_ptr shared pointer + noDelete
639
638
{
640
639
NbtFloatClass* nbtObj = new NbtFloatClass (std::unique_ptr<FloatTag>(tag));
641
640
nbtObj->canDelete = false ;
@@ -706,7 +705,7 @@ DoubleTag* NbtDoubleClass::extract(Local<Value> v) {
706
705
707
706
Local<Value> NbtDoubleClass::pack (DoubleTag* tag, bool noDelete) {
708
707
try {
709
- if (noDelete) // unique_ptr 共享指针 + noDelete
708
+ if (noDelete) // unique_ptr shared pointer + noDelete
710
709
{
711
710
NbtDoubleClass* nbtObj = new NbtDoubleClass (std::unique_ptr<DoubleTag>(tag));
712
711
nbtObj->canDelete = false ;
@@ -777,7 +776,7 @@ StringTag* NbtStringClass::extract(Local<Value> v) {
777
776
778
777
Local<Value> NbtStringClass::pack (StringTag* tag, bool noDelete) {
779
778
try {
780
- if (noDelete) // unique_ptr 共享指针 + noDelete
779
+ if (noDelete) // unique_ptr shared pointer + noDelete
781
780
{
782
781
NbtStringClass* nbtObj = new NbtStringClass (std::unique_ptr<StringTag>(tag));
783
782
nbtObj->canDelete = false ;
@@ -855,7 +854,7 @@ ByteArrayTag* NbtByteArrayClass::extract(Local<Value> v) {
855
854
856
855
Local<Value> NbtByteArrayClass::pack (ByteArrayTag* tag, bool noDelete) {
857
856
try {
858
- if (noDelete) // unique_ptr 共享指针 + noDelete
857
+ if (noDelete) // unique_ptr shared pointer + noDelete
859
858
{
860
859
NbtByteArrayClass* nbtObj = new NbtByteArrayClass (std::unique_ptr<ByteArrayTag>(tag));
861
860
nbtObj->canDelete = false ;
@@ -920,28 +919,29 @@ NbtListClass::NbtListClass(std::unique_ptr<ListTag> p) : ScriptClass(ScriptClass
920
919
921
920
// //////////////// Helper //////////////////
922
921
void NbtListClassAddHelper (ListTag* tag, Local<Array>& arr) {
923
- if (arr.size () > 0 ) {
922
+ if (arr.size ()
923
+ > 0 ) { // ListTag::add deletes the Tag which is provided as argument, so make a copy of Tag before using it.
924
924
Local<Value> t = arr.get (0 );
925
925
if (IsInstanceOf<NbtByteClass>(t))
926
- for (int i = 0 ; i < arr.size (); ++i) tag->add (*NbtByteClass::extract (arr.get (i)));
926
+ for (int i = 0 ; i < arr.size (); ++i) tag->add (*NbtByteClass::extract (arr.get (i))-> copy () );
927
927
else if (IsInstanceOf<NbtShortClass>(t))
928
- for (int i = 0 ; i < arr.size (); ++i) tag->add (*NbtShortClass::extract (arr.get (i)));
928
+ for (int i = 0 ; i < arr.size (); ++i) tag->add (*NbtShortClass::extract (arr.get (i))-> copy () );
929
929
else if (IsInstanceOf<NbtIntClass>(t))
930
- for (int i = 0 ; i < arr.size (); ++i) tag->add (*NbtIntClass::extract (arr.get (i)));
930
+ for (int i = 0 ; i < arr.size (); ++i) tag->add (*NbtIntClass::extract (arr.get (i))-> copy () );
931
931
else if (IsInstanceOf<NbtLongClass>(t))
932
- for (int i = 0 ; i < arr.size (); ++i) tag->add (*NbtLongClass::extract (arr.get (i)));
932
+ for (int i = 0 ; i < arr.size (); ++i) tag->add (*NbtLongClass::extract (arr.get (i))-> copy () );
933
933
else if (IsInstanceOf<NbtFloatClass>(t))
934
- for (int i = 0 ; i < arr.size (); ++i) tag->add (*NbtFloatClass::extract (arr.get (i)));
934
+ for (int i = 0 ; i < arr.size (); ++i) tag->add (*NbtFloatClass::extract (arr.get (i))-> copy () );
935
935
else if (IsInstanceOf<NbtDoubleClass>(t))
936
- for (int i = 0 ; i < arr.size (); ++i) tag->add (*NbtDoubleClass::extract (arr.get (i)));
936
+ for (int i = 0 ; i < arr.size (); ++i) tag->add (*NbtDoubleClass::extract (arr.get (i))-> copy () );
937
937
else if (IsInstanceOf<NbtStringClass>(t))
938
- for (int i = 0 ; i < arr.size (); ++i) tag->add (*NbtStringClass::extract (arr.get (i)));
938
+ for (int i = 0 ; i < arr.size (); ++i) tag->add (*NbtStringClass::extract (arr.get (i))-> copy () );
939
939
else if (IsInstanceOf<NbtByteArrayClass>(t))
940
- for (int i = 0 ; i < arr.size (); ++i) tag->add (*NbtByteArrayClass::extract (arr.get (i)));
940
+ for (int i = 0 ; i < arr.size (); ++i) tag->add (*NbtByteArrayClass::extract (arr.get (i))-> copy () );
941
941
else if (IsInstanceOf<NbtListClass>(t))
942
- for (int i = 0 ; i < arr.size (); ++i) tag->add (*NbtListClass::extract (arr.get (i)));
942
+ for (int i = 0 ; i < arr.size (); ++i) tag->add (*NbtListClass::extract (arr.get (i))-> copyList () );
943
943
else if (IsInstanceOf<NbtCompoundClass>(t))
944
- for (int i = 0 ; i < arr.size (); ++i) tag->add (*NbtCompoundClass::extract (arr.get (i)));
944
+ for (int i = 0 ; i < arr.size (); ++i) tag->add (*NbtCompoundClass::extract (arr.get (i))-> clone () );
945
945
else if (t.isArray ()) {
946
946
for (int i = 0 ; i < arr.size (); ++i) {
947
947
auto arrTag = ListTag ();
@@ -984,7 +984,7 @@ ListTag* NbtListClass::extract(Local<Value> v) {
984
984
985
985
Local<Value> NbtListClass::pack (ListTag* tag, bool noDelete) {
986
986
try {
987
- if (noDelete) // unique_ptr 共享指针 + noDelete
987
+ if (noDelete) // unique_ptr shared pointer + noDelete
988
988
{
989
989
NbtListClass* nbtObj = new NbtListClass (std::unique_ptr<ListTag>(tag));
990
990
nbtObj->canDelete = false ;
@@ -1232,26 +1232,27 @@ Local<Value> NbtListClass::setTag(const Arguments& args) {
1232
1232
return Local<Value>();
1233
1233
}
1234
1234
1235
- if (IsInstanceOf<NbtByteClass>(args[1 ])) {
1236
- list[index] = std::unique_ptr<ByteTag>(NbtByteClass::extract (args[1 ]));
1235
+ if (IsInstanceOf<NbtByteClass>(args[1 ]
1236
+ )) { // Tag is stored as unique_ptr in TagClass, but TagClass must own the Tag, so I have to copy the Tag
1237
+ list[index] = NbtByteClass::extract (args[1 ])->copy ();
1237
1238
} else if (IsInstanceOf<NbtShortClass>(args[1 ])) {
1238
- list[index] = std::unique_ptr<ShortTag>( NbtShortClass::extract (args[1 ]));
1239
+ list[index] = NbtShortClass::extract (args[1 ])-> copy ( );
1239
1240
} else if (IsInstanceOf<NbtIntClass>(args[1 ])) {
1240
- list[index] = std::unique_ptr<IntTag>( NbtIntClass::extract (args[1 ]));
1241
+ list[index] = NbtIntClass::extract (args[1 ])-> copy ( );
1241
1242
} else if (IsInstanceOf<NbtLongClass>(args[1 ])) {
1242
- list[index] = std::unique_ptr<Int64Tag>( NbtLongClass::extract (args[1 ]));
1243
+ list[index] = NbtLongClass::extract (args[1 ])-> copy ( );
1243
1244
} else if (IsInstanceOf<NbtFloatClass>(args[1 ])) {
1244
- list[index] = std::unique_ptr<FloatTag>( NbtFloatClass::extract (args[1 ]));
1245
+ list[index] = NbtFloatClass::extract (args[1 ])-> copy ( );
1245
1246
} else if (IsInstanceOf<NbtDoubleClass>(args[1 ])) {
1246
- list[index] = std::unique_ptr<DoubleTag>( NbtDoubleClass::extract (args[1 ]));
1247
+ list[index] = NbtDoubleClass::extract (args[1 ])-> copy ( );
1247
1248
} else if (IsInstanceOf<NbtStringClass>(args[1 ])) {
1248
- list[index] = std::unique_ptr<StringTag>( NbtStringClass::extract (args[1 ]));
1249
+ list[index] = NbtStringClass::extract (args[1 ])-> copy ( );
1249
1250
} else if (IsInstanceOf<NbtByteArrayClass>(args[1 ])) {
1250
- list[index] = std::unique_ptr<ByteArrayTag>( NbtByteArrayClass::extract (args[1 ]));
1251
+ list[index] = NbtByteArrayClass::extract (args[1 ])-> copy ( );
1251
1252
} else if (IsInstanceOf<NbtListClass>(args[1 ])) {
1252
- list[index] = std::unique_ptr<ListTag>( NbtListClass::extract (args[1 ]));
1253
+ list[index] = NbtListClass::extract (args[1 ])-> copyList ( );
1253
1254
} else if (IsInstanceOf<NbtCompoundClass>(args[1 ])) {
1254
- list[index] = std::unique_ptr<CompoundTag>( NbtCompoundClass::extract (args[1 ]));
1255
+ list[index] = NbtCompoundClass::extract (args[1 ])-> clone ( );
1255
1256
} else {
1256
1257
LOG_ERROR_WITH_SCRIPT_INFO (" Unknown type! Cannot set Tag into List" );
1257
1258
return Local<Value>();
@@ -1264,27 +1265,27 @@ Local<Value> NbtListClass::setTag(const Arguments& args) {
1264
1265
Local<Value> NbtListClass::addTag (const Arguments& args) {
1265
1266
CHECK_ARGS_COUNT (args, 1 );
1266
1267
1267
- try {
1268
+ try { // ListTag::add deletes the Tag which is provided as argument, so make a copy of Tag before using it.
1268
1269
if (IsInstanceOf<NbtByteClass>(args[0 ])) {
1269
- nbt->add (*NbtByteClass::extract (args[0 ]));
1270
+ nbt->add (*NbtByteClass::extract (args[0 ])-> copy () );
1270
1271
} else if (IsInstanceOf<NbtShortClass>(args[0 ])) {
1271
- nbt->add (*NbtShortClass::extract (args[0 ]));
1272
+ nbt->add (*NbtShortClass::extract (args[0 ])-> copy () );
1272
1273
} else if (IsInstanceOf<NbtIntClass>(args[0 ])) {
1273
- nbt->add (*NbtIntClass::extract (args[0 ]));
1274
+ nbt->add (*NbtIntClass::extract (args[0 ])-> copy () );
1274
1275
} else if (IsInstanceOf<NbtLongClass>(args[0 ])) {
1275
- nbt->add (*NbtLongClass::extract (args[0 ]));
1276
+ nbt->add (*NbtLongClass::extract (args[0 ])-> copy () );
1276
1277
} else if (IsInstanceOf<NbtFloatClass>(args[0 ])) {
1277
- nbt->add (*NbtFloatClass::extract (args[0 ]));
1278
+ nbt->add (*NbtFloatClass::extract (args[0 ])-> copy () );
1278
1279
} else if (IsInstanceOf<NbtDoubleClass>(args[0 ])) {
1279
- nbt->add (*NbtDoubleClass::extract (args[0 ]));
1280
+ nbt->add (*NbtDoubleClass::extract (args[0 ])-> copy () );
1280
1281
} else if (IsInstanceOf<NbtStringClass>(args[0 ])) {
1281
- nbt->add (*NbtStringClass::extract (args[0 ]));
1282
+ nbt->add (*NbtStringClass::extract (args[0 ])-> copy () );
1282
1283
} else if (IsInstanceOf<NbtByteArrayClass>(args[0 ])) {
1283
- nbt->add (*NbtByteArrayClass::extract (args[0 ]));
1284
+ nbt->add (*NbtByteArrayClass::extract (args[0 ])-> copy () );
1284
1285
} else if (IsInstanceOf<NbtListClass>(args[0 ])) {
1285
- nbt->add (*NbtListClass::extract (args[0 ]));
1286
+ nbt->add (*NbtListClass::extract (args[0 ])-> copyList () );
1286
1287
} else if (IsInstanceOf<NbtCompoundClass>(args[0 ])) {
1287
- nbt->add (*NbtCompoundClass::extract (args[0 ]));
1288
+ nbt->add (*NbtCompoundClass::extract (args[0 ])-> clone () );
1288
1289
} else {
1289
1290
LOG_ERROR_WITH_SCRIPT_INFO (" Unknown type! Cannot add Tag into List" );
1290
1291
return Local<Value>();
@@ -1433,17 +1434,27 @@ void NbtCompoundClassAddHelper(CompoundTag* tag, Local<Object>& obj) {
1433
1434
if (keys.size () > 0 ) {
1434
1435
for (int i = 0 ; i < keys.size (); ++i) {
1435
1436
Local<Value> t = obj.get (keys[i]);
1436
- if (IsInstanceOf<NbtByteClass>(t)) tag->at (keys[i]) = *NbtByteClass::extract (obj.get (keys[i]));
1437
- else if (IsInstanceOf<NbtShortClass>(t)) tag->at (keys[i]) = *NbtShortClass::extract (obj.get (keys[i]));
1438
- else if (IsInstanceOf<NbtIntClass>(t)) tag->at (keys[i]) = *NbtIntClass::extract (obj.get (keys[i]));
1439
- else if (IsInstanceOf<NbtLongClass>(t)) tag->at (keys[i]) = *NbtLongClass::extract (obj.get (keys[i]));
1440
- else if (IsInstanceOf<NbtFloatClass>(t)) tag->at (keys[i]) = *NbtFloatClass::extract (obj.get (keys[i]));
1441
- else if (IsInstanceOf<NbtDoubleClass>(t)) tag->at (keys[i]) = *NbtDoubleClass::extract (obj.get (keys[i]));
1442
- else if (IsInstanceOf<NbtStringClass>(t)) tag->at (keys[i]) = *NbtStringClass::extract (obj.get (keys[i]));
1437
+ if (IsInstanceOf<NbtByteClass>(t
1438
+ )) // Assignment refers to the rvalue, so the Tag is copied before assignment
1439
+ tag->at (keys[i]) = NbtByteClass::extract (obj.get (keys[i]))->copy ()->as <ByteTag>();
1440
+ else if (IsInstanceOf<NbtShortClass>(t))
1441
+ tag->at (keys[i]) = NbtShortClass::extract (obj.get (keys[i]))->copy ()->as <ShortTag>();
1442
+ else if (IsInstanceOf<NbtIntClass>(t))
1443
+ tag->at (keys[i]) = NbtIntClass::extract (obj.get (keys[i]))->copy ()->as <IntTag>();
1444
+ else if (IsInstanceOf<NbtLongClass>(t))
1445
+ tag->at (keys[i]) = NbtLongClass::extract (obj.get (keys[i]))->copy ()->as <Int64Tag>();
1446
+ else if (IsInstanceOf<NbtFloatClass>(t))
1447
+ tag->at (keys[i]) = NbtFloatClass::extract (obj.get (keys[i]))->copy ()->as <FloatTag>();
1448
+ else if (IsInstanceOf<NbtDoubleClass>(t))
1449
+ tag->at (keys[i]) = NbtDoubleClass::extract (obj.get (keys[i]))->copy ()->as <DoubleTag>();
1450
+ else if (IsInstanceOf<NbtStringClass>(t))
1451
+ tag->at (keys[i]) = NbtStringClass::extract (obj.get (keys[i]))->copy ()->as <StringTag>();
1443
1452
else if (IsInstanceOf<NbtByteArrayClass>(t))
1444
1453
tag->at (keys[i]) = *NbtByteArrayClass::extract (obj.get (keys[i]));
1445
- else if (IsInstanceOf<NbtListClass>(t)) tag->at (keys[i]) = *NbtListClass::extract (obj.get (keys[i]));
1446
- else if (IsInstanceOf<NbtCompoundClass>(t)) tag->at (keys[i]) = *NbtCompoundClass::extract (obj.get (keys[i]));
1454
+ else if (IsInstanceOf<NbtListClass>(t))
1455
+ tag->at (keys[i]) = *NbtListClass::extract (obj.get (keys[i]))->copyList ();
1456
+ else if (IsInstanceOf<NbtCompoundClass>(t))
1457
+ tag->at (keys[i]) = *NbtCompoundClass::extract (obj.get (keys[i]))->clone ();
1447
1458
else if (t.isArray ()) {
1448
1459
auto arrTag = ListTag ();
1449
1460
auto data = obj.get (keys[i]).asArray ();
@@ -1475,15 +1486,15 @@ NbtCompoundClass* NbtCompoundClass::constructor(const Arguments& args) {
1475
1486
CATCH_C (" Fail in Create CompoundTag!" );
1476
1487
}
1477
1488
1478
- std::unique_ptr< CompoundTag> NbtCompoundClass::extract (Local<Value> v) {
1489
+ CompoundTag* NbtCompoundClass::extract (Local<Value> v) {
1479
1490
if (EngineScope::currentEngine ()->isInstanceOf <NbtCompoundClass>(v))
1480
- return std::move (EngineScope::currentEngine ()->getNativeInstance <NbtCompoundClass>(v)->nbt );
1491
+ return std::move (EngineScope::currentEngine ()->getNativeInstance <NbtCompoundClass>(v)->nbt . get () );
1481
1492
else return nullptr ;
1482
1493
}
1483
1494
1484
1495
Local<Value> NbtCompoundClass::pack (CompoundTag* tag, bool noDelete) {
1485
1496
try {
1486
- if (noDelete) // unique_ptr 共享指针 + noDelete
1497
+ if (noDelete) // unique_ptr shared pointer + noDelete
1487
1498
{
1488
1499
NbtCompoundClass* nbtObj = new NbtCompoundClass (std::unique_ptr<CompoundTag>(tag));
1489
1500
nbtObj->canDelete = false ;
@@ -1674,26 +1685,27 @@ Local<Value> NbtCompoundClass::setTag(const Arguments& args) {
1674
1685
try {
1675
1686
auto key = args[0 ].toStr ();
1676
1687
1677
- if (IsInstanceOf<NbtByteClass>(args[1 ])) {
1678
- nbt->at (key) = *NbtByteClass::extract (args[1 ]);
1688
+ if (IsInstanceOf<NbtByteClass>(args[1 ]
1689
+ )) { // Assignment refers to the rvalue, so the Tag is copied before assignment
1690
+ nbt->at (key) = NbtByteClass::extract (args[1 ])->copy ()->as <ByteTag>();
1679
1691
} else if (IsInstanceOf<NbtShortClass>(args[1 ])) {
1680
- nbt->at (key) = * NbtShortClass::extract (args[1 ]);
1692
+ nbt->at (key) = NbtShortClass::extract (args[1 ])-> copy ()-> as <ShortTag>( );
1681
1693
} else if (IsInstanceOf<NbtIntClass>(args[1 ])) {
1682
- nbt->at (key) = * NbtIntClass::extract (args[1 ]);
1694
+ nbt->at (key) = NbtIntClass::extract (args[1 ])-> copy ()-> as <IntTag>( );
1683
1695
} else if (IsInstanceOf<NbtLongClass>(args[1 ])) {
1684
- nbt->at (key) = * NbtLongClass::extract (args[1 ]);
1696
+ nbt->at (key) = NbtLongClass::extract (args[1 ])-> copy ()-> as <Int64Tag>( );
1685
1697
} else if (IsInstanceOf<NbtFloatClass>(args[1 ])) {
1686
- nbt->at (key) = * NbtFloatClass::extract (args[1 ]);
1698
+ nbt->at (key) = NbtFloatClass::extract (args[1 ])-> copy ()-> as <FloatTag>( );
1687
1699
} else if (IsInstanceOf<NbtDoubleClass>(args[1 ])) {
1688
- nbt->at (key) = * NbtDoubleClass::extract (args[1 ]);
1700
+ nbt->at (key) = NbtDoubleClass::extract (args[1 ])-> copy ()-> as <DoubleTag>( );
1689
1701
} else if (IsInstanceOf<NbtStringClass>(args[1 ])) {
1690
- nbt->at (key) = * NbtStringClass::extract (args[1 ]);
1702
+ nbt->at (key) = NbtStringClass::extract (args[1 ])-> copy ()-> as <StringTag>( );
1691
1703
} else if (IsInstanceOf<NbtByteArrayClass>(args[1 ])) {
1692
- nbt->at (key) = * NbtByteArrayClass::extract (args[1 ]);
1704
+ nbt->at (key) = NbtByteArrayClass::extract (args[1 ])-> copy ()-> as <ByteArrayTag>( );
1693
1705
} else if (IsInstanceOf<NbtListClass>(args[1 ])) {
1694
- nbt->at (key) = *NbtListClass::extract (args[1 ]);
1706
+ nbt->at (key) = *NbtListClass::extract (args[1 ])-> copyList () ;
1695
1707
} else if (IsInstanceOf<NbtCompoundClass>(args[1 ])) {
1696
- nbt->at (key) = *NbtCompoundClass::extract (args[1 ]);
1708
+ nbt->at (key) = *NbtCompoundClass::extract (args[1 ])-> clone () ;
1697
1709
} else {
1698
1710
LOG_ERROR_WITH_SCRIPT_INFO (" Unknown type! Cannot set Tag into Compound" );
1699
1711
return Local<Value>();
0 commit comments