mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-27 03:27:56 +01:00
NBTUtils comments and contributors link in README.md
This commit is contained in:
parent
11fc1e39bc
commit
4412bea7b8
1
.github/README.md
vendored
1
.github/README.md
vendored
@ -84,6 +84,7 @@ It is a field where Minecraft evolved a lot, inventories are now used a lot as c
|
||||
Commands are the simplest way of communication between clients and server. Since 1.13 Minecraft has incorporated a new library denominated "Brigadier", we then integrated an API meant to use the full potential of args types.
|
||||
|
||||
# Credits
|
||||
* The [contributors](https://github.com/Minestom/Minestom/graphs/contributors) of the project
|
||||
* [The Minecraft Coalition](https://wiki.vg/) and [`#mcdevs`](https://github.com/mcdevs) -
|
||||
protocol and file formats research.
|
||||
* [The Minecraft Wiki](https://minecraft.gamepedia.com/Minecraft_Wiki) for all their useful info
|
||||
|
@ -360,6 +360,14 @@ public final class NBTUtils {
|
||||
// End NbtData
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an object into its {@link NBT} equivalent.
|
||||
*
|
||||
* @param value
|
||||
* @param type
|
||||
* @param supportDataType
|
||||
* @return
|
||||
*/
|
||||
@Nullable
|
||||
public static NBT toNBT(@NotNull Object value, @NotNull Class type, boolean supportDataType) {
|
||||
type = PrimitiveConversion.getObjectClass(type);
|
||||
@ -407,6 +415,15 @@ public final class NBTUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a nbt object to its raw value.
|
||||
* <p>
|
||||
* Currently support number, string, byte/int/long array.
|
||||
*
|
||||
* @param nbt the nbt tag to convert
|
||||
* @return the value representation of a tag
|
||||
* @throws UnsupportedOperationException if the tag type is not supported
|
||||
*/
|
||||
public static Object fromNBT(@NotNull NBT nbt) {
|
||||
if (nbt instanceof NBTNumber) {
|
||||
return ((NBTNumber) nbt).getValue();
|
||||
|
Loading…
Reference in New Issue
Block a user