Add Ender Chest and Trash Can
This commit is contained in:
		
							parent
							
								
									e9e255908f
								
							
						
					
					
						commit
						7c15c0b75e
					
				
							
								
								
									
										18
									
								
								crafts.lua
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								crafts.lua
									
									
									
									
									
								
							@ -97,6 +97,15 @@ minetest.register_craft({
 | 
			
		||||
	}
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
minetest.register_craft({
 | 
			
		||||
	output = "xdecor:enderchest",
 | 
			
		||||
	recipe = {
 | 
			
		||||
		{"", "default:obsidian", ""},
 | 
			
		||||
		{"default:obsidian", "default:chest", "default:obsidian"},
 | 
			
		||||
		{"", "default:obsidian", ""}
 | 
			
		||||
	}
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
minetest.register_craft({
 | 
			
		||||
	output = "xdecor:fence_wrought_iron 2",
 | 
			
		||||
	recipe = {
 | 
			
		||||
@ -285,6 +294,15 @@ minetest.register_craft({
 | 
			
		||||
	} 
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
minetest.register_craft({
 | 
			
		||||
	output = "xdecor:trash_can",
 | 
			
		||||
	recipe = {
 | 
			
		||||
		{"group:wood", "", "group:wood"},
 | 
			
		||||
		{"group:wood", "", "group:wood"},
 | 
			
		||||
		{"group:wood", "group:wood", "group:wood"}
 | 
			
		||||
	}
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
minetest.register_craft({
 | 
			
		||||
	output = "xdecor:tv",
 | 
			
		||||
	recipe = {
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										2
									
								
								hive.lua
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								hive.lua
									
									
									
									
									
								
							@ -42,9 +42,9 @@ xdecor.register("hive", {
 | 
			
		||||
	allow_metadata_inventory_put = function(pos, listname, index, stack, player)
 | 
			
		||||
		local meta = minetest.get_meta(pos)
 | 
			
		||||
		local inv = meta:get_inventory()
 | 
			
		||||
		local to_stack = inv:get_stack(listname, index)
 | 
			
		||||
 | 
			
		||||
		if listname == "honey" then return 0 end
 | 
			
		||||
		return stack:get_count()
 | 
			
		||||
	end,
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										67
									
								
								nodes.lua
									
									
									
									
									
								
							
							
						
						
									
										67
									
								
								nodes.lua
									
									
									
									
									
								
							@ -222,6 +222,32 @@ xdecor.register("empty_shelf", {
 | 
			
		||||
	sounds = xdecor.wood
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
xdecor.register("enderchest", {
 | 
			
		||||
	description = "Ender Chest",
 | 
			
		||||
	tiles = {
 | 
			
		||||
		"xdecor_enderchest_top.png",
 | 
			
		||||
		"xdecor_enderchest_top.png",
 | 
			
		||||
		"xdecor_enderchest_side.png",
 | 
			
		||||
		"xdecor_enderchest_side.png",
 | 
			
		||||
		"xdecor_enderchest_side.png",
 | 
			
		||||
		"xdecor_enderchest_front.png"
 | 
			
		||||
	},
 | 
			
		||||
	groups = {cracky=2},
 | 
			
		||||
	on_construct = function(pos)
 | 
			
		||||
		local meta = minetest.get_meta(pos)
 | 
			
		||||
		meta:set_string("formspec",
 | 
			
		||||
				"size[8,9]"..xdecor.fancy_gui..
 | 
			
		||||
				"list[current_player;enderchest;0,0;8,4;]"..
 | 
			
		||||
				"list[current_player;main;0,5;8,4;]")
 | 
			
		||||
		meta:set_string("infotext", "Ender Chest")
 | 
			
		||||
	end
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
minetest.register_on_joinplayer(function(player)
 | 
			
		||||
	local inv = player:get_inventory()
 | 
			
		||||
	inv:set_size("enderchest", 8*4)
 | 
			
		||||
end)
 | 
			
		||||
 | 
			
		||||
local fence_sbox = {
 | 
			
		||||
	type = "fixed",
 | 
			
		||||
	fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7}
 | 
			
		||||
@ -472,6 +498,47 @@ xdecor.register("tatami", {
 | 
			
		||||
	}
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
xdecor.register("trash_can", {
 | 
			
		||||
	description = "Trash Can",
 | 
			
		||||
	tiles = {"xdecor_wood.png"},
 | 
			
		||||
   	groups = {choppy=3, flammable=2},
 | 
			
		||||
   	sounds = xdecor.wood,
 | 
			
		||||
   	node_box = {
 | 
			
		||||
		type = "fixed",
 | 
			
		||||
		fixed = {
 | 
			
		||||
			{-0.3125, -0.5, 0.3125, 0.3125, 0.5, 0.375},
 | 
			
		||||
			{0.3125, -0.5, -0.375, 0.375, 0.5, 0.375},
 | 
			
		||||
			{-0.3125, -0.5, -0.375, 0.3125, 0.5, -0.3125},
 | 
			
		||||
			{-0.375, -0.5, -0.375, -0.3125, 0.5, 0.375},
 | 
			
		||||
			{-0.3125, -0.5, -0.3125, 0.3125, -0.4375, 0.3125}
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
	collision_box = {
 | 
			
		||||
		type = "fixed",
 | 
			
		||||
		fixed = {
 | 
			
		||||
			{-0.375, -0.5, 0.375, 0.375, 0.25, 0.375},
 | 
			
		||||
			{0.375, -0.5, -0.375, 0.375, 0.25, 0.375},
 | 
			
		||||
			{-0.375, -0.5, -0.375, 0.375, 0.25, -0.375},
 | 
			
		||||
			{-0.375, -0.5, -0.375, -0.375, 0.25, 0.375},
 | 
			
		||||
			{-0.375, -0.5, -0.375, 0.375, -0.4375, 0.375}
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
	on_construct = function(pos)
 | 
			
		||||
		local meta = minetest.get_meta(pos)
 | 
			
		||||
		meta:set_string("infotext", "Trash Can - throw your waste here!")
 | 
			
		||||
	end
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
-- Thanks to Evergreen for this code.
 | 
			
		||||
local old_on_step = minetest.registered_entities["__builtin:item"].on_step
 | 
			
		||||
minetest.registered_entities["__builtin:item"].on_step = function(self, dtime)
 | 
			
		||||
	if minetest.get_node(self.object:getpos()).name == "xdecor:trash_can" then
 | 
			
		||||
		self.object:remove()
 | 
			
		||||
		return
 | 
			
		||||
	end
 | 
			
		||||
	old_on_step(self, dtime)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
xdecor.register("tv", {
 | 
			
		||||
	description = "Television",
 | 
			
		||||
	light_source = 11,
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								textures/xdecor_enderchest_front.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								textures/xdecor_enderchest_front.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 349 B  | 
							
								
								
									
										
											BIN
										
									
								
								textures/xdecor_enderchest_side.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								textures/xdecor_enderchest_side.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 334 B  | 
							
								
								
									
										
											BIN
										
									
								
								textures/xdecor_enderchest_top.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								textures/xdecor_enderchest_top.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 312 B  | 
@ -108,13 +108,18 @@ end
 | 
			
		||||
local function xput(pos, listname, index, stack, player)
 | 
			
		||||
	local meta = minetest.get_meta(pos)
 | 
			
		||||
	local inv = meta:get_inventory()
 | 
			
		||||
	local to_stack = inv:get_stack(listname, index)
 | 
			
		||||
 | 
			
		||||
	if listname == "output" then
 | 
			
		||||
		return 0
 | 
			
		||||
	else
 | 
			
		||||
		return 99
 | 
			
		||||
	end
 | 
			
		||||
	if listname == "fuel" then
 | 
			
		||||
		if stack:get_name() == "xdecor:hammer" then
 | 
			
		||||
			return stack:get_count()
 | 
			
		||||
		else
 | 
			
		||||
			return 0
 | 
			
		||||
		end
 | 
			
		||||
	end
 | 
			
		||||
	return stack:get_count()
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
xdecor.register("worktable", {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user