
local vert1 = {
	type = "fixed",
	fixed = {
			{-0.5, -0.5, -0.4375, 0.5, 0.5, 0.5}, 
			{0.1875, -0.5, -0.5, 0.5, 0.5, 0.5}, 
			{-0.5, -0.5, -0.5, -0.1875, 0.5, 0.5}, 
		}
	}

local vert2 = {
	type = "fixed",
	fixed = {
			{-0.5, -0.5, -0.375, 0.5, 0.5, 0.5},
			{0.1875, -0.5, -0.5, 0.5, 0.5, 0.5}, 
			{-0.5, -0.5, -0.5, -0.1875, 0.5, 0.5}, 
		}
	}

local vert3 = {
	type = "fixed",
	fixed = {
			{-0.5, -0.5, -0.3125, 0.5, 0.5, 0.5}, 
			{0.1875, -0.5, -0.5, 0.5, 0.5, 0.5}, 
			{-0.5, -0.5, -0.5, -0.1875, 0.5, 0.5}, 
		}
	}

local vert4 = {
	type = "fixed",
	fixed = {
			{-0.5, -0.5, -0.25, 0.5, 0.5, 0.5},
			{0.1875, -0.5, -0.5, 0.5, 0.5, 0.5},
			{-0.5, -0.5, -0.5, -0.1875, 0.5, 0.5}, 
		}
	}

local hori1 = {
	type = "fixed",
	fixed = {
			{-0.5, -0.5, -0.4375, 0.5, 0.5, 0.5},
			{-0.5, 0.1875, -0.5, 0.5, 0.5, 0.5},
			{-0.5, -0.5, -0.5, 0.5, -0.1875, 0.5},   
		}
	}

local hori2 = {
	type = "fixed",
	fixed = {
			{-0.5, -0.5, -0.375, 0.5, 0.5, 0.5},
			{-0.5, 0.1875, -0.5, 0.5, 0.5, 0.5},
			{-0.5, -0.5, -0.5, 0.5, -0.1875, 0.5},  
		}
	}

local hori3 = {
	type = "fixed",
	fixed = {
			{-0.5, -0.5, -0.3125, 0.5, 0.5, 0.5}, 
			{-0.5, 0.1875, -0.5, 0.5, 0.5, 0.5}, 
			{-0.5, -0.5, -0.5, 0.5, -0.1875, 0.5},  
		}
	}

local hori4 = {
	type = "fixed",
	fixed = {
			{-0.5, -0.5, -0.25, 0.5, 0.5, 0.5}, 
			{-0.5, 0.1875, -0.5, 0.5, 0.5, 0.5}, 
			{-0.5, -0.5, -0.5, 0.5, -0.1875, 0.5}, 
		}
	}

local cross1 = {
	type = "fixed",
	fixed = {
			{-0.5, -0.5, -0.4375, 0.5, 0.5, 0.5},
			{0.1875, -0.5, -0.5, 0.5, -0.1875, 0.5},
			{-0.5, -0.5, -0.5, -0.1875, -0.1875, 0.5},
			{-0.5, 0.1875, -0.5, -0.1875, 0.5, 0.5}, 
			{0.1875, 0.1875, -0.5, 0.5, 0.5, 0.5},
		}
	}

local cross2 = {
	type = "fixed",
	fixed = {
			{-0.5, -0.5, -0.375, 0.5, 0.5, 0.5},
			{0.1875, -0.5, -0.5, 0.5, -0.1875, 0.5}, 
			{-0.5, -0.5, -0.5, -0.1875, -0.1875, 0.5}, 
			{-0.5, 0.1875, -0.5, -0.1875, 0.5, 0.5},
			{0.1875, 0.1875, -0.5, 0.5, 0.5, 0.5},  
		}
	}

local cross3 = {
	type = "fixed",
	fixed = {
			{-0.5, -0.5, -0.3125, 0.5, 0.5, 0.5},
			{0.1875, -0.5, -0.5, 0.5, -0.1875, 0.5},
			{-0.5, -0.5, -0.5, -0.1875, -0.1875, 0.5}, 
			{-0.5, 0.1875, -0.5, -0.1875, 0.5, 0.5},
			{0.1875, 0.1875, -0.5, 0.5, 0.5, 0.5}, 
		}
	}

local cross4 = {
	type = "fixed",
	fixed = {
			{-0.5, -0.5, -0.25, 0.5, 0.5, 0.5},
			{0.1875, -0.5, -0.5, 0.5, -0.1875, 0.5}, 
			{-0.5, -0.5, -0.5, -0.1875, -0.1875, 0.5}, 
			{-0.5, 0.1875, -0.5, -0.1875, 0.5, 0.5}, 
			{0.1875, 0.1875, -0.5, 0.5, 0.5, 0.5},
		}
	}

local chis1 = {
	type = "fixed",
	fixed = {
			{-0.5, -0.5, -0.4375, 0.5, 0.5, 0.5},
			{-0.4375, -0.4375, -0.5, 0.4375, 0.4375, 0.5},
		}
	}

local chis2 = {
	type = "fixed",
	fixed = {
			{-0.5, -0.5, -0.375, 0.5, 0.5, 0.5}, 
			{-0.375, -0.375, -0.5, 0.375, 0.375, 0.5}, 
			{-0.4375, -0.4375, -0.4375, 0.4375, 0.4375, 0.5},
		}
	}

local chis3 = {
	type = "fixed",
	fixed = {
			{-0.5, -0.5, -0.3125, 0.5, 0.5, 0.5}, 
			{-0.375, -0.375, -0.4375, 0.375, 0.375, 0.5},
			{-0.4375, -0.4375, -0.375, 0.4375, 0.4375, 0.5},
			{-0.3125, -0.3125, -0.5, 0.3125, 0.3125, 0.5},
		}
	}

local chis4 = {
	type = "fixed",
	fixed = {
			{-0.5, -0.5, -0.25, 0.5, 0.5, 0.5}, 
			{-0.375, -0.375, -0.375, 0.375, 0.375, 0.5},
			{-0.4375, -0.4375, -0.3125, 0.4375, 0.4375, 0.5}, 
			{-0.3125, -0.3125, -0.4375, 0.3125, 0.3125, 0.5}, 
			{-0.25, -0.25, -0.5, 0.25, 0.25, 0.5},
		}
	}

local squar1 = {
	type = "fixed",
	fixed = {
			{-0.5, -0.5, -0.4375, 0.5, 0.5, 0.5},
			{-0.5, -0.5, -0.5, -0.3125, 0.5, -0.4375},
			{0.3125, -0.5, -0.5, 0.5, 0.5, -0.4375},
			{-0.5, -0.5, -0.5, 0.5, -0.3125, -0.4375},
			{-0.5, 0.3125, -0.5, 0.5, 0.5, -0.4375}, 
		}
	}

local squar2 = {
	type = "fixed",
	fixed = {
			{-0.5, -0.5, -0.375, 0.5, 0.5, 0.5}, 
			{-0.5, -0.5, -0.5, -0.3125, 0.5, -0.375},
			{0.3125, -0.5, -0.5, 0.5, 0.5, -0.375},
			{-0.5, -0.5, -0.5, 0.5, -0.3125, -0.375},
			{-0.5, 0.3125, -0.5, 0.5, 0.5, -0.375},
		}
	}

local squar3 = {
	type = "fixed",
	fixed = {
			{-0.5, -0.5, -0.3125, 0.5, 0.5, 0.5},
			{-0.5, -0.5, -0.5, -0.3125, 0.5, -0.3125},
			{0.3125, -0.5, -0.5, 0.5, 0.5, -0.3125},
			{-0.5, -0.5, -0.5, 0.5, -0.3125, -0.3125},
			{-0.5, 0.3125, -0.5, 0.5, 0.5, -0.3125},
		}
	}

local squar4 = {
	type = "fixed",
	fixed = {
			{-0.5, -0.5, -0.25, 0.5, 0.5, 0.5},
			{-0.5, -0.5, -0.5, -0.3125, 0.5, -0.25},
			{0.3125, -0.5, -0.5, 0.5, 0.5, -0.25},
			{-0.5, -0.5, -0.5, 0.5, -0.3125, -0.25},
			{-0.5, 0.3125, -0.5, 0.5, 0.5, -0.25},
		}
	}

local default_material = {
		{"default:cobble", "default_cobble", "Cobble", {cracky = 3, not_in_creative_inventory=1}},
		{"default:sandstone","default_sandstone", "Sandstone", {crumbly=2, not_in_creative_inventory=1}},
		{"default:clay","default_clay",  "Clay", {crumbly=3, not_in_creative_inventory=1}},
		{"default:coalblock","default_coal_block",  "Coal Block", {cracky = 3, not_in_creative_inventory=1}},
		{"default:stone","default_stone", "Stone", {cracky = 3, not_in_creative_inventory=1}},
		{"default:desert_stone","default_desert_stone", "Desert Stone", {cracky = 3, not_in_creative_inventory=1}},
		{"default:wood","default_wood", "Wood", {choppy=2, not_in_creative_inventory=1}},
		{"default:acacia_wood","default_acacia_wood", "Acacia Wood", {choppy=2, not_in_creative_inventory=1}},
		{"default:aspen_wood","default_aspen_wood", "Aspen Wood", {choppy=2, not_in_creative_inventory=1}},
		{"default:pine_wood","default_pine_wood", "Pine Wood", {choppy=2, not_in_creative_inventory=1}},
		{"default:desert_cobble","default_desert_cobble", "Desert Cobble", {cracky = 3, not_in_creative_inventory=1}},
		{"default:junglewood","default_junglewood", "Jungle Wood", {choppy=2, not_in_creative_inventory=1}},
		{"default:sandstonebrick","default_sandstone_brick", "Sandstone Brick", {cracky = 2, not_in_creative_inventory=1}},
		{"default:stonebrick","default_stone_brick", "Stone Brick", {cracky = 2, not_in_creative_inventory=1}},
		{"default:desert_stonebrick","default_desert_stone_brick", "Desert Stone Brick", {cracky = 2, not_in_creative_inventory=1}},
		}

for i in ipairs (default_material) do
	local item = default_material [i][1]
	local mat = default_material [i][2]
	local desc = default_material [i][3]
	local gro = default_material [i][4]

minetest.register_node("mychisel:vertical_"..mat.."1", {
	description = "Vertical "..desc.."1",
	drawtype = "nodebox",
	tiles = {
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png^mychisel_vtint.png",
		},
	paramtype = "light",
	paramtype2 = "facedir",
	drop = item,
	groups = gro,
	node_box = vert1,
	selection_box = vert1,
	on_place = minetest.rotate_node,
})

minetest.register_node("mychisel:vertical_"..mat.."2", {
	description = "Vertical "..desc.."2",
	drawtype = "nodebox",
	tiles = {
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png^mychisel_vtint.png",
		},
	paramtype = "light",
	paramtype2 = "facedir",
	drop = item,
	groups = gro,
	node_box = vert2,
	selection_box = vert2
})

minetest.register_node("mychisel:vertical_"..mat.."3", {
	description = "Vertical "..desc.."3",
	drawtype = "nodebox",
	tiles = {
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png^mychisel_vtint.png",
		},
	paramtype = "light",
	paramtype2 = "facedir",
	drop = item,
	groups = gro,
	node_box = vert3,
	selection_box = vert3
})

minetest.register_node("mychisel:vertical_"..mat.."4", {
	description = "Vertical "..desc.."4",
	drawtype = "nodebox",
	tiles = {
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png^mychisel_vtint.png",
		},
	paramtype = "light",
	paramtype2 = "facedir",
	drop = item,
	groups = gro,
	node_box = vert4,
	selection_box = vert4
})

minetest.register_node("mychisel:chiseled_"..mat.."1", {
	description = "Chiseled"..desc.."1",
	drawtype = "nodebox",
	tiles = {
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png^mychisel_ctint1.png",
		},
	paramtype = "light",
	paramtype2 = "facedir",
	drop = item,
	groups = gro,
	node_box = chis1,
	selection_box = chis1,
})

minetest.register_node("mychisel:chiseled_"..mat.."2", {
	description = "Chiseled"..desc.."2",
	drawtype = "nodebox",
	tiles = {
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png^mychisel_ctint2.png",
		},
	paramtype = "light",
	paramtype2 = "facedir",
	drop = item,
	groups = gro,
	node_box = chis2,
	selection_box = chis2
})

minetest.register_node("mychisel:chiseled_"..mat.."3", {
	description = "Chiseled"..desc.."3",
	drawtype = "nodebox",
	tiles = {
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png^mychisel_ctint3.png",
		},
	paramtype = "light",
	paramtype2 = "facedir",
	drop = item,
	groups = gro,
	node_box = chis3,
	selection_box = chis3
})

minetest.register_node("mychisel:chiseled_"..mat.."4", {
	description = "Chiseled"..desc.."4",
	drawtype = "nodebox",
	tiles = {
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png^mychisel_ctint4.png",
		},
	paramtype = "light",
	paramtype2 = "facedir",
	drop = item,
	groups = gro,
	node_box = chis4,
	selection_box = chis4
})

minetest.register_node("mychisel:horizontal_"..mat.."1", {
	description = "Horizontal "..desc.."1",
	drawtype = "nodebox",
	tiles = {
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png^mychisel_htint.png",
		},
	paramtype = "light",
	paramtype2 = "facedir",
	drop = item,
	groups = gro,
	node_box = hori1,
	selection_box = hori1
})

minetest.register_node("mychisel:horizontal_"..mat.."2", {
	description = "Horizontal"..desc.."2",
	drawtype = "nodebox",
	tiles = {
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png^mychisel_htint.png",
		},
	paramtype = "light",
	paramtype2 = "facedir",
	drop = item,
	groups = gro,
	node_box = hori2,
	selection_box = hori2
})

minetest.register_node("mychisel:horizontal_"..mat.."3", {
	description = "Horizontal"..desc.."3",
	drawtype = "nodebox",
	tiles = {
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png^mychisel_htint.png",
		},
	paramtype = "light",
	paramtype2 = "facedir",
	drop = item,
	groups = gro,
	node_box = hori3,
	selection_box = hori3
})

minetest.register_node("mychisel:horizontal_"..mat.."4", {
	description = "Horizontal"..desc.."4",
	drawtype = "nodebox",
	tiles = {
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png^mychisel_htint.png",
		},
	paramtype = "light",
	paramtype2 = "facedir",
	drop = item,
	groups = gro,
	node_box = hori4,
	selection_box = hori4
})

minetest.register_node("mychisel:cross_"..mat.."1", {
	description = "cross "..desc.."1",
	drawtype = "nodebox",
	tiles = {
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png^mychisel_ctint.png",
		},
	paramtype = "light",
	paramtype2 = "facedir",
	drop = item,
	groups = gro,
	node_box = cross1,
	selection_box = cross1
})

minetest.register_node("mychisel:cross_"..mat.."2", {
	description = "cross"..desc.."2",
	drawtype = "nodebox",
	tiles = {
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png^mychisel_ctint.png",
		},
	paramtype = "light",
	paramtype2 = "facedir",
	drop = item,
	groups = gro,
	node_box = cross2,
	selection_box = cross2
})

minetest.register_node("mychisel:cross_"..mat.."3", {
	description = "cross"..desc.."3",
	drawtype = "nodebox",
	tiles = {
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png^mychisel_ctint.png",
		},
	paramtype = "light",
	paramtype2 = "facedir",
	drop = item,
	groups = gro,
	node_box = cross3,
	selection_box = cross3
})

minetest.register_node("mychisel:cross_"..mat.."4", {
	description = "cross"..desc.."4",
	drawtype = "nodebox",
	tiles = {
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png^mychisel_ctint.png",
		},
	paramtype = "light",
	paramtype2 = "facedir",
	drop = item,
	groups = gro,
	node_box = cross4,
	selection_box = cross4
})

minetest.register_node("mychisel:square_"..mat.."1", {
	description = "cross "..desc.."1",
	drawtype = "nodebox",
	tiles = {
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png^mychisel_stint.png",
		},
	paramtype = "light",
	paramtype2 = "facedir",
	drop = item,
	groups = gro,
	node_box = squar1,
	selection_box = squar1
})

minetest.register_node("mychisel:square_"..mat.."2", {
	description = "cross"..desc.."2",
	drawtype = "nodebox",
	tiles = {
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png^mychisel_stint.png",
		},
	paramtype = "light",
	paramtype2 = "facedir",
	drop = item,
	groups = gro,
	node_box = squar2,
	selection_box = squar2
})

minetest.register_node("mychisel:square_"..mat.."3", {
	description = "cross"..desc.."3",
	drawtype = "nodebox",
	tiles = {
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png^mychisel_stint.png",
		},
	paramtype = "light",
	paramtype2 = "facedir",
	drop = item,
	groups = gro,
	node_box = squar3,
	selection_box = squar3
})

minetest.register_node("mychisel:square_"..mat.."4", {
	description = "cross"..desc.."4",
	drawtype = "nodebox",
	tiles = {
		mat..".png",
		mat..".png",
		mat..".png", mat..".png", mat..".png",
		mat..".png^mychisel_stint.png",
		},
	paramtype = "light",
	paramtype2 = "facedir",
	drop = item,
	groups = gro,
	node_box = squar4,
	selection_box = squar4

})

minetest.register_node("mychisel:square_"..mat.."4", {
	description = "cross"..desc.."4",
	drawtype = "nodebox",
	tiles = {
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png",
		mat..".png^mychisel_stint.png",
		},
	paramtype = "light",
	paramtype2 = "facedir",
	drop = item,
	groups = gro,
	node_box = squar4,
	selection_box = squar4

})

minetest.register_node("mychisel:chisel_deco", {
	drawtype = "nodebox",
	paramtype = "light",
	paramtype2 = "facedir",
	tiles = {
		"default_steel_block.png",
		"default_wood.png",
		"mychisel_chisel.png",
		"mychisel_chisel.png",
		"mychisel_chisel.png",
		"mychisel_chisel.png"
	},
	groups = {
		snappy=3,
		flammable=2,
		not_in_creative_inventory=1
	},
	node_box = {
		type = "fixed",
                fixed = {
			{-0.125, -0.5, -0.125, 0.125, 0.25, 0.125}, -- NodeBox1
			{-0.1875, 0.25, -0.1875, 0.1875, 0.5, 0.1875}, -- NodeBox2
			}
		},
	sounds = default.node_sound_wood_defaults(),
	on_dig = function(pos, node, digger)
		if digger:is_player() and digger:get_inventory() then
			local meta = minetest.env:get_meta(pos)
			local wear_out = meta:get_int("wear")
			digger:get_inventory():add_item("main", {name="mychisel:chisel", count=1, wear=wear_out, metadata=""})
		end
		minetest.remove_node(pos)
        end,
})

end
