code:
local S = farming.intllib
local tr = minetest.get_modpath("toolranks")

-- Hoe registration function

farming.register_hoe = function(name, def)

	-- Check for : prefix (register new hoes in your mod's namespace)
	if name:sub(1,1) ~= ":" then
		name = ":" .. name
	end

	-- Check def table
	if def.description == nil then
		def.description = S("Hoe")
	end

	if def.inventory_image == nil then
		def.inventory_image = "unknown_item.png"
	end

	if def.max_uses == nil then
		def.max_uses = 30
	end

	-- add hoe group
	def.groups = def.groups or {}
	def.groups.hoe = 1

	-- Register the tool
	minetest.register_tool(name, {
		description = def.description,
		inventory_image = def.inventory_image,
		on_use = function(itemstack, user, pointed_thing)
			return farming.hoe_on_use(itemstack, user, pointed_thing, def.max_uses)
		end,
		groups = def.groups,
		sound = {breaks = "default_tool_breaks"}
	})

	-- Register its recipe
	if def.recipe then
		minetest.register_craft({
			output = name:sub(2),
			recipe = def.recipe
		})
	elseif def.material then
		minetest.register_craft({
			output = name:sub(2),
			recipe = {
				{def.material, def.material, ""},
				{"", "group:stick", ""},
				{"", "group:stick", ""}
			}
		})
	end
end

-- Turns dirt with group soil=1 into soil

function farming.hoe_on_use(itemstack, user, pointed_thing, uses)

	local pt = pointed_thing

	-- am I going to hoe the top of a dirt node?
	if not pt or pt.type ~= "node"
	or pt.above.y ~= pt.under.y + 1 then
		return
	end

	local under = minetest.get_node(pt.under)
	local upos = pointed_thing.under

	if minetest.is_protected(upos, user:get_player_name()) then
		minetest.record_protection_violation(upos, user:get_player_name())
		return
	end

	local p = {x = pt.under.x, y = pt.under.y + 1, z = pt.under.z}
	local above = minetest.get_node(p)

	-- return if any of the nodes is not registered
	if not minetest.registered_nodes[under.name]
	or not minetest.registered_nodes[above.name] then
		return
	end

	-- check if the node above the pointed thing is air
	if above.name ~= "air" then
		return
	end

	-- check if pointing at dirt
	if minetest.get_item_group(under.name, "soil") ~= 1 then
		return
	end

	-- check if (wet) soil defined
	local ndef = minetest.registered_nodes[under.name]
	if ndef.soil == nil or ndef.soil.wet == nil or ndef.soil.dry == nil then
		return
	end

	if minetest.is_protected(pt.under, user:get_player_name()) then
		minetest.record_protection_violation(pt.under, user:get_player_name())
		return
	end

	-- turn the node into soil, wear out item and play sound
	minetest.set_node(pt.under, {name = ndef.soil.dry})

	minetest.sound_play("default_dig_crumbly", {pos = pt.under, gain = 0.5})

	local wdef = itemstack:get_definition()
	local wear = 65535 / (uses - 1)

	if farming.is_creative(user:get_player_name()) then
		if tr then
			wear = 1
		else
			wear = 0
		end
	end

	if tr then
		itemstack = toolranks.new_afteruse(itemstack, user, under, {wear = wear})
	else
		itemstack:add_wear(wear)
	end

	if itemstack:get_count() == 0 and wdef.sound and wdef.sound.breaks then
		minetest.sound_play(wdef.sound.breaks, {pos = pt.above,
			gain = 0.5}, true)
	end

	return itemstack
end

-- Define Hoes

farming.register_hoe(":farming:hoe_wood", {
	description = S("Wooden Hoe"),
	inventory_image = "farming_tool_woodhoe.png",
	max_uses = 30,
	material = "group:wood"
})

minetest.register_craft({
	type = "fuel",
	recipe = "farming:hoe_wood",
	burntime = 5
})

farming.register_hoe(":farming:hoe_stone", {
	description = S("Stone Hoe"),
	inventory_image = "farming_tool_stonehoe.png",
	max_uses = 90,
	material = "group:stone"
})

farming.register_hoe(":farming:hoe_steel", {
	description = S("Steel Hoe"),
	inventory_image = "farming_tool_steelhoe.png",
	max_uses = 200,
	material = "default:steel_ingot"
})

farming.register_hoe(":farming:hoe_bronze", {
	description = S("Bronze Hoe"),
	inventory_image = "farming_tool_bronzehoe.png",
	max_uses = 500,
	groups = {not_in_creative_inventory = 1}
})

farming.register_hoe(":farming:hoe_mese", {
	description = S("Mese Hoe"),
	inventory_image = "farming_tool_mesehoe.png",
	max_uses = 350,
	groups = {not_in_creative_inventory = 1},
})

farming.register_hoe(":farming:hoe_diamond", {
	description = S("Diamond Hoe"),
	inventory_image = "farming_tool_diamondhoe.png",
	max_uses = 500,
	groups = {not_in_creative_inventory = 1}
})

-- Toolranks support
if tr then

minetest.override_item("farming:hoe_wood", {
	original_description = "Wood Hoe",
	description = toolranks.create_description("Wood Hoe")})

minetest.override_item("farming:hoe_stone", {
	original_description = "Stone Hoe",
	description = toolranks.create_description("Stone Hoe")})

minetest.override_item("farming:hoe_steel", {
	original_description = "Steel Hoe",
	description = toolranks.create_description("Steel Hoe")})

minetest.override_item("farming:hoe_bronze", {
	original_description = "Bronze Hoe",
	description = toolranks.create_description("Bronze Hoe")})

minetest.override_item("farming:hoe_mese", {
	original_description = "Mese Hoe",
	description = toolranks.create_description("Mese Hoe")})

minetest.override_item("farming:hoe_diamond", {
	original_description = "Diamond Hoe",
	description = toolranks.create_description("Diamond Hoe")})
end

-- hoe bomb function
local function hoe_area(pos, player)

	-- check for protection
	if minetest.is_protected(pos, player:get_player_name()) then
		minetest.record_protection_violation(pos, player:get_player_name())
		return
	end

	local r = 5 -- radius

	-- remove flora (grass, flowers etc.)
	local res = minetest.find_nodes_in_area(
		{x = pos.x - r, y = pos.y - 1, z = pos.z - r},
		{x = pos.x + r, y = pos.y + 2, z = pos.z + r},
		{"group:flora"})

	for n = 1, #res do
		minetest.swap_node(res[n], {name = "air"})
	end

	-- replace dirt with tilled soil
	res = nil
	res = minetest.find_nodes_in_area_under_air(
		{x = pos.x - r, y = pos.y - 1, z = pos.z - r},
		{x = pos.x + r, y = pos.y + 2, z = pos.z + r},
		{"group:soil"})

	for n = 1, #res do
		minetest.swap_node(res[n], {name = "farming:soil"})
	end
end

-- throwable hoe bomb
minetest.register_entity("farming:hoebomb_entity", {
	physical = true,
	visual = "sprite",
	visual_size = {x = 1.0, y = 1.0},
	textures = {"farming_hoe_bomb.png"},
	collisionbox = {-0.1,-0.1,-0.1,0.1,0.1,0.1},
	lastpos = {},
	player = "",

	on_step = function(self, dtime)

		if not self.player then

			self.object:remove()

			return
		end

		local pos = self.object:get_pos()

		if self.lastpos.x ~= nil then

			local vel = self.object:getvelocity()

			-- only when potion hits something physical
			if vel.x == 0
			or vel.y == 0
			or vel.z == 0 then

				if self.player ~= "" then

					-- round up coords to fix glitching through doors
					self.lastpos = vector.round(self.lastpos)

					hoe_area(self.lastpos, self.player)
				end

				self.object:remove()

				return

			end
		end

		self.lastpos = pos
	end
})

-- actual throwing function
local function throw_potion(itemstack, player)

	local playerpos = player:get_pos()

	local obj = minetest.add_entity({
		x = playerpos.x,
		y = playerpos.y + 1.5,
		z = playerpos.z
	}, "farming:hoebomb_entity")

	local dir = player:get_look_dir()
	local velocity = 20

	obj:setvelocity({
		x = dir.x * velocity,
		y = dir.y * velocity,
		z = dir.z * velocity
	})

	obj:setacceleration({
		x = dir.x * -3,
		y = -9.5,
		z = dir.z * -3
	})

	obj:get_luaentity().player = player
end

-- hoe bomb item
minetest.register_craftitem("farming:hoe_bomb", {
	description = S("Hoe Bomb (use or throw on grassy areas to hoe land)"),
	inventory_image = "farming_hoe_bomb.png",
	groups = {flammable = 2, not_in_creative_inventory = 1},
	on_use = function(itemstack, user, pointed_thing)

		if pointed_thing.type == "node" then
			hoe_area(pointed_thing.above, user)
		else
			throw_potion(itemstack, user)

			if not farming.is_creative(user:get_player_name()) then

				itemstack:take_item()

				return itemstack
			end
		end
	end,
})

-- Mithril Scythe (special item)

farming.scythe_not_drops = {"farming:trellis", "farming:beanpole"}

farming.add_to_scythe_not_drops = function(item)
	table.insert(farming.scythe_not_drops, item)
end

minetest.register_tool("farming:scythe_mithril", {
	description = S("Mithril Scythe (Right-click to harvest and replant crops)"),
	inventory_image = "farming_scythe_mithril.png",
	sound = {breaks = "default_tool_breaks"},

	on_use = function(itemstack, placer, pointed_thing)

		if pointed_thing.type ~= "node" then
			return
		end

		local pos = pointed_thing.under
		local name = placer:get_player_name()

		if minetest.is_protected(pos, name) then
			return
		end

		local node = minetest.get_node_or_nil(pos)

		if not node then
			return
		end

		local def = minetest.registered_nodes[node.name]

		if not def then
			return
		end

		if not def.drop then
			return
		end

		if not def.groups
		or not def.groups.plant then
			return
		end

		local drops = minetest.get_node_drops(node.name, "")

		if not drops
		or #drops == 0
		or (#drops == 1 and drops[1] == "") then
			return
		end

		-- get crop name
		local mname = node.name:split(":")[1]
		local pname = node.name:split(":")[2]
		local sname = tonumber(pname:split("_")[2])
		pname = pname:split("_")[1]

		if not sname then
			return
		end

		-- add dropped items
		for _, dropped_item in pairs(drops) do

			-- dont drop items on this list
			for _, not_item in pairs(farming.scythe_not_drops) do

				if dropped_item == not_item then
					dropped_item = nil
				end
			end

			if dropped_item then

				local obj = minetest.add_item(pos, dropped_item)

				if obj then

					obj:set_velocity({
						x = math.random(-10, 10) / 9,
						y = 3,
						z = math.random(-10, 10) / 9
					})
				end
			end
		end

		-- Run script hook
		for _, callback in pairs(core.registered_on_dignodes) do
			callback(pos, node, placer)
		end

		-- play sound
		minetest.sound_play("default_grass_footstep", {pos = pos, gain = 1.0})

		local replace = mname .. ":" .. pname .. "_1"

		if minetest.registered_nodes[replace] then

			local p2 = minetest.registered_nodes[replace].place_param2 or 1

			minetest.set_node(pos, {name = replace, param2 = p2})
		else
			minetest.set_node(pos, {name = "air"})
		end

		if not farming.is_creative(name) then

			itemstack:add_wear(65535 / 150) -- 150 uses

			return itemstack
		end
	end,
})

if minetest.get_modpath("moreores") then

	minetest.register_craft({
		output = "farming:scythe_mithril",
		recipe = {
			{"", "moreores:mithril_ingot", "moreores:mithril_ingot"},
			{"moreores:mithril_ingot", "", "group:stick"},
			{"", "", "group:stick"}
		}
	})

	farming.register_hoe(":moreores:hoe_silver", {
		description = S("%s Hoe"):format(S("Silver")),
		inventory_image = "moreores_tool_silverhoe.png",
		max_uses = 300,
		material = "moreores:silver_ingot"
	})

	farming.register_hoe(":moreores:hoe_mithril", {
		description = S("%s Hoe"):format(S("Mithril")),
		inventory_image = "moreores_tool_mithrilhoe.png",
		max_uses = 1000,
		material = "moreores:mithril_ingot"
	})

	-- Toolranks support
	if tr then

		local desc = S("%s Hoe"):format(S("Silver"))

		minetest.override_item("moreores:hoe_silver", {
			original_description = desc,
			description = toolranks.create_description(desc)})

		desc = S("%s Hoe"):format(S("Mithril"))

		minetest.override_item("moreores:hoe_mithril", {
			original_description = desc,
			description = toolranks.create_description(desc)})
	end
end


code:
--[[
	Farming Redo Mod
	by TenPlus1
	NEW growing routine by prestidigitator
	auto-refill by crabman77
]]

farming = {
	mod = "redo",
	version = "20200702",
	path = minetest.get_modpath("farming"),
	select = {
		type = "fixed",
		fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
	},
	registered_plants = {}
}

local creative_mode_cache = minetest.settings:get_bool("creative_mode")

function farming.is_creative(name)
	return creative_mode_cache or minetest.check_player_privs(name, {creative = true})
end

local statistics = dofile(farming.path .. "/statistics.lua")

-- Intllib
local S = dofile(farming.path .. "/intllib.lua")
farming.intllib = S

-- Utility Function
local time_speed = tonumber(minetest.settings:get("time_speed")) or 72
local SECS_PER_CYCLE = (time_speed > 0 and (24 * 60 * 60) / time_speed) or 0
local function clamp(x, min, max)
	return (x < min and min) or (x > max and max) or x
end

-- return amount of day or night that has elapsed
-- dt is time elapsed, count_day if true counts day, otherwise night
local function day_or_night_time(dt, count_day)

	local t_day = minetest.get_timeofday()
	local t1_day = t_day - dt / SECS_PER_CYCLE
	local t1_c, t2_c  -- t1_c < t2_c and t2_c always in [0, 1)

	if count_day then

		if t_day < 0.25 then
			t1_c = t1_day + 0.75  -- Relative to sunup, yesterday
			t2_c = t_day  + 0.75
		else
			t1_c = t1_day - 0.25  -- Relative to sunup, today
			t2_c = t_day  - 0.25
		end
	else
		if t_day < 0.75 then
			t1_c = t1_day + 0.25  -- Relative to sundown, yesterday
			t2_c = t_day  + 0.25
		else
			t1_c = t1_day - 0.75  -- Relative to sundown, today
			t2_c = t_day  - 0.75
		end
	end

	local dt_c = clamp(t2_c, 0, 0.5) - clamp(t1_c, 0, 0.5)  -- this cycle

	if t1_c < -0.5 then
		local nc = math.floor(-t1_c)
		t1_c = t1_c + nc
		dt_c = dt_c + 0.5 * nc + clamp(-t1_c - 0.5, 0, 0.5)
	end

	return dt_c * SECS_PER_CYCLE
end

-- Growth Logic
local STAGE_LENGTH_AVG = tonumber(
		minetest.settings:get("farming_stage_length")) or 200 -- 160
local STAGE_LENGTH_DEV = STAGE_LENGTH_AVG / 6

-- return plant name and stage from node provided
local function plant_name_stage(node)

	local name

	if type(node) == "table" then

		if node.name then
			name = node.name
		elseif node.x and node.y and node.z then
			node = minetest.get_node_or_nil(node)
			name = node and node.name
		end
	else
		name = tostring(node)
	end

	if not name or name == "ignore" then
		return nil
	end

	local sep_pos = name:find("_[^_]+$")

	if sep_pos and sep_pos > 1 then

		local stage = tonumber(name:sub(sep_pos + 1))

		if stage and stage >= 0 then
			return name:sub(1, sep_pos - 1), stage
		end
	end

	return name, 0
end

-- Map from node name to
-- { plant_name = ..., name = ..., stage = n, stages_left = { node_name, ... } }

local plant_stages = {}

farming.plant_stages = plant_stages

--- Registers the stages of growth of a (possible plant) node.
 --
 -- @param node
 --    Node or position table, or node name.
 -- @return
 --    The (possibly zero) number of stages of growth the plant will go through
 --    before being fully grown, or nil if not a plant.

local register_plant_node

-- Recursive helper
local function reg_plant_stages(plant_name, stage, force_last)

	local node_name = plant_name and plant_name .. "_" .. stage
	local node_def = node_name and minetest.registered_nodes[node_name]

	if not node_def then
		return nil
	end

	local stages = plant_stages[node_name]

	if stages then
		return stages
	end

	if minetest.get_item_group(node_name, "growing") > 0 then

		local ns = reg_plant_stages(plant_name, stage + 1, true)
		local stages_left = (ns and { ns.name, unpack(ns.stages_left) }) or {}

		stages = {
			plant_name = plant_name,
			name = node_name,
			stage = stage,
			stages_left = stages_left
		}

		if #stages_left > 0 then

			local old_constr = node_def.on_construct
			local old_destr  = node_def.on_destruct

			minetest.override_item(node_name,
				{
					on_construct = function(pos)

						if old_constr then
							old_constr(pos)
						end

						farming.handle_growth(pos)
					end,

					on_destruct = function(pos)

						minetest.get_node_timer(pos):stop()

						if old_destr then
							old_destr(pos)
						end
					end,

					on_timer = function(pos, elapsed)
						return farming.plant_growth_timer(pos, elapsed, node_name)
					end,
				})
		end

	elseif force_last then

		stages = {
			plant_name = plant_name,
			name = node_name,
			stage = stage,
			stages_left = {}
		}
	else
		return nil
	end

	plant_stages[node_name] = stages

	return stages
end

local register_plant_node = function(node)

	local plant_name, stage = plant_name_stage(node)

	if plant_name then

		local stages = reg_plant_stages(plant_name, stage, false)
		return stages and #stages.stages_left
	else
		return nil
	end
end

local function set_growing(pos, stages_left)

	if not stages_left then
		return
	end

	local timer = minetest.get_node_timer(pos)

	if stages_left > 0 then

		if not timer:is_started() then

			local stage_length = statistics.normal(STAGE_LENGTH_AVG, STAGE_LENGTH_DEV)

			stage_length = clamp(stage_length, 0.5 * STAGE_LENGTH_AVG, 3.0 * STAGE_LENGTH_AVG)

			timer:set(stage_length, -0.5 * math.random() * STAGE_LENGTH_AVG)
		end

	elseif timer:is_started() then
		timer:stop()
	end
end

-- detects a crop at given position, starting or stopping growth timer when needed
function farming.handle_growth(pos, node)

	if not pos then
		return
	end

	local stages_left = register_plant_node(node or pos)

	if stages_left then
		set_growing(pos, stages_left)
	end
end

minetest.after(0, function()

	for _, node_def in pairs(minetest.registered_nodes) do
		register_plant_node(node_def)
	end
end)

-- Just in case a growing type or added node is missed (also catches existing
-- nodes added to map before timers were incorporated).
minetest.register_abm({
	nodenames = {"group:growing"},
	interval = 300,
	chance = 1,
	catch_up = false,
	action = function(pos, node)
		farming.handle_growth(pos, node)
	end
})

-- Plant timer function that grows plants under the right conditions.
function farming.plant_growth_timer(pos, elapsed, node_name)

	local stages = plant_stages[node_name]

	if not stages then
		return false
	end

	local max_growth = #stages.stages_left

	if max_growth <= 0 then
		return false
	end

	-- custom growth check
	local chk = minetest.registered_nodes[node_name].growth_check

	if chk then

		if chk(pos, node_name) then
			return true
		end

	-- otherwise check for wet soil beneath crop
	else
		local under = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z})

		if minetest.get_item_group(under.name, "soil") < 3 then
			return true
		end
	end

	local growth
	local light_pos = {x = pos.x, y = pos.y, z = pos.z}
	local lambda = elapsed / STAGE_LENGTH_AVG

	if lambda < 0.1 then
		return true
	end

	local MIN_LIGHT = minetest.registered_nodes[node_name].minlight or 12
	local MAX_LIGHT = minetest.registered_nodes[node_name].maxlight or 15
	--print ("---", MIN_LIGHT, MAX_LIGHT)

	if max_growth == 1 or lambda < 2.0 then

		local light = (minetest.get_node_light(light_pos) or 0)
		--print ("light level:", light)

		if light < MIN_LIGHT or light > MAX_LIGHT then
			return true
		end

		growth = 1
	else
		local night_light  = (minetest.get_node_light(light_pos, 0) or 0)
		local day_light    = (minetest.get_node_light(light_pos, 0.5) or 0)
		local night_growth = night_light >= MIN_LIGHT and night_light <= MAX_LIGHT
		local day_growth = day_light >= MIN_LIGHT and day_light <= MAX_LIGHT

		if not night_growth then

			if not day_growth then
				return true
			end

			lambda = day_or_night_time(elapsed, true) / STAGE_LENGTH_AVG

		elseif not day_growth then

			lambda = day_or_night_time(elapsed, false) / STAGE_LENGTH_AVG
		end

		growth = statistics.poisson(lambda, max_growth)

		if growth < 1 then
			return true
		end
	end

	if minetest.registered_nodes[stages.stages_left[growth]] then

		local p2 = minetest.registered_nodes[stages.stages_left[growth] ].place_param2 or 1

		minetest.swap_node(pos, {name = stages.stages_left[growth], param2 = p2})
	else
		return true
	end

	return growth ~= max_growth
end

-- refill placed plant by crabman (26/08/2015) updated by TenPlus1
function farming.refill_plant(player, plantname, index)

	local inv = player:get_inventory()
	local old_stack = inv:get_stack("main", index)

	if old_stack:get_name() ~= "" then
		return
	end

	for i, stack in ipairs(inv:get_list("main")) do

		if stack:get_name() == plantname and i ~= index then

			inv:set_stack("main", index, stack)
			stack:clear()
			inv:set_stack("main", i, stack)

			return
		end
	end
end

-- Place Seeds on Soil
function farming.place_seed(itemstack, placer, pointed_thing, plantname)

	local pt = pointed_thing

	-- check if pointing at a node
	if not pt or pt.type ~= "node" then
		return
	end

	local under = minetest.get_node(pt.under)

	-- am I right-clicking on something that has a custom on_place set?
	-- thanks to Krock for helping with this issue :)
	local def = minetest.registered_nodes[under.name]
	if placer and itemstack and def and def.on_rightclick then
		return def.on_rightclick(pt.under, under, placer, itemstack)
	end

	local above = minetest.get_node(pt.above)

	-- check if pointing at the top of the node
	if pt.above.y ~= pt.under.y + 1 then
		return
	end

	-- return if any of the nodes is not registered
	if not minetest.registered_nodes[under.name]
	or not minetest.registered_nodes[above.name] then
		return
	end

	-- can I replace above node, and am I pointing at soil
	if not minetest.registered_nodes[above.name].buildable_to
	or minetest.get_item_group(under.name, "soil") < 2
	-- avoid multiple seed placement bug
	or minetest.get_item_group(above.name, "plant") ~= 0 then
		return
	end

	-- is player planting seed?
	local name = placer and placer:get_player_name() or ""

	-- if not protected then add node and remove 1 item from the itemstack
	if not minetest.is_protected(pt.above, name) then

		local p2 = minetest.registered_nodes[plantname].place_param2 or 1

		minetest.set_node(pt.above, {name = plantname, param2 = p2})

--minetest.get_node_timer(pt.above):start(1)
--farming.handle_growth(pt.above)--, node)

		minetest.sound_play("default_place_node", {pos = pt.above, gain = 1.0})

		if placer and itemstack
		and not farming.is_creative(placer:get_player_name()) then

			local name = itemstack:get_name()

			itemstack:take_item()

			-- check for refill
			if itemstack:get_count() == 0 then

				minetest.after(0.10,
					farming.refill_plant,
					placer,
					name,
					placer:get_wield_index()
				)
			end
		end

		return itemstack
	end
end

-- Function to register plants (default farming compatibility)
farming.register_plant = function(name, def)

	if not def.steps then
		return nil
	end

	local mname = name:split(":")[1]
	local pname = name:split(":")[2]

	-- Check def
	def.description = def.description or S("Seed")
	def.inventory_image = def.inventory_image or "unknown_item.png"
	def.minlight = def.minlight or 12
	def.maxlight = def.maxlight or 15

	-- Register seed
	minetest.register_node(":" .. mname .. ":seed_" .. pname, {

		description = def.description,
		tiles = {def.inventory_image},
		inventory_image = def.inventory_image,
		wield_image = def.inventory_image,
		drawtype = "signlike",
		groups = {seed = 1, snappy = 3, attached_node = 1, flammable = 2},
		paramtype = "light",
		paramtype2 = "wallmounted",
		walkable = false,
		sunlight_propagates = true,
		selection_box = farming.select,
		place_param2 = def.place_param2 or nil,
		next_plant = mname .. ":" .. pname .. "_1",

		on_place = function(itemstack, placer, pointed_thing)
			return farming.place_seed(itemstack, placer,
				pointed_thing, mname .. ":" .. pname .. "_1")
		end,
	})

	-- Register harvest
	minetest.register_craftitem(":" .. mname .. ":" .. pname, {
		description = pname:gsub("^%l", string.upper),
		inventory_image = mname .. "_" .. pname .. ".png",
		groups = def.groups or {flammable = 2},
	})

	-- Register growing steps
	for i = 1, def.steps do

		local base_rarity = 1
		if def.steps ~= 1 then
			base_rarity =  8 - (i - 1) * 7 / (def.steps - 1)
		end
		local drop = {
			items = {
				{items = {mname .. ":" .. pname}, rarity = base_rarity},
				{items = {mname .. ":" .. pname}, rarity = base_rarity * 2},
				{items = {mname .. ":seed_" .. pname}, rarity = base_rarity},
				{items = {mname .. ":seed_" .. pname}, rarity = base_rarity * 2},
			}
		}

		local g = {
			snappy = 3, flammable = 2, plant = 1, growing = 1,
			attached_node = 1, not_in_creative_inventory = 1,
		}

		-- Last step doesn't need growing=1 so Abm never has to check these
		if i == def.steps then
			g.growing = 0
		end

		local node_name = mname .. ":" .. pname .. "_" .. i

		local next_plant = nil

		if i < def.steps then
			next_plant = mname .. ":" .. pname .. "_" .. (i + 1)
		end

		minetest.register_node(node_name, {
			drawtype = "plantlike",
			waving = 1,
			tiles = {mname .. "_" .. pname .. "_" .. i .. ".png"},
			paramtype = "light",
			paramtype2 = def.paramtype2,
			place_param2 = def.place_param2,
			walkable = false,
			buildable_to = true,
			sunlight_propagates = true,
			drop = drop,
			selection_box = farming.select,
			groups = g,
			sounds = default.node_sound_leaves_defaults(),
			minlight = def.minlight,
			maxlight = def.maxlight,
			next_plant = next_plant
		})
	end

-- add to farming.registered_plants
farming.registered_plants[mname .. ":" .. pname] = {
	crop = mname .. ":" .. pname,
	seed = mname .. ":seed_" .. pname,
	steps = def.steps,
	minlight = def.minlight,
	maxlight = def.maxlight
}
--print(dump(farming.registered_plants[mname .. ":" .. pname]))
	-- Return info
	return {seed = mname .. ":seed_" .. pname, harvest = mname .. ":" .. pname}
end

-- default settings
farming.carrot = 0.001
farming.potato = 0.001
farming.tomato = 0.001
farming.cucumber = 0.001
farming.corn = 0.001
farming.coffee = 0.001
farming.melon = 0.001
farming.pumpkin = 0.001
farming.cocoa = true
farming.raspberry = 0.001
farming.blueberry = 0.001
farming.rhubarb = 0.001
farming.beans = 0.001
farming.grapes = 0.001
farming.barley = true
farming.chili = 0.003
farming.garlic = 0.001
farming.onion = 0.001
farming.pepper = 0.002
farming.pineapple = 0.001
farming.peas = 0.001
farming.beetroot = 0.001
farming.mint = 0.005
farming.cabbage = 0.001
farming.grains = true
farming.rarety = 0.002

-- Load new global settings if found inside mod folder
local input = io.open(farming.path.."/farming.conf", "r")
if input then
	dofile(farming.path .. "/farming.conf")
	input:close()
end

-- load new world-specific settings if found inside world folder
local worldpath = minetest.get_worldpath()
input = io.open(worldpath.."/farming.conf", "r")
if input then
	dofile(worldpath .. "/farming.conf")
	input:close()
end

-- important items
dofile(farming.path.."/soil.lua")
dofile(farming.path.."/hoes.lua")
dofile(farming.path.."/grass.lua")
dofile(farming.path.."/utensils.lua")

-- default crops
dofile(farming.path.."/crops/wheat.lua")
dofile(farming.path.."/crops/cotton.lua")

-- helper function
local function ddoo(file, check)

	if check then
		dofile(farming.path .. "/crops/" .. file)
	end
end

-- add additional crops and food (if enabled)
ddoo("carrot.lua", farming.carrot)
ddoo("potato.lua", farming.potato)
ddoo("tomato.lua", farming.tomato)
ddoo("cucumber.lua", farming.cucumber)
ddoo("corn.lua", farming.corn)
ddoo("coffee.lua", farming.coffee)
ddoo("melon.lua", farming.melon)
ddoo("pumpkin.lua", farming.pumpkin)
ddoo("cocoa.lua", farming.cocoa)
ddoo("raspberry.lua", farming.raspberry)
ddoo("blueberry.lua", farming.blueberry)
ddoo("rhubarb.lua", farming.rhubarb)
ddoo("beans.lua", farming.beans)
ddoo("grapes.lua", farming.grapes)
ddoo("barley.lua", farming.barley)
ddoo("garlic.lua", farming.garlic)
ddoo("onion.lua", farming.onion)
ddoo("pepper.lua", farming.pepper)
ddoo("pineapple.lua", farming.pineapple)
ddoo("peas.lua", farming.peas)
ddoo("beetroot.lua", farming.beetroot)
ddoo("chili.lua", farming.chili)
ddoo("ryeoatrice.lua", farming.grains)
ddoo("mint.lua", farming.mint)
ddoo("cabbage.lua", farming.cabbage)

dofile(farming.path .. "/food.lua")
dofile(farming.path .. "/mapgen.lua")
dofile(farming.path .. "/compatibility.lua") -- Farming Plus compatibility
dofile(farming.path .. "/lucky_block.lua")

repo_name: korkut/MeseCraft

license: mit


code:
-- Fallback functions for when `intllib` is not installed.
-- Code released under Unlicense <http://unlicense.org>.

-- Get the latest version of this file at:
--   https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua

local function format(str, ...)
	local args = { ... }
	local function repl(escape, open, num, close)
		if escape == "" then
			local replacement = tostring(args[tonumber(num)])
			if open == "" then
				replacement = replacement..close
			end
			return replacement
		else
			return "@"..open..num..close
		end
	end
	return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
end

local gettext, ngettext
if minetest.get_modpath("intllib") then
	if intllib.make_gettext_pair then
		-- New method using gettext.
		gettext, ngettext = intllib.make_gettext_pair()
	else
		-- Old method using text files.
		gettext = intllib.Getter()
	end
end

-- Fill in missing functions.

gettext = gettext or function(msgid, ...)
	return format(msgid, ...)
end

ngettext = ngettext or function(msgid, msgid_plural, n, ...)
	return format(n==1 and msgid or msgid_plural, ...)
end

return gettext, ngettext


code:
# German translation of the farming mod by TenPlus1
# textdomain: farming
# author: Xanthin
# author: TheDarkTiger
# last update: 2020/Apr/26

###### folder . ######

### init.lua ###
Seed=Saatgut

### compatibility.lua ###
Banana=
Banana Leaves=
Orange=
Strawberry=

### food.lua ###
Sugar=Zucker
Salt=
Rose Water=
Turkish Delight=
Garlic Bread=
Donut=Donut
Chocolate Donut=Schokodonut
Apple Donut=Apfeldonut
Porridge=
Jaffa Cake=

### hoes.lua ###
Hoe=Hacke
Wooden Hoe=Holzhacke
Stone Hoe=Steinhacke
Steel Hoe=Stahlhacke
Bronze Hoe=Bronzehacke
Mese Hoe=Mesehacke
Diamond Hoe=Diamanthacke
# Surcharge du mod [Toolranks] à faire #
Hoe Bomb (use or throw on grassy areas to hoe land)=
Mithril Scythe (Right-click to harvest and replant crops)=
# Surcharge du mod [Toolranks] à faire #

### soil.lua ###
Soil=Ackerboden
Wet Soil=Bewässerter Ackerboden

### utensils.lua ###
Wooden Bowl=
Saucepan=
Cooking Pot=
Baking Tray=
Skillet=
Mortar and Pestle=
Cutting Board=
Juicer=
Glass Mixing Bowl=

###### folder ./crops ######

### barley.lua ###
Barley Seed=Gerstenkörner
Barley=Gerste

### beans.lua ###
Green Beans=Grüne Bohnen
Bean Pole (place on soil before planting beans)=Bohnenstange (vor dem Pflanzen der Bohnen auf den\nAckerboden stellen)

### beetroot.lua ###
Beetroot=
Beetroot Soup=

### blueberry.lua ###
Blueberries=Blaubeeren
Blueberry Muffin=Blaubeermuffin
Blueberry Pie=

### carrot.lua ##
Carrot=Möhre
Carrot Juice=
Golden Carrot=Goldene Möhre

### chili.lua ###
Chili Pepper=
Bowl of Chili=

### cocoa.lua ###
Cocoa Beans=Kakaobohne
Cookie=Keks
Bar of Dark Chocolate=Tafel Zartbitterschokolade
Chocolate Block=

### coffee.lua ###
Coffee Beans=Kaffeebohnen
Cup of Coffee=Tasse Kaffee

### corn.lua ###
Corn=Mais
Corn on the Cob=Maiskolben
Cornstarch=
Bottle of Ethanol=Flasche Ethanol

### cotton.lua ###
Cotton Seed=Baumwollsamen
Cotton=Baumwolle
String=

### cucumber.lua ###
Cucumber=Gurke

### garlic.lua ###
Garlic clove=
Garlic=
Garlic Braid=

### grapes.lua ###
Grapes=Weintrauben
Trellis (place on soil before planting grapes)=Spalier (vor dem Pflanzen der Weintrauben auf den\nAckerboden stellen)

### hemp.lua ###
Hemp Seed=Hanfsamen
Hemp Leaf=Hanfblatt
Bottle of Hemp Oil=Flasche mit Hanföl
Hemp Fibre=Hanffaser
Hemp Block=
Hemp Rope=Hanfseil

### melon.lua ###
Melon Slice=Melonenscheibe
Melon=Melone

### onion.lua ###
Onion=

### peas.lua ###
Pea Pod=
Peas=
Pea Soup=

### pepper.lua ###
Peppercorn=
Pepper=
Ground Pepper=

### pinapple.lua ###
Pineapple Top=
Pineapple=
Pineapple Ring=
Pineapple Juice=

### potato.lua ###
Potato=Kartoffel
Baked Potato=Ofenkartoffel
Cucumber and Potato Salad=

### pumpkin.lua ###
Pumpkin Slice=Kürbisscheibe
Jack 'O Lantern (punch to turn on and off)=Kürbislaterne (Punch zum Ein- und Ausschalten)
Scarecrow Bottom=
Pumpkin Bread=Kürbisbrot
Pumpkin Dough=Kürbisteig
Pumpkin=Kürbis

### raspberry.lua ###
Raspberries=Himbeeren
Raspberry Smoothie=Himbeersmoothie

### rhubarb.lua ###
Rhubarb=Rhabarber
Rhubarb Pie=Rhabarberkuchen

### ryeoatrice.lua ###
Rye=
Rye seed=
Oat=
Oat seed=
Rice=
Rice grains=
Rice Bread=
Rice Flour=
Multigrain Flour=
Multigrain Bread=

### tomato.lua ###
Tomato=Tomate

### wheat.lua ###
Wheat Seed=Weizenkörner
Wheat=Weizen
Straw=Stroh
Flour=Mehl
Bread=Brot
Sliced Bread=
Toast=
Toast Sandwich=


code:
# Traduction Française du mod farming par TenPlus1
# textdomain: farming
# author: Papaou30
# author: TheDarkTiger
# last update: 2020/Apr/26

###### folder . ######

### init.lua ###
Seed=Graine

### compatibility.lua ###
Banana=Banane
Banana Leaves=Feuilles de Banane
Orange=Orange
Strawberry=Fraise

### food.lua ###
Sugar=Sucre
Salt=Sel
Rose Water=Eau de Rose
Turkish Delight=Douceur Turque
Garlic Bread=Pain à l'Ail
Donut=Beignet
Chocolate Donut=Beignet au chocolat
Apple Donut=Beignet aux pommes
Porridge=Gruau de céréales
Jaffa Cake=Petit gâteau à l'orange "Jaffa"

### hoes.lua ###
Hoe=Binette
Wooden Hoe=Binette en Bois
Stone Hoe=Binette en Pierre
Steel Hoe=Binette en Acier
Bronze Hoe=Binette en Bronze
Mese Hoe=Binette en Mese
Diamond Hoe=Binette en Diamant
# Surcharge du mod [Toolranks] à faire #
Hoe Bomb (use or throw on grassy areas to hoe land)=Bombe à binnage (Actionner ou lancer sur une zone herbeuse pour la binner)
Mithril Scythe (Right-click to harvest and replant crops)=Faux en Mithril (Récolte et replante des graines)
# Surcharge du mod [Toolranks] à faire #

### soil.lua ###
Soil=Sol binné
Wet Soil=Sol binné humide

### utensils.lua ###
Wooden Bowl=Bol en Bois
Saucepan=Casserole
Cooking Pot=Fait-tout
Baking Tray=Lèche-frite
Skillet=Poêle
Mortar and Pestle=Mortier et Pilon
Cutting Board=Planche à découper
Juicer=Presse-agrumes
Glass Mixing Bowl=Terrine en Verre

###### folder ./crops ######

### barley.lua ###
Barley Seed=Graine d'Orge
Barley=Orge

### beans.lua ###
Green Beans=Haricots verts
Bean Pole (place on soil before planting beans)=Tuteur pour haricots  (placer sur le sol avant de planter des haricots)

### beetroot.lua ###
Beetroot=Betrave
Beetroot Soup=Soupe de Betrave

### blueberry.lua ###
Blueberries=Myrtilles
Blueberry Muffin=Muffin aux Myrtilles
Blueberry Pie=Tarte aux Myrtilles

### carrot.lua ##
Carrot=Carotte
Carrot Juice=Jus de Carotte
Golden Carrot=Carotte dorée

### chili.lua ###
Chili Pepper=Piment Rouge
Bowl of Chili=Assiette de Chilli

### cocoa.lua ###
Cocoa Beans=Fèves de Cacao
Cookie=Cookie
Bar of Dark Chocolate=Tablette de Chocolat noir
Chocolate Block=Block de Chocolat

### coffee.lua ###
Coffee Beans=Grains de café
Cup of Coffee=Tasse de café

### corn.lua ###
Corn=Maïs
Corn on the Cob=Cobette (Maïs cuit)
Cornstarch=Fécule de Maïs
Bottle of Ethanol=Bouteille d'Éthanol

### cotton.lua ###
Cotton Seed=Graines de Coton
Cotton=Coton
String=Ficelle

### cucumber.lua ###
Cucumber=Concombre

### garlic.lua ###
Garlic clove=Gousse d'Ail
Garlic=Tête d'Ail
Garlic Braid=Ail tressé

### grapes.lua ###
Grapes=Raisins
Trellis (place on soil before planting grapes)=Treillis (placer sur le sol avant de planter la vigne)

### hemp.lua ###
Hemp Seed=Graines de Chanvre
Hemp Leaf=Feuille de Chanvre
Bottle of Hemp Oil=Bouteille d'huile de Chanvre
Hemp Fibre=Fibre de Chanvre
Hemp Block=Bloc de Chanvre
Hemp Rope=Corde de Chanvre

### melon.lua ###
Melon Slice=Tranche de Melon
Melon=Melon

### onion.lua ###
Onion=Oignon

### peas.lua ###
Pea Pod=Cosse de Petit-poids
Peas=Petit-poids
Pea Soup=Soupe de Petit-poids

### pepper.lua ###
Peppercorn=Grain de Poivre
Pepper=Poivron
Ground Pepper=Poivre moulu

### pinapple.lua ###
Pineapple Top=Pousse d'Ananas
Pineapple=Ananas
Pineapple Ring=Tranche d'Ananas
Pineapple Juice=Jus d'Ananas

### potato.lua ###
Potato=Pomme de terre
Baked Potato=Pomme de terre cuite
Cucumber and Potato Salad=Salade de Pomme de terre au Concombre

### pumpkin.lua ###
Pumpkin Slice=Tranche de Citrouille
Jack 'O Lantern (punch to turn on and off)=Jack 'O Lantern (Frapper pour allumer et éteindre)
Scarecrow Bottom=Base d'Epouventail
Pumpkin Bread=Pain à la Citrouille
Pumpkin Dough=Pâton de pain à la Citrouille
Pumpkin=Citrouille

### raspberry.lua ###
Raspberries=Framboises
Raspberry Smoothie=Smoothie aux Framboises

### rhubarb.lua ###
Rhubarb=Rhubarbe
Rhubarb Pie=Tarte à la rhubarbe

### ryeoatrice.lua ###
Rye=Seigle
Rye seed=Grains de Seigle
Oat=Orge
Oat seed=Grains d'Orge
Rice=Riz
Rice grains=Grain de Riz
Rice Bread=Pain de Riz
Rice Flour=Farine de Riz
Multigrain Flour=Farine Multi-céréales
Multigrain Bread=Pain aux Céréales

### tomato.lua ###
Tomato=Tomate

### wheat.lua ###
Wheat Seed=Grain de blé
Wheat=Blé
Straw=Paille
Flour=Farine
Bread=Pain
Sliced Bread=Tranche de Pain
Toast=Pain Grillé
Toast Sandwich=Sandwich au Pain


code:
# Translation of the farming mod by TenPlus1
# textdomain: farming
# author: (Hamlet)
# last update: 2020/Jun/02

###### folder . ######

### init.lua ###
Seed=Seme

### compatibility.lua ###
Banana=Banana
Banana Leaves=Foglie di banano
Orange=Arancia
Strawberry=Fragola

### food.lua ###
Sugar=Zucchero
Salt=Sale
Rose Water=Acqua di rose
Turkish Delight=Lokum
Garlic Bread=Pane all'aglio
Donut=Ciambella
Chocolate Donut=Ciambella al cioccolato
Apple Donut=Ciambella alla mela
Porridge=Porridge
Jaffa Cake=Torta di jaffa

### hoes.lua ###
Hoe=Zappa
Wooden Hoe=Zappa di legno
Stone Hoe=Zappa di pietra
Steel Hoe=Zappa d'acciaio
Bronze Hoe=Zappa di bronzo
Mese Hoe=Zappa di mese
Diamond Hoe=Zappa di diamante
# Surcharge du mod [Toolranks] à faire #
Hoe Bomb (use or throw on grassy areas to hoe land)=Bomba zappa (usala o lanciala sulle aree erbose per zappare il terreno)
Mithril Scythe (Right-click to harvest and replant crops)=Falce di mithril (clicca col destro per raccogliere e ripiantare le prose)
# Surcharge du mod [Toolranks] à faire #

### soil.lua ###
Soil=Terreno coltivabile
Wet Soil=Terreno coltivabile bagnato

### utensils.lua ###
Wooden Bowl=Ciotola di legno
Saucepan=Casseruola
Cooking Pot=Pentola da cottura
Baking Tray=Teglia da forno
Skillet=Padella
Mortar and Pestle=Mortaio e pestello
Cutting Board=Tagliere
Juicer=Spremiagrumi
Glass Mixing Bowl=Terrina di vetro

###### folder ./crops ######

### barley.lua ###
Barley Seed=Seme d'orzo
Barley=Orzo

### beans.lua ###
Green Beans=Fagiolini
Bean Pole (place on soil before planting beans)=Palina per fagiolini (mettila sul terreno coltivabile prima di piantare i fagiolini)

### beetroot.lua ###
Beetroot=Barbabietola
Beetroot Soup=Zuppa di barbabietola

### blueberry.lua ###
Blueberries=Mirtilli
Blueberry Muffin=Focaccina di mirtilli
Blueberry Pie=Tortino di mirtilli

### carrot.lua ##
Carrot=Carota
Carrot Juice=Succo di carota
Golden Carrot=Carota d'oro

### chili.lua ###
Chili Pepper=Peperoncino
Bowl of Chili=Ciotola di peperoncino

### cocoa.lua ###
Cocoa Beans=Chicchi di cacao
Cookie=Biscotto
Bar of Dark Chocolate=Barra di cioccolato fondente
Chocolate Block=Blocco di cioccolato

### coffee.lua ###
Coffee Beans=Chicchi di caffè
Cup of Coffee=Tazza di caffè

### corn.lua ###
Corn=Mais
Corn on the Cob=Pannocchia arrostita
Cornstarch=Amido di mais
Bottle of Ethanol=Bottiglia di alcol etilico

### cotton.lua ###
Cotton Seed=Seme di cotone
Cotton=Cotone
String=Filo

### cucumber.lua ###
Cucumber=Cetriolo

### garlic.lua ###
Garlic clove=Spicchio d'aglio
Garlic=Aglio
Garlic Braid=Treccia d'aglio

### grapes.lua ###
Grapes=Chicchi d'uva
Trellis (place on soil before planting grapes)=Graticcio (mettilo sul terreno coltivabile prima di piantare i chicchi d'uva)

### hemp.lua ###
Hemp Seed=Seme di canapa
Hemp Leaf=Foglia di canapa
Bottle of Hemp Oil=Bottiglia d'olio di canapa
Hemp Fibre=Fibra di canapa
Hemp Block=Blocco di canapa
Hemp Rope=Corda di canapa

### melon.lua ###
Melon Slice=Fetta d'anguria
Melon=Anguria

### onion.lua ###
Onion=Cipolla

### peas.lua ###
Pea Pod=Baccello di piselli
Peas=Piselli
Pea Soup=Zuppa di piselli

### pepper.lua ###
Peppercorn=Grano di pepe
Pepper=Pepe
Ground Pepper=Pepe macinato

### pinapple.lua ###
Pineapple Top=Cima d'ananas
Pineapple=Ananas
Pineapple Ring=Anello d'ananas
Pineapple Juice=Succo d'ananas

### potato.lua ###
Potato=Patata
Baked Potato=Patata arrostita
Cucumber and Potato Salad=Insalata di patate e cetrioli

### pumpkin.lua ###
Pumpkin Slice=Fetta di zucca
Jack 'O Lantern (punch to turn on and off)=Jack Lanterna (colpirlo per accenderlo e spegnerlo)
Scarecrow Bottom=Fondo dello spaventapasseri
Pumpkin Bread=Pane alla zucca
Pumpkin Dough=Pasta di zucca
Pumpkin=Zucca

### raspberry.lua ###
Raspberries=Lamponi
Raspberry Smoothie=Purea di lamponi

### rhubarb.lua ###
Rhubarb=Rabarbaro
Rhubarb Pie=Tortino al rabarbaro

### ryeoatrice.lua ###
Rye=Segale
Rye seed=Seme di segale
Oat=Avena
Oat seed=Seme d'avena
Rice=Riso
Rice grains=Chicchi di riso
Rice Bread=Pane di riso
Rice Flour=Farina di riso
Multigrain Flour=Farina multicereale
Multigrain Bread=Pane multicereale

### tomato.lua ###
Tomato=Pomodoro

### wheat.lua ###
Wheat Seed=Seme di grano
Wheat=Grano
Straw=Paglia
Flour=Farina
Bread=Pane
Sliced Bread=Pane a fette
Toast=Pane tostato
Toast Sandwich=Panino di pane tostato


code:
# Portuguese translation of the farming mod by TenPlus1
# textdomain: farming
# author: BrunoMine <borgesdossantosbruno@gmail.com>
# author: TheDarkTiger
# last update: 2020/Apr/26

###### folder . ######

### init.lua ###
Seed=Sementes

### compatibility.lua ###
Banana=
Banana Leaves=
Orange=
Strawberry=

### food.lua ###
Sugar=Açucar
Salt=
Rose Water=
Turkish Delight=
Garlic Bread=
Donut=Donut
Chocolate Donut=Donut de Chocolate
Apple Donut=Donut de Maça
Porridge=
Jaffa Cake=

### hoes.lua ###
Hoe=Enxada
Wooden Hoe=Enxada de Madeira
Stone Hoe=Enxada de Pedra
Steel Hoe=Enxada de Aço
Bronze Hoe=Enxada de Bronze
Mese Hoe=Enxada de Mese
Diamond Hoe=Enxada de Diamante
# Surcharge du mod [Toolranks] à faire #
Hoe Bomb (use or throw on grassy areas to hoe land)=
Mithril Scythe (Right-click to harvest and replant crops)=
# Surcharge du mod [Toolranks] à faire #

### soil.lua ###
Soil=Solo
Wet Soil=Solo Seco

### utensils.lua ###
Wooden Bowl=
Saucepan=
Cooking Pot=
Baking Tray=
Skillet=
Mortar and Pestle=
Cutting Board=
Juicer=
Glass Mixing Bowl=

###### folder ./crops ######

### barley.lua ###
Barley Seed=Sementes de Cevada
Barley=Cevada

### beans.lua ###
Green Beans=Feijoes Verdes
Bean Pole (place on soil before planting beans)=Apoio de feijao (coloque no solo antes de plantar feijao)

### beetroot.lua ###
Beetroot=
Beetroot Soup=

### blueberry.lua ###
Blueberries=Mirtilos
Blueberry Muffin=Muffin de Mirtilos
Blueberry Pie=

### carrot.lua ##
Carrot=Cenoura
Carrot Juice=
Golden Carrot=Cenoura Dourada

### chili.lua ###
Chili Pepper=
Bowl of Chili=

### cocoa.lua ###
Cocoa Beans=Amendoas de Cacau
Cookie=Cookie
Bar of Dark Chocolate=Barra de Chocolate Preto
Chocolate Block=

### coffee.lua ###
Coffee Beans=Grao de Cafe
Cup of Coffee=Xicara de Cafe

### corn.lua ###
Corn=Milho
Corn on the Cob=Espiga de Milho
Cornstarch=
Bottle of Ethanol=Garrafa de Etanol

### cotton.lua ###
Cotton Seed=Sementes de Algodao
Cotton=Algodao
String=

### cucumber.lua ###
Cucumber=Pepino

### garlic.lua ###
Garlic clove=
Garlic=
Garlic Braid=

### grapes.lua ###
Grapes=Uvas
Trellis (place on soil before planting grapes)=Grade de Ripas (colocar no solo antes de plantar uvas)

### hemp.lua ###
Hemp Seed=Sementes de Canhamo
Hemp Leaf=Folha de Canhamo
Bottle of Hemp Oil=Garrafa de Oleo de Canhamo
Hemp Fibre=Fibra de Canhamo
Hemp Block=
Hemp Rope=Corda de Canhamo

### melon.lua ###
Melon Slice=Sementes de Melancia
Melon=Melancia

### onion.lua ###
Onion=

### peas.lua ###
Pea Pod=
Peas=
Pea Soup=

### pepper.lua ###
Peppercorn=
Pepper=
Ground Pepper=

### pinapple.lua ###
Pineapple Top=
Pineapple=
Pineapple Ring=
Pineapple Juice=

### potato.lua ###
Potato=Batata
Baked Potato=Batata Cozida
Cucumber and Potato Salad=

### pumpkin.lua ###
Pumpkin Slice=Pedaço de Abobora
Jack 'O Lantern (punch to turn on and off)=Jack 'O Lantern (Socos para ligar e desligar)
Scarecrow Bottom=
Pumpkin Bread=Pao de Abobora
Pumpkin Dough=Massa de Abobora
Pumpkin=Abobora

### raspberry.lua ###
Raspberries=Framboesa
Raspberry Smoothie=Batida de Framboesa

### rhubarb.lua ###
Rhubarb=Ruibarbo
Rhubarb Pie=Torta de Ruibarbo

### ryeoatrice.lua ###
Rye=
Rye seed=
Oat=
Oat seed=
Rice=
Rice grains=
Rice Bread=
Rice Flour=
Multigrain Flour=
Multigrain Bread=

### tomato.lua ###
Tomato=Tomate

### wheat.lua ###
Wheat Seed=Sementes de Trigo
Wheat=Trigo
Straw=Palha
Flour=Farinha
Bread=Pao
Sliced Bread=
Toast=
Toast Sandwich=


code:
# Russian translation of the farming mod by TenPlus1
# textdomain: farming
# author: codexp <codexp@gmx.net>
# author: TheDarkTiger
# author: YELLOW <pikayellow35@gmail.com>
# last update: 2020/Jun/20

###### folder . ######

### init.lua ###
Seed=Семена

### compatibility.lua ###
Banana=Банан
Banana Leaves=Листья банана
Orange=Апельсин
Strawberry=Земляника

### food.lua ###
Sugar=Сахар
Salt=Соль
Rose Water=Розовая вода
Turkish Delight=Рахат-лукум
Garlic Bread=Чесночный хлеб
Donut=Пончик
Chocolate Donut=Шоколадный пончик
Apple Donut=Яблочный пончик
Porridge=Каша
Jaffa Cake=Яффский пирог
Apple Pie=Яблочный пирог
Cactus Juice=Кактусовый сок

### hoes.lua ###
Hoe=Мотыга
Wooden Hoe=Деревянная мотыга
Stone Hoe=Каменная мотыга
Steel Hoe=Стальная мотыга
Bronze Hoe=Бронзовая мотыга
Mese Hoe=Магическая мотыга
Diamond Hoe=Алмазная мотыга
# Surcharge du mod [Toolranks] à faire #
Hoe Bomb (use or throw on grassy areas to hoe land)=Мотыгобомба (используйте или бросьте на траву для ее обработки)
Mithril Scythe (Right-click to harvest and replant crops)=Мифриловая коса (Щелкните правой кнопкой мыши для сбора и пересадки растений)
# Surcharge du mod [Toolranks] à faire #
%s Hoe=%s мотыга
Silver=Серебряная
Mithril=Мифриловая
Silver Hoe=Серебряная
Mithril Hoe=Мифриловая

### soil.lua ###
Soil=Земля
Wet Soil=Увлажненная земля
Savanna Soil=Земля саванны
Wet Savanna Soil=Увлажненная земля саванны

### utensils.lua ###
Wooden Bowl=Деревянная миска
Saucepan=Кастрюля
Cooking Pot=Котел
Baking Tray=Противень
Skillet=Сковорода
Mortar and Pestle=Ступка и пестик
Cutting Board=Разделочная доска
Juicer=Соковыжималка
Glass Mixing Bowl=Стеклянная чаша

###### folder ./crops ######

### barley.lua ###
Barley Seed=Семена ячменя
Barley=Ячмень

### beans.lua ###
Green Beans=Зеленая фасоль
Bean Pole (place on soil before planting beans)=Жердь для бобовых (установите на почву перед посадкой бобовых)

### beetroot.lua ###
Beetroot=Свекла
Beetroot Soup=Борщ

### blueberry.lua ###
Blueberries=Голубика
Blueberry Muffin=Кекс с голубикой
Blueberry Pie=Пирог с голубикой

### carrot.lua ##
Carrot=Морковь
Carrot Juice=Морковный сок
Golden Carrot=Золотая морковь

### chili.lua ###
Chili Pepper=Перец чили
Bowl of Chili=Миска чили

### cocoa.lua ###
Cocoa Beans=Какао-бобы
Cookie=Печенье
Bar of Dark Chocolate=Плитка темного шоколада
Chocolate Block=Шоколадный блок

### coffee.lua ###
Coffee Beans=Кофейные зерна
Cup of Coffee=Чашка кофе

### corn.lua ###
Corn=Кукуруза
Corn on the Cob=Початок кукурузы
Cornstarch=Кукурузный крахмал
Bottle of Ethanol=Бутылка спирта

### cotton.lua ###
Wild Cotton=Дикорастущий хлопок
Cotton Seed=Семена хлопка
Cotton=Хлопок
String=Нить

### cucumber.lua ###
Cucumber=Огурец

### garlic.lua ###
Garlic clove=Зубчик чеснока
Garlic=Чеснок
Garlic Braid=Связка чеснока

### grapes.lua ###
Grapes=Виноград
Trellis (place on soil before planting grapes)=Решетка (поставьте на почву перед посадкой винограда)

### hemp.lua ###
Hemp Seed=Семена конопли
Hemp Leaf=Лист конопли
Bottle of Hemp Oil=Бутылка конопляного масла
Hemp Fibre=Конопляное волокно
Hemp Block=Блок конопли
Hemp Rope=Пеньковая веревка

### melon.lua ###
Melon Slice=Долька арбуза
Melon=Арбуз

### mint.lua ###
Mint Seeds=Семена мяты
Mint Leaf=Лист мяты
Mint Tea=Чай с мятой

### onion.lua ###
Onion=Лук
Onion Soup=Луковый суп

### peas.lua ###
Pea Pod=Стручок гороха
Peas=Горох
Pea Soup=Гороховый суп

### pepper.lua ###
Peppercorn=Перчинка
Pepper=Перец
Ground Pepper=Молотый перец

### pinapple.lua ###
Pineapple Top=Верхушка ананаса
Pineapple=Ананас
Pineapple Ring=Кольцо ананаса
Pineapple Juice=Ананасовый сок

### potato.lua ###
Potato=Картофель
Baked Potato=Печеный картофель
Cucumber and Potato Salad=Салат из огурцов и картофеля

### pumpkin.lua ###
Pumpkin Slice=Ломтик тыквы
Jack 'O Lantern (punch to turn on and off)=Светильник джека (удар для включения и выключения)
Scarecrow Bottom=Основание пугала
Pumpkin Bread=Тыквенный хлеб
Pumpkin Dough=Тыквенное тесто
Pumpkin=Тыква

### raspberry.lua ###
Raspberries=Малина
Raspberry Smoothie=Малиновый смузи

### rhubarb.lua ###
Rhubarb=Ревень
Rhubarb Pie=Пирог с ревенем

### ryeoatrice.lua ###
Rye=Рожь
Rye seed=Зёрна ржи
Oat=Овес
Oat seed=Семена овса
Rice grains=Зёрна риса
Rice=Рис
Rice Bread=Рисовый хлеб
Rice Flour=Рисовая мука
Multigrain Flour=Мультизерновая мука
Multigrain Bread=Мультизерновой хлеб

### tomato.lua ###
Tomato=Помидор

### wheat.lua ###
Wheat Seed=Зёрна пшеницы
Wheat=Пшеница
Straw=Солома
Flour=Мука
Bread=Хлеб
Sliced Bread=Нарезанный хлеб
Toast=Тост
Toast Sandwich=Сэндвич


code:
# Translation of the farming mod by TenPlus1
# textdomain: farming
# author: (you)
# last update: 2020/Apr/26

###### folder . ######

### init.lua ###
Seed=

### compatibility.lua ###
Banana=
Banana Leaves=
Orange=
Strawberry=

### food.lua ###
Sugar=
Salt=
Rose Water=
Turkish Delight=
Garlic Bread=
Donut=
Chocolate Donut=
Apple Donut=
Porridge=
Jaffa Cake=

### hoes.lua ###
Hoe=
Wooden Hoe=
Stone Hoe=
Steel Hoe=
Bronze Hoe=
Mese Hoe=
Diamond Hoe=
# Surcharge du mod [Toolranks] � faire #
Hoe Bomb (use or throw on grassy areas to hoe land)=
Mithril Scythe (Right-click to harvest and replant crops)=
# Surcharge du mod [Toolranks] � faire #

### soil.lua ###
Soil=
Wet Soil=

### utensils.lua ###
Wooden Bowl=
Saucepan=
Cooking Pot=
Baking Tray=
Skillet=
Mortar and Pestle=
Cutting Board=
Juicer=
Glass Mixing Bowl=

###### folder ./crops ######

### barley.lua ###
Barley Seed=
Barley=

### beans.lua ###
Green Beans=
Bean Pole (place on soil before planting beans)=

### beetroot.lua ###
Beetroot=
Beetroot Soup=

### blueberry.lua ###
Blueberries=
Blueberry Muffin=
Blueberry Pie=

### carrot.lua ##
Carrot=
Carrot Juice=
Golden Carrot=

### chili.lua ###
Chili Pepper=
Bowl of Chili=

### cocoa.lua ###
Cocoa Beans=
Cookie=
Bar of Dark Chocolate=
Chocolate Block=

### coffee.lua ###
Coffee Beans=
Cup of Coffee=

### corn.lua ###
Corn=
Corn on the Cob=
Cornstarch=
Bottle of Ethanol=

### cotton.lua ###
Cotton Seed=
Cotton=
String=

### cucumber.lua ###
Cucumber=

### garlic.lua ###
Garlic clove=
Garlic=
Garlic Braid=

### grapes.lua ###
Grapes=
Trellis (place on soil before planting grapes)=

### hemp.lua ###
Hemp Seed=
Hemp Leaf=
Bottle of Hemp Oil=
Hemp Fibre=
Hemp Block=
Hemp Rope=

### melon.lua ###
Melon Slice=
Melon=

### onion.lua ###
Onion=

### peas.lua ###
Pea Pod=
Peas=
Pea Soup=

### pepper.lua ###
Peppercorn=
Pepper=
Ground Pepper=

### pinapple.lua ###
Pineapple Top=
Pineapple=
Pineapple Ring=
Pineapple Juice=

### potato.lua ###
Potato=
Baked Potato=
Cucumber and Potato Salad=

### pumpkin.lua ###
Pumpkin Slice=
Jack 'O Lantern (punch to turn on and off)=
Scarecrow Bottom=
Pumpkin Bread=
Pumpkin Dough=
Pumpkin=

### raspberry.lua ###
Raspberries=
Raspberry Smoothie=

### rhubarb.lua ###
Rhubarb=
Rhubarb Pie=

### ryeoatrice.lua ###
Rye=
Rye seed=
Oat=
Oat seed=
Rice=
Rice grains=
Rice Bread=
Rice Flour=
Multigrain Flour=
Multigrain Bread=

### tomato.lua ###
Tomato=

### wheat.lua ###
Wheat Seed=
Wheat=
Straw=
Flour=
Bread=
Sliced Bread=
Toast=
Toast Sandwich=


code:
-- add lucky blocks

if minetest.get_modpath("lucky_block") then

	lucky_block:add_blocks({
		{"dro", {"farming:corn"}, 5},
		{"dro", {"farming:coffee_cup_hot"}, 1},
		{"dro", {"farming:bread"}, 5},
		{"nod", "farming:jackolantern", 0},
		{"tro", "farming:jackolantern_on"},
		{"nod", "default:river_water_source", 1},
		{"tel"},
		{"dro", {"farming:trellis", "farming:grapes"}, 5},
		{"dro", {"farming:bottle_ethanol"}, 1},
		{"nod", "farming:melon", 0},
		{"dro", {"farming:donut", "farming:donut_chocolate", "farming:donut_apple"}, 5},
		{"dro", {"farming:hemp_leaf", "farming:hemp_fibre", "farming:seed_hemp"}, 10},
		{"nod", "fire:permanent_flame", 1},
		{"dro", {"farming:chili_pepper", "farming:chili_bowl"}, 5},
		{"dro", {"farming:bowl"}, 3},
		{"dro", {"farming:saucepan"}, 1},
		{"dro", {"farming:pot"}, 1},
		{"dro", {"farming:baking_tray"}, 1},
		{"dro", {"farming:skillet"}, 1},
		{"exp", 4},
		{"dro", {"farming:mortar_pestle"}, 1},
		{"dro", {"farming:cutting_board"}, 1},
		{"dro", {"farming:juicer"}, 1},
		{"dro", {"farming:mixing_bowl"}, 1},
		{"dro", {"farming:hoe_bronze"}, 1},
		{"dro", {"farming:hoe_mese"}, 1},
		{"dro", {"farming:hoe_diamond"}, 1},
		{"dro", {"farming:hoe_bomb"}, 10},
		{"dro", {"farming:turkish_delight"}, 5},
		{"lig"},
		{"dro", {"farming:scythe_mithril"}, 1},
		{"sch", "instafarm", 0, true, {
			{"farming:wheat_8", "farming:carrot_8"},
			{"farming:cotton_8", "farming:rhubarb_3"},
		}},
		{"sch", "instafarm", 0, true, {
			{"farming:wheat_8", "farming:pepper_5"},
			{"farming:cotton_8", "farming:onion_5"},
		}},
		{"sch", "instafarm", 0, true, {
			{"farming:wheat_8", "farming:beetroot_5"},
			{"farming:cotton_8", "farming:barley_7"},
		}},
		{"sch", "instafarm", 0, true, {
			{"farming:wheat_8", "farming:corn_8"},
			{"farming:cotton_8", "farming:grapes_8"},
		}},
		{"sch", "instafarm", 0, true, {
			{"farming:wheat_8", "farming:pea_5"},
			{"farming:cotton_8", "farming:coffee_5"},
		}},
		{"sch", "instafarm", 0, true, {
			{"farming:wheat_8", "farming:raspberry_4"},
			{"farming:cotton_8", "farming:tomato_8"},
		}},
		{"sch", "instafarm", 0, true, {
			{"farming:wheat_8", "farming:chili_8"},
			{"farming:cotton_8", "farming:cucumber_4"},
		}},
		{"nod", "default:chest", 0, {
			{name = "farming:seed_wheat", max = 15},
			{name = "farming:seed_barley", max = 15},
			{name = "farming:seed_barley", max = 15},
			{name = "farming:seed_hemp", max = 15},
			{name = "farming:seed_rye", max = 15},
			{name = "farming:seed_rice", max = 15},
			{name = "farming:seed_oat", max = 15},
			{name = "farming:soil_wet", max = 10},
		}},
	})
end


code:
-- decoration function
local function register_plant(name, min, max, spawnon, spawnby, num, rarety)

	-- do not place on mapgen if no value given (or not true)
	if not rarety then
		return
	end

	-- set rarety value or default to farming.rarety if not a number
	rarety = tonumber(rarety) or farming.rarety

	minetest.register_decoration({
		deco_type = "simple",
		place_on = spawnon or {"default:dirt_with_grass"},
		sidelen = 16,
		noise_params = {
			offset = 0,
			scale = rarety,
			spread = {x = 100, y = 100, z = 100},
			seed = 329,
			octaves = 3,
			persist = 0.6
		},
		y_min = min,
		y_max = max,
		decoration = "farming:" .. name,
		spawn_by = spawnby,
		num_spawn_by = num
	})
end

-- add crops to mapgen
register_plant("potato_3", 15, 40, nil, "", -1, farming.potato)
register_plant("tomato_7", 5, 20, nil, "", -1, farming.tomato)
register_plant("corn_7", 12, 22, nil, "", -1, farming.corn)
register_plant("coffee_5", 20, 45, {"default:dirt_with_dry_grass",
	"default:dirt_with_rainforest_litter",
	"default:dry_dirt_with_dry_grass"}, "", -1, farming.coffee)
register_plant("raspberry_4", 3, 10, nil, "", -1, farming.raspberry)
register_plant("rhubarb_3", 3, 15, nil, "", -1, farming.rhubarb)
register_plant("blueberry_4", 3, 10, nil, "", -1, farming.blueberry)
register_plant("beanbush", 18, 35, nil, "", -1, farming.beans)
register_plant("grapebush", 25, 45, nil, "", -1, farming.grapes)
register_plant("onion_5", 5, 22, nil, "", -1, farming.onion)
register_plant("garlic_5", 3, 30, nil, "group:tree", 1, farming.garlic)
register_plant("pea_5", 25, 50, nil, "", -1, farming.peas)
register_plant("beetroot_5", 1, 15, nil, "", -1, farming.beetroot)
register_plant("mint_4", 1, 75, {"default:dirt_with_grass",
"default:dirt_with_coniferous_litter"}, "group:water", 1, farming.mint)
register_plant("cabbage_6", 2, 10, nil, "", -1, farming.cabbage)

if minetest.get_mapgen_setting("mg_name") == "v6" then

	register_plant("carrot_8", 1, 30, nil, "group:water", 1, farming.carrot)
	register_plant("cucumber_4", 1, 20, nil, "group:water", 1, farming.cucumber)
	register_plant("melon_8", 1, 20, nil, "group:water", 1, farming.melon)
	register_plant("pumpkin_8", 1, 20, nil, "group:water", 1, farming.pumpkin)
else
	-- v7 maps have a beach so plants growing near water is limited to 6 high
	register_plant("carrot_8", 1, 15, nil, "", -1, farming.carrot)
	register_plant("cucumber_4", 1, 10, nil, "", -1, farming.cucumber)
	register_plant("melon_8", 1, 6, {"default:dirt_with_dry_grass",
		"default:dirt_with_rainforest_litter"}, "", -1, farming.melon)
	register_plant("pumpkin_8", 1, 6, nil, "", -1, farming.pumpkin)
end

if farming.hemp then
minetest.register_decoration({
	deco_type = "simple",
	place_on = {"default:dirt_with_grass", "default:dirt_with_rainforest_litter"},
	sidelen = 16,
	noise_params = {
		offset = 0,
		scale = tonumber(farming.hemp) or farming.rarety,
		spread = {x = 100, y = 100, z = 100},
		seed = 420,
		octaves = 3,
		persist = 0.6
	},
	y_min = 3,
	y_max = 45,
	decoration = "farming:hemp_7",
	spawn_by = "group:tree",
	num_spawn_by = 1
})
end

if farming.chili then
minetest.register_decoration({
	deco_type = "simple",
	place_on = {"default:dirt_with_grass", "default:dirt_with_rainforest_litter"},
	sidelen = 16,
	noise_params = {
		offset = 0,
		scale = tonumber(farming.chili) or farming.rarety,
		spread = {x = 100, y = 100, z = 100},
		seed = 760,
		octaves = 3,
		persist = 0.6
	},
	y_min = 5,
	y_max = 35,
	decoration = {"farming:chili_8"},
	spawn_by = "group:tree",
	num_spawn_by = 1
})
end

if farming.pepper then
minetest.register_decoration({
	deco_type = "simple",
	place_on = {"default:dirt_with_rainforest_litter"},
	sidelen = 16,
	noise_params = {
		offset = 0,
		scale = tonumber(farming.pepper) or farming.rarety,
		spread = {x = 100, y = 100, z = 100},
		seed = 933,
		octaves = 3,
		persist = 0.6
	},
	y_min = 5,
	y_max = 35,
	decoration = {"farming:pepper_5"},
	spawn_by = "group:tree",
	num_spawn_by = 1
})
end

if farming.pineapple then
minetest.register_decoration({
	deco_type = "simple",
	place_on = {"default:dirt_with_dry_grass", "default:dry_dirt_with_dry_grass"},
	sidelen = 16,
	noise_params = {
		offset = 0,
		scale = tonumber(farming.pineapple) or farming.rarety,
		spread = {x = 100, y = 100, z = 100},
		seed = 917,
		octaves = 3,
		persist = 0.6
	},
	y_min = 18,
	y_max = 30,
	decoration = {"farming:pineapple_8"}
})
end

minetest.register_decoration({
	name = "farming:cotton_wild",
	deco_type = "simple",
	place_on = {"default:dry_dirt_with_dry_grass"},
	sidelen = 16,
	noise_params = {
		offset = -0.1,
		scale = 0.1,
		spread = {x = 50, y = 50, z = 50},
		seed = 4242,
		octaves = 3,
		persist = 0.7
	},
	biomes = {"savanna"},
	y_max = 31000,
	y_min = 1,
	decoration = "farming:cotton_wild"
})


code:
name = farming
description = Adds many plants and food to Minetest.
depends = default
optional_depends = stairs, intllib, lucky_block, toolranks
author = TenPlus1
title = Farming


code:
#    Contains a value used for speed of crop growth in seconds
farming_stage_length (Farming Stage Length) float 160.0


code:
local S = farming.intllib

-- add soil types to existing dirt blocks
minetest.override_item("default:dirt", {
	soil = {
		base = "default:dirt",
		dry = "farming:soil",
		wet = "farming:soil_wet"
	}
})

minetest.override_item("default:dirt_with_grass", {
	soil = {
		base = "default:dirt_with_grass",
		dry = "farming:soil",
		wet = "farming:soil_wet"
	}
})

minetest.override_item("default:dirt_with_dry_grass", {
	soil = {
		base = "default:dirt_with_dry_grass",
		dry = "farming:soil",
		wet = "farming:soil_wet"
	}
})

minetest.override_item("default:dirt_with_rainforest_litter", {
	soil = {
		base = "default:dirt_with_rainforest_litter",
		dry = "farming:soil",
		wet = "farming:soil_wet"
	}
})

minetest.override_item("default:dirt_with_coniferous_litter", {
	soil = {
		base = "default:dirt_with_coniferous_litter",
		dry = "farming:soil",
		wet = "farming:soil_wet"
	}
})

minetest.override_item("default:dry_dirt", {
	soil = {
		base = "default:dry_dirt",
		dry = "farming:dry_soil",
		wet = "farming:dry_soil_wet"
	}
})

minetest.override_item("default:dry_dirt_with_dry_grass", {
	soil = {
		base = "default:dry_dirt_with_dry_grass",
		dry = "farming:dry_soil",
		wet = "farming:dry_soil_wet"
	}
})

-- normal soil
minetest.register_node("farming:soil", {
	description = S("Soil"),
	tiles = {"default_dirt.png^farming_soil.png", "default_dirt.png"},
	drop = "default:dirt",
	groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 2, field = 1},
	sounds = default.node_sound_dirt_defaults(),
	soil = {
		base = "default:dirt",
		dry = "farming:soil",
		wet = "farming:soil_wet"
	}
})

-- wet soil
minetest.register_node("farming:soil_wet", {
	description = S("Wet Soil"),
	tiles = {
		"default_dirt.png^farming_soil_wet.png",
		"default_dirt.png^farming_soil_wet_side.png"},
	drop = "default:dirt",
	groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 3, field = 1},
	sounds = default.node_sound_dirt_defaults(),
	soil = {
		base = "default:dirt",
		dry = "farming:soil",
		wet = "farming:soil_wet"
	}
})

-- savanna soil
if minetest.registered_nodes["default:dry_dirt"] then
minetest.register_node("farming:dry_soil", {
	description = S("Savanna Soil"),
	tiles = {
		"default_dry_dirt.png^farming_soil.png",
		"default_dry_dirt.png"},
	drop = "default:dry_dirt",
	groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 2, field = 1},
	sounds = default.node_sound_dirt_defaults(),
	soil = {
		base = "default:dry_dirt",
		dry = "farming:dry_soil",
		wet = "farming:dry_soil_wet"
	}
})

minetest.register_node("farming:dry_soil_wet", {
	description = S("Wet Savanna Soil"),
	tiles = {
		"default_dry_dirt.png^farming_soil_wet.png",
		"default_dry_dirt.png^farming_soil_wet_side.png"},
	drop = "default:dry_dirt",
	groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 3, field = 1},
	sounds = default.node_sound_dirt_defaults(),
	soil = {
		base = "default:dry_dirt",
		dry = "farming:dry_soil",
		wet = "farming:dry_soil_wet"
	}
})
end

-- sand is not soil, change existing sand-soil to use dry soil
minetest.register_alias("farming:desert_sand_soil", "farming:dry_soil")
minetest.register_alias("farming:desert_sand_soil_wet", "farming:dry_soil_wet")

-- if water near soil then change to wet soil
minetest.register_abm({
	nodenames = {"group:field"},
	interval = 15,
	chance = 4,
	catch_up = false,

	action = function(pos, node)

		local ndef = minetest.registered_nodes[node.name]
		if not ndef or not ndef.soil or not ndef.soil.wet
		or not ndef.soil.base or not ndef.soil.dry then return end

		pos.y = pos.y + 1
		local nn = minetest.get_node_or_nil(pos)
		pos.y = pos.y - 1

		if nn then nn = nn.name else return end

		-- what's on top of soil, if solid/not plant change soil to dirt
		if minetest.registered_nodes[nn]
		and minetest.registered_nodes[nn].walkable
		and minetest.get_item_group(nn, "plant") == 0 then
			minetest.set_node(pos, {name = "default:dirt"})
			return
		end

		-- if map around soil not loaded then skip until loaded
		if minetest.find_node_near(pos, 3, {"ignore"}) then
			return
		end

		-- check if water is within 3 nodes horizontally and 1 below
		if #minetest.find_nodes_in_area(
				{x = pos.x + 3, y = pos.y - 1, z = pos.z + 3},
				{x = pos.x - 3, y = pos.y    , z = pos.z - 3},
				{"group:water"}) > 0 then

			minetest.set_node(pos, {name = ndef.soil.wet})

		elseif node.name == ndef.soil.wet then
			minetest.set_node(pos, {name = ndef.soil.dry})

		elseif node.name == ndef.soil.dry
		and minetest.get_item_group(nn, "plant") == 0 then
			minetest.set_node(pos, {name = ndef.soil.base})
		end
	end
})


code:
local statistics = {}
local ROOT_2 = math.sqrt(2.0)

-- Approximations for erf(x) and erfInv(x) from
-- https://en.wikipedia.org/wiki/Error_function

local erf
local erf_inv

local A = 8 * (math.pi - 3.0)/(3.0 * math.pi * (4.0 - math.pi))
local B = 4.0 / math.pi
local C = 2.0/(math.pi * A)
local D = 1.0 / A

erf = function(x)

	if x == 0 then return 0; end

	local xSq  = x * x
	local aXSq = A * xSq
	local v = math.sqrt(1.0 - math.exp(-xSq * (B + aXSq) / (1.0 + aXSq)))

	return (x > 0 and v) or -v
end

erf_inv = function(x)

	if x == 0 then return 0; end

	if x <= -1 or x >= 1 then return nil; end

	local y = math.log(1 - x * x)
	local u = C + 0.5 * y
	local v = math.sqrt(math.sqrt(u * u - D * y) - u)

	return (x > 0 and v) or -v
end

local function std_normal(u)
	return ROOT_2 * erf_inv(2.0 * u - 1.0)
end

local poisson
local cdf_table = {}

local function generate_cdf(lambda_index, lambda)

	local max = math.ceil(4 * lambda)
	local pdf = math.exp(-lambda)
	local cdf = pdf
	local t = { [0] = pdf }

	for i = 1, max - 1 do
		pdf = pdf * lambda / i
		cdf = cdf + pdf
		t[i] = cdf
	end

	return t
end

for li = 1, 100 do
	cdf_table[li] = generate_cdf(li, 0.25 * li)
end

poisson = function(lambda, max)

	if max < 2 then
		return (math.random() < math.exp(-lambda) and 0) or 1
	elseif lambda >= 2 * max then
		return max
	end

	local u = math.random()
	local lambda_index = math.floor(4 * lambda + 0.5)
	local cdfs = cdf_table[lambda_index]

	if cdfs then

		lambda = 0.25 * lambda_index

		if u < cdfs[0] then return 0; end
		if max > #cdfs then max = #cdfs + 1 else max = math.floor(max); end
		if u >= cdfs[max - 1] then return max; end

		if max > 4 then  -- Binary search

			local s = 0

			while s + 1 < max do

				local m = math.floor(0.5 * (s + max))

				if u < cdfs[m] then max = m; else s = m; end
			end
		else
			for i = 1, max - 1 do
				if u < cdfs[i] then return i; end
			end
		end

		return max
	else
		local x = lambda + math.sqrt(lambda) * std_normal(u)

		return (x < 0.5 and 0) or (x >= max - 0.5 and max) or math.floor(x + 0.5)
	end
end

-- Error function.
statistics.erf = erf

-- Inverse error function.
statistics.erf_inv = erf_inv

--- Standard normal distribution function (mean 0, standard deviation 1).
 --
 -- @return
 --    Any real number (actually between -3.0 and 3.0).

statistics.std_normal = function()

	local u = math.random()

	if u < 0.001 then
		return -3.0
	elseif u > 0.999 then
		return 3.0
	end

	return std_normal(u)
end

--- Standard normal distribution function (mean 0, standard deviation 1).
 --
 -- @param mu
 --    The distribution mean.
 -- @param sigma
 --    The distribution standard deviation.
 -- @return
 --    Any real number (actually between -3*sigma and 3*sigma).

statistics.normal = function(mu, sigma)

	local u = math.random()

	if u < 0.001 then
		return mu - 3.0 * sigma
	elseif u > 0.999 then
		return mu + 3.0 * sigma
	end

	return mu + sigma * std_normal(u)
end

--- Poisson distribution function.
 --
 -- @param lambda
 --    The distribution mean and variance.
 -- @param max
 --    The distribution maximum.
 -- @return
 --    An integer between 0 and max (both inclusive).

statistics.poisson = function(lambda, max)

	lambda, max = tonumber(lambda), tonumber(max)

	if not lambda or not max or lambda <= 0 or max < 1 then return 0; end

	return poisson(lambda, max)
end

return statistics


code:
local S = farming.intllib

-- wooden bowl

minetest.register_craftitem("farming:bowl", {
	description = S("Wooden Bowl"),
	inventory_image = "farming_bowl.png",
	groups = {food_bowl = 1, flammable = 2}
})

minetest.register_craft({
	output = "farming:bowl 4",
	recipe = {
		{"group:wood", "", "group:wood"},
		{"", "group:wood", ""}
	}
})

minetest.register_craft({
	type = "fuel",
	recipe = "farming:bowl",
	burntime = 10,
})

-- saucepan

minetest.register_craftitem("farming:saucepan", {
	description = S("Saucepan"),
	inventory_image = "farming_saucepan.png",
	groups = {food_saucepan = 1, flammable = 2}
})

minetest.register_craft({
	output = "farming:saucepan",
	recipe = {
		{"default:steel_ingot", "", ""},
		{"", "group:stick", ""}
	}
})

-- cooking pot

minetest.register_craftitem("farming:pot", {
	description = S("Cooking Pot"),
	inventory_image = "farming_pot.png",
	groups = {food_pot = 1, flammable = 2}
})

minetest.register_craft({
	output = "farming:pot",
	recipe = {
		{"group:stick", "default:steel_ingot", "default:steel_ingot"},
		{"", "default:steel_ingot", "default:steel_ingot"}
	}
})

-- baking tray

minetest.register_craftitem("farming:baking_tray", {
	description = S("Baking Tray"),
	inventory_image = "farming_baking_tray.png",
	groups = {food_baking_tray = 1, flammable = 2}
})

minetest.register_craft({
	output = "farming:baking_tray",
	recipe = {
		{"default:clay_brick", "default:clay_brick", "default:clay_brick"},
		{"default:clay_brick", "", "default:clay_brick"},
		{"default:clay_brick", "default:clay_brick", "default:clay_brick"}
	}
})

-- skillet

minetest.register_craftitem("farming:skillet", {
	description = S("Skillet"),
	inventory_image = "farming_skillet.png",
	groups = {food_skillet = 1, flammable = 2}
})

minetest.register_craft({
	output = "farming:skillet",
	recipe = {
		{"default:steel_ingot", "", ""},
		{"", "default:steel_ingot", ""},
		{"", "", "group:stick"}
	}
})

-- mortar and pestle

minetest.register_craftitem("farming:mortar_pestle", {
	description = S("Mortar and Pestle"),
	inventory_image = "farming_mortar_pestle.png",
	groups = {food_mortar_pestle = 1, flammable = 2}
})

minetest.register_craft({
	output = "farming:mortar_pestle",
	recipe = {
		{"default:stone", "group:stick", "default:stone"},
		{"", "default:stone", ""}
	}
})

-- cutting board

minetest.register_craftitem("farming:cutting_board", {
	description = S("Cutting Board"),
	inventory_image = "farming_cutting_board.png",
	groups = {food_cutting_board = 1, flammable = 2}
})

minetest.register_craft({
	output = "farming:cutting_board",
	recipe = {
		{"default:steel_ingot", "", ""},
		{"", "group:stick", ""},
		{"", "", "group:wood"}
	}
})

-- juicer

minetest.register_craftitem("farming:juicer", {
	description = S("Juicer"),
	inventory_image = "farming_juicer.png",
	groups = {food_juicer = 1, flammable = 2}
})

minetest.register_craft({
	output = "farming:juicer",
	recipe = {
		{"", "default:stone", ""},
		{"default:stone", "", "default:stone"}
	}
})

-- glass mixing bowl

minetest.register_craftitem("farming:mixing_bowl", {
	description = S("Glass Mixing Bowl"),
	inventory_image = "farming_mixing_bowl.png",
	groups = {food_mixing_bowl = 1, flammable = 2}
})

minetest.register_craft({
	output = "farming:mixing_bowl",
	recipe = {
		{"default:glass", "group:stick", "default:glass"},
		{"", "default:glass", ""}
	}
})

minetest.register_craft( {
	type = "shapeless",
	output = "vessels:glass_fragments",
	recipe = {
		"farming:mixing_bowl"
	}
})


code:
ExtraBlocks mod for Minetest (ver.0.0.4)
Copyright (C) 2019 - gigomaf <bartiko2@poczta.fm>

"ExtraBlocks" is free software, you can redistribute
and modify it under the terms of the GNU LGPL license.

ExtraBlocks is a decoration mod with some extra features:

Fireplace - decorative block, you may switch it on and off

Textures: (CC BY-NC 3.0) by gigomaf

Sounds:
fire.ogg (CC0 1.0) https://freesound.org/people/Adam_N/sounds/164661/


code:
-- FIREPLACE -----------------------------------------------

minetest.register_node("fireplace:fireplace", {
	description = "Fireplace",
	tiles = {"fireplace_top.png", "fireplace_top.png", "fireplace_side.png", "fireplace_top.png", "fireplace_top.png", "fireplace_front.png"},
	groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
	paramtype2 = "facedir",
	sounds = default.node_sound_stone_defaults(),
	on_rightclick = function(pos, node, clicker, itemstack)
		node.name = "fireplace:fireplace_active"
		minetest.set_node(pos, node)
		minetest.sound_play("fire", {
			pos = pos,
			max_hear_distance = 10,
			gain = 6,
		})
	end
})

minetest.register_node("fireplace:fireplace_active", {
	tiles = {
	"fireplace_top.png", "fireplace_top.png", "fireplace_side.png", "fireplace_top.png", "fireplace_top.png",
		{
			image = "fireplace_active.png",
			animation = {
				type = "vertical_frames",
				aspect_w = 16,
				aspect_h = 16,
				length = 1.5
			},
		}
	},
	groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
	paramtype2 = "facedir",
	light_source = 8,
	on_rightclick = function(pos, node, clicker, itemstack)
		node.name = "fireplace:fireplace"
		minetest.set_node(pos, node)
	end
})

minetest.register_craft({
	output = 'fireplace:fireplace',
	recipe = {
		{'default:wood', 'default:wood', 'default:wood'},
		{'default:stone', 'default:coalblock', 'default:stone'},
		{'default:stone', 'default:stone', 'default:stone'},
	}
})


code:
name = fireplace
depends = default


code:
# Fruit Tools
Adds a variety of fruit tools and other fruit-related items to Minetest.

![alt text](https://github.com/ChimneySwift/fruit_tools/blob/master/screenshot.png "All of the Fruit Tools")

**Code license:** [MIT](https://opensource.org/licenses/MIT)

**Textures license:** [MIT](https://opensource.org/licenses/MIT)

**Dependencies:** farming, default, bucket, vessels

**Optional Dependencies:** mobs, 3d_armor, toolranks

## Tools:
Fruit tools will occasionally drop the fruit they are made when used, this fuctionality can be adjusted in init.lua (See "Settings" section of this document).

- Admin pick (IMPORTANT NOTE: Please see "Settings" section of this document)
  - Tool capabilities:
      - full_punch_interval: 0.1
      - max_drop_level: 3
      - groupcaps: 0 for everything
      - fleshy: 100
      - Note: can break cloud, requires additional privs for use (picklepick/dealer depending on which pick is enabled)
- Corn pick
  - Tool capabilities:
      - full_punch_interval: 0.9
      - max_drop_level: 3
      - cracky: {times={[1]=2.0, [2]=1.0, [3]=0.50}, uses=30, maxlevel=3}
      - fleshy: 5
- Bean hoe
  - Tool capabilities:
      - uses: 1000
- Raspberry axe
  - Tool capabilities:
      - full_punch_interval: 0.9
      - max_drop_level: 1
      - choppy: {times={[1]=1.90, [2]=0.80, [3]=0.40}, uses=50, maxlevel=2}
      - fleshy: 7
- Melon axe
  - Tool capabilities:
      - full_punch_interval: 0.9
      - max_drop_level: 1
      - choppy: {times={[1]=1.80, [2]=0.70, [3]=0.30}, uses=70, maxlevel=2}
      - fleshy: 7
- Grape shovel
  - Tool capabilities:
      - full_punch_interval: 1.0
      - max_drop_level: 1
      - crumbly: {times={[1]=1.00, [2]=0.40, [3]=0.20}, uses=50, maxlevel=3}
      - fleshy: 4
- Apple shovel
  - Tool capabilities:
      - full_punch_interval: 1.0
      - max_drop_level: 1
      - crumbly: {times={[1]=0.9, [2]=0.30, [3]=0.10}, uses=80, maxlevel=3}
      - fleshy: 4
- Chili sword
  - Tool capabilities:
      - full_punch_interval: 0.5
      - max_drop_level: 1
      - snappy: {times={[1]=1.85, [2]=0.80, [3]=0.25}, uses=60, maxlevel=3}
      - fleshy: 8
- Carrot sword
  - Tool capabilities:
      - full_punch_interval: 0.5
      - max_drop_level: 1
      - snappy: {times={[1]=1.70, [2]=0.70, [3]=0.20}, uses=80, maxlevel=3}
      - fleshy: 9
- Golden carrot sword
  - Tool capabilities:
      - full_punch_interval: 0.4
      - max_drop_level: 1
      - snappy: {times={[1]=1.65, [2]=0.60, [3]=0.15}, uses=100, maxlevel=3}
      - fleshy: 10

### Crafting:
Pick:

m|m|m
-|-|-
r|s|r
r|s|r

m = Pick material (Eg: for Corn Pick it would be Corn on the Cob)

s = Stick

r = Tool Resin

Hoe:

m|m|×
-|-|-
r|s|r
r|s|r

m = Hoe material (Eg: for Bean Hoe it would be Green Beans)

s = Stick

r = Tool Resin

Axe:

r|m|m
-|-|-
r|s|m
r|s|r

m = Axe material (Eg: for Melon Axe it would be Melon Slice)

s = Stick

r = Tool Resin

Shovel:

×|m|×
-|-|-
r|s|r
r|s|r

m = Shovel material (Eg: for Apple Shovel it would be Apple)

s = Stick

r = Tool Resin

Sword:

×|m|×
-|-|-
r|m|r
r|m|r

m = Sword material (Eg: for Carrot Sword it would be Carrot)

r = Tool Resin

## Shields:
Fruit sheilds will occasionally drop the fruit they are made when hit (fruit placed in hitter's inventory), this fuctionality can be adjusted in init.lua (See "Settings" section of this document).

- Orange Sheild
  - Shield Capabilities:
      - armor_heal: 16
      - armor_use: 100
      - fleshy: 16
      - cracky: 2
      - snappy: 1
      - level: 3
- Tomato Sheild
  - Shield Capabilities:
      - armor_heal: 15
      - armor_use: 150
      - fleshy: 15
      - cracky: 2
      - snappy: 1
      - level: 3

### Crafting:

m|r|m
-|-|-
r|m|r
×|r|×

m = Sheild material (Eg: for Carrot Sword it would be Carrot)

r = Tool Resin

## Throwing Foods:

Throwing foods can be crafted from regular food. They look like regular food, but instead of being eaten they are thrown. If a throwing food lands on an unprotected dirt block, it may plant the thrown food if the food can be planted (Eg: if you throw a throwing tomato, it may plant a tomato plant) this fuctionality can be adjusted in init.lua (See "Settings" section of this document). Each throwing food does 2 fleshy damage.

* Throwing donut apple
* Throwing tomato
* Throwing blueberries
* Throwing grapes
* Throwing raspberries
* Throwing melon_slice
* Throwing orange
* Throwing strawberry

### Crafting

Throwing food:

f|f|f
-|-|-
f|s|f
f|f|f

f = Food material (Eg: for Throwing Tomato it would be Tomato)

s = Stone

Regular food (to revert back):

f|f|f
-|-|-
f|f|f
f|f|f

f = Throwing food (Eg: for Tomato it would be Throwing Tomato)

## Settings
### Admin Pick Settings:
By default the admin pick is set to the "Weed Pick", if you do not wish for your world to contain cannabis (aka weed) references, simply set the `say_no_to_cannabis` variable on line 8 of init.lua to `true`, this will replace the "Weed Pick" with the "Pickle Pick" (both tools have the same capabilities), if you do not wish for your world to contain pickle references then we can't help you, sorry.

### Extra Drops:
By default when a shield is hit, or a fruit tool is used, there is a 1 in 5 chance that between 1 and 5 of the shield/tool's food is also dropped. To enable/disable this set `extra_drops` on line 12 of `init.lua` to `false`. To change the drop chance change `extra_drop_chance` on line 14 of `init.lua`, to change the drop maximum change `extra_drop_max` on line 16 of `init.lua` and to change the drop minimum change `extra_drop_min` on line 18 of `init.lua`.

### Throwable Food Planting:
By default, when a throwable food hits an unprotected dirt node, it will place a fully grown plant of the throwable food's origin (Eg: Throwing Tomato plants a fully grown tomato plant) on top of the dirt 1 out of 5 times. To enable/disable this set `plant` on line 22 of `init.lua` to `false`. To make the mod first hoe the dirt, then place a new plant on top (instead of a fully grown one), set `plant_whole` on line 24 of `init.lua` to `false`. To change the chance of a plant being planted change `plant_chance` on line 26 of `init.lua`

## Notes
* This mod is a work in progress, tool capabilities etc. are subject to change, the code is still slightly messy, if you have any suggestions for improvements, start a GitHub issue, comment on the minetest forums (forum.minetest.net) or modify the code and create a pull request.

* Satisfy optional dependency "mobs" for throwing foods and optional dependency "3darmor" for sheilds.

* The dependancy "farming" refers to TenPlus1's farming_redo, not the farming mod from minetest_game.

## Changelog
* No changes yet!