mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-09-01 10:07:56 +00:00
Clean up data-gathering code
- Refer to this as "data" rather than "metadata". I'm still not sure where the meta came from - blame OpenPeripheral I guess. - Likewise, use getItemDetail within inventory methods, rather than getItemMeta. - Refactor common data-getting code into one class. This means that turtle.getItemDetail, turtle.inspect and commands.getBlockInfo all use the same code. - turtle.getItemDetail now accepts a second "detailed" parameter which will include the full metadata (#471, #452). - Tags are now only included in the detailed list. This is a breaking change, however should only affect one version (1.89.x) and I'm not convinced that the previous behaviour was safe.
This commit is contained in:
@@ -206,16 +206,17 @@ function getItemSpace(slot) end
|
||||
--- Get detailed information about the items in the given slot.
|
||||
--
|
||||
-- @tparam[opt] number slot The slot to get information about. Defaults to the @{turtle.select|selected slot}.
|
||||
-- @tparam[opt] boolean detailed Whether to include "detailed" information. When @{true} the method will contain
|
||||
-- much more information about the item at the cost of taking longer to run.
|
||||
-- @treturn nil|table Information about the given slot, or @{nil} if it is empty.
|
||||
-- @usage Print the current slot, assuming it contains 13 dirt.
|
||||
--
|
||||
-- print(textutils.serialize(turtle.getItemDetail()))
|
||||
-- -- => {
|
||||
-- -- name = "minecraft:dirt",
|
||||
-- -- damage = 0,
|
||||
-- -- count = 13,
|
||||
-- -- }
|
||||
function getItemDetail(slot) end
|
||||
function getItemDetail(slot, detailed) end
|
||||
|
||||
function getFuelLevel() end
|
||||
|
||||
|
Reference in New Issue
Block a user