Jump to content




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


  • This topic is locked This topic is locked
4 replies to this topic

#1 apemanzilla

  • Members
  • 1,421 posts

Posted 09 April 2015 - 11:30 PM

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:
[/font]
{
  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:
Posted Image

Posted Image

Edited by apemanzilla, 09 April 2015 - 11:31 PM.


#2 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 10 April 2015 - 07: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:

View Postvalithor, on 10 April 2015 - 02:13 AM, said:

View Postapemanzilla, on 09 April 2015 - 11:49 PM, said:

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 by Bomb Bloke, 10 April 2015 - 08:05 AM.


#3 The Lone Wolfling

  • Members
  • 43 posts

Posted 10 April 2015 - 02: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.

#4 dan200

  • Administrators
  • 542 posts
  • LocationCambridge, England

Posted 10 April 2015 - 04: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.

#5 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 10 April 2015 - 04:50 PM

This somehow got unapproved instead of closed, fixing.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users