This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
apemanzilla's profile picture

[1.73] turtle.inspect and turtle.getItemDetail have different keys for damage

Started by apemanzilla, 09 April 2015 - 10:30 PM
apemanzilla #1
Posted 10 April 2015 - 12:30 AM
turtle.getItemDetail returns a table as such:

{
  name = "minecraft:sandstone",
  damage = 0,
  count = 1
}

however, when using turtle.inspect (or any directional version of it) it returns a table formatted as such:

{
name = "minecraft:sandstone",
metadata = 0
}


Note that the with turtle.getItemDetail, the key for the damage value is "damage". However, with turtle.inspect, it is "metadata". There do not appear to be any differences between the two values.

Screenshots:


Edited on 09 April 2015 - 10:31 PM
Bomb Bloke #2
Posted 10 April 2015 - 08:52 AM
Just for the sake of pointing it out, commands.getBlockInfo() also goes with "metadata".

Edit:

Actually, as you may've spotted, valithor makes a good point:

For normal computers, the damage value is the computer ID. For Advanced computers, the damage value is the computer ID + 16384.

That is for the item themselves (btw its computer ID + 16385 counting for the id 0). When placed it is something different.

Blocks in the world don't have damage values, and items in an inventory don't have metadata. The two values can be used for the same purposes at times, but they're not the same thing.
Edited on 10 April 2015 - 07:05 AM
The Lone Wolfling #3
Posted 10 April 2015 - 03:44 PM
Yeah, there is no guarantee that metadata will match with damage values. For a lot of blocks it will match, but not always.

Among other things, damage values can go a lot higher than metadata values.
dan200 #4
Posted 10 April 2015 - 05:36 PM
Minecraft Blocks have a 4-bit metadata, Minecraft ItemStacks have a 16-bit damage value. For blocks created by placing items, these often correspond, but they are seperate things.

Not a bug. closing.
Lyqyd #5
Posted 10 April 2015 - 05:50 PM
This somehow got unapproved instead of closed, fixing.