Skip to content

Commit 5a8cbde

Browse files
committed
fixed place-behaviour
1 parent 52ef914 commit 5a8cbde

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

inventory/inventory.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ end
168168
---@param item Item
169169
---@param slot number | nil
170170
function inventory:addItemToInventory(item, slot)
171+
if not item.maxcount then item.maxcount = 64 end
172+
171173
local succ, errorReason = self:pickUpItem(item, slot)
172174
assert(succ, errorReason)
173175
return succ, errorReason

turtleMock.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,9 @@ local function place(turtle, position)
436436
if block ~= nil then
437437
return false, "Cannot place block here"
438438
end
439-
turtle.emulator:createBlock({item = item, position = position})
439+
local tmpItem = deepCopy(item)
440+
tmpItem.count = 1
441+
turtle.emulator:createBlock({item = tmpItem, position = position})
440442
return turtle.inventory:removeItem(turtle.inventory.selectedSlot, 1)
441443
end
442444

0 commit comments

Comments
 (0)