-
Notifications
You must be signed in to change notification settings - Fork 0
How to modify the inventory
Adding an item to the inventory (e.g. of a turtle) is very easy At first You define the item.
Each item needs a "name"
local turtleEmulator = require("turtleEmulator")
_G.turtle = turtleEmulator:createTurtle()
local itemToAdd = {name = "minecraft:coal", count = 64, fuelgain = 16}
local addToSlotNo = 2
turtle.addItemToInventory(itemToAdd, addToSlotNo) -- adds the item(s) to the slot
turtle.removeItem(addToSlotNo, 64) -- removes 64 item(s) from the slot
Additional modifiers:
-
count Type: number
how many items are within the items-entity
-
maxcount Type: number
Defines how many items each slot can hold. E.g. Ender Perals can only hold 16
-
fuelgain Type: number
Allows the turtle to refuel by consuming the item, by the specified amount
-
placeAble Type: boolean
Defines weither or not the item can be placed as a block within the world (default: false).
Will be overshadowed if the following function is defined:
-
placeAction Type: function
Is the optional action, which will be called when the item attempts to be placed as a block.
Parameters: Turtle (selfReference), Item (currentItem), Vector (position)
Return (Expected): Success Type: boolean
-
equipable Type: boolean
Defines if weither or not the item is equipable (default: false).
-
tags Type: table
Any tags you might require. E.g. in the geoScanner