From 68041822d3ec0c9f12ab09c24b865efc2fa20070 Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Sun, 29 Mar 2020 10:04:09 +0100 Subject: [PATCH] added unified inventory support for barrel recipes --- README.md | 1 + depends.txt | 1 + init.lua | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/README.md b/README.md index 0e6fb20..3e5afca 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ Change log: - 0.9 - Added Glass of Rum and Bottle of Rum thanks to acm :) Added {alcohol=1} groups - 1.0 - Added glass and bottle or Bourbon made by fermenting corn - 1.1 - Added glass and bottle of Vodka made by fermenting baked potato, Added MineClone2 support and spanish translation +- 1.2 - Added Unified Inventory support for barrel recipes (thanks to realmicu) Lucky Blocks: 13 diff --git a/depends.txt b/depends.txt index 84b5376..5effc29 100644 --- a/depends.txt +++ b/depends.txt @@ -7,3 +7,4 @@ mcl_core? mcl_sounds? mcl_loot? doc? +unified_inventory? diff --git a/init.lua b/init.lua index 380b5d2..4a08355 100644 --- a/init.lua +++ b/init.lua @@ -18,6 +18,8 @@ if mcl then wine.sand = "mcl_core:sand" end +-- check for Unified Inventory +local is_uninv = minetest.global_exists("unified_inventory") or false -- Intllib local S @@ -41,6 +43,17 @@ else end +-- Unified Inventory hints +if is_uninv then + unified_inventory.register_craft_type("barrel", { + description = "Barrel", + icon = 'wine_barrel.png', + width = 1, + height = 1, + }) +end + + local ferment = { {"farming:grapes", "wine:glass_wine"}, {"farming:barley", "wine:glass_beer"}, @@ -59,10 +72,29 @@ if mcl then ferment[5] = {"mcl_core:paper", "wine:glass_rum"} end + +if is_uninv then + for _, f in pairs(ferment) do + unified_inventory.register_craft({ + type = "barrel", + items = { f[1] }, + output = f[2], + }) + end +end + + function wine:add_item(list) for n = 1, #list do table.insert(ferment, list[n]) + if is_uninv then + unified_inventory.register_craft({ + type = "barrel", + items = { list[n][1] }, + output = list[n][2], + }) + end end end