cg_plus respects the standard groups not_in_creative_inventory
and not_in_craft_guide
.
Adding either of these to an item/node definition will make it not appear in the crafting guide.
Adds or overrides a type of craft in cg_plus, for use with cg.register_craft
. Default craft methods are normal
,
shapeless
, cooking
, fuel
, digging
, and digging_chance
.
name
(string): The name of the new craft method. Matches themethod
field in craft definitions.def
(table): A craft method definition with the following fields:description
(string): A human-readable name for the crafting method, which will be shown next to recipes in the crafting guide.arrow_icon
(string): Texture to use for the arrow icon in recipes. Default is a plain arrow.uses_crafting_grid
(bool): Setting totrue
allows crafts of this method to be automatically staged in the default crafting grid when autocrafting is enabled.get_grid_size = function(craft)
: Used to calculate the shape of the crafting grid displayed for each recipe. Takes a recipe defintioncraft
and returns a table in the format{x = width, y = height}
.get_infotext = function(craft)
: Optional, used to add additional information to a recipe page, e.g. cooking or burning times. Takes a recipe defintioncraft
and returns a string.
See below.
Registers a craft to appear only in the crafting guide, independent of minetest.register_craft
. Useful for mods that
implement crafting outside the default crafting grid.
recipe
(table): Possible keys:method
(string): Can be an official crafting method or one created withcg.register_craft
.width
(integer): Width of the recipe inputs, which may be less than the width of the crafting grid. If zero, the recipe will expand to the full width of the crafting grid.items
(table): One-dimensional table of input item names, listed from left-to-right and top-to-bottom. May be groups such asgroup:dye
orgroup:dye,color_violet
.output
(string): Output itemstring, e.g.default:stone
ordefault:wood 4
.- Additional fields can be added (e.g. cooking time) which can be displayed using
get_infotext
incg.register_crafting_method
. Theitems
andwidth
fields are reserved.
assign_to
(string): Optional itemstring; if specified, the craft will be assigned to this item rather than the output item. Useful for fuel recipes that consume the input, etc.
Register a craft for a theoretical mod woodmod
which allows sawing of stairs using a table saw:
cg.register_crafting_method("woodmod_table_saw", {
description = "Table Saw",
arrow_icon = "cg_plus_arrow_bottom.png^woodmod_icon_saw.png",
uses_crafting_grid = false,
get_grid_size = function(craft)
return {x = 4, y = 4}
end,
get_infotext = function(craft)
return string.format("Cutting time: %i seconds", craft.cutting_time)
end,
})
cg.register_craft({
method = "woodmod_table_saw",
width = 2,
items = {"group:wood", "", "group:wood", "group:wood"},
output = "stairs:stair_wood 4",
cutting_time = 10,
})
Adds or overrides a group stereotype. When a recipe takes a generic item in the given group, the given item will be displayed instead of a randomly-chosen item in that group. Clicking on the item button with group search disabled will also search for the stereotype item.
group
can be multiple comma-separated groups (e.g. dye,color_blue
) for use by recipes with multi-group items. The
order of the groups does matter.
Show yellow dye as the default for items in the dye
group:
cg.register_group_stereotype("dye", "dye:yellow")