Utility Commands
This page is for server administrators.
Starting with version 2.0.0, NBTProxy supports a couple of NBT query commands. In order to enabled these you must first go into your config.yml
and change the paths to true
for the commands you wish to enable.
If you are just checking things out you can skip down to Examples.
To enable everything your config.yml
should look like this:
enabled-commands:
read:
item: true
block: true
entity: true
file: true
write:
item: true
block: true
entity: true
file: true
The command looks like /nbt <query_type> <query_target> [nbt_data | path]
all of which are explained below.
See:
The query type can be one of:
-
get
orread
- To take a look at the NBT tag that is on the target. Enabled for specific targets in theread
section from theconfig.yml
. -
set
orwrite
- To completely overwrite the NBT tag on the target. Enabled for specific targets in thewrite
section from theconfig.yml
. -
add
- To add to the existing NBT tag on the target. This will overwrite tags with the same name. Enabled for specific targets in thewrite
section from theconfig.yml
.
The query target can be one of:
-
item
- uses the item in the caller's main hand as the target. As such, it can only be executed by players in-game and not from console. Enabled in theitem
section from theconfig.yml
. -
block
- uses the block that the caller is looking at as the target. As such, it can only be executed by players in-game and not from console. The block must be a tile entity, such as a furnace, or the caller will get a message saying that the block doesn't have any NBT associated with it. Enabled in theblock
section from theconfig.yml
. -
entity
- uses entities within 5 blocks in all three directions as the target. As such, it can only be executed by players in-game and not from console. Enabled in theentity
section from theconfig.yml
. If this becomes an issue and a better selection method is required please open an issue or a PM on spigot. -
player
- requires an additional argument<name>
that is the name of the player to target. This can be executed from in-game or console and is enabled in theentity
section from theconfig.yml
. -
file
- requires an additional argument<path>
that is the path from the server jar to the file to target. It is too dangerous to let lose in-game so this command can only be executed by console. It is enabled in thefile
section from theconfig.yml
.
The set
, write
, and add
commands all require an additional <nbt_data>
argument which specifies the compound tag to write (or append) to the target. This format is the same as the regular NBT one may see when executing vanilla commands. Some examples on this can be found at minecraft.gamepedia.com.
The get
and read
commands can take an optional path which specifies which tag in particular the caller wants. For example if the caller looks at a furnace and executes /nbt read block
the output may look like this:
{
'BurnTime': 0s,
'CookTime': 0s,
'CookTimeTotal': 0s,
'id': "minecraft:furnace",
'Items':[0:{Slot:0b,id:"minecraft:totem",Count:1b,Damage:0s}],
'Lock': "",
'x': 12,
'y': 70,
'z': 96
}
But maybe the caller just wanted to find out what item was in the furnace so instead they could execute /nbt read block Items.0
to get an output like this:
{
Count:1b,
Damage:0s,
id:"minecraft:totem",
Slot:0b
}
The path specifies how to get from the top level tag (the target's tag) to the data that the caller wants. Each time the path must enter a compound tag (described with {
... }
) or a list tag (described with [
... ]
) the path needs a dot (.
).
The path elements are then just tag names separated by dots that lead to the desired data.
Ex 1. Reading the level.dat
:
- From console execute
/nbt read file world/level.dat
withread.file
enabled in theconfig.yml
{
'Data': {
'allowCommands': 0b,
'BorderCenterX': 0.0d,
'BorderCenterZ': 0.0d,
'BorderDamagePerBlock': 0.2d,
'BorderSafeZone': 5.0d,
'BorderSize': 6.0E7d,
'BorderSizeLerpTarget': 6.0E7d,
'BorderSizeLerpTime': 0L,
'BorderWarningBlocks': 5.0d,
'BorderWarningTime': 15.0d,
'clearWeatherTime': 0,
'DataVersion': 819,
'DayTime': 84000L,
'Difficulty': 1b,
'DifficultyLocked': 0b,
'DimensionData': {
},
'GameRules': {
'commandBlockOutput': "true",
'disableElytraMovementCheck': "false",
'doDaylightCycle': "true",
'doEntityDrops': "true",
'doFireTick': "true",
'doMobLoot': "true",
'doMobSpawning': "true",
'doTileDrops': "true",
'doWeatherCycle': "true",
'keepInventory': "false",
'logAdminCommands': "true",
'maxEntityCramming': "24",
'mobGriefing': "true",
'naturalRegeneration': "true",
'randomTickSpeed': "3",
'reducedDebugInfo': "false",
'sendCommandFeedback': "true",
'showDeathMessages': "true",
'spawnRadius': "10",
'spectatorsGenerateChunks': "true"
},
'GameType': 0,
'generatorName': "default",
'generatorOptions': "",
'generatorVersion': 1,
'hardcore': 0b,
'initialized': 1b,
'LastPlayed': 1479357928691L,
'LevelName': "world",
'MapFeatures': 1b,
'raining': 0b,
'rainTime': 140417,
'RandomSeed': 6444133902814818117L,
'SizeOnDisk': 0L,
'SpawnX': 16,
'SpawnY': 64,
'SpawnZ': 100,
'thundering': 0b,
'thunderTime': 88549,
'Time': 84000L,
'Version': {
'Id': 819,
'Name': "1.11",
'Snapshot': 0b
},
'version': 19133
}
}
Ex 2. Getting just the seed from the level.dat
:
- From console execute
/nbt read file world/level.dat Data.RandomSeed
withread.file
enabled in theconfig.yml
6444133902814818117L
Ex 3. Setting the color of the leather helmet you are holding:
- Hold a leather helmet and execute
/nbt add item {display:{color:16711935}}
withwrite.item
enabled in theconfig.yml
- This should change the color to magenta (FF00FF in hex converted to decimal)