diff --git a/src/nbt/NBT.cpp b/src/nbt/NBT.cpp index 554d061..218faef 100644 --- a/src/nbt/NBT.cpp +++ b/src/nbt/NBT.cpp @@ -1,7 +1,6 @@ #include "NBT.h" #include "cNBT/nbt.h" -#include "cNBT/list.h" #include #include diff --git a/src/nbt/NBT.h b/src/nbt/NBT.h index d49bff7..298593d 100644 --- a/src/nbt/NBT.h +++ b/src/nbt/NBT.h @@ -188,9 +188,15 @@ namespace NBT } template - const T CompoundTag::Get(const char *name) const + const T CompoundTag::Get(const char* name) const { - nbt_node *result = Internal::FindByName(m_node, name); - return T(result); + nbt_node* result = Internal::FindByName(m_node, name); + if constexpr (std::is_base_of::value) { + return T(result); + } + else { + // DataTag can be auto converted to T + return DataTag(result); + } } } \ No newline at end of file