### list() return value example Source: https://wiki.createmod.net/users/cc-tweaked-integration/logistics/package-object Example of the table returned by list(), representing all items in the package inventory. ```lua { { name = "minecraft:apple", count = 1, }, { name = "minecraft:stick", count = 1, }, { nbt = "ce5c752cf2df5cf4ffb17d7b7bfacad7", count = 1, name = "minecraft:enchanted_book", }, } ``` -------------------------------- ### list() return value example Source: https://wiki.createmod.net/users/cc-tweaked-integration/logistics/packager Example of the sparse table returned by list(), representing items in the connected inventory. ```lua { { name = "minecraft:apple", count = 1, }, { name = "minecraft:stick", count = 1, }, [ 10 ] = { nbt = "ce5c752cf2df5cf4ffb17d7b7bfacad7", count = 1, name = "minecraft:enchanted_book", }, } ``` -------------------------------- ### getWares() Source: https://wiki.createmod.net/users/cc-tweaked-integration/logistics/table-cloth Gets the list of items requested on purchase. ```APIDOC ## getWares() ### Description Gets the list of items requested on purchase. ### Returns - **table** - Table of itemDetails. ``` -------------------------------- ### Configure Table Cloth as a Shop Source: https://wiki.createmod.net/users/cc-tweaked-integration/logistics/table-cloth Example of initializing a Table Cloth peripheral and setting its wares and price tag requirements. ```lua tableCloth = peripheral.find("Create_TableCloth") if tableCloth then -- makes sure the tablecloth exists, in case it was wrapped while it wasn't a store/inventory tableCloth.setWares( { name = "minecraft:diamond"}, -- defaults to 1 { name = "redstone", count = 30 } ) tableCloth.setPriceTagItem("gold_ingot") tableCloth.setPriceTagCount(2) end ``` -------------------------------- ### Detailed stock list output Source: https://wiki.createmod.net/users/cc-tweaked-integration/logistics/stock-ticker Example of the table returned by stock(true) containing detailed item information. ```lua { { name = "minecraft:stick", itemGroups = {}, tags = { [ "forge:rods/wooden" ] = true, [ "forge:rods" ] = true, }, count = 1, maxCount = 64, displayName = "Stick", }, { enchantments = { { level = 1, name = "minecraft:unbreaking", displayName = "Unbreaking I", }, }, tags = { [ "minecraft:bookshelf_books" ] = true, }, name = "minecraft:enchanted_book", itemGroups = {}, maxCount = 1, count = 1, nbt = "ce5c752cf2df5cf4ffb17d7b7bfacad7", displayName = "Enchanted Book", }, } ``` -------------------------------- ### Set Crafting Request Example Source: https://wiki.createmod.net/users/cc-tweaked-integration/logistics/redstone-requester Demonstrates how to configure a crafting request with batch counts and specific item slots, followed by setting an address and triggering the request. ```lua redstoneRequester = peripheral.find("Create_RedstoneRequester") redstoneRequester.setCraftingRequest( 1, -- number of crafts we want "minecraft:diamond", "minecraft:diamond", "diamond", -- skipping "minecraft:" works for vanilla items "minecraft:air", -- sets an empty slot "minecraft:stick", nil, -- also sets an empty slot nil, "minecraft:stick", -- not providing args at the end also sets empty slots ) redstoneRequester.setAddress("crafter"]) redstoneRequester.request() ``` ```lua redstoneRequester.setCraftingRequest() ``` -------------------------------- ### getItemDetail(slot) return value example Source: https://wiki.createmod.net/users/cc-tweaked-integration/logistics/packager Example of the table structure returned by getItemDetail(slot) for an item in the inventory. ```lua { name = "minecraft:apple", itemGroups = {}, tags = {}, count = 1, maxCount = 64, displayName = "Apple", } ``` -------------------------------- ### Set Standard Request Example Source: https://wiki.createmod.net/users/cc-tweaked-integration/logistics/redstone-requester Demonstrates how to set a standard item request using tables containing item names and counts, followed by setting an address and triggering the request. ```lua redstoneRequester = peripheral.find("Create_RedstoneRequester") redstoneRequester.setRequest( { name = "minecraft:dirt", count = nil }, -- defaults to 1 -- "diamond", -- this would error { name = "minecraft:sand", count = "yay" }, -- defaults to 1 { name = "cobblestone", count = 21 }, -- skipping "minecraft:" works for vanilla items { name = "create:wrench" }, ) redstoneRequester.setAddress("crafter") redstoneRequester.request() ``` ```lua redstoneRequester.setRequest() ``` -------------------------------- ### getOrderData() return value example Source: https://wiki.createmod.net/users/cc-tweaked-integration/logistics/package-object Example of the orderData object structure returned by getOrderData(). ```lua { getCrafts(), -- function: 52d1c058 getIndex(), -- function: 1f03a979 getItemDetail(), -- function: 4782ee89 getLinkIndex(), -- function: 3dfc0241 getOrderID(), -- function: 625c4b8e isFinal(), -- function: 4953530c isFinalLink(), -- function: 19750a09 list(), -- function: 4446fd6c } ``` -------------------------------- ### getItemDetail return structure Source: https://wiki.createmod.net/users/cc-tweaked-integration/logistics/package-frogport Example of the table returned by getItemDetail, showing item metadata and the package object structure. ```lua { tags = { [ "create:packages" ] = true, }, maxCount = 1, name = "create:cardboard_package_12x10", itemGroups = {}, count = 1, nbt = "ceed8ad969b49055bc14042fc07b6892", displayName = "Cardboard Package", package = { -- Packages come with this field, which points to the Package Object getAddress(), --function: 38260b86 getItemDetail(), -- function: 7de9d189 getOrderData(), -- function: 6d149c07 isValid(), -- function: 3a6300d3 list(), -- function: 1c7bc70 setAddresS(), -- function: 1c7bc70 } } ``` -------------------------------- ### getCrafts() return value example Source: https://wiki.createmod.net/users/cc-tweaked-integration/logistics/order-data-object Returns a table of crafting recipes, where each entry includes the count of times to craft and the recipe layout for a 3x3 grid. ```lua { { count = 5, -- Number of times this recipe needs to be crafted recipe = { -- Corresponds to crafting grid "minecraft:iron_nugget", "minecraft:iron_nugget", "minecraft:iron_nugget", "create:cogwheel", "minecraft:iron_nugget", "minecraft:iron_nugget", "minecraft:iron_nugget", "minecraft:iron_nugget", "minecraft:iron_nugget" } }, { count = 10, recipe = { nil, "minecraft:redstone_torch", nil, nil, "minecraft:iron_ingot", nil, nil, "minecraft:glass_pane", nil } } } ``` -------------------------------- ### list return structure Source: https://wiki.createmod.net/users/cc-tweaked-integration/logistics/package-frogport Example of the sparse table returned by the list method, containing basic item information for each slot. ```lua { { nbt = "ceed8ad969b49055bc14042fc07b6892", count = 1, name = "create:cardboard_package_12x10", }, { nbt = "c04232dbe75de33196e9d261136f7a27", count = 1, name = "create:cardboard_package_10x8", }, }, ``` -------------------------------- ### Train Schedule Lua Table Structure Source: https://wiki.createmod.net/users/cc-tweaked-integration/train/train-schedule Example of a complete train schedule table, demonstrating the cyclic property, instruction definitions, and the nested AND/OR condition structure. ```lua schedule = { cyclic = true, -- Does the schedule repeat itself after the end has been reached? entries = { -- List of entries, each entry contains a single instruction and multiple conditions. { instruction = { id = "create:destination", -- The different instructions are described below. data = { -- Data that is stored about the instruction. Different for each instruction type. text = "Station 1", }, }, conditions = { -- List of lists of conditions. The outer list is the "OR" list { -- and the inner lists are "AND" lists. { id = "create:delay", -- The different conditions are described below. data = { -- Data that is stored about the condition. Different for each condition type. value = 5, time_unit = 1, }, }, { id = "create:powered", data = {}, }, }, { { id = "create:time_of_day", data = { rotation = 0, hour = 14, minute = 0, }, }, }, }, }, }, } ``` -------------------------------- ### getStationName() Source: https://wiki.createmod.net/users/cc-tweaked-integration/train/train-station Gets the station's current name. ```APIDOC ## getStationName() ### Description Gets the station's current name. ### Returns - **string** - The station's current name. ### Throws - If the station is not connected to a track. ``` -------------------------------- ### getAddress() Source: https://wiki.createmod.net/users/cc-tweaked-integration/logistics/table-cloth Gets the Table Cloth's address. ```APIDOC ## getAddress() ### Description Gets the Table Cloth's address. ### Returns - **string** - The address currently in use. ``` -------------------------------- ### isFinalLink() Source: https://wiki.createmod.net/users/cc-tweaked-integration/logistics/order-data-object Checks if the package is fully assembled and ready to craft. ```APIDOC ## isFinalLink() ### Description Indicates if this package is part of the last link in the order. ### Returns - **boolean** - true if this is part of the final linked package in a chain, false otherwise. ``` -------------------------------- ### list() Source: https://wiki.createmod.net/users/cc-tweaked-integration/logistics/order-data-object Lists basic information about all items in the complete order. This method is only valid for packages with a link index of 1. ```APIDOC ## list() ### Description Lists basic information about all items in the complete order, even if they are not in the package. The returned table is empty after re-packaging for individual crafts. This method is only valid for packages with a link index of 1; otherwise, it returns nil. ### Returns - **table** - A list of tables containing item information (name, count, and optional nbt hash), or nil if the linkIndex is not 1. ### Example Response { { name = "minecraft:apple", count = 1, }, { nbt = "ce5c752cf2df5cf4ffb17d7b7bfacad7", count = 1, name = "minecraft:enchanted_book", } } ``` -------------------------------- ### getTrainName() Source: https://wiki.createmod.net/users/cc-tweaked-integration/train/train-station Gets the currently present train's name. ```APIDOC ## getTrainName() ### Description Gets the currently present train's name. ### Returns - **string** - The currently present train's name. ### Throws - If the station is not connected to a track. - If there is currently no train present at the station. ``` -------------------------------- ### getPriceTagCount() Source: https://wiki.createmod.net/users/cc-tweaked-integration/logistics/table-cloth Gets the Table Cloth's Pricetag item count. ```APIDOC ## getPriceTagCount() ### Description Gets the Table Cloth's Pricetag item count. ### Returns - **number** - Number of items. ``` -------------------------------- ### getGeneratedSpeed() Source: https://wiki.createmod.net/users/cc-tweaked-integration/creative-motor Gets the creative motor's current generated speed. ```APIDOC ## getGeneratedSpeed() ### Description Gets the creative motor's current generated speed. ### Returns - **number** - The current generated rotation speed in RPM. ``` -------------------------------- ### Build a train schedule with trainlib Source: https://wiki.createmod.net/users/cc-tweaked-integration/train/libraries Uses the trainlib pseudo-OOP library to create a cyclic schedule that drives to two stations with specific player count conditions. ```lua local tl = require("trainlib") local schedule = tl.schedule(true) -- cyclic / looping! local conditions = tl.condition_set_or():addCondition(tl.conditions.player_count(1, false)) local conditions_destination = tl.condition_set_or():addCondition(tl.conditions.player_count(0, true)) schedule :addEntry(tl.entry(tl.instructions.destination("Station 1"), conditions)) :addEntry(tl.entry(tl.instructions.destination("Station 2"), conditions_destination)) station.setSchedule(schedule) ``` -------------------------------- ### getPassingTrainName() Source: https://wiki.createmod.net/users/cc-tweaked-integration/train/train-observer Gets the name of a train within the train observer's range. ```APIDOC ## getPassingTrainName() ### Description Gets the name of a train within the train observer's range. ### Returns - **string** - The name of the train detected, or nil if none is found. ``` -------------------------------- ### list() Source: https://wiki.createmod.net/users/cc-tweaked-integration/logistics/package-object Lists all items currently in the package. ```APIDOC ## list() ### Description List all items inside the package. Returns a table with an entry for each slot. ### Returns - **table** - A list of tables containing basic item information (name, count, nbt). ``` -------------------------------- ### getPriceTagItem() Source: https://wiki.createmod.net/users/cc-tweaked-integration/logistics/table-cloth Gets the Item used for the Table Cloth's price tag. ```APIDOC ## getPriceTagItem() ### Description Gets the Item used for the Table Cloth's price tag. ### Returns - **table** - Table of itemDetails. ``` -------------------------------- ### setWares(item, ...) Source: https://wiki.createmod.net/users/cc-tweaked-integration/logistics/table-cloth Sets the Table Cloth's wares that get requested on purchase. ```APIDOC ## setWares(item, ...) ### Description Sets the Table Cloth's wares that get requested on purchase. Each argument represents an item to be requested and is a table of the item name and count. ### Parameters - **item** (table) - Required - Table of name (string) and count (number). Up to 9 item args allowed. ``` -------------------------------- ### create:powered Source: https://wiki.createmod.net/users/cc-tweaked-integration/train/train-schedule Wait for the station to be powered with a redstone signal. ```APIDOC ## create:powered ### Description Wait for the station to be powered with a redstone signal. ``` -------------------------------- ### create:redstone_link Source: https://wiki.createmod.net/users/cc-tweaked-integration/train/train-schedule Wait for a redstone link to be powered. ```APIDOC ## create:redstone_link ### Description Wait for a redstone link to be powered. ### Data - **frequency** (table) - A list of the two items making up the redstone link frequency. - **inverted** (number) - Whether the redstone link should be powered (0) or not powered (1) to meet the condition. ``` -------------------------------- ### requestFiltered() basic usage Source: https://wiki.createmod.net/users/cc-tweaked-integration/logistics/stock-ticker A simple example of how to use requestFiltered to request 10 apples from a specific network address. ```lua .requestfiltered("address", {name = "apple", _requestCount = 10}) ``` -------------------------------- ### list() Source: https://wiki.createmod.net/users/cc-tweaked-integration/logistics/repackager Lists all items currently in the connected inventory. ```APIDOC ## list() ### Description List all items in the connected inventory. Returns a sparse table where each entry contains basic item information. ### Returns - **table** - A table containing item name, count, and NBT hash for each occupied slot. ``` -------------------------------- ### Build a train schedule with Scheduler Source: https://wiki.createmod.net/users/cc-tweaked-integration/train/libraries Uses the Scheduler library to create a cyclic schedule with time and power-based wait conditions. ```lua local Scheduler = require("scheduler") local schedule = Scheduler.new(true) -- cyclic / looping! :to("Station 1") :wait(5):powered() :OR():time(14, 0, "daily") :to("Station 2") :wait(1) station.setSchedule(schedule) ``` -------------------------------- ### Handle train_signal_state_change event Source: https://wiki.createmod.net/users/cc-tweaked-integration/train/train-signal An example of using os.pullEvent to listen for signal state changes and print the new status to the terminal. ```lua while true do local event, side, status = os.pullEvent("train_signal_state_change") print("Signal on side", side, "changed to", status) end ``` -------------------------------- ### Define and compile a schedule with Create Scheduler Source: https://wiki.createmod.net/users/cc-tweaked-integration/train/libraries Defines a schedule using the Create Scheduler DSL and compiles it into a Lua object for the station. ```scheduler cyclic to "Station 1" { wait 5m, powered time = 14:00 daily } to "Station 2" { wait 1m } ``` ```lua local mksched = require "create-scheduler" local schedule = mksched("cyclic to ...") station.setSchedule(schedule) ``` -------------------------------- ### Request all items Source: https://wiki.createmod.net/users/cc-tweaked-integration/logistics/stock-ticker Requests all items in the network by passing an empty filter. ```lua stockTicker.request("givenAddress", {}) ``` -------------------------------- ### request() Source: https://wiki.createmod.net/users/cc-tweaked-integration/logistics/redstone-requester Triggers a package request based on the current configuration and address. ```APIDOC ## request() ### Description Requests for a package in the network using the Redstone Requester's configuration, request data and address. ``` -------------------------------- ### list() Source: https://wiki.createmod.net/users/cc-tweaked-integration/logistics/stock-ticker Lists all items currently present in the payment inventory. ```APIDOC ## list() ### Description Lists all items in the payment inventory. Returns a sparse table where each entry represents an item in a slot. ### Returns - **table** - A table containing basic item information (name, count, nbt) for each slot. ``` -------------------------------- ### list() Source: https://wiki.createmod.net/users/cc-tweaked-integration/logistics/stock-ticker Returns a list of items currently available in the network. ```APIDOC ## list() ### Description Returns a table containing all items currently in the network, including their name, count, and optional NBT data. ### Returns - **table** - A list of items, where each entry contains `name`, `count`, and optionally `nbt`. ``` -------------------------------- ### update() Source: https://wiki.createmod.net/users/cc-tweaked-integration/display-link Pushes the internal buffer changes to the physical display. ```APIDOC ## update() ### Description Pushes any changes to the connected display target. Changes are only made to an internal buffer until this function is called. ```