ignore nbt for crafting
This commit is contained in:
@@ -26,14 +26,9 @@ local craftPage = UI.Page {
|
|||||||
x = 6, y = 4,
|
x = 6, y = 4,
|
||||||
value = 'Eject',
|
value = 'Eject',
|
||||||
},
|
},
|
||||||
eject = UI.Chooser {
|
eject = UI.Checkbox {
|
||||||
x = 15, y = 4, width = 7,
|
x = 15, y = 4, width = 7,
|
||||||
value = true,
|
value = true,
|
||||||
nochoice = 'No',
|
|
||||||
choices = {
|
|
||||||
{ name = 'Yes', value = true },
|
|
||||||
{ name = 'No', value = false },
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
resources = UI.Window {
|
resources = UI.Window {
|
||||||
|
|||||||
@@ -4,11 +4,12 @@ local Milo = require('milo')
|
|||||||
local UI = require('ui')
|
local UI = require('ui')
|
||||||
local Util = require('util')
|
local Util = require('util')
|
||||||
|
|
||||||
|
local colors = _G.colors
|
||||||
local turtle = _G.turtle
|
local turtle = _G.turtle
|
||||||
|
|
||||||
local context = Milo:getContext()
|
local context = Milo:getContext()
|
||||||
|
|
||||||
local function learnRecipe()
|
local function learnRecipe(ignoreNBT)
|
||||||
local ingredients = Milo:getTurtleInventory()
|
local ingredients = Milo:getTurtleInventory()
|
||||||
|
|
||||||
if not ingredients then
|
if not ingredients then
|
||||||
@@ -77,13 +78,15 @@ local function learnRecipe()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not recipe then
|
if not recipe then
|
||||||
_debug(results)
|
return false, 'Unknown error'
|
||||||
_debug(newRecipe)
|
|
||||||
error('Failed - view system log')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
newRecipe.count = recipe.count
|
newRecipe.count = recipe.count
|
||||||
|
|
||||||
|
if ignoreNBT then
|
||||||
|
recipe.nbtHash = nil
|
||||||
|
end
|
||||||
|
|
||||||
local key = Milo:uniqueKey(recipe)
|
local key = Milo:uniqueKey(recipe)
|
||||||
if recipe.maxCount ~= 64 then
|
if recipe.maxCount ~= 64 then
|
||||||
newRecipe.maxCount = recipe.maxCount
|
newRecipe.maxCount = recipe.maxCount
|
||||||
@@ -92,6 +95,9 @@ local function learnRecipe()
|
|||||||
if ingredient.maxDamage > 0 then
|
if ingredient.maxDamage > 0 then
|
||||||
-- ingredient.damage = '*' -- I don't think this is right
|
-- ingredient.damage = '*' -- I don't think this is right
|
||||||
end
|
end
|
||||||
|
if ignoreNBT then
|
||||||
|
ingredient.nbtHash = nil
|
||||||
|
end
|
||||||
ingredients[k] = Milo:uniqueKey(ingredient)
|
ingredients[k] = Milo:uniqueKey(ingredient)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -108,16 +114,30 @@ local pages = {
|
|||||||
turtleCraft = UI.Window {
|
turtleCraft = UI.Window {
|
||||||
index = 2,
|
index = 2,
|
||||||
validFor = 'Turtle Crafting',
|
validFor = 'Turtle Crafting',
|
||||||
notice = UI.TextArea {
|
notice = UI.Text {
|
||||||
x = 2, ex = -2, y = 2, ey = -2,
|
x = 2, y = 2,
|
||||||
value =
|
textColor = colors.yellow,
|
||||||
[[Place recipe in turtle!]],
|
value = 'Place recipe in turtle',
|
||||||
|
},
|
||||||
|
ignoreNBT = UI.Checkbox {
|
||||||
|
x = 3, y = 4,
|
||||||
|
help = 'Ignore damage of item',
|
||||||
|
value = true,
|
||||||
|
},
|
||||||
|
text = UI.Text {
|
||||||
|
x = 7, y = 4,
|
||||||
|
value = 'Ignore NBT (recommended)',
|
||||||
|
},
|
||||||
|
ignoreInfo = UI.TextArea {
|
||||||
|
x = 2, ex = -2, y = 6, ey = -2,
|
||||||
|
textColor = colors.yellow,
|
||||||
|
value = 'Some items contain unique NBT information. This information can be ignored for most items.',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
function pages.turtleCraft:validate()
|
function pages.turtleCraft:validate()
|
||||||
local recipe, msg = learnRecipe(self)
|
local recipe, msg = learnRecipe(self, self.ignoreNBT.value)
|
||||||
|
|
||||||
if recipe then
|
if recipe then
|
||||||
local displayName = itemDB:getName(recipe)
|
local displayName = itemDB:getName(recipe)
|
||||||
|
|||||||
@@ -331,7 +331,7 @@ local function equip(side, item)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function scan()
|
local function scan()
|
||||||
equip('left', 'plethora:module')
|
equip('left', 'plethora:module:2')
|
||||||
local blocks = peripheral.call('left', 'scan')
|
local blocks = peripheral.call('left', 'scan')
|
||||||
equip('left', 'minecraft:diamond_pickaxe')
|
equip('left', 'minecraft:diamond_pickaxe')
|
||||||
local throttle = Util.throttle()
|
local throttle = Util.throttle()
|
||||||
|
|||||||
Reference in New Issue
Block a user