Item - Uberi/MineTest-API GitHub Wiki

Item

Description

Tools and Craftitems

Syntax

{
	description = "Steel Axe",
	groups = {}, -- key=name, value=rating; rating=1..3.
	             if rating not applicable, use 1.
	             eg. {wool=1, fluffy=3}
	                 {soil=2, outerspace=1, crumbly=1}
	                 {bendy=2, snappy=1},
	                 {hard=1, metal=1, spikes=1}
	inventory_image = "default_tool_steelaxe.png",
	wield_image = "",
	wield_scale = {x=1,y=1,z=1},
	stack_max = 99,
	liquids_pointable = false,
	tool_capabilities = {
		full_punch_interval = 1.0,
		max_drop_level=0,
		groupcaps={
			-- For example:
			fleshy={times={[2]=0.80, [3]=0.40}, maxwear=0.05, maxlevel=1},
			snappy={times={[2]=0.80, [3]=0.40}, maxwear=0.05, maxlevel=1},
			choppy={times={[3]=0.90}, maxwear=0.05, maxlevel=0}
		}
	}
	node_placement_prediction = nil,
	^ If nil and item is node, prediction is made automatically
	^ If nil and item is not a node, no prediction is made
	^ If "" and item is anything, no prediction is made
	^ Otherwise should be name of node which the client immediately places
	  on ground when the player places the item. Server will always update
	  actual result to client in a short moment.
	
	on_place = func(itemstack, placer, pointed_thing),
	^ Shall place item and return the leftover itemstack
	^ default: minetest.item_place
	on_drop = func(itemstack, dropper, pos),
	^ Shall drop item and return the leftover itemstack
	^ default: minetest.item_drop
	on_use = func(itemstack, user, pointed_thing),
	^  default: nil
	^ Function must return either nil if no item shall be removed from
	  inventory, or an itemstack to replace the original itemstack.
	    eg. itemstack:take_item(); return itemstack
	^ Otherwise, the function is free to do what it wants.
	^ The default functions handle regular use cases.
}
⚠️ **GitHub.com Fallback** ⚠️