Don't allow to put items with meta or wear information into the 8x2000 chest

This information would get lost, which can be abused to repair tools for free.
This commit is contained in:
Thomas--S 2020-07-17 18:31:32 +02:00
parent 96f8710980
commit 8dcf8b3108

View File

@ -381,6 +381,12 @@ local function move_from_inv_to_nvm(pos, idx)
local nvm_stack = get_stack(nvm, idx) local nvm_stack = get_stack(nvm, idx)
if inv_stack:get_count() > 0 then if inv_stack:get_count() > 0 then
-- Don't handle items with meta or wear information because it would get lost.
local meta_table = inv_stack:get_meta():to_table()
if meta_table ~= nil and next(meta_table.fields) ~= nil or inv_stack:get_wear() ~= 0 then
return
end
if nvm_stack.count == 0 or nvm_stack.name == inv_stack:get_name() then if nvm_stack.count == 0 or nvm_stack.name == inv_stack:get_name() then
local count = math.min(inv_stack:get_count(), get_stacksize(pos) - nvm_stack.count) local count = math.min(inv_stack:get_count(), get_stacksize(pos) - nvm_stack.count)
nvm_stack.count = nvm_stack.count + count nvm_stack.count = nvm_stack.count + count