diff --git a/.gitignore b/.gitignore
index c8f21e5044aea7d784b1fa1eb8734caa4aa512c4..db131c29fbb3f410884470b571fad00a80eb5c87 100644
--- a/.gitignore
+++ b/.gitignore
@@ -59,4 +59,7 @@ CPackSourceConfig.cmake
 Makefile
 cmake_install.cmake
 locale/
+*.cbp
+*.layout
+*.o
 
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 446fff07530745cd4d8393254d357e0fb348bd11..5c8753e78779ade00d090e5d93eaa1f8b72511c0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,7 +12,7 @@ set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string")
 # Also remember to set PROTOCOL_VERSION in clientserver.h when releasing
 set(VERSION_MAJOR 0)
 set(VERSION_MINOR 4)
-set(VERSION_PATCH 6)
+set(VERSION_PATCH 7)
 if(VERSION_EXTRA)
 	set(VERSION_PATCH ${VERSION_PATCH}-${VERSION_EXTRA})
 endif()
@@ -28,6 +28,13 @@ else()
 	set(RUN_IN_PLACE 0 CACHE BOOL "Run directly in source directory structure")
 endif()
 
+# RUN_IN_PLACE is exported as a #define value, ensure it's 1/0 instead of ON/OFF
+if(RUN_IN_PLACE)
+	set(RUN_IN_PLACE 1)
+else()
+	set(RUN_IN_PLACE 0)
+endif()
+
 set(BUILD_CLIENT 1 CACHE BOOL "Build client")
 if(WIN32)
 	set(BUILD_SERVER 0 CACHE BOOL "Build server")
diff --git a/builtin/misc_helpers.lua b/builtin/misc_helpers.lua
index 8b0db6c5a1f5d9125bcf1ef3b23c0b8ac5cb7634..743a9cfd30768d4894a55c41ebd9b19572eaa6cc 100644
--- a/builtin/misc_helpers.lua
+++ b/builtin/misc_helpers.lua
@@ -57,7 +57,7 @@ function dump(o, dumped)
 		dumped[o] = true
 		local t = {}
 		for k,v in pairs(o) do
-			t[#t+1] = "" .. k .. " = " .. dump(v, dumped)
+			t[#t+1] = "[" .. dump(k, dumped) .. "] = " .. dump(v, dumped)
 		end
 		return "{" .. table.concat(t, ", ") .. "}"
 	elseif type(o) == "boolean" then
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index 5143c2ef3f15ce7ddd0d7d53c656459fd1d9cfd1..a19174548605743b3a4825b8e00a2591eb069e0f 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -1,6 +1,7 @@
-Minetest Lua Modding API Reference 0.4.6
+Minetest Lua Modding API Reference 0.4.7
 ========================================
-More information at http://c55.me/minetest/
+More information at http://www.minetest.net/
+Developer Wiki: http://dev.minetest.net/
 
 Introduction
 -------------
@@ -409,6 +410,18 @@ Currently supported flags:  absheight
     Also produce this same ore between the height range of -height_max and -height_min.
     Useful for having ore in sky realms without having to duplicate ore entries.
 
+Decoration types
+-------------------
+The varying types of decorations that can be placed.
+The default value is simple, and is currently the only type supported.
+
+- simple
+    Creates a 1xHx1 column of a specified node (or a random node from a list, if a decoration
+    list is specified).  Can specify a certain node it must spawn next to, such as water or lava,
+    for example.  Can also generate a decoration of random height between a specified lower and
+    upper bound.  This type of decoration is intended for placement of grass, flowers, cacti,
+    papyrus, and so on.
+
 HUD element types
 -------------------
 The position field is used for all element types.
@@ -945,6 +958,7 @@ minetest.register_craftitem(name, item definition)
 minetest.register_alias(name, convert_to)
 minetest.register_craft(recipe)
 minetest.register_ore(ore definition)
+minetest.register_decoration(decoration definition)
 
 Global callback registration functions: (Call these only at load time)
 minetest.register_globalstep(func(dtime))
@@ -1004,7 +1018,6 @@ minetest.setting_get(name) -> string or nil
 minetest.setting_getbool(name) -> boolean value or nil
 minetest.setting_get_pos(name) -> position or nil
 minetest.setting_save() -> nil, save all settings to config file
-minetest.add_to_creative_inventory(itemstring)
 
 Authentication:
 minetest.notify_authentication_modified(name)
@@ -1279,15 +1292,6 @@ minetest.object_refs
 minetest.luaentities
 ^ List of lua entities, indexed by active object id
 
-Deprecated but defined for backwards compatibility:
-minetest.digprop_constanttime(time)
-minetest.digprop_stonelike(toughness)
-minetest.digprop_dirtlike(toughness)
-minetest.digprop_gravellike(toughness)
-minetest.digprop_woodlike(toughness)
-minetest.digprop_leaveslike(toughness)
-minetest.digprop_glasslike(toughness)
-
 Class reference
 ----------------
 NodeMetaRef: Node metadata - reference extra data and functionality stored
@@ -1696,6 +1700,7 @@ Node definition (register_node)
     liquid_alternative_source = "", -- Source version of flowing liquid
     liquid_viscosity = 0, -- Higher viscosity = slower flow (max. 7)
     liquid_renewable = true, -- Can new liquid source be created by placing
+    drowning = true, -- Player will drown in these
     two or more sources nearly?
     light_source = 0, -- Amount of light emitted by node
     damage_per_second = 0, -- If player is inside node, this damage is caused
@@ -1834,7 +1839,7 @@ Recipe for register_craft (furnace fuel)
 
 Ore definition (register_ore)
 {
-    ore_type = "scatter" -- See "Ore types"
+    ore_type = "scatter", -- See "Ore types"
     ore = "default:stone_with_coal",
     wherein = "default:stone",
     clust_scarcity = 8*8*8,
@@ -1856,6 +1861,41 @@ Ore definition (register_ore)
     ^ Needed for sheet ore_type.  Omit from scatter ore_type for a uniform ore distribution
 }
 
+Decoration definition (register_decoration)
+{
+    deco_type = "simple", -- See "Decoration types"
+    place_on = "default:dirt_with_grass",
+    ^ Node that decoration can be placed on
+    sidelen = 8,
+    ^ Size of divisions made in the chunk being generated.
+    ^ If the chunk size is not evenly divisible by sidelen, sidelen is made equal to the chunk size.
+    fill_ratio = 0.02,
+    ^ Ratio of the area to be uniformly filled by the decoration.
+    ^ Used only if noise_params is not specified.
+    noise_params = {offset=0, scale=.45, spread={x=100, y=100, z=100}, seed=354, octaves=3, persist=0.7},
+    ^ NoiseParams structure describing the perlin noise used for decoration distribution.
+    ^ The result of this is multiplied by the 2d area of the division being decorated.
+    biomes = {"Oceanside", "Hills", "Plains"},
+    ^ List of biomes in which this decoration occurs.  Occurs in all biomes if this is omitted,
+    ^ and ignored if the Mapgen being used does not support biomes.
+
+    ----- Simple-type parameters
+    decoration = "default:grass",
+    ^ The node name used as the decoration.
+    ^ If instead a list of strings, a randomly selected node from the list is placed as the decoration.
+    height = 1,
+    ^ Number of nodes high the decoration is made.
+    ^ If height_max is not 0, this is the lower bound of the randomly selected height.
+    height_max = 0,
+    ^ Number of nodes the decoration can be at maximum.
+    ^ If absent, the parameter 'height' is used as a constant.
+    spawn_by = "default:water",
+    ^ Node that the decoration only spawns next to, in a 1-node square radius.
+    num_spawn_by = 1,
+    ^ Number of spawn_by nodes that must be surrounding the decoration position to occur.
+    ^ If absent or -1, decorations occur next to any nodes.
+}
+
 Chatcommand definition (register_chatcommand)
 {
     params = "<name> <privilege>", -- short parameter description
diff --git a/doc/minetest.6 b/doc/minetest.6
index 64dfdd149d2adf817d80967d5110dd2801a6054c..c690229df3e77a0761100596fea947129cdcd82f 100644
--- a/doc/minetest.6
+++ b/doc/minetest.6
@@ -88,7 +88,7 @@ This man page was originally written by
 Juhani Numminen <juhaninumminen0@gmail.com>.
 
 .SH WWW
-http://c55.me/minetest/
+http://www.minetest.net/
 
 .SH "SEE ALSO"
 .BR minetestserver(6)
diff --git a/doc/minetestserver.6 b/doc/minetestserver.6
index 93c354e7942cf3d6ebd0f353b5f90cf2c86e2370..5a9b0a08b982b3ffedb1c3280d4df99ca9b5547b 100644
--- a/doc/minetestserver.6
+++ b/doc/minetestserver.6
@@ -64,7 +64,7 @@ This man page was originally written by
 Juhani Numminen <juhaninumminen0@gmail.com>.
 
 .SH WWW
-http://c55.me/minetest/
+http://www.minetest.net/
 
 .SH "SEE ALSO"
 .BR minetest(6)
diff --git a/games/minimal/menu/background.png b/games/minimal/menu/background.png
index e020f909d47609478325f9f6500e7dea37b81af3..ea5fbdce54e58a08cfbdf97b88162836a2cccd76 100644
Binary files a/games/minimal/menu/background.png and b/games/minimal/menu/background.png differ
diff --git a/games/minimal/menu/icon.png b/games/minimal/menu/icon.png
index fa8d7cd7f7f74d46d0328eaf4c0196857e0bc89f..8ef6750232b7b0c55777ac407e59528321a91cc9 100644
Binary files a/games/minimal/menu/icon.png and b/games/minimal/menu/icon.png differ
diff --git a/games/minimal/mods/bucket/textures/bucket.png b/games/minimal/mods/bucket/textures/bucket.png
index f165fd209e9dc30282c963ee27dcd34eeb84b115..b775a9fd335d074debc8a63010330a052da00a38 100644
Binary files a/games/minimal/mods/bucket/textures/bucket.png and b/games/minimal/mods/bucket/textures/bucket.png differ
diff --git a/games/minimal/mods/bucket/textures/bucket_lava.png b/games/minimal/mods/bucket/textures/bucket_lava.png
index 7cf27cd1f41fb13063c94f69007e55b3591c6605..889ed61d44a0eb2557e4addef32022e8d8594f77 100644
Binary files a/games/minimal/mods/bucket/textures/bucket_lava.png and b/games/minimal/mods/bucket/textures/bucket_lava.png differ
diff --git a/games/minimal/mods/bucket/textures/bucket_water.png b/games/minimal/mods/bucket/textures/bucket_water.png
index f220ec51e691f95e2cf1f2076d29dd6a08a4d890..a3c9d72f74e06692c3eeb9534cc09e26cdb9f61c 100644
Binary files a/games/minimal/mods/bucket/textures/bucket_water.png and b/games/minimal/mods/bucket/textures/bucket_water.png differ
diff --git a/games/minimal/mods/default/textures/bubble.png b/games/minimal/mods/default/textures/bubble.png
new file mode 100644
index 0000000000000000000000000000000000000000..3bca7e11cce4c0bfcb34180eea447b6c5e1c6655
Binary files /dev/null and b/games/minimal/mods/default/textures/bubble.png differ
diff --git a/games/minimal/mods/default/textures/crack_anylength.png b/games/minimal/mods/default/textures/crack_anylength.png
index 6832c5118a11bbe79d8fa91e3797c334ee83d51a..d9b49f9111b9c11899514d9aaca57d1fca34c8cc 100644
Binary files a/games/minimal/mods/default/textures/crack_anylength.png and b/games/minimal/mods/default/textures/crack_anylength.png differ
diff --git a/games/minimal/mods/default/textures/default_apple.png b/games/minimal/mods/default/textures/default_apple.png
index 9593f28f6068b7d932036f42b9eede227e1c1616..4473dca285e3fbb076b28ca0efe057a576befcac 100644
Binary files a/games/minimal/mods/default/textures/default_apple.png and b/games/minimal/mods/default/textures/default_apple.png differ
diff --git a/games/minimal/mods/default/textures/default_book.png b/games/minimal/mods/default/textures/default_book.png
index 176fb6aa96154614c7edb3a7ed80064d23a8fceb..ea14a372a6533575674afe257ec2c0eaf8770a19 100644
Binary files a/games/minimal/mods/default/textures/default_book.png and b/games/minimal/mods/default/textures/default_book.png differ
diff --git a/games/minimal/mods/default/textures/default_bookshelf.png b/games/minimal/mods/default/textures/default_bookshelf.png
index 5ecc50ff3ad1d0f633f2fb18cd59801fa2391ed7..f225e3449cfd3d1ab84e61028a72135c4bb90939 100644
Binary files a/games/minimal/mods/default/textures/default_bookshelf.png and b/games/minimal/mods/default/textures/default_bookshelf.png differ
diff --git a/games/minimal/mods/default/textures/default_brick.png b/games/minimal/mods/default/textures/default_brick.png
index 32d77f34787b079f9df729bc398b780be98e83b1..def1cf0b17ba8883fd4748b941cd76219218ca63 100644
Binary files a/games/minimal/mods/default/textures/default_brick.png and b/games/minimal/mods/default/textures/default_brick.png differ
diff --git a/games/minimal/mods/default/textures/default_cactus_side.png b/games/minimal/mods/default/textures/default_cactus_side.png
index fc479fde6f9dc859180035ee3974c1ffb198136c..128a4d28a74a7bd8e4436b67e8f1e5a4cd41e65f 100644
Binary files a/games/minimal/mods/default/textures/default_cactus_side.png and b/games/minimal/mods/default/textures/default_cactus_side.png differ
diff --git a/games/minimal/mods/default/textures/default_cactus_top.png b/games/minimal/mods/default/textures/default_cactus_top.png
index f9e68df5114b04f48290dc277b9d73f49db941cc..eda1a0bb6374dfc88b4475f304f2b0e034ef5c1b 100644
Binary files a/games/minimal/mods/default/textures/default_cactus_top.png and b/games/minimal/mods/default/textures/default_cactus_top.png differ
diff --git a/games/minimal/mods/default/textures/default_chest_front.png b/games/minimal/mods/default/textures/default_chest_front.png
index c5628af946d1c41ca21248c6fd6eca7d9ab8d4a7..55b076c354b3b6d8f067cb2477b7bf9dd36ba311 100644
Binary files a/games/minimal/mods/default/textures/default_chest_front.png and b/games/minimal/mods/default/textures/default_chest_front.png differ
diff --git a/games/minimal/mods/default/textures/default_chest_lock.png b/games/minimal/mods/default/textures/default_chest_lock.png
index ae038fae5435ba60b88b6db73296c451cd5e827e..4b2d1af6c5e4e09eb439cf27d2b67eb21f3153e6 100644
Binary files a/games/minimal/mods/default/textures/default_chest_lock.png and b/games/minimal/mods/default/textures/default_chest_lock.png differ
diff --git a/games/minimal/mods/default/textures/default_chest_side.png b/games/minimal/mods/default/textures/default_chest_side.png
index 916dd784d008eb82c4eac20225f6d7f5c84ecefb..ae4847cb66315f4b62b2f0d36b129fd554eff184 100644
Binary files a/games/minimal/mods/default/textures/default_chest_side.png and b/games/minimal/mods/default/textures/default_chest_side.png differ
diff --git a/games/minimal/mods/default/textures/default_chest_top.png b/games/minimal/mods/default/textures/default_chest_top.png
index 58c79674d95d1fb6e947b1239234853cccdec621..ac41551b0a85585d8a5ced8f72294572d428d3bf 100644
Binary files a/games/minimal/mods/default/textures/default_chest_top.png and b/games/minimal/mods/default/textures/default_chest_top.png differ
diff --git a/games/minimal/mods/default/textures/default_clay.png b/games/minimal/mods/default/textures/default_clay.png
index 3557429d81f05837cb54ea3a964392bf28b78440..070b69e486b4f521bc7829f8245cab562a6c07c9 100644
Binary files a/games/minimal/mods/default/textures/default_clay.png and b/games/minimal/mods/default/textures/default_clay.png differ
diff --git a/games/minimal/mods/default/textures/default_clay_brick.png b/games/minimal/mods/default/textures/default_clay_brick.png
index e36648e48f68ab3c201132839093a18a7387a72f..e25633b70a51a4aa736e6583b3f1cd57eea8aca3 100644
Binary files a/games/minimal/mods/default/textures/default_clay_brick.png and b/games/minimal/mods/default/textures/default_clay_brick.png differ
diff --git a/games/minimal/mods/default/textures/default_clay_lump.png b/games/minimal/mods/default/textures/default_clay_lump.png
index be0bab9d741ce23d10d86a223e5e085d17736c9a..ceed6fa7565f91e9431ebf5ccd73a4ffa27d2cc3 100644
Binary files a/games/minimal/mods/default/textures/default_clay_lump.png and b/games/minimal/mods/default/textures/default_clay_lump.png differ
diff --git a/games/minimal/mods/default/textures/default_cloud.png b/games/minimal/mods/default/textures/default_cloud.png
index 24091a37722e5918880372acee3b414c1c2a8d77..faf0ec13de983c2e28528138705425868155b239 100644
Binary files a/games/minimal/mods/default/textures/default_cloud.png and b/games/minimal/mods/default/textures/default_cloud.png differ
diff --git a/games/minimal/mods/default/textures/default_coal_lump.png b/games/minimal/mods/default/textures/default_coal_lump.png
index bad901efaa6e67127ee6cda5fcf125c901b3c26f..dae47e3425bd7007f94cc701ecb1dec022f5b8cf 100644
Binary files a/games/minimal/mods/default/textures/default_coal_lump.png and b/games/minimal/mods/default/textures/default_coal_lump.png differ
diff --git a/games/minimal/mods/default/textures/default_cobble.png b/games/minimal/mods/default/textures/default_cobble.png
index 7d044741964a58ac04278550959002890ff6bea4..2a28d25a569acd27621d745c5d23f29585a8b265 100644
Binary files a/games/minimal/mods/default/textures/default_cobble.png and b/games/minimal/mods/default/textures/default_cobble.png differ
diff --git a/games/minimal/mods/default/textures/default_fence.png b/games/minimal/mods/default/textures/default_fence.png
index 0b99f0eb5dd6b27c9f478cc1eb8a510b59a97ea6..e3510c52a1085b10c272c40fc440b9c5eb939e8d 100644
Binary files a/games/minimal/mods/default/textures/default_fence.png and b/games/minimal/mods/default/textures/default_fence.png differ
diff --git a/games/minimal/mods/default/textures/default_furnace_fire_bg.png b/games/minimal/mods/default/textures/default_furnace_fire_bg.png
index 1272e101e5f5fb5e3c78f21f4e7bcf40c1c60c12..e3370f438fad0f8a5af6c70fcda355964da0191b 100644
Binary files a/games/minimal/mods/default/textures/default_furnace_fire_bg.png and b/games/minimal/mods/default/textures/default_furnace_fire_bg.png differ
diff --git a/games/minimal/mods/default/textures/default_furnace_fire_fg.png b/games/minimal/mods/default/textures/default_furnace_fire_fg.png
index fbb19df7438f6c806af40f6357bd0b28761c0169..7a126e325f3ca5cde22e76b3a89a10187e82d3e1 100644
Binary files a/games/minimal/mods/default/textures/default_furnace_fire_fg.png and b/games/minimal/mods/default/textures/default_furnace_fire_fg.png differ
diff --git a/games/minimal/mods/default/textures/default_furnace_front.png b/games/minimal/mods/default/textures/default_furnace_front.png
index 1620a27c33f54a34d92789d9757050b0cd5a4235..4da398c0a9c8fb2548d3351d92c836c2f6edbc11 100644
Binary files a/games/minimal/mods/default/textures/default_furnace_front.png and b/games/minimal/mods/default/textures/default_furnace_front.png differ
diff --git a/games/minimal/mods/default/textures/default_furnace_front_active.png b/games/minimal/mods/default/textures/default_furnace_front_active.png
index e4d8a5b81e68a485cb9457011391e69a421fa67e..06c4ab3efec213f9bc4883c760b9b080ce9ca3dd 100644
Binary files a/games/minimal/mods/default/textures/default_furnace_front_active.png and b/games/minimal/mods/default/textures/default_furnace_front_active.png differ
diff --git a/games/minimal/mods/default/textures/default_furnace_side.png b/games/minimal/mods/default/textures/default_furnace_side.png
index 63cb162fe5315f3b8c921c9e09be95c1a0ac573e..c729de9bf3b572e2a71f96b01b9249a6cfffca09 100644
Binary files a/games/minimal/mods/default/textures/default_furnace_side.png and b/games/minimal/mods/default/textures/default_furnace_side.png differ
diff --git a/games/minimal/mods/default/textures/default_glass.png b/games/minimal/mods/default/textures/default_glass.png
index ade0196fe64e00c80496c9bfc914645d5b472bd2..fd665a40cc26a480a29db5ae65029e21b422a2b7 100644
Binary files a/games/minimal/mods/default/textures/default_glass.png and b/games/minimal/mods/default/textures/default_glass.png differ
diff --git a/games/minimal/mods/default/textures/default_grass.png b/games/minimal/mods/default/textures/default_grass.png
index 3610bb2bc54cc561abd9d59f2ee78c9ea9d1a5a0..1d76708a046ebb96f6ce1548b824db4bfea0dfef 100644
Binary files a/games/minimal/mods/default/textures/default_grass.png and b/games/minimal/mods/default/textures/default_grass.png differ
diff --git a/games/minimal/mods/default/textures/default_grass_footsteps.png b/games/minimal/mods/default/textures/default_grass_footsteps.png
index 57e063d8cf729a82c24c700bd49a025feece82fd..8349033d62edcad0223b154d9ab04b9979eb66e6 100644
Binary files a/games/minimal/mods/default/textures/default_grass_footsteps.png and b/games/minimal/mods/default/textures/default_grass_footsteps.png differ
diff --git a/games/minimal/mods/default/textures/default_gravel.png b/games/minimal/mods/default/textures/default_gravel.png
index f08666ad9347cd736071d5cfb2ce951f956ce45c..4b47e2346ffe16711f750edcd35755174a6b88ae 100644
Binary files a/games/minimal/mods/default/textures/default_gravel.png and b/games/minimal/mods/default/textures/default_gravel.png differ
diff --git a/games/minimal/mods/default/textures/default_iron_lump.png b/games/minimal/mods/default/textures/default_iron_lump.png
index edb931018b41ea9b8c5090f6cfa38cff69008b65..6b515f66d6cd2cc3a93990f6f4bb78bea1a99111 100644
Binary files a/games/minimal/mods/default/textures/default_iron_lump.png and b/games/minimal/mods/default/textures/default_iron_lump.png differ
diff --git a/games/minimal/mods/default/textures/default_junglegrass.png b/games/minimal/mods/default/textures/default_junglegrass.png
index eea87c07c55ea290e364c45f0dbad538c19468c7..7066f7dd95418fb818b73a49ec7674afc72deac0 100644
Binary files a/games/minimal/mods/default/textures/default_junglegrass.png and b/games/minimal/mods/default/textures/default_junglegrass.png differ
diff --git a/games/minimal/mods/default/textures/default_jungletree.png b/games/minimal/mods/default/textures/default_jungletree.png
index ccd20ac7403a35d9d288524afaf94e6e50939d26..a1fd36a51069c1a0a746d29a89fc36f8df6ab269 100644
Binary files a/games/minimal/mods/default/textures/default_jungletree.png and b/games/minimal/mods/default/textures/default_jungletree.png differ
diff --git a/games/minimal/mods/default/textures/default_jungletree_top.png b/games/minimal/mods/default/textures/default_jungletree_top.png
index 2a9b51373d939d19e3486f735761bf57c88614a9..a13fdae4abe96a586ad8ad3e3d69ddf4395c28c4 100644
Binary files a/games/minimal/mods/default/textures/default_jungletree_top.png and b/games/minimal/mods/default/textures/default_jungletree_top.png differ
diff --git a/games/minimal/mods/default/textures/default_ladder.png b/games/minimal/mods/default/textures/default_ladder.png
index 11056359df244d768e3aa827f5de09feed10aabe..46757b884e9510342fd1f4323d4ede538ce7ce2b 100644
Binary files a/games/minimal/mods/default/textures/default_ladder.png and b/games/minimal/mods/default/textures/default_ladder.png differ
diff --git a/games/minimal/mods/default/textures/default_lava.png b/games/minimal/mods/default/textures/default_lava.png
index cb02ada1318a66f6af28e2095b73d79b103080ed..a4cf649f142ae0e8d7519390a0950ee2bd131b23 100644
Binary files a/games/minimal/mods/default/textures/default_lava.png and b/games/minimal/mods/default/textures/default_lava.png differ
diff --git a/games/minimal/mods/default/textures/default_lava_flowing_animated.png b/games/minimal/mods/default/textures/default_lava_flowing_animated.png
index cef8e36113597ea1b2427c6709db33322d4cf406..0bbd136069de06daa31d323780ef957f1d9745ed 100644
Binary files a/games/minimal/mods/default/textures/default_lava_flowing_animated.png and b/games/minimal/mods/default/textures/default_lava_flowing_animated.png differ
diff --git a/games/minimal/mods/default/textures/default_lava_source_animated.png b/games/minimal/mods/default/textures/default_lava_source_animated.png
index 9339a684e82af0afe60d01793457b78e76000438..aa9d57cf17d0be0dddfbb0cfe0aae10e362dac94 100644
Binary files a/games/minimal/mods/default/textures/default_lava_source_animated.png and b/games/minimal/mods/default/textures/default_lava_source_animated.png differ
diff --git a/games/minimal/mods/default/textures/default_leaves.png b/games/minimal/mods/default/textures/default_leaves.png
index 7a25126e94888ac1135b4640d084815103410a65..00ce4471c365798e385a9e6c0e3f642372769429 100644
Binary files a/games/minimal/mods/default/textures/default_leaves.png and b/games/minimal/mods/default/textures/default_leaves.png differ
diff --git a/games/minimal/mods/default/textures/default_mese.png b/games/minimal/mods/default/textures/default_mese.png
index 4c876cdc57e2f061fcd3ff3ebe9bc4c26e08487d..123f0f4b916efa30f7adfc89f43440ac28a9b86d 100644
Binary files a/games/minimal/mods/default/textures/default_mese.png and b/games/minimal/mods/default/textures/default_mese.png differ
diff --git a/games/minimal/mods/default/textures/default_mineral_coal.png b/games/minimal/mods/default/textures/default_mineral_coal.png
index 3ff9692fb483347662c6b1aa37ff7214d1bd125d..0f52062af1a21000deab8c6f02cde775efd724bd 100644
Binary files a/games/minimal/mods/default/textures/default_mineral_coal.png and b/games/minimal/mods/default/textures/default_mineral_coal.png differ
diff --git a/games/minimal/mods/default/textures/default_mineral_iron.png b/games/minimal/mods/default/textures/default_mineral_iron.png
index 51b15d95da3315794e1bd43d8a47b0de6f1609a3..6c894ce1ce524a93dfb4a7ef48e1b4eb9b83f25e 100644
Binary files a/games/minimal/mods/default/textures/default_mineral_iron.png and b/games/minimal/mods/default/textures/default_mineral_iron.png differ
diff --git a/games/minimal/mods/default/textures/default_mossycobble.png b/games/minimal/mods/default/textures/default_mossycobble.png
index fad1b33ff7dadc8147da9e75df67b303a14ad5a5..5082953a6ebc86155ff2cfb26f8145c7c2561877 100644
Binary files a/games/minimal/mods/default/textures/default_mossycobble.png and b/games/minimal/mods/default/textures/default_mossycobble.png differ
diff --git a/games/minimal/mods/default/textures/default_nc_back.png b/games/minimal/mods/default/textures/default_nc_back.png
index febd7384af439fa038cf63387b20ad4bc8c55cc6..e479ace8306c8f856da9f8f99f40924ef67a8a9a 100644
Binary files a/games/minimal/mods/default/textures/default_nc_back.png and b/games/minimal/mods/default/textures/default_nc_back.png differ
diff --git a/games/minimal/mods/default/textures/default_nc_front.png b/games/minimal/mods/default/textures/default_nc_front.png
index 53b02d174806e1bef10c8f3a8ebd134543668ae1..c9dd6a330ed87cfb410787d9038410c2f1576c54 100644
Binary files a/games/minimal/mods/default/textures/default_nc_front.png and b/games/minimal/mods/default/textures/default_nc_front.png differ
diff --git a/games/minimal/mods/default/textures/default_nc_rb.png b/games/minimal/mods/default/textures/default_nc_rb.png
index 7183e69867ab0e9aa896fd2811910382eee39d6c..685a22ccf53ab659eafcab0dd95e7b031cbdb0af 100644
Binary files a/games/minimal/mods/default/textures/default_nc_rb.png and b/games/minimal/mods/default/textures/default_nc_rb.png differ
diff --git a/games/minimal/mods/default/textures/default_nc_side.png b/games/minimal/mods/default/textures/default_nc_side.png
index 0a34c8bef9eab2e5431188bd5419f53b6032f2f9..bc85427ae32465bd6cdd6833dd1d553d55fa0971 100644
Binary files a/games/minimal/mods/default/textures/default_nc_side.png and b/games/minimal/mods/default/textures/default_nc_side.png differ
diff --git a/games/minimal/mods/default/textures/default_paper.png b/games/minimal/mods/default/textures/default_paper.png
index ae5c06bc6fea52d8d78c85592b97405682bf0e9b..3c31f77c2c6f588a0f896e0f5a6c16bf05bbfd9b 100644
Binary files a/games/minimal/mods/default/textures/default_paper.png and b/games/minimal/mods/default/textures/default_paper.png differ
diff --git a/games/minimal/mods/default/textures/default_papyrus.png b/games/minimal/mods/default/textures/default_papyrus.png
index bf0dec7fe2f2048a4f521c8efce41fd775ef1339..3707e4081ad5326e9c5d38c302de70a4173078c0 100644
Binary files a/games/minimal/mods/default/textures/default_papyrus.png and b/games/minimal/mods/default/textures/default_papyrus.png differ
diff --git a/games/minimal/mods/default/textures/default_rail.png b/games/minimal/mods/default/textures/default_rail.png
index 18176d9f3ca96ec9d6e4f6d41ab7a370aa93afeb..777e10c00404de93965cdbe42f02015572efb796 100644
Binary files a/games/minimal/mods/default/textures/default_rail.png and b/games/minimal/mods/default/textures/default_rail.png differ
diff --git a/games/minimal/mods/default/textures/default_rail_crossing.png b/games/minimal/mods/default/textures/default_rail_crossing.png
index 98464057704a84ab9dfeac63f13e9b1af8d6f1ae..a988c4740786bc78673b5e98ffa36125dd158ada 100644
Binary files a/games/minimal/mods/default/textures/default_rail_crossing.png and b/games/minimal/mods/default/textures/default_rail_crossing.png differ
diff --git a/games/minimal/mods/default/textures/default_rail_curved.png b/games/minimal/mods/default/textures/default_rail_curved.png
index 62afa3d2b81c4dc6f85275ea6de89ffb43a1be8b..f87e826c9d652e7daacd1431ad99c7c9a1236f61 100644
Binary files a/games/minimal/mods/default/textures/default_rail_curved.png and b/games/minimal/mods/default/textures/default_rail_curved.png differ
diff --git a/games/minimal/mods/default/textures/default_rail_t_junction.png b/games/minimal/mods/default/textures/default_rail_t_junction.png
index 9985f63cd49ce29f636e72fe3b168fe1b6bad236..fd25b5ba6a6b8f05f50feff56c064472867ef3c6 100644
Binary files a/games/minimal/mods/default/textures/default_rail_t_junction.png and b/games/minimal/mods/default/textures/default_rail_t_junction.png differ
diff --git a/games/minimal/mods/default/textures/default_sand.png b/games/minimal/mods/default/textures/default_sand.png
index 15101a7eb0ba9b929426eacdf144628dc6382bc7..1a56cc737ff404bc230d051d8f33658fb7ef476e 100644
Binary files a/games/minimal/mods/default/textures/default_sand.png and b/games/minimal/mods/default/textures/default_sand.png differ
diff --git a/games/minimal/mods/default/textures/default_sandstone.png b/games/minimal/mods/default/textures/default_sandstone.png
index c4759b4d0289346f97ba69c44230d34b409c2a1d..bd9cb8692f449d37711a3a31e313230d147327ee 100644
Binary files a/games/minimal/mods/default/textures/default_sandstone.png and b/games/minimal/mods/default/textures/default_sandstone.png differ
diff --git a/games/minimal/mods/default/textures/default_sapling.png b/games/minimal/mods/default/textures/default_sapling.png
index 73f502306a4d767241f2850fdf037385ee2e8887..93602322cf80884b48c15537a154a88a58540b24 100644
Binary files a/games/minimal/mods/default/textures/default_sapling.png and b/games/minimal/mods/default/textures/default_sapling.png differ
diff --git a/games/minimal/mods/default/textures/default_scorched_stuff.png b/games/minimal/mods/default/textures/default_scorched_stuff.png
index 9ced2fbe89e84a0abf5ca13f71c10a0b3b11170a..c7efc7e58d00484cda61f6ce55b810bc5ea79ade 100644
Binary files a/games/minimal/mods/default/textures/default_scorched_stuff.png and b/games/minimal/mods/default/textures/default_scorched_stuff.png differ
diff --git a/games/minimal/mods/default/textures/default_sign_wall.png b/games/minimal/mods/default/textures/default_sign_wall.png
index 06eac1ee902967573d7036eadac70fb849dd4800..93c075a2d22b67577b91b3a1844f28ff004aeb8d 100644
Binary files a/games/minimal/mods/default/textures/default_sign_wall.png and b/games/minimal/mods/default/textures/default_sign_wall.png differ
diff --git a/games/minimal/mods/default/textures/default_steel_block.png b/games/minimal/mods/default/textures/default_steel_block.png
index 8e2020081b0ac3a2a4184ec1dfee15f0726b2f4e..9c0a0e2484f58f5bc7f64076add1e0b89fe3e57f 100644
Binary files a/games/minimal/mods/default/textures/default_steel_block.png and b/games/minimal/mods/default/textures/default_steel_block.png differ
diff --git a/games/minimal/mods/default/textures/default_steel_ingot.png b/games/minimal/mods/default/textures/default_steel_ingot.png
index f6c9414e781fd31cc2a437620e2b6887424b6b59..ad133bc124e1c46e7e4aa398ad4bf5cdc475c869 100644
Binary files a/games/minimal/mods/default/textures/default_steel_ingot.png and b/games/minimal/mods/default/textures/default_steel_ingot.png differ
diff --git a/games/minimal/mods/default/textures/default_stick.png b/games/minimal/mods/default/textures/default_stick.png
index 2d31797f00678eaf60a7c84536b20b3e30d743d1..055a6ac0439fbb9a7fe1c83a07918e3891665da9 100644
Binary files a/games/minimal/mods/default/textures/default_stick.png and b/games/minimal/mods/default/textures/default_stick.png differ
diff --git a/games/minimal/mods/default/textures/default_stone.png b/games/minimal/mods/default/textures/default_stone.png
index cad0dbe2b428e955f6a345baccefba3c5428dfeb..a835fe002e4baa2554c9cccc22015ac1c1f2960c 100644
Binary files a/games/minimal/mods/default/textures/default_stone.png and b/games/minimal/mods/default/textures/default_stone.png differ
diff --git a/games/minimal/mods/default/textures/default_tnt_bottom.png b/games/minimal/mods/default/textures/default_tnt_bottom.png
index 8ba2fca0be5b58ab656f61743204358e8d8152f8..4eda0603ff17f85b0b81ea90819866aa73ec432c 100644
Binary files a/games/minimal/mods/default/textures/default_tnt_bottom.png and b/games/minimal/mods/default/textures/default_tnt_bottom.png differ
diff --git a/games/minimal/mods/default/textures/default_tnt_side.png b/games/minimal/mods/default/textures/default_tnt_side.png
index d9a2bc4ebee1e8046f98d7fd48deb545b7aa4896..c259726d688808e83e0c50a192b2dca46d190070 100644
Binary files a/games/minimal/mods/default/textures/default_tnt_side.png and b/games/minimal/mods/default/textures/default_tnt_side.png differ
diff --git a/games/minimal/mods/default/textures/default_tnt_top.png b/games/minimal/mods/default/textures/default_tnt_top.png
index a84ffc9af486b0869b64c649700eafb6aab959e9..a031a34ad5e9adae3bc2798f9c2d026219626ed8 100644
Binary files a/games/minimal/mods/default/textures/default_tnt_top.png and b/games/minimal/mods/default/textures/default_tnt_top.png differ
diff --git a/games/minimal/mods/default/textures/default_tool_mesepick.png b/games/minimal/mods/default/textures/default_tool_mesepick.png
index a1f3812e0992e9b575f00944c0a2580ce78f640d..2b5e12cdb4f28e7cb9e125119129f2cbc84f6da7 100644
Binary files a/games/minimal/mods/default/textures/default_tool_mesepick.png and b/games/minimal/mods/default/textures/default_tool_mesepick.png differ
diff --git a/games/minimal/mods/default/textures/default_tool_steelaxe.png b/games/minimal/mods/default/textures/default_tool_steelaxe.png
index 0ad23c93b70fb8f88a4b9b6d024566af443a17a2..fae19dd0dc51ec75da2d91dc8400aa543e608c6e 100644
Binary files a/games/minimal/mods/default/textures/default_tool_steelaxe.png and b/games/minimal/mods/default/textures/default_tool_steelaxe.png differ
diff --git a/games/minimal/mods/default/textures/default_tool_steelpick.png b/games/minimal/mods/default/textures/default_tool_steelpick.png
index 7982dafebf650bcc5d6492e33212365f57625d7c..3a8f58643ee084378d8049f99b93726b8126b711 100644
Binary files a/games/minimal/mods/default/textures/default_tool_steelpick.png and b/games/minimal/mods/default/textures/default_tool_steelpick.png differ
diff --git a/games/minimal/mods/default/textures/default_tool_steelshovel.png b/games/minimal/mods/default/textures/default_tool_steelshovel.png
index ed8413846005dfb5d02ada350a4e2c088c566cc8..d5b1bc6bc354e3b5f6a22fe4c5f73648b5372149 100644
Binary files a/games/minimal/mods/default/textures/default_tool_steelshovel.png and b/games/minimal/mods/default/textures/default_tool_steelshovel.png differ
diff --git a/games/minimal/mods/default/textures/default_tool_steelsword.png b/games/minimal/mods/default/textures/default_tool_steelsword.png
index a74581238cad9a6f90e319a980b4c83eda9e8e2e..efc61a0d14b8a21f02767fc5f159711f0168b5f9 100644
Binary files a/games/minimal/mods/default/textures/default_tool_steelsword.png and b/games/minimal/mods/default/textures/default_tool_steelsword.png differ
diff --git a/games/minimal/mods/default/textures/default_tool_stoneaxe.png b/games/minimal/mods/default/textures/default_tool_stoneaxe.png
index 698ac918fdbeb8dd86515fe65360b9d53077aaa7..532e16fbc10db3722f1818714d33d66cf77e4158 100644
Binary files a/games/minimal/mods/default/textures/default_tool_stoneaxe.png and b/games/minimal/mods/default/textures/default_tool_stoneaxe.png differ
diff --git a/games/minimal/mods/default/textures/default_tool_stonepick.png b/games/minimal/mods/default/textures/default_tool_stonepick.png
index b34de6f327a633d5127acaf39974c4a8aac219ec..d9156ee3a230e0d4a462fe73dbe4b4b50e9f3b48 100644
Binary files a/games/minimal/mods/default/textures/default_tool_stonepick.png and b/games/minimal/mods/default/textures/default_tool_stonepick.png differ
diff --git a/games/minimal/mods/default/textures/default_tool_stoneshovel.png b/games/minimal/mods/default/textures/default_tool_stoneshovel.png
index ba5243101a1180a6f5f07f0fb791dae2c1e9416f..7bbd2d4070260fe3fa426774e5880f831860aed0 100644
Binary files a/games/minimal/mods/default/textures/default_tool_stoneshovel.png and b/games/minimal/mods/default/textures/default_tool_stoneshovel.png differ
diff --git a/games/minimal/mods/default/textures/default_tool_stonesword.png b/games/minimal/mods/default/textures/default_tool_stonesword.png
index 8f8191f92c33c6cb8bbe7d6280f0cd518d15a36d..533b8734f67c3b954bbae8d3deca495d6eaed7e9 100644
Binary files a/games/minimal/mods/default/textures/default_tool_stonesword.png and b/games/minimal/mods/default/textures/default_tool_stonesword.png differ
diff --git a/games/minimal/mods/default/textures/default_tool_woodaxe.png b/games/minimal/mods/default/textures/default_tool_woodaxe.png
index 3daa4af72bb200b80ad57b1ee801d21ee1115c71..6e70f4a2156742b4a74f3e92b32f89b93587a226 100644
Binary files a/games/minimal/mods/default/textures/default_tool_woodaxe.png and b/games/minimal/mods/default/textures/default_tool_woodaxe.png differ
diff --git a/games/minimal/mods/default/textures/default_tool_woodpick.png b/games/minimal/mods/default/textures/default_tool_woodpick.png
index ea728cca3fd583d1cc76a702ea48b7f0961fd51a..15c61f408a469d78566a0abd666ff8d9c2f5ea54 100644
Binary files a/games/minimal/mods/default/textures/default_tool_woodpick.png and b/games/minimal/mods/default/textures/default_tool_woodpick.png differ
diff --git a/games/minimal/mods/default/textures/default_tool_woodshovel.png b/games/minimal/mods/default/textures/default_tool_woodshovel.png
index 649ab4c38a79fb48376ed13949ae5e182d328cd0..e0b3608dbaf093e1dca9be17ea30b0c8445dbc48 100644
Binary files a/games/minimal/mods/default/textures/default_tool_woodshovel.png and b/games/minimal/mods/default/textures/default_tool_woodshovel.png differ
diff --git a/games/minimal/mods/default/textures/default_tool_woodsword.png b/games/minimal/mods/default/textures/default_tool_woodsword.png
index d6c6be3254274acdd5a95665a580ad68dcfcb50e..8099af1391695db1cb70f6df1f2a77bad3d150ac 100644
Binary files a/games/minimal/mods/default/textures/default_tool_woodsword.png and b/games/minimal/mods/default/textures/default_tool_woodsword.png differ
diff --git a/games/minimal/mods/default/textures/default_torch.png b/games/minimal/mods/default/textures/default_torch.png
index 7a953c2222c831a5619cac7e3f080de8563b1adb..21d98bdbb059a806a574318ac46c7af6d4d65343 100644
Binary files a/games/minimal/mods/default/textures/default_torch.png and b/games/minimal/mods/default/textures/default_torch.png differ
diff --git a/games/minimal/mods/default/textures/default_torch_on_ceiling.png b/games/minimal/mods/default/textures/default_torch_on_ceiling.png
index 6965d380e3ec0df3037b6fcc47bbf331f968a700..dccd380b23a210f96fe4f84c9777bee87cef6476 100644
Binary files a/games/minimal/mods/default/textures/default_torch_on_ceiling.png and b/games/minimal/mods/default/textures/default_torch_on_ceiling.png differ
diff --git a/games/minimal/mods/default/textures/default_torch_on_floor.png b/games/minimal/mods/default/textures/default_torch_on_floor.png
index 76d1dd5ac90f3333cf496218d45b419911aeb172..c22010750b1e47653b60ca028faa0eade0d88046 100644
Binary files a/games/minimal/mods/default/textures/default_torch_on_floor.png and b/games/minimal/mods/default/textures/default_torch_on_floor.png differ
diff --git a/games/minimal/mods/default/textures/default_tree_top.png b/games/minimal/mods/default/textures/default_tree_top.png
index 2cdd94f80c0c991c90309ffff6f1d91f0ad188c9..3e6bd5262a4350898fc3b92045e48804b62349fe 100644
Binary files a/games/minimal/mods/default/textures/default_tree_top.png and b/games/minimal/mods/default/textures/default_tree_top.png differ
diff --git a/games/minimal/mods/default/textures/default_water.png b/games/minimal/mods/default/textures/default_water.png
index e5f8cdc25e9c48cc8307d470cc28e5ca268a3a4b..3e385ae8bd7c49eaf366af8e23a33eba5f7f990e 100644
Binary files a/games/minimal/mods/default/textures/default_water.png and b/games/minimal/mods/default/textures/default_water.png differ
diff --git a/games/minimal/mods/default/textures/heart.png b/games/minimal/mods/default/textures/heart.png
index 6bc183e04f21cba17b52009e89bb52072d5a0afd..c25f43b9a1172eab6436eeb475672433bdb6dcb3 100644
Binary files a/games/minimal/mods/default/textures/heart.png and b/games/minimal/mods/default/textures/heart.png differ
diff --git a/games/minimal/mods/default/textures/player.png b/games/minimal/mods/default/textures/player.png
index 90adf97476ecd3442dcd435201658ebfaef9d7ab..cf5d83f100fdc65c7f2a619690ef0b2c5c7dfa6c 100644
Binary files a/games/minimal/mods/default/textures/player.png and b/games/minimal/mods/default/textures/player.png differ
diff --git a/games/minimal/mods/default/textures/player_back.png b/games/minimal/mods/default/textures/player_back.png
index 530aa7519b95a650ce4fea2612b2dced58becdbc..d498674eb02b644afed9dc87559724136ca639f6 100644
Binary files a/games/minimal/mods/default/textures/player_back.png and b/games/minimal/mods/default/textures/player_back.png differ
diff --git a/games/minimal/mods/default/textures/treeprop.png b/games/minimal/mods/default/textures/treeprop.png
index 77ea4d6d4ad6c245b9fe60b0a65238b8c3fe4186..eb8a8e6c4f72f621425efa2fffd133d433c5daca 100644
Binary files a/games/minimal/mods/default/textures/treeprop.png and b/games/minimal/mods/default/textures/treeprop.png differ
diff --git a/games/minimal/mods/default/textures/wieldhand.png b/games/minimal/mods/default/textures/wieldhand.png
index c4549e5ede15586602c9223d5b5e3d9ca92b88f4..dbed6ad0c49f7b64ff050aa4ff37dd6740a1636a 100644
Binary files a/games/minimal/mods/default/textures/wieldhand.png and b/games/minimal/mods/default/textures/wieldhand.png differ
diff --git a/games/minimal/mods/experimental/textures/experimental_dummyball.png b/games/minimal/mods/experimental/textures/experimental_dummyball.png
index 0846765528b0c40fe3a5adbc6a732203dfd35e11..256414f46d76c2af0151c4866f648a77409acfd2 100644
Binary files a/games/minimal/mods/experimental/textures/experimental_dummyball.png and b/games/minimal/mods/experimental/textures/experimental_dummyball.png differ
diff --git a/games/minimal/mods/experimental/textures/experimental_tester_tool_1.png b/games/minimal/mods/experimental/textures/experimental_tester_tool_1.png
index 8b5bc0b412045f5c604f7d867feccefe6991f402..587923c8663c50b18fbc378a3e0fe75fc21cf9b6 100644
Binary files a/games/minimal/mods/experimental/textures/experimental_tester_tool_1.png and b/games/minimal/mods/experimental/textures/experimental_tester_tool_1.png differ
diff --git a/games/minimal/mods/legacy/textures/apple_iron.png b/games/minimal/mods/legacy/textures/apple_iron.png
index 2dffdf014384dc17d0b646c294c15ce0436692d4..db59458565a7ec35db083e15c671ed756e06710f 100644
Binary files a/games/minimal/mods/legacy/textures/apple_iron.png and b/games/minimal/mods/legacy/textures/apple_iron.png differ
diff --git a/games/minimal/mods/legacy/textures/cooked_rat.png b/games/minimal/mods/legacy/textures/cooked_rat.png
index daad3be0d19a741831bd9e1123846c19b580ca78..776dc4ee0111507fc57b6d2206e281ec81d2a1dc 100644
Binary files a/games/minimal/mods/legacy/textures/cooked_rat.png and b/games/minimal/mods/legacy/textures/cooked_rat.png differ
diff --git a/games/minimal/mods/legacy/textures/dungeon_master.png b/games/minimal/mods/legacy/textures/dungeon_master.png
index 3457c8228fce6572daa79e219e0bb22f568062ea..d52d8ccd7d4c3fdd7288aca92f6294b5901f4a1a 100644
Binary files a/games/minimal/mods/legacy/textures/dungeon_master.png and b/games/minimal/mods/legacy/textures/dungeon_master.png differ
diff --git a/games/minimal/mods/legacy/textures/fireball.png b/games/minimal/mods/legacy/textures/fireball.png
index 52314285004054d0eb1088c1772ffbec2315e8c2..124469ce4325ff525a55db2c2de41da83f0ec1a5 100644
Binary files a/games/minimal/mods/legacy/textures/fireball.png and b/games/minimal/mods/legacy/textures/fireball.png differ
diff --git a/games/minimal/mods/legacy/textures/firefly.png b/games/minimal/mods/legacy/textures/firefly.png
index 40df7fa1cc62fd8daf90ba6ae24a93992551b9fd..ea95a6a849e0db362164fbe8d49bae28168ddc02 100644
Binary files a/games/minimal/mods/legacy/textures/firefly.png and b/games/minimal/mods/legacy/textures/firefly.png differ
diff --git a/games/minimal/mods/legacy/textures/oerkki1.png b/games/minimal/mods/legacy/textures/oerkki1.png
index 33cbac9e76114d9ce2de4006b616fe2fd17f9f21..061709c8051ad13f7fadf84b3907dc2c87e7dc64 100644
Binary files a/games/minimal/mods/legacy/textures/oerkki1.png and b/games/minimal/mods/legacy/textures/oerkki1.png differ
diff --git a/games/minimal/mods/legacy/textures/oerkki1_damaged.png b/games/minimal/mods/legacy/textures/oerkki1_damaged.png
index 9b777387cf85645bb2bb588fddbf99d3cb85befd..b2a30337e191314efb182fd2f50e7ade00108379 100644
Binary files a/games/minimal/mods/legacy/textures/oerkki1_damaged.png and b/games/minimal/mods/legacy/textures/oerkki1_damaged.png differ
diff --git a/games/minimal/mods/legacy/textures/rat.png b/games/minimal/mods/legacy/textures/rat.png
index d1a0e2ae26ad41a751c99ea84e79f45e58c1970b..04cf9b86589557248bac317a9ec0c3beb613e77a 100644
Binary files a/games/minimal/mods/legacy/textures/rat.png and b/games/minimal/mods/legacy/textures/rat.png differ
diff --git a/minetest.conf.example b/minetest.conf.example
index 1f9780f407ae2d89748a12385dc9cab86d5a0190..4306740e9b7180a3c157ef3f176f4e5d525eda8d 100644
--- a/minetest.conf.example
+++ b/minetest.conf.example
@@ -8,7 +8,7 @@
 # Uncomment settings by removing the preceding #.
 #
 # Further documentation:
-# http://c55.me/minetest/wiki/doku.php
+# http://wiki.minetest.com/
 #
 # NOTE: This file might not be up-to-date, refer to the
 #       defaultsettings.cpp file for an up-to-date list:
@@ -93,11 +93,17 @@
 #new_style_water = false
 # Constant volume liquids
 #liquid_finite = false
+# Max liquids processed per step
+#liquid_loop_max = 1000
 # Update liquids every .. recommend for finite: 0.2
 #liquid_update = 1.0
-# When finite liquid: relax flowing blocks to source if level near max and N nearby source blocks, more realistic, but not true constant. values: 0,1,2,3,4 : 0 - disable, 1 - most aggresive
+# Relax flowing blocks to source if level near max and N nearby
+#  source blocks, more realistic, but not true constant.
+#  values: 0,1,2,3,4 : 0 - disable, 1 - most aggresive
+#  (for finite liquids)
 #liquid_relax = 2
 # Optimization: faster cave flood (and not true constant)
+#  (for finite liquids)
 #liquid_fast_flood = 1
 # Underground water and lava springs, its infnity sources if liquid_finite enabled
 #underground_springs = 1
@@ -254,6 +260,10 @@
 #max_block_send_distance = 10
 # From how far blocks are generated for clients (value * 16 nodes)
 #max_block_generate_distance = 6
+# Number of extra blocks that can be loaded by /clearobjects at once
+# This is a trade-off between sqlite transaction overhead and
+# memory consumption (4096=100MB, as a rule of thumb)
+#max_clearobjects_extra_loaded_blocks = 4096
 # Interval of sending time of day to clients
 #time_send_interval = 5
 # Length of day/night cycle. 72=20min, 360=4min, 1=24hour, 0=day/night/whatever stays unchanged
diff --git a/misc/minetest-icon-24x24.png b/misc/minetest-icon-24x24.png
index 4d587c410f81f7f8dcbca6e814212b51aa3a5e60..334e2f6d61cb8c8ffcfac839b2bacbd653e1af07 100644
Binary files a/misc/minetest-icon-24x24.png and b/misc/minetest-icon-24x24.png differ
diff --git a/src/biome.cpp b/src/biome.cpp
index b50c562a06155c377840dd972767dfaae1036653..bc84d4bc1c1ec419adf22e107da8434d81c7d1d3 100644
--- a/src/biome.cpp
+++ b/src/biome.cpp
@@ -168,3 +168,13 @@ Biome *BiomeDefManager::getBiome(float heat, float humidity, s16 y) {
 	
 	return biome_closest ? biome_closest : biomes[0];
 }
+
+
+u8 BiomeDefManager::getBiomeIdByName(const char *name) {
+	for (size_t i = 0; i != biomes.size(); i++) {
+		if (!strcasecmp(name, biomes[i]->name.c_str()))
+			return i;
+	}
+	
+	return 0;
+}
diff --git a/src/biome.h b/src/biome.h
index 17703db5a13c476167256be58ae3a9b4adc97765..535dc498947c96a7ca9ec569bd6fc36d1cd6a630 100644
--- a/src/biome.h
+++ b/src/biome.h
@@ -84,6 +84,7 @@ class BiomeDefManager {
 
 	void addBiome(Biome *b);
 	void resolveNodeNames(INodeDefManager *ndef);
+	u8 getBiomeIdByName(const char *name);
 };
 
 #endif
diff --git a/src/client.cpp b/src/client.cpp
index 6b1789fe095a51a4f963dd25cedc48c2f82936d2..5f53e14f7c73b19b25048496a14e1ed9d3d8c027 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -2680,6 +2680,13 @@ u16 Client::getHP()
 	return player->hp;
 }
 
+u16 Client::getBreath()
+{
+	Player *player = m_env.getLocalPlayer();
+	assert(player != NULL);
+	return player->breath;
+}
+
 bool Client::getChatMessage(std::wstring &message)
 {
 	if(m_chat_queue.size() == 0)
diff --git a/src/client.h b/src/client.h
index f0cc5586816372c007532ef6101854491784ddca..1d231a5a3be27b9de468c0138f12a3c3f0e0134b 100644
--- a/src/client.h
+++ b/src/client.h
@@ -349,6 +349,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
 	void setCrack(int level, v3s16 pos);
 
 	u16 getHP();
+	u16 getBreath();
 
 	bool checkPrivilege(const std::string &priv)
 	{ return (m_privileges.count(priv) != 0); }
diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp
index f270a47aa4d175d5b36818a70313a820294065c2..ffaa7a3c71475b1e72c520e721c2c93111a437f7 100644
--- a/src/defaultsettings.cpp
+++ b/src/defaultsettings.cpp
@@ -175,6 +175,7 @@ void set_default_settings(Settings *settings)
 	settings->setDefault("max_simultaneous_block_sends_server_total", "20");
 	settings->setDefault("max_block_send_distance", "9");
 	settings->setDefault("max_block_generate_distance", "7");
+	settings->setDefault("max_clearobjects_extra_loaded_blocks", "4096");
 	settings->setDefault("time_send_interval", "5");
 	settings->setDefault("time_speed", "72");
 	settings->setDefault("server_unload_unused_data_timeout", "29");
@@ -208,6 +209,7 @@ void set_default_settings(Settings *settings)
 
 	//liquid stuff
 	settings->setDefault("liquid_finite", "false");
+	settings->setDefault("liquid_loop_max", "1000");
 	settings->setDefault("liquid_update", "1.0");
 	settings->setDefault("liquid_relax", "2");
 	settings->setDefault("liquid_fast_flood", "1");
@@ -238,7 +240,7 @@ void set_default_settings(Settings *settings)
 	settings->setDefault("mgv7_np_terrain_mod",      "0, 1, (350, 350, 350), 85039, 5, 0.6");
 	settings->setDefault("mgv7_np_terrain_persist",  "0, 1, (500, 500, 500), 539, 3, 0.6");
 	settings->setDefault("mgv7_np_height_select",    "0.5, 0.5, (250, 250, 250), 4213, 5, 0.69");
-	settings->setDefault("mgv7_np_ridge",            "0.5, 1, (100, 100, 100), 6467, 4, 0.75");
+	settings->setDefault("mgv7_np_ridge",            "0, 1, (100, 100, 100), 6467, 4, 0.75");
 
 	settings->setDefault("mgindev_np_terrain_base",   "-4,   20,  (250, 250, 250), 82341, 5, 0.6,  10,  10");
 	settings->setDefault("mgindev_np_terrain_higher", "20,   16,  (500, 500, 500), 85039, 5, 0.6,  10,  10");
diff --git a/src/emerge.cpp b/src/emerge.cpp
index fd6c0e91f746d138b2f490404daf71913652f3f3..9edc42b7bf40afff857e4c6bbfbc97b8ff70f521 100644
--- a/src/emerge.cpp
+++ b/src/emerge.cpp
@@ -101,6 +101,10 @@ EmergeManager::~EmergeManager() {
 	for (unsigned int i = 0; i < ores.size(); i++)
 		delete ores[i];
 	ores.clear();
+
+	for (unsigned int i = 0; i < decorations.size(); i++)
+		delete decorations[i];
+	decorations.clear();
 	
 	for (std::map<std::string, MapgenFactory *>::iterator iter = mglist.begin();
 			iter != mglist.end(); iter ++) {
@@ -119,9 +123,13 @@ void EmergeManager::initMapgens(MapgenParams *mgparams) {
 		return;
 	
 	biomedef->resolveNodeNames(ndef);
+	for (size_t i = 0; i != ores.size(); i++)
+		ores[i]->resolveNodeNames(ndef);
+	for (size_t i = 0; i != decorations.size(); i++)
+		decorations[i]->resolveNodeNames(ndef);
 	
 	this->params = mgparams;
-	for (unsigned int i = 0; i != emergethread.size(); i++) {
+	for (size_t i = 0; i != emergethread.size(); i++) {
 		mg = createMapgen(params->mg_name, 0, params);
 		if (!mg) {
 			infostream << "EmergeManager: falling back to mapgen v6" << std::endl;
diff --git a/src/emerge.h b/src/emerge.h
index b42e82d38237e1dcaab047eb8dc0e46fd49febad..084956932eef2df2aabd2397affa01e8f6cd49f3 100644
--- a/src/emerge.h
+++ b/src/emerge.h
@@ -87,6 +87,7 @@ class EmergeManager {
 	//Mapgen-related structures
 	BiomeDefManager *biomedef;
 	std::vector<Ore *> ores;
+	std::vector<Decoration *> decorations;
 
 	EmergeManager(IGameDef *gamedef);
 	~EmergeManager();
diff --git a/src/environment.cpp b/src/environment.cpp
index 83ae590149937e7a8cf5cb9050bb245cbf0cf8f6..99da5190c0dedaef2985b253e0333e76837695aa 100644
--- a/src/environment.cpp
+++ b/src/environment.cpp
@@ -40,6 +40,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #ifndef SERVER
 #include "clientmap.h"
 #include "localplayer.h"
+#include "event.h"
 #endif
 #include "daynightratio.h"
 #include "map.h"
@@ -945,6 +946,16 @@ void ServerEnvironment::clearAllObjects()
 		m_active_objects.erase(*i);
 	}
 
+	// Get list of loaded blocks
+	std::list<v3s16> loaded_blocks;
+	infostream<<"ServerEnvironment::clearAllObjects(): "
+			<<"Listing all loaded blocks"<<std::endl;
+	m_map->listAllLoadedBlocks(loaded_blocks);
+	infostream<<"ServerEnvironment::clearAllObjects(): "
+			<<"Done listing all loaded blocks: "
+			<<loaded_blocks.size()<<std::endl;
+
+	// Get list of loadable blocks
 	std::list<v3s16> loadable_blocks;
 	infostream<<"ServerEnvironment::clearAllObjects(): "
 			<<"Listing all loadable blocks"<<std::endl;
@@ -953,6 +964,20 @@ void ServerEnvironment::clearAllObjects()
 			<<"Done listing all loadable blocks: "
 			<<loadable_blocks.size()
 			<<", now clearing"<<std::endl;
+
+	// Grab a reference on each loaded block to avoid unloading it
+	for(std::list<v3s16>::iterator i = loaded_blocks.begin();
+			i != loaded_blocks.end(); ++i)
+	{
+		v3s16 p = *i;
+		MapBlock *block = m_map->getBlockNoCreateNoEx(p);
+		assert(block);
+		block->refGrab();
+	}
+
+	// Remove objects in all loadable blocks
+	u32 unload_interval = g_settings->getS32("max_clearobjects_extra_loaded_blocks");
+	unload_interval = MYMAX(unload_interval, 1);
 	u32 report_interval = loadable_blocks.size() / 10;
 	u32 num_blocks_checked = 0;
 	u32 num_blocks_cleared = 0;
@@ -987,7 +1012,22 @@ void ServerEnvironment::clearAllObjects()
 					<<" in "<<num_blocks_cleared<<" blocks ("
 					<<percent<<"%)"<<std::endl;
 		}
+		if(num_blocks_checked % unload_interval == 0){
+			m_map->unloadUnreferencedBlocks();
+		}
 	}
+	m_map->unloadUnreferencedBlocks();
+
+	// Drop references that were added above
+	for(std::list<v3s16>::iterator i = loaded_blocks.begin();
+			i != loaded_blocks.end(); ++i)
+	{
+		v3s16 p = *i;
+		MapBlock *block = m_map->getBlockNoCreateNoEx(p);
+		assert(block);
+		block->refDrop();
+	}
+
 	infostream<<"ServerEnvironment::clearAllObjects(): "
 			<<"Finished: Cleared "<<num_objs_cleared<<" objects"
 			<<" in "<<num_blocks_cleared<<" blocks"<<std::endl;
@@ -2151,8 +2191,11 @@ void ClientEnvironment::step(float dtime)
 		{
 			f32 damage_f = (speed - tolerance)/BS * post_factor;
 			u16 damage = (u16)(damage_f+0.5);
-			if(damage != 0)
+			if(damage != 0){
 				damageLocalPlayer(damage, true);
+				MtEvent *e = new SimpleTriggerEvent("PlayerFallingDamage");
+				m_gamedef->event()->put(e);
+			}
 		}
 	}
 	
@@ -2184,7 +2227,45 @@ void ClientEnvironment::step(float dtime)
 			damageLocalPlayer(damage_per_second, true);
 		}
 	}
-	
+
+	/*
+		Drowning
+	*/
+	if(m_drowning_interval.step(dtime, 2.0))
+	{
+		v3f pf = lplayer->getPosition();
+
+		// head
+		v3s16 p = floatToInt(pf + v3f(0, BS*1.6, 0), BS);
+		MapNode n = m_map->getNodeNoEx(p);
+		ContentFeatures c = m_gamedef->ndef()->get(n);
+
+		if(c.isLiquid() && c.drowning){
+			if(lplayer->breath > 10)
+				lplayer->breath = 11;
+			if(lplayer->breath > 0)
+				lplayer->breath -= 1;
+		}
+
+		if(lplayer->breath == 0){
+			damageLocalPlayer(1, true);
+		}
+	}
+	if(m_breathing_interval.step(dtime, 0.5))
+	{
+		v3f pf = lplayer->getPosition();
+
+		// head
+		v3s16 p = floatToInt(pf + v3f(0, BS*1.6, 0), BS);
+		MapNode n = m_map->getNodeNoEx(p);
+		ContentFeatures c = m_gamedef->ndef()->get(n);
+
+		if(!c.isLiquid() || !c.drowning){
+			if(lplayer->breath <= 10)
+				lplayer->breath += 1;
+		}
+	}
+
 	/*
 		Stuff that can be done in an arbitarily large dtime
 	*/
@@ -2221,6 +2302,7 @@ void ClientEnvironment::step(float dtime)
 		Step active objects and update lighting of them
 	*/
 	
+	g_profiler->avg("CEnv: num of objects", m_active_objects.size());
 	bool update_lighting = m_active_object_light_update_interval.step(dtime, 0.21);
 	for(std::map<u16, ClientActiveObject*>::iterator
 			i = m_active_objects.begin();
@@ -2250,6 +2332,7 @@ void ClientEnvironment::step(float dtime)
 	/*
 		Step and handle simple objects
 	*/
+	g_profiler->avg("CEnv: num of simple objects", m_simple_objects.size());
 	for(std::list<ClientSimpleObject*>::iterator
 			i = m_simple_objects.begin(); i != m_simple_objects.end();)
 	{
diff --git a/src/environment.h b/src/environment.h
index a62173a11f51a4481fd8fa86399a9d21ce51c82c..ac479999cf748d29a09f5a18e72b74afd64dc7be 100644
--- a/src/environment.h
+++ b/src/environment.h
@@ -494,6 +494,8 @@ class ClientEnvironment : public Environment
 	Queue<ClientEnvEvent> m_client_event_queue;
 	IntervalLimiter m_active_object_light_update_interval;
 	IntervalLimiter m_lava_hurt_interval;
+	IntervalLimiter m_drowning_interval;
+	IntervalLimiter m_breathing_interval;
 	std::list<std::string> m_player_names;
 };
 
diff --git a/src/game.cpp b/src/game.cpp
index 22bd8c4292fbb02f55d8d9b715500c6d5cb7fd74..8331179593fc33d56bce265430340018a5c062c2 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -729,6 +729,18 @@ class SoundMaker
 		sm->m_sound->playSound(sm->m_ndef->get(nde->n).sound_dug, false);
 	}
 
+	static void playerDamage(MtEvent *e, void *data)
+	{
+		SoundMaker *sm = (SoundMaker*)data;
+		sm->m_sound->playSound(SimpleSoundSpec("player_damage", 0.5), false);
+	}
+
+	static void playerFallingDamage(MtEvent *e, void *data)
+	{
+		SoundMaker *sm = (SoundMaker*)data;
+		sm->m_sound->playSound(SimpleSoundSpec("player_falling_damage", 0.5), false);
+	}
+
 	void registerReceiver(MtEventManager *mgr)
 	{
 		mgr->reg("ViewBobbingStep", SoundMaker::viewBobbingStep, this);
@@ -737,6 +749,8 @@ class SoundMaker
 		mgr->reg("CameraPunchLeft", SoundMaker::cameraPunchLeft, this);
 		mgr->reg("CameraPunchRight", SoundMaker::cameraPunchRight, this);
 		mgr->reg("NodeDug", SoundMaker::nodeDug, this);
+		mgr->reg("PlayerDamage", SoundMaker::playerDamage, this);
+		mgr->reg("PlayerFallingDamage", SoundMaker::playerFallingDamage, this);
 	}
 
 	void step(float dtime)
@@ -820,7 +834,7 @@ class GameGlobalShaderConstantSetter : public IShaderConstantSetter
 	}
 };
 
-void nodePlacementPrediction(Client &client,
+bool nodePlacementPrediction(Client &client,
 		const ItemDefinition &playeritem_def,
 		v3s16 nodepos, v3s16 neighbourpos)
 {
@@ -840,7 +854,7 @@ void nodePlacementPrediction(Client &client,
 			if(nodedef->get(n_under).buildable_to)
 				p = nodepos;
 			else if (!nodedef->get(map.getNode(p)).buildable_to)
-				return;
+				return false;
 		}catch(InvalidPositionException &e){}
 		// Find id of predicted node
 		content_t id;
@@ -850,7 +864,7 @@ void nodePlacementPrediction(Client &client,
 					<<playeritem_def.name<<" (places "
 					<<prediction
 					<<") - Name not known"<<std::endl;
-			return;
+			return false;
 		}
 		// Predict param2 for facedir and wallmounted nodes
 		u8 param2 = 0;
@@ -889,13 +903,14 @@ void nodePlacementPrediction(Client &client,
 			else
 				pp = p + v3s16(0,-1,0);
 			if(!nodedef->get(map.getNode(pp)).walkable)
-				return;
+				return false;
 		}
 		// Add node to client map
 		MapNode n(id, 0, param2);
 		try{
 			// This triggers the required mesh update too
 			client.addNode(p, n);
+			return true;
 		}catch(InvalidPositionException &e){
 			errorstream<<"Node placement prediction failed for "
 					<<playeritem_def.name<<" (places "
@@ -903,6 +918,7 @@ void nodePlacementPrediction(Client &client,
 					<<") - Position not loaded"<<std::endl;
 		}
 	}
+	return false;
 }
 
 
@@ -1366,6 +1382,7 @@ void the_game(
 			false, false);
 	guitext_profiler->setBackgroundColor(video::SColor(120,0,0,0));
 	guitext_profiler->setVisible(false);
+	guitext_profiler->setWordWrap(true);
 	
 	/*
 		Some statistics are collected in these
@@ -1684,6 +1701,10 @@ void the_game(
 		{
 			input->clear();
 		}
+		if (!guienv->hasFocus(gui_chat_console) && gui_chat_console->isOpen())
+		{
+			gui_chat_console->closeConsoleAtOnce();
+		}
 
 		// Input handler step() (used by the random input generator)
 		input->step(dtime);
@@ -2198,6 +2219,9 @@ void the_game(
 					player->hurt_tilt_timer = 1.5;
 					player->hurt_tilt_strength = event.player_damage.amount/2;
 					player->hurt_tilt_strength = rangelim(player->hurt_tilt_strength, 2.0, 10.0);
+
+					MtEvent *e = new SimpleTriggerEvent("PlayerDamage");
+					gamedef->event()->put(e);
 				}
 				else if(event.type == CE_PLAYER_FORCE_MOVE)
 				{
@@ -2567,7 +2591,8 @@ void the_game(
 				Handle digging
 			*/
 			
-			if(nodig_delay_timer <= 0.0 && input->getLeftState())
+			if(nodig_delay_timer <= 0.0 && input->getLeftState()
+					&& client.checkPrivilege("interact"))
 			{
 				if(!digging)
 				{
@@ -2684,13 +2709,20 @@ void the_game(
 					gamedef->event()->put(e);
 				}
 
-				dig_time += dtime;
+				if(dig_time_complete < 100000.0)
+					dig_time += dtime;
+				else {
+					dig_time = 0;
+					client.setCrack(-1, nodepos);
+				}
 
 				camera.setDigging(0);  // left click animation
 			}
 
-			if(input->getRightClicked() ||
-					repeat_rightclick_timer >= g_settings->getFloat("repeat_rightclick_time"))
+			if((input->getRightClicked() ||
+					repeat_rightclick_timer >=
+						g_settings->getFloat("repeat_rightclick_time")) &&
+					client.checkPrivilege("interact"))
 			{
 				repeat_rightclick_timer = 0;
 				infostream<<"Ground right-clicked"<<std::endl;
@@ -2744,13 +2776,17 @@ void the_game(
 					
 					// If the wielded item has node placement prediction,
 					// make that happen
-					nodePlacementPrediction(client,
+					bool placed = nodePlacementPrediction(client,
 							playeritem_def,
 							nodepos, neighbourpos);
 					
 					// Read the sound
-					soundmaker.m_player_rightpunch_sound =
-							playeritem_def.sound_place;
+					if(placed)
+						soundmaker.m_player_rightpunch_sound =
+								playeritem_def.sound_place;
+					else
+						soundmaker.m_player_rightpunch_sound =
+								SimpleSoundSpec();
 				}
 			}
 		}
@@ -3283,7 +3319,7 @@ void the_game(
 		if (show_hud)
 		{
 			hud.drawHotbar(v2s32(displaycenter.X, screensize.Y),
-					client.getHP(), client.getPlayerItem());
+					client.getHP(), client.getPlayerItem(), client.getBreath());
 		}
 
 		/*
diff --git a/src/guiChatConsole.cpp b/src/guiChatConsole.cpp
index 3dfd0090a6c6b224898b06ed678ec41269f33eb8..daec18efc91901ec57b0585682effcc8bd8debf8 100644
--- a/src/guiChatConsole.cpp
+++ b/src/guiChatConsole.cpp
@@ -134,6 +134,11 @@ void GUIChatConsole::openConsole(f32 height)
 	reformatConsole();
 }
 
+bool GUIChatConsole::isOpen() const
+{
+	return m_open;
+}
+
 bool GUIChatConsole::isOpenInhibited() const
 {
 	return m_open_inhibited > 0;
@@ -545,7 +550,13 @@ bool GUIChatConsole::OnEvent(const SEvent& event)
 		}
 		else if(event.KeyInput.Char != 0 && !event.KeyInput.Control)
 		{
-			m_chat_backend->getPrompt().input(event.KeyInput.Char);
+			#if (defined(linux) || defined(__linux))
+				wchar_t wc = L'_';
+				mbtowc( &wc, (char *) &event.KeyInput.Char, sizeof(event.KeyInput.Char) );
+				m_chat_backend->getPrompt().input(wc);
+			#else
+				m_chat_backend->getPrompt().input(event.KeyInput.Char);
+			#endif
 			return true;
 		}
 	}
diff --git a/src/guiChatConsole.h b/src/guiChatConsole.h
index c896aae28d6caa5fd17efc7f0313077afad1e0ab..5991157b276bc06003f8c5b4c6bbc622655fd2bd 100644
--- a/src/guiChatConsole.h
+++ b/src/guiChatConsole.h
@@ -39,6 +39,9 @@ class GUIChatConsole : public gui::IGUIElement
 	// This doesn't open immediately but initiates an animation.
 	// You should call isOpenInhibited() before this.
 	void openConsole(f32 height);
+
+	bool isOpen() const;
+
 	// Check if the console should not be opened at the moment
 	// This is to avoid reopening the console immediately after closing
 	bool isOpenInhibited() const;
diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp
index 3e0d7fd46710f2fa2b20a6145ba412f189664f9b..c1b256f0890727c24df28b3ea98b4b765ab13714 100644
--- a/src/guiFormSpecMenu.cpp
+++ b/src/guiFormSpecMenu.cpp
@@ -698,7 +698,7 @@ void GUIFormSpecMenu::drawList(const ListDrawSpec &s, int phase)
 		bool selected = m_selected_item
 			&& m_invmgr->getInventory(m_selected_item->inventoryloc) == inv
 			&& m_selected_item->listname == s.listname
-			&& m_selected_item->i == i;
+			&& m_selected_item->i == item_i;
 		bool hovering = rect.isPointInside(m_pointer);
 
 		if(phase == 0)
@@ -912,11 +912,20 @@ void GUIFormSpecMenu::drawMenu()
 
 void GUIFormSpecMenu::updateSelectedItem()
 {
+	// If the selected stack has become empty for some reason, deselect it.
+	// If the selected stack has become inaccessible, deselect it.
+	// If the selected stack has become smaller, adjust m_selected_amount.
+	ItemStack selected = verifySelectedItem();
+
 	// WARNING: BLACK MAGIC
 	// See if there is a stack suited for our current guess.
 	// If such stack does not exist, clear the guess.
-	if(m_selected_content_guess.name != "")
-	{
+	if(m_selected_content_guess.name != "" &&
+			selected.name == m_selected_content_guess.name &&
+			selected.count == m_selected_content_guess.count){
+		// Selected item fits the guess. Skip the black magic.
+	}
+	else if(m_selected_content_guess.name != ""){
 		bool found = false;
 		for(u32 i=0; i<m_inventorylists.size() && !found; i++){
 			const ListDrawSpec &s = m_inventorylists[i];
@@ -934,23 +943,12 @@ void GUIFormSpecMenu::updateSelectedItem()
 				if(stack.name == m_selected_content_guess.name &&
 						stack.count == m_selected_content_guess.count){
 					found = true;
-					if(m_selected_item){
-						// If guessed stack is already selected, all is fine
-						if(m_selected_item->inventoryloc == s.inventoryloc &&
-								m_selected_item->listname == s.listname &&
-								m_selected_item->i == (s32)item_i &&
-								m_selected_amount == stack.count){
-							break;
-						}
-						delete m_selected_item;
-						m_selected_item = NULL;
-					}
 					infostream<<"Client: Changing selected content guess to "
 							<<s.inventoryloc.dump()<<" "<<s.listname
 							<<" "<<item_i<<std::endl;
+					delete m_selected_item;
 					m_selected_item = new ItemSpec(s.inventoryloc, s.listname, item_i);
 					m_selected_amount = stack.count;
-					break;
 				}
 			}
 		}
@@ -960,35 +958,6 @@ void GUIFormSpecMenu::updateSelectedItem()
 			m_selected_content_guess.name = "";
 		}
 	}
-	// If the selected stack has become empty for some reason, deselect it.
-	// If the selected stack has become smaller, adjust m_selected_amount.
-	if(m_selected_item)
-	{
-		bool selection_valid = false;
-		if(m_selected_item->isValid())
-		{
-			Inventory *inv = m_invmgr->getInventory(m_selected_item->inventoryloc);
-			if(inv)
-			{
-				InventoryList *list = inv->getList(m_selected_item->listname);
-				if(list && (u32) m_selected_item->i < list->getSize())
-				{
-					ItemStack stack = list->getItem(m_selected_item->i);
-					if(m_selected_amount > stack.count)
-						m_selected_amount = stack.count;
-					if(!stack.empty())
-						selection_valid = true;
-				}
-			}
-		}
-		if(!selection_valid)
-		{
-			delete m_selected_item;
-			m_selected_item = NULL;
-			m_selected_amount = 0;
-			m_selected_dragging = false;
-		}
-	}
 
 	// If craftresult is nonempty and nothing else is selected, select it now.
 	if(!m_selected_item)
@@ -1017,12 +986,43 @@ void GUIFormSpecMenu::updateSelectedItem()
 	// If craftresult is selected, keep the whole stack selected
 	if(m_selected_item && m_selected_item->listname == "craftresult")
 	{
-		Inventory *inv = m_invmgr->getInventory(m_selected_item->inventoryloc);
-		assert(inv);
-		InventoryList *list = inv->getList(m_selected_item->listname);
-		assert(list);
-		m_selected_amount = list->getItem(m_selected_item->i).count;
+		m_selected_amount = verifySelectedItem().count;
+	}
+}
+
+ItemStack GUIFormSpecMenu::verifySelectedItem()
+{
+	// If the selected stack has become empty for some reason, deselect it.
+	// If the selected stack has become inaccessible, deselect it.
+	// If the selected stack has become smaller, adjust m_selected_amount.
+	// Return the selected stack.
+
+	if(m_selected_item)
+	{
+		if(m_selected_item->isValid())
+		{
+			Inventory *inv = m_invmgr->getInventory(m_selected_item->inventoryloc);
+			if(inv)
+			{
+				InventoryList *list = inv->getList(m_selected_item->listname);
+				if(list && (u32) m_selected_item->i < list->getSize())
+				{
+					ItemStack stack = list->getItem(m_selected_item->i);
+					if(m_selected_amount > stack.count)
+						m_selected_amount = stack.count;
+					if(!stack.empty())
+						return stack;
+				}
+			}
+		}
+
+		// selection was not valid
+		delete m_selected_item;
+		m_selected_item = NULL;
+		m_selected_amount = 0;
+		m_selected_dragging = false;
 	}
+	return ItemStack();
 }
 
 void GUIFormSpecMenu::acceptInput()
diff --git a/src/guiFormSpecMenu.h b/src/guiFormSpecMenu.h
index 17b202b187e5ab30c2bd39ae49283236e86ce172..ae985adde157330cdcecab1a285f640c282ac8cf 100644
--- a/src/guiFormSpecMenu.h
+++ b/src/guiFormSpecMenu.h
@@ -186,6 +186,7 @@ class GUIFormSpecMenu : public GUIModalMenu
 	void drawSelectedItem();
 	void drawMenu();
 	void updateSelectedItem();
+	ItemStack verifySelectedItem();
 
 	void acceptInput();
 	bool OnEvent(const SEvent& event);
diff --git a/src/hud.cpp b/src/hud.cpp
index a3ae38bcb7a241b75832d9ced81ff8b3b85551ff..9404ed997e66971bd9ccd8085b701a98ff9a5bc5 100644
--- a/src/hud.cpp
+++ b/src/hud.cpp
@@ -278,7 +278,7 @@ void Hud::drawStatbar(v2s32 pos, u16 corner, u16 drawdir, std::string texture, s
 }
 
 
-void Hud::drawHotbar(v2s32 centerlowerpos, s32 halfheartcount, u16 playeritem) {
+void Hud::drawHotbar(v2s32 centerlowerpos, s32 halfheartcount, u16 playeritem, s32 breath) {
 	InventoryList *mainlist = inventory->getList("main");
 	if (mainlist == NULL) {
 		errorstream << "draw_hotbar(): mainlist == NULL" << std::endl;
@@ -295,6 +295,9 @@ void Hud::drawHotbar(v2s32 centerlowerpos, s32 halfheartcount, u16 playeritem) {
 	if (player->hud_flags & HUD_FLAG_HEALTHBAR_VISIBLE)
 		drawStatbar(pos - v2s32(0, 4), HUD_CORNER_LOWER, HUD_DIR_LEFT_RIGHT,
 				"heart.png", halfheartcount, v2s32(0, 0));
+	if (player->hud_flags & HUD_FLAG_BREATHBAR_VISIBLE && breath <= 10)
+		drawStatbar(pos - v2s32(-180, 4), HUD_CORNER_LOWER, HUD_DIR_LEFT_RIGHT,
+				"bubble.png", breath*2, v2s32(0, 0));
 }
 
 
diff --git a/src/hud.h b/src/hud.h
index fa9d33f8b5d5e02b6b79801bfaa066a3a94d2337..c7289f7c4f79244b963f17cd6ef00266c3c960f0 100644
--- a/src/hud.h
+++ b/src/hud.h
@@ -35,6 +35,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #define HUD_FLAG_HEALTHBAR_VISIBLE (1 << 1)
 #define HUD_FLAG_CROSSHAIR_VISIBLE (1 << 2)
 #define HUD_FLAG_WIELDITEM_VISIBLE (1 << 3)
+#define HUD_FLAG_BREATHBAR_VISIBLE (1 << 4)
 
 #define HUD_PARAM_HOTBAR_ITEMCOUNT 1
 
@@ -122,7 +123,7 @@ class Hud {
 	void drawStatbar(v2s32 pos, u16 corner, u16 drawdir,
 					 std::string texture, s32 count, v2s32 offset);
 	
-	void drawHotbar(v2s32 centerlowerpos, s32 halfheartcount, u16 playeritem);
+	void drawHotbar(v2s32 centerlowerpos, s32 halfheartcount, u16 playeritem, s32 breath);
 	void resizeHotbar();
 	
 	void drawCrosshair();
diff --git a/src/map.cpp b/src/map.cpp
index 43502253b14121b2aa3fb12e9f5e9af64f221cdb..001ae1609e3a26063ca396d31b5665a410eb2757 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -1510,6 +1510,11 @@ void Map::timerUpdate(float dtime, float unload_timeout,
 	}
 }
 
+void Map::unloadUnreferencedBlocks(std::list<v3s16> *unloaded_blocks)
+{
+	timerUpdate(0.0, -1.0, unloaded_blocks);
+}
+
 void Map::deleteSectors(std::list<v2s16> &list)
 {
 	for(std::list<v2s16>::iterator j = list.begin();
@@ -1646,10 +1651,12 @@ void Map::transformLiquidsFinite(std::map<v3s16, MapBlock*> & modified_blocks)
 	// List of MapBlocks that will require a lighting update (due to lava)
 	std::map<v3s16, MapBlock*> lighting_modified_blocks;
 
+	u16 loop_max = g_settings->getU16("liquid_loop_max");
+
 	while (m_transforming_liquid.size() > 0)
 	{
 		// This should be done here so that it is done when continue is used
-		if (loopcount >= initial_size || loopcount >= 1000)
+		if (loopcount >= initial_size || loopcount >= loop_max)
 			break;
 		loopcount++;
 		/*
@@ -1988,10 +1995,12 @@ void Map::transformLiquids(std::map<v3s16, MapBlock*> & modified_blocks)
 	// List of MapBlocks that will require a lighting update (due to lava)
 	std::map<v3s16, MapBlock*> lighting_modified_blocks;
 
+	u16 loop_max = g_settings->getU16("liquid_loop_max");
+
 	while(m_transforming_liquid.size() != 0)
 	{
 		// This should be done here so that it is done when continue is used
-		if(loopcount >= initial_size || loopcount >= 10000)
+		if(loopcount >= initial_size || loopcount >= loop_max)
 			break;
 		loopcount++;
 
@@ -3409,6 +3418,26 @@ void ServerMap::listAllLoadableBlocks(std::list<v3s16> &dst)
 	}
 }
 
+void ServerMap::listAllLoadedBlocks(std::list<v3s16> &dst)
+{
+	for(std::map<v2s16, MapSector*>::iterator si = m_sectors.begin();
+		si != m_sectors.end(); ++si)
+	{
+		MapSector *sector = si->second;
+
+		std::list<MapBlock*> blocks;
+		sector->getBlocks(blocks);
+
+		for(std::list<MapBlock*>::iterator i = blocks.begin();
+				i != blocks.end(); ++i)
+		{
+			MapBlock *block = (*i);
+			v3s16 p = block->getPos();
+			dst.push_back(p);
+		}
+	}
+}
+
 void ServerMap::saveMapMeta()
 {
 	DSTACK(__FUNCTION_NAME);
diff --git a/src/map.h b/src/map.h
index 31001e4c397b9342a430671bf2e85d4f668b00a6..530d81e7a72a646df488bd6316a96f86976a81b9 100644
--- a/src/map.h
+++ b/src/map.h
@@ -279,6 +279,12 @@ class Map /*: public NodeContainer*/
 	void timerUpdate(float dtime, float unload_timeout,
 			std::list<v3s16> *unloaded_blocks=NULL);
 
+	/*
+		Unloads all blocks with a zero refCount().
+		Saves modified blocks before unloading on MAPTYPE_SERVER.
+	*/
+	void unloadUnreferencedBlocks(std::list<v3s16> *unloaded_blocks=NULL);
+
 	// Deletes sectors and their blocks from memory
 	// Takes cache into account
 	// If deleted sector is in sector cache, clears cache
@@ -433,8 +439,8 @@ class ServerMap : public Map
 	void endSave();
 
 	void save(ModifiedState save_level);
-	//void loadAll();
 	void listAllLoadableBlocks(std::list<v3s16> &dst);
+	void listAllLoadedBlocks(std::list<v3s16> &dst);
 	// Saves map seed and possibly other stuff
 	void saveMapMeta();
 	void loadMapMeta();
diff --git a/src/mapblock_mesh.cpp b/src/mapblock_mesh.cpp
index 0f83e863c0bbaf44f1218618d1538a4b158e7fbb..be88b19732692e88d2979511dfaff5c7fe2856a9 100644
--- a/src/mapblock_mesh.cpp
+++ b/src/mapblock_mesh.cpp
@@ -717,8 +717,7 @@ TileSpec getNodeTile(MapNode mn, v3s16 p, v3s16 dir, MeshMakeData *data)
 	u16 tile_index=facedir*16 + dir_i;
 	TileSpec spec = getNodeTileN(mn, p, dir_to_tile[tile_index], data);
 	spec.rotation=dir_to_tile[tile_index + 1];
-	std::string name = data->m_gamedef->tsrc()->getTextureName(spec.texture.id);
-	spec.texture = data->m_gamedef->tsrc()->getTexture(name);
+	spec.texture = data->m_gamedef->tsrc()->getTexture(spec.texture.id);
 	return spec;
 }
 
@@ -1200,7 +1199,6 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data):
 	*/
 
 	translateMesh(m_mesh, intToFloat(data->m_blockpos * MAP_BLOCKSIZE, BS));
-	m_mesh->recalculateBoundingBox(); // translateMesh already does this
 
 	if(m_mesh)
 	{
diff --git a/src/mapgen.cpp b/src/mapgen.cpp
index 835c14be13cd196a1200ef8144e6a81afea4c6e1..72757f4fac6f13f24ddd2eb5698d2128c71eabdb 100644
--- a/src/mapgen.cpp
+++ b/src/mapgen.cpp
@@ -87,7 +87,7 @@ void Ore::resolveNodeNames(INodeDefManager *ndef) {
 			wherein = CONTENT_AIR;
 		}
 	}
-	
+
 	if (wherein == CONTENT_IGNORE) {
 		wherein = ndef->getId(wherein_name);
 		if (wherein == CONTENT_IGNORE) {
@@ -109,10 +109,7 @@ void Ore::placeOre(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) {
 	if (!in_range)
 		return;
 
-	resolveNodeNames(mg->ndef);
-	
 	int ymin, ymax;
-	
 	if (in_range & ORE_RANGE_MIRROR) {
 		ymin = MYMAX(nmin.Y, -height_max);
 		ymax = MYMIN(nmax.Y, -height_min);
@@ -122,7 +119,7 @@ void Ore::placeOre(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) {
 	}
 	if (clust_size >= ymax - ymin + 1)
 		return;
-	
+
 	nmin.Y = ymin;
 	nmax.Y = ymax;
 	generate(mg->vm, mg->seed, blockseed, nmin, nmax);
@@ -130,7 +127,7 @@ void Ore::placeOre(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) {
 
 
 void OreScatter::generate(ManualMapVoxelManipulator *vm, int seed,
-						u32 blockseed, v3s16 nmin, v3s16 nmax) {
+						  u32 blockseed, v3s16 nmin, v3s16 nmax) {
 	PseudoRandom pr(blockseed);
 	MapNode n_ore(ore, 0, ore_param2);
 
@@ -145,16 +142,16 @@ void OreScatter::generate(ManualMapVoxelManipulator *vm, int seed,
 		int x0 = pr.range(nmin.X, nmax.X - csize + 1);
 		int y0 = pr.range(nmin.Y, nmax.Y - csize + 1);
 		int z0 = pr.range(nmin.Z, nmax.Z - csize + 1);
-		
+ 
 		if (np && (NoisePerlin3D(np, x0, y0, z0, seed) < nthresh))
 			continue;
-		
+
 		for (int z1 = 0; z1 != csize; z1++)
 		for (int y1 = 0; y1 != csize; y1++)
 		for (int x1 = 0; x1 != csize; x1++) {
 			if (pr.range(1, orechance) != 1)
 				continue;
-			
+
 			u32 i = vm->m_area.index(x0 + x1, y0 + y1, z0 + z1);
 			if (vm->m_data[i].getContent() == wherein)
 				vm->m_data[i] = n_ore;
@@ -167,10 +164,10 @@ void OreSheet::generate(ManualMapVoxelManipulator *vm, int seed,
 						u32 blockseed, v3s16 nmin, v3s16 nmax) {
 	PseudoRandom pr(blockseed + 4234);
 	MapNode n_ore(ore, 0, ore_param2);
-	
+
 	int max_height = clust_size;
 	int y_start = pr.range(nmin.Y, nmax.Y - max_height);
-	
+
 	if (!noise) {
 		int sx = nmax.X - nmin.X + 1;
 		int sz = nmax.Z - nmin.Z + 1;
@@ -178,14 +175,14 @@ void OreSheet::generate(ManualMapVoxelManipulator *vm, int seed,
 	}
 	noise->seed = seed + y_start;
 	noise->perlinMap2D(nmin.X, nmin.Z);
-	
+
 	int index = 0;
 	for (int z = nmin.Z; z <= nmax.Z; z++)
 	for (int x = nmin.X; x <= nmax.X; x++) {
 		float noiseval = noise->result[index++];
 		if (noiseval < nthresh)
 			continue;
-			
+
 		int height = max_height * (1. / pr.range(1, 3));
 		int y0 = y_start + np->scale * noiseval; //pr.range(1, 3) - 1;
 		int y1 = y0 + height;
@@ -193,7 +190,7 @@ void OreSheet::generate(ManualMapVoxelManipulator *vm, int seed,
 			u32 i = vm->m_area.index(x, y, z);
 			if (!vm->m_area.contains(i))
 				continue;
-				
+
 			if (vm->m_data[i].getContent() == wherein)
 				vm->m_data[i] = n_ore;
 		}
@@ -201,6 +198,325 @@ void OreSheet::generate(ManualMapVoxelManipulator *vm, int seed,
 }
 
 
+Decoration *createDecoration(DecorationType type) {
+	switch (type) {
+		case DECO_SIMPLE:
+			return new DecoSimple;
+		//case DECO_SCHEMATIC:
+		//	return new DecoSchematic;
+		//case DECO_LSYSTEM:
+		//	return new DecoLSystem;
+		default:
+			return NULL;
+	}
+}
+
+
+Decoration::~Decoration() {
+	delete np;
+}
+
+
+void Decoration::resolveNodeNames(INodeDefManager *ndef) {
+	if (c_place_on == CONTENT_IGNORE)
+		c_place_on = ndef->getId(place_on_name);
+}
+
+
+void Decoration::placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) {
+	PseudoRandom ps(blockseed + 53);
+	int carea_size = nmax.X - nmin.X + 1;
+
+	// Divide area into parts
+	if (carea_size % sidelen) {
+		errorstream << "Decoration::placeDeco: chunk size is not divisible by "
+			"sidelen; setting sidelen to " << carea_size << std::endl;
+		sidelen = carea_size;
+	}
+	
+	s16 divlen = carea_size / sidelen;
+	int area = sidelen * sidelen;
+
+	for (s16 z0 = 0; z0 < divlen; z0++)
+	for (s16 x0 = 0; x0 < divlen; x0++) {
+		v2s16 p2d_center( // Center position of part of division
+			nmin.X + sidelen / 2 + sidelen * x0,
+			nmin.Z + sidelen / 2 + sidelen * z0
+		);
+		v2s16 p2d_min( // Minimum edge of part of division
+			nmin.X + sidelen * x0,
+			nmin.Z + sidelen * z0
+		);
+		v2s16 p2d_max( // Maximum edge of part of division
+			nmin.X + sidelen + sidelen * x0 - 1,
+			nmin.Z + sidelen + sidelen * z0 - 1
+		);
+
+		// Amount of decorations
+		float nval = np ?
+			NoisePerlin2D(np, p2d_center.X, p2d_center.Y, mapseed) :
+			fill_ratio;
+		u32 deco_count = area * MYMAX(nval, 0.f);
+
+		for (u32 i = 0; i < deco_count; i++) {
+			s16 x = ps.range(p2d_min.X, p2d_max.X);
+			s16 z = ps.range(p2d_min.Y, p2d_max.Y);
+
+			int mapindex = carea_size * (z - nmin.Z) + (x - nmin.X);
+			
+			s16 y = mg->heightmap ? 
+					mg->heightmap[mapindex] :
+					mg->findGroundLevel(v2s16(x, z), nmin.Y, nmax.Y);
+					
+			if (y < nmin.Y || y > nmax.Y)
+				continue;
+
+			int height = getHeight();
+			int max_y = nmax.Y + MAP_BLOCKSIZE;
+			if (y + 1 + height > max_y) {
+				continue;
+#if 0
+				printf("Decoration at (%d %d %d) cut off\n", x, y, z);
+				//add to queue
+				JMutexAutoLock cutofflock(cutoff_mutex);
+				cutoffs.push_back(CutoffData(x, y, z, height));
+#endif
+			}
+
+			if (mg->biomemap) {
+				std::set<u8>::iterator iter;
+				
+				if (biomes.size()) {
+					iter = biomes.find(mg->biomemap[mapindex]);
+					if (iter == biomes.end())
+						continue;
+				}
+			}
+
+			generate(mg, &ps, max_y, 0, v3s16(x, y, z));
+		}
+	}
+}
+
+
+#if 0
+void Decoration::placeCutoffs(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) {
+	PseudoRandom pr(blockseed + 53);
+	std::vector<CutoffData> handled_cutoffs;
+	
+	// Copy over the cutoffs we're interested in so we don't needlessly hold a lock
+	{
+		JMutexAutoLock cutofflock(cutoff_mutex);
+		for (std::list<CutoffData>::iterator i = cutoffs.begin();
+			i != cutoffs.end(); ++i) {
+			CutoffData cutoff = *i;
+			v3s16 p    = cutoff.p;
+			s16 height = cutoff.height;
+			if (p.X < nmin.X || p.X > nmax.X ||
+				p.Z < nmin.Z || p.Z > nmax.Z)
+				continue;
+			if (p.Y + height < nmin.Y || p.Y > nmax.Y)
+				continue;
+			
+			handled_cutoffs.push_back(cutoff);
+		}
+	}
+	
+	// Generate the cutoffs
+	for (size_t i = 0; i != handled_cutoffs.size(); i++) {
+		v3s16 p    = handled_cutoffs[i].p;
+		s16 height = handled_cutoffs[i].height;
+		
+		if (p.Y + height > nmax.Y) {
+			//printf("Decoration at (%d %d %d) cut off again!\n", p.X, p.Y, p.Z);
+			cuttoffs.push_back(v3s16(p.X, p.Y, p.Z));
+		}
+		
+		generate(mg, &pr, nmax.Y, nmin.Y - p.Y, v3s16(p.X, nmin.Y, p.Z));
+	}
+	
+	// Remove cutoffs that were handled from the cutoff list
+	{
+		JMutexAutoLock cutofflock(cutoff_mutex);
+		for (std::list<CutoffData>::iterator i = cutoffs.begin();
+			i != cutoffs.end(); ++i) {
+			
+			for (size_t j = 0; j != handled_cutoffs.size(); j++) {
+				CutoffData coff = *i;
+				if (coff.p == handled_cutoffs[j].p)
+					i = cutoffs.erase(i);
+			}
+		}
+	}	
+}
+#endif
+
+
+void DecoSimple::resolveNodeNames(INodeDefManager *ndef) {
+	Decoration::resolveNodeNames(ndef);
+	
+	if (c_deco == CONTENT_IGNORE) {
+		c_deco = ndef->getId(deco_name);
+		if (c_deco == CONTENT_IGNORE) {
+			errorstream << "DecoSimple::resolveNodeNames: decoration node '"
+				<< deco_name << "' not defined";
+			c_deco = CONTENT_AIR;
+		}
+	}
+	if (c_spawnby == CONTENT_IGNORE) {
+		c_spawnby = ndef->getId(spawnby_name);
+		if (c_spawnby == CONTENT_IGNORE) {
+			errorstream << "DecoSimple::resolveNodeNames: spawnby node '"
+				<< deco_name << "' not defined";
+			nspawnby = -1;
+			c_spawnby = CONTENT_AIR;
+		}
+	}
+	
+	if (c_decolist.size())
+		return;
+	
+	for (size_t i = 0; i != decolist_names.size(); i++) {		
+		content_t c = ndef->getId(decolist_names[i]);
+		if (c == CONTENT_IGNORE) {
+			errorstream << "DecoSimple::resolveNodeNames: decolist node '"
+				<< decolist_names[i] << "' not defined";
+			c = CONTENT_AIR;
+		}
+		c_decolist.push_back(c);
+	}
+}
+
+
+void DecoSimple::generate(Mapgen *mg, PseudoRandom *pr, s16 max_y, s16 start_y, v3s16 p) {
+	ManualMapVoxelManipulator *vm = mg->vm;
+
+	u32 vi = vm->m_area.index(p);
+	if (vm->m_data[vi].getContent() != c_place_on &&
+		c_place_on != CONTENT_IGNORE)
+		return;
+		
+	if (nspawnby != -1) {
+		int nneighs = 0;
+		v3s16 dirs[8] = { // a Moore neighborhood
+			v3s16( 0, 0,  1),
+			v3s16( 0, 0, -1),
+			v3s16( 1, 0,  0),
+			v3s16(-1, 0,  0),
+			v3s16( 1, 0,  1),
+			v3s16(-1, 0,  1),
+			v3s16(-1, 0, -1),
+			v3s16( 1, 0, -1)
+		};
+		
+		for (int i = 0; i != 8; i++) {
+			u32 index = vm->m_area.index(p + dirs[i]);
+			if (vm->m_area.contains(index) &&
+				vm->m_data[index].getContent() == c_spawnby)
+				nneighs++;
+		}
+		
+		if (nneighs < nspawnby)
+			return;
+	}
+	
+	size_t ndecos = c_decolist.size();
+	content_t c_place = ndecos ? c_decolist[pr->range(0, ndecos - 1)] : c_deco;
+
+	s16 height = (deco_height_max > 0) ?
+		pr->range(deco_height, deco_height_max) : deco_height;
+
+	height = MYMIN(height, max_y - p.Y);
+	
+	v3s16 em = vm->m_area.getExtent();
+	for (int i = start_y; i < height; i++) {
+		vm->m_area.add_y(em, vi, 1);
+		
+		content_t c = vm->m_data[vi].getContent();
+		if (c != CONTENT_AIR && c != CONTENT_IGNORE)
+			break;
+		
+		vm->m_data[vi] = MapNode(c_place);
+	}
+}
+
+
+int DecoSimple::getHeight() {
+	return (deco_height_max > 0) ? deco_height_max : deco_height;
+}
+
+
+std::string DecoSimple::getName() {
+	return deco_name;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+
+
+Mapgen::Mapgen() {
+	seed        = 0;
+	water_level = 0;
+	generating  = false;
+	id          = -1;
+	vm          = NULL;
+	ndef        = NULL;
+	heightmap   = NULL;
+	biomemap    = NULL;
+}
+
+
+// Returns Y one under area minimum if not found
+s16 Mapgen::findGroundLevelFull(v2s16 p2d) {
+	v3s16 em = vm->m_area.getExtent();
+	s16 y_nodes_max = vm->m_area.MaxEdge.Y;
+	s16 y_nodes_min = vm->m_area.MinEdge.Y;
+	u32 i = vm->m_area.index(p2d.X, y_nodes_max, p2d.Y);
+	s16 y;
+	
+	for (y = y_nodes_max; y >= y_nodes_min; y--) {
+		MapNode &n = vm->m_data[i];
+		if (ndef->get(n).walkable)
+			break;
+
+		vm->m_area.add_y(em, i, -1);
+	}
+	return (y >= y_nodes_min) ? y : y_nodes_min - 1;
+}
+
+
+s16 Mapgen::findGroundLevel(v2s16 p2d, s16 ymin, s16 ymax) {
+	v3s16 em = vm->m_area.getExtent();
+	u32 i = vm->m_area.index(p2d.X, ymax, p2d.Y);
+	s16 y;
+	
+	for (y = ymax; y >= ymin; y--) {
+		MapNode &n = vm->m_data[i];
+		if (ndef->get(n).walkable)
+			break;
+
+		vm->m_area.add_y(em, i, -1);
+	}
+	return y;
+}
+
+
+void Mapgen::updateHeightmap(v3s16 nmin, v3s16 nmax) {
+	if (!heightmap)
+		return;
+	
+	//TimeTaker t("Mapgen::updateHeightmap", NULL, PRECISION_MICRO);
+	int index = 0;
+	for (s16 z = nmin.Z; z <= nmax.Z; z++) {
+		for (s16 x = nmin.X; x <= nmax.X; x++) {
+			s16 y = findGroundLevel(v2s16(x, z), nmin.Y, nmax.Y);
+			heightmap[index++] = y;
+		}
+	}
+	//printf("updateHeightmap: %dus\n", t.stop());
+}
+
+
 void Mapgen::updateLiquid(UniqueQueue<v3s16> *trans_liquid, v3s16 nmin, v3s16 nmax) {
 	bool isliquid, wasliquid;
 	v3s16 em  = vm->m_area.getExtent();
@@ -208,11 +524,11 @@ void Mapgen::updateLiquid(UniqueQueue<v3s16> *trans_liquid, v3s16 nmin, v3s16 nm
 	for (s16 z = nmin.Z; z <= nmax.Z; z++) {
 		for (s16 x = nmin.X; x <= nmax.X; x++) {
 			wasliquid = true;
-			
+
 			u32 i = vm->m_area.index(x, nmax.Y, z);
 			for (s16 y = nmax.Y; y >= nmin.Y; y--) {
 				isliquid = ndef->get(vm->m_data[i]).isLiquid();
-				
+
 				// there was a change between liquid and nonliquid, add to queue
 				if (isliquid != wasliquid)
 					trans_liquid->push_back(v3s16(x, y, z));
@@ -242,7 +558,7 @@ void Mapgen::setLighting(v3s16 nmin, v3s16 nmax, u8 light) {
 void Mapgen::lightSpread(VoxelArea &a, v3s16 p, u8 light) {
 	if (light <= 1 || !a.contains(p))
 		return;
-		
+
 	u32 vi = vm->m_area.index(p);
 	MapNode &nn = vm->m_data[vi];
 
@@ -250,9 +566,9 @@ void Mapgen::lightSpread(VoxelArea &a, v3s16 p, u8 light) {
 	// should probably compare masked, but doesn't seem to make a difference
 	if (light <= nn.param1 || !ndef->get(nn).light_propagates)
 		return;
-	
+
 	nn.param1 = light;
-	
+
 	lightSpread(a, p + v3s16(0, 0, 1), light);
 	lightSpread(a, p + v3s16(0, 1, 0), light);
 	lightSpread(a, p + v3s16(1, 0, 0), light);
@@ -282,7 +598,7 @@ void Mapgen::calcLighting(v3s16 nmin, v3s16 nmax) {
 				continue;
 			}
 			vm->m_area.add_y(em, i, -1);
-
+ 
 			for (int y = a.MaxEdge.Y; y >= a.MinEdge.Y; y--) {
 				MapNode &n = vm->m_data[i];
 				if (!ndef->get(n).sunlight_propagates)
@@ -292,7 +608,7 @@ void Mapgen::calcLighting(v3s16 nmin, v3s16 nmax) {
 			}
 		}
 	}
-	
+
 	// now spread the sunlight and light up any sources
 	for (int z = a.MinEdge.Z; z <= a.MaxEdge.Z; z++) {
 		for (int y = a.MinEdge.Y; y <= a.MaxEdge.Y; y++) {
@@ -302,11 +618,11 @@ void Mapgen::calcLighting(v3s16 nmin, v3s16 nmax) {
 				if (n.getContent() == CONTENT_IGNORE ||
 					!ndef->get(n).light_propagates)
 					continue;
-				
+
 				u8 light_produced = ndef->get(n).light_source & 0x0F;
 				if (light_produced)
 					n.param1 = light_produced;
-				
+
 				u8 light = n.param1 & 0x0F;
 				if (light) {
 					lightSpread(a, v3s16(x,     y,     z + 1), light);
@@ -319,7 +635,7 @@ void Mapgen::calcLighting(v3s16 nmin, v3s16 nmax) {
 			}
 		}
 	}
-	
+
 	//printf("updateLighting: %dms\n", t.stop());
 }
 
@@ -331,24 +647,24 @@ void Mapgen::calcLightingOld(v3s16 nmin, v3s16 nmax) {
 	bool sunlight = !block_is_underground;
 
 	ScopeProfiler sp(g_profiler, "EmergeThread: mapgen lighting update", SPT_AVG);
-	
+
 	for (int i = 0; i < 2; i++) {
 		enum LightBank bank = banks[i];
 		std::set<v3s16> light_sources;
 		std::map<v3s16, u8> unlight_from;
 
 		voxalgo::clearLightAndCollectSources(*vm, a, bank, ndef,
-                                        light_sources, unlight_from);
+											 light_sources, unlight_from);
 		voxalgo::propagateSunlight(*vm, a, sunlight, light_sources, ndef);
 
 		vm->unspreadLight(bank, unlight_from, light_sources, ndef);
 		vm->spreadLight(bank, light_sources, ndef);
 	}
 }
-
-
+ 
+ 
 //////////////////////// Mapgen V6 parameter read/write
-
+ 
 bool MapgenV6Params::readParams(Settings *settings) {
 	freq_desert = settings->getFloat("mgv6_freq_desert");
 	freq_beach  = settings->getFloat("mgv6_freq_beach");
@@ -367,12 +683,12 @@ bool MapgenV6Params::readParams(Settings *settings) {
 		settings->getNoiseParams("mgv6_np_apple_trees",    np_apple_trees);
 	return success;
 }
-
-
+ 
+ 
 void MapgenV6Params::writeParams(Settings *settings) {
 	settings->setFloat("mgv6_freq_desert", freq_desert);
 	settings->setFloat("mgv6_freq_beach",  freq_beach);
-	
+ 
 	settings->setNoiseParams("mgv6_np_terrain_base",   np_terrain_base);
 	settings->setNoiseParams("mgv6_np_terrain_higher", np_terrain_higher);
 	settings->setNoiseParams("mgv6_np_steepness",      np_steepness);
@@ -411,7 +727,6 @@ void MapgenV7Params::writeParams(Settings *settings) {
 
 /////////////////////////////////// legacy static functions for farmesh
 
-
 s16 Mapgen::find_ground_level_from_noise(u64 seed, v2s16 p2d, s16 precision) {
 	//just need to return something
 	s16 level = 5;
@@ -421,9 +736,9 @@ s16 Mapgen::find_ground_level_from_noise(u64 seed, v2s16 p2d, s16 precision) {
 
 bool Mapgen::get_have_beach(u64 seed, v2s16 p2d) {
 	double sandnoise = noise2d_perlin(
-			0.2+(float)p2d.X/250, 0.7+(float)p2d.Y/250,
-			seed+59420, 3, 0.50);
-
+				0.2+(float)p2d.X/250, 0.7+(float)p2d.Y/250,
+				seed+59420, 3, 0.50);
+ 
 	return (sandnoise > 0.15);
 }
 
diff --git a/src/mapgen.h b/src/mapgen.h
index 5d1e3bdf03952bf484c306ac0a1b7014f20b5b2b..f3d90a14eb7fa0b31391d353e4b2eecedfc542c1 100644
--- a/src/mapgen.h
+++ b/src/mapgen.h
@@ -86,9 +86,15 @@ class Mapgen {
 	int id;
 	ManualMapVoxelManipulator *vm;
 	INodeDefManager *ndef;
+	s16 *heightmap;
+	u8 *biomemap;
 
+	Mapgen();
 	virtual ~Mapgen() {}
 
+	s16 findGroundLevelFull(v2s16 p2d);
+	s16 findGroundLevel(v2s16 p2d, s16 ymin, s16 ymax);
+	void updateHeightmap(v3s16 nmin, v3s16 nmax);
 	void updateLiquid(UniqueQueue<v3s16> *trans_liquid, v3s16 nmin, v3s16 nmax);
 	void setLighting(v3s16 nmin, v3s16 nmax, u8 light);
 	void lightSpread(VoxelArea &a, v3s16 p, u8 light);
@@ -166,5 +172,90 @@ class OreSheet : public Ore {
 
 Ore *createOre(OreType type);
 
+
+enum DecorationType {
+	DECO_SIMPLE,
+	DECO_SCHEMATIC,
+	DECO_LSYSTEM
+};
+
+#if 0
+struct CutoffData {
+	VoxelArea a;
+	Decoration *deco;
+	//v3s16 p;
+	//v3s16 size;
+	//s16 height;
+	
+	CutoffData(s16 x, s16 y, s16 z, s16 h) {
+		p = v3s16(x, y, z);
+		height = h;
+	}
+};
+#endif
+
+class Decoration {
+public:
+	int mapseed;
+	std::string place_on_name;
+	content_t c_place_on;
+	s16 sidelen;
+	float fill_ratio;
+	NoiseParams *np;
+	
+	std::set<u8> biomes;
+	//std::list<CutoffData> cutoffs;
+	//JMutex cutoff_mutex;
+
+	virtual ~Decoration();
+	
+	virtual void resolveNodeNames(INodeDefManager *ndef);
+	void placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
+	void placeCutoffs(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
+	
+	virtual void generate(Mapgen *mg, PseudoRandom *pr, s16 max_y,
+						s16 start_y, v3s16 p) = 0;
+	virtual int getHeight() = 0;
+	virtual std::string getName() = 0;
+};
+
+class DecoSimple : public Decoration {
+public:
+	std::string deco_name;
+	std::string spawnby_name;
+	content_t c_deco;
+	content_t c_spawnby;
+	s16 deco_height;
+	s16 deco_height_max;
+	s16 nspawnby;
+	
+	std::vector<std::string> decolist_names;
+	std::vector<content_t> c_decolist;
+
+	~DecoSimple() {}
+	
+	void resolveNodeNames(INodeDefManager *ndef);
+	virtual void generate(Mapgen *mg, PseudoRandom *pr, s16 max_y,
+						s16 start_y, v3s16 p);
+	virtual int getHeight();
+	virtual std::string getName();
+};
+
+/*
+class DecoSchematic : public Decoration {
+public:
+	virtual void generate(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
+};
+*/
+
+/*
+class DecoLSystem : public Decoration {
+public:
+	virtual void generate(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
+};
+*/
+
+Decoration *createDecoration(DecorationType type);
+
 #endif
 
diff --git a/src/mapgen_v6.cpp b/src/mapgen_v6.cpp
index eaca33988444e3059b891d8101961a5dfbecaa99..d3db00dc20b0d93807a2376704cc69e118edf1f6 100644
--- a/src/mapgen_v6.cpp
+++ b/src/mapgen_v6.cpp
@@ -79,7 +79,7 @@ MapgenV6::MapgenV6(int mapgenid, MapgenV6Params *params, EmergeManager *emerge)
 	this->freq_beach  = params->freq_beach;
 
 	this->ystride = csize.X; //////fix this
-
+	
 	np_cave        = &params->np_cave;
 	np_humidity    = &params->np_humidity;
 	np_trees       = &params->np_trees;
@@ -108,23 +108,6 @@ MapgenV6::~MapgenV6() {
 
 //////////////////////// Some helper functions for the map generator
 
-// Returns Y one under area minimum if not found
-s16 MapgenV6::find_ground_level(v2s16 p2d) {
-	v3s16 em = vm->m_area.getExtent();
-	s16 y_nodes_max = vm->m_area.MaxEdge.Y;
-	s16 y_nodes_min = vm->m_area.MinEdge.Y;
-	u32 i = vm->m_area.index(p2d.X, y_nodes_max, p2d.Y);
-	s16 y;
-	
-	for (y = y_nodes_max; y >= y_nodes_min; y--) {
-		MapNode &n = vm->m_data[i];
-		if(ndef->get(n).walkable)
-			break;
-
-		vm->m_area.add_y(em, i, -1);
-	}
-	return (y >= y_nodes_min) ? y : y_nodes_min - 1;
-}
 
 // Returns Y one under area minimum if not found
 s16 MapgenV6::find_stone_level(v2s16 p2d) {
@@ -462,6 +445,12 @@ void MapgenV6::makeChunk(BlockMakeData *data) {
 	// Generate some trees, and add grass, if a jungle
 	if (flags & MG_TREES)
 		placeTreesAndJungleGrass();
+	
+	// Generate the registered decorations
+	for (unsigned int i = 0; i != emerge->decorations.size(); i++) {
+		Decoration *deco = emerge->decorations[i];
+		deco->placeDeco(this, blockseed + i, node_min, node_max);
+	}
 
 	// Generate the registered ores
 	for (unsigned int i = 0; i != emerge->ores.size(); i++) {
@@ -849,7 +838,7 @@ void MapgenV6::placeTreesAndJungleGrass() {
 				s16 x = grassrandom.range(p2d_min.X, p2d_max.X);
 				s16 z = grassrandom.range(p2d_min.Y, p2d_max.Y);
 				
-				s16 y = find_ground_level(v2s16(x, z)); ////////////////optimize this!
+				s16 y = findGroundLevelFull(v2s16(x, z)); ////////////////optimize this!
 				if (y < water_level || y < node_min.Y || y > node_max.Y)
 					continue;
 				
@@ -866,7 +855,7 @@ void MapgenV6::placeTreesAndJungleGrass() {
 		for (u32 i = 0; i < tree_count; i++) {
 			s16 x = myrand_range(p2d_min.X, p2d_max.X);
 			s16 z = myrand_range(p2d_min.Y, p2d_max.Y);
-			s16 y = find_ground_level(v2s16(x, z)); ////////////////////optimize this!
+			s16 y = findGroundLevelFull(v2s16(x, z)); ////////////////////optimize this!
 			// Don't make a tree under water level
 			// Don't make a tree so high that it doesn't fit
 			if(y < water_level || y > node_max.Y - 6)
diff --git a/src/mapgen_v6.h b/src/mapgen_v6.h
index 8f456fd3f1e630838d013b7afd75127c73915835..f4ffd25f3c241f6b4c47db1b99449695423707c2 100644
--- a/src/mapgen_v6.h
+++ b/src/mapgen_v6.h
@@ -132,7 +132,6 @@ class MapgenV6 : public Mapgen {
 	virtual float baseTerrainLevelFromMap(v2s16 p);
 	virtual float baseTerrainLevelFromMap(int index);
 
-	s16 find_ground_level(v2s16 p2d);
 	s16 find_stone_level(v2s16 p2d);
 	bool block_is_underground(u64 seed, v3s16 blockpos);
 	s16 find_ground_level_from_noise(u64 seed, v2s16 p2d, s16 precision);
diff --git a/src/mapgen_v7.cpp b/src/mapgen_v7.cpp
index 6daa5fc6abbaac2138d19a0d3fd2795f89203ad3..2439c95b3facf4a8123fb1a4dbf05f542f19799e 100644
--- a/src/mapgen_v7.cpp
+++ b/src/mapgen_v7.cpp
@@ -52,7 +52,7 @@ NoiseParams nparams_v7_def_terrain_persist =
 NoiseParams nparams_v7_def_height_select =
 	{0.5, 0.5, v3f(250.0, 250.0, 250.0), 4213, 5, 0.69};
 NoiseParams nparams_v7_def_ridge =
-	{0.5, 1.0, v3f(100.0, 100.0, 100.0), 6467, 4, 0.75};
+	{0, 1.0, v3f(100.0, 100.0, 100.0), 6467, 4, 0.75};
 /*
 NoiseParams nparams_v6_def_beach =
 	{0.0, 1.0, v3f(250.0, 250.0, 250.0), 59420, 3, 0.50};
@@ -121,15 +121,19 @@ int MapgenV7::getGroundLevelAtPoint(v2s16 p) {
 	Biome *b = bmgr->getBiome(heat, humidity, groundlevel);
 	
 	s16 y = groundlevel;
-	if (y > water_level) {
-		int iters = 1024; // don't even bother iterating more than 1024 times..
-		while (iters--) {
-			float ridgenoise = NoisePerlin3D(noise_ridge->np, p.X, y, p.Y, seed);
-			if (ridgenoise * (float)(y * y) < 15.0)
-				break;
-			y--;
-		}
+	int iters = 1024; // don't even bother iterating more than 64 times..
+	while (iters--) {
+		if (y <= water_level)
+			break;
+		
+		float ridgenoise = NoisePerlin3D(noise_ridge->np, p.X, y, p.Y, seed);
+		if (ridgenoise * (float)(y * y) < 15.0)
+			break;
+			
+		y--;
 	}
+	if (iters == 0)
+		printf("iters exhausted at %d %d\n", p.X, p.Y);
 
 	return y + b->top_depth;
 }
@@ -182,15 +186,24 @@ void MapgenV7::makeChunk(BlockMakeData *data) {
 	
 	generateTerrain();
 	carveRidges();
+
+	if (flags & MG_CAVES)
+		generateCaves(stone_surface_max_y);
 	
-	generateCaves(stone_surface_max_y);
 	addTopNodes();
+	
+	updateHeightmap(node_min, node_max);
 
 	if (flags & MG_DUNGEONS) {
 		DungeonGen dgen(ndef, data->seed, water_level);
 		dgen.generate(vm, blockseed, full_node_min, full_node_max);
 	}
 
+	for (size_t i = 0; i != emerge->decorations.size(); i++) {
+		Decoration *deco = emerge->decorations[i];
+		deco->placeDeco(this, blockseed + i, node_min, node_max);
+	}
+
 	for (size_t i = 0; i != emerge->ores.size(); i++) {
 		Ore *ore = emerge->ores[i];
 		ore->placeOre(this, blockseed + i, node_min, node_max);
diff --git a/src/mapgen_v7.h b/src/mapgen_v7.h
index b6b03689d12582810a035c5fa1997278106a92b7..d7177862d8bc34468085fbcf4d408fd4d8c29b60 100644
--- a/src/mapgen_v7.h
+++ b/src/mapgen_v7.h
@@ -67,9 +67,7 @@ class MapgenV7 : public Mapgen {
 	v3s16 full_node_min;
 	v3s16 full_node_max;
 	
-	s16 *heightmap;
 	s16 *ridge_heightmap;
-	u8 *biomemap;
 	
 	Noise *noise_terrain_base;
 	Noise *noise_terrain_alt;
diff --git a/src/modalMenu.h b/src/modalMenu.h
index d19b4e27cb4d33e0966d7313cbd08a9e0b6e2053..62bfabc06b7c9818bc4b6538b3d1db253c58631c 100644
--- a/src/modalMenu.h
+++ b/src/modalMenu.h
@@ -99,6 +99,7 @@ class GUIModalMenu : public gui::IGUIElement
 		allowFocusRemoval(true);
 		// This removes Environment's grab on us
 		Environment->removeFocus(this);
+		m_menumgr->deletingMenu(this);
 		this->remove();
 	}
 
diff --git a/src/nodedef.cpp b/src/nodedef.cpp
index ba3e42e980a36e9901183533c3d2f1aff6db11d5..7d8ce70d312470cbb1ba673ded75f88b433347c5 100644
--- a/src/nodedef.cpp
+++ b/src/nodedef.cpp
@@ -211,6 +211,7 @@ void ContentFeatures::reset()
 	liquid_alternative_source = "";
 	liquid_viscosity = 0;
 	liquid_renewable = true;
+	drowning = true;
 	light_source = 0;
 	damage_per_second = 0;
 	node_box = NodeBox();
@@ -279,6 +280,7 @@ void ContentFeatures::serialize(std::ostream &os, u16 protocol_version)
 	writeU8(os, rightclickable);
 	// Stuff below should be moved to correct place in a version that otherwise changes
 	// the protocol version
+	writeU8(os, drowning);
 }
 
 void ContentFeatures::deSerialize(std::istream &is)
@@ -343,6 +345,7 @@ void ContentFeatures::deSerialize(std::istream &is)
 	try{
 		// Stuff below should be moved to correct place in a version that
 		// otherwise changes the protocol version
+		drowning = readU8(is);
 	}catch(SerializationError &e) {};
 }
 
diff --git a/src/nodedef.h b/src/nodedef.h
index 2691aca33eb59376bec13174eb465639310479b6..e397d20e026de2c170bc1f74ef69e61c690fadc2 100644
--- a/src/nodedef.h
+++ b/src/nodedef.h
@@ -219,6 +219,7 @@ struct ContentFeatures
 	u8 liquid_viscosity;
 	// Is liquid renewable (new liquid source will be created between 2 existing)
 	bool liquid_renewable;
+	bool drowning;
 	// Amount of light the node emits
 	u8 light_source;
 	u32 damage_per_second;
diff --git a/src/player.cpp b/src/player.cpp
index 4eb5955c089461c5632a96e184aed0742ede3188..a199c9a6c2ff13f6257b5f93b179622e42adccec 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -36,6 +36,7 @@ Player::Player(IGameDef *gamedef):
 	camera_barely_in_ceiling(false),
 	inventory(gamedef->idef()),
 	hp(PLAYER_MAX_HP),
+	breath(-1),
 	peer_id(PEER_ID_INEXISTENT),
 // protected
 	m_gamedef(gamedef),
@@ -80,7 +81,8 @@ Player::Player(IGameDef *gamedef):
 	physics_override_gravity = 1;
 
 	hud_flags = HUD_FLAG_HOTBAR_VISIBLE | HUD_FLAG_HEALTHBAR_VISIBLE |
-			 HUD_FLAG_CROSSHAIR_VISIBLE | HUD_FLAG_WIELDITEM_VISIBLE;
+			 HUD_FLAG_CROSSHAIR_VISIBLE | HUD_FLAG_WIELDITEM_VISIBLE |
+			 HUD_FLAG_BREATHBAR_VISIBLE;
 
 	hud_hotbar_itemcount = HUD_HOTBAR_ITEMCOUNT_DEFAULT;
 }
diff --git a/src/player.h b/src/player.h
index d3738fd528b46b6afd28a5bfbdeacaa01d73bb2c..517bd354dad0fed5161e340534ff3f75dd181386 100644
--- a/src/player.h
+++ b/src/player.h
@@ -232,6 +232,7 @@ class Player
 	float physics_override_gravity;
 
 	u16 hp;
+	u16 breath;
 
 	float hurt_tilt_timer;
 	float hurt_tilt_strength;
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp
index c7966a0be83d0eac2143b4acf0a60b7dba126ba7..64c76ef7c4d446158eca7787c1ad63c44a4bd2c2 100644
--- a/src/script/common/c_content.cpp
+++ b/src/script/common/c_content.cpp
@@ -389,6 +389,7 @@ ContentFeatures read_content_features(lua_State *L, int index)
 	f.liquid_viscosity = getintfield_default(L, index,
 			"liquid_viscosity", f.liquid_viscosity);
 	getboolfield(L, index, "liquid_renewable", f.liquid_renewable);
+	getboolfield(L, index, "drowning", f.drowning);
 	// Amount of light the node emits
 	f.light_source = getintfield_default(L, index,
 			"light_source", f.light_source);
diff --git a/src/script/common/c_content.h b/src/script/common/c_content.h
index 251a72e27b3b0f62fe9585c5dc08649180ee7ce8..58be7118cd39f467e532241a1f04e78f3830beda 100644
--- a/src/script/common/c_content.h
+++ b/src/script/common/c_content.h
@@ -39,19 +39,19 @@ extern "C" {
 #include "irrlichttypes_bloated.h"
 #include "util/string.h"
 
-class MapNode;
+struct MapNode;
 class INodeDefManager;
-class PointedThing;
-class ItemStack;
-class ItemDefinition;
-class ToolCapabilities;
-class ObjectProperties;
-class SimpleSoundSpec;
-class ServerSoundParams;
+struct PointedThing;
+struct ItemStack;
+struct ItemDefinition;
+struct ToolCapabilities;
+struct ObjectProperties;
+struct SimpleSoundSpec;
+struct ServerSoundParams;
 class Inventory;
-class NodeBox;
-class ContentFeatures;
-class TileDef;
+struct NodeBox;
+struct ContentFeatures;
+struct TileDef;
 class Server;
 struct DigParams;
 struct HitParams;
diff --git a/src/script/cpp_api/s_entity.h b/src/script/cpp_api/s_entity.h
index b95b6b4b4105c5a197ef9a183a077173cf56b50f..8df9d7f0014e8f422a5949dafc97806eb4f86536 100644
--- a/src/script/cpp_api/s_entity.h
+++ b/src/script/cpp_api/s_entity.h
@@ -23,8 +23,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "cpp_api/s_base.h"
 #include "irr_v3d.h"
 
-class ObjectProperties;
-class ToolCapabilities;
+struct ObjectProperties;
+struct ToolCapabilities;
 
 class ScriptApiEntity
 		: virtual public ScriptApiBase
diff --git a/src/script/cpp_api/s_inventory.h b/src/script/cpp_api/s_inventory.h
index bf3b5de85c62376b08e192c14d12d8cc23499bdd..d1a81de8026efcacceaa685fdb1490cc2a3a63df 100644
--- a/src/script/cpp_api/s_inventory.h
+++ b/src/script/cpp_api/s_inventory.h
@@ -22,7 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include "cpp_api/s_base.h"
 
-class ItemStack;
+struct ItemStack;
 
 class ScriptApiDetached
 		: virtual public ScriptApiBase
diff --git a/src/script/cpp_api/s_item.h b/src/script/cpp_api/s_item.h
index 28ac444f678b4445afcae3739f7dd20e75b60222..0f2b160429d1ec432d4914f3b22b696fa49e90f8 100644
--- a/src/script/cpp_api/s_item.h
+++ b/src/script/cpp_api/s_item.h
@@ -23,10 +23,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "cpp_api/s_base.h"
 #include "irr_v3d.h"
 
-class PointedThing;
-class ItemStack;
+struct PointedThing;
+struct ItemStack;
 class ServerActiveObject;
-class ItemDefinition;
+struct ItemDefinition;
 class LuaItemStack;
 class ModApiItemMod;
 
diff --git a/src/script/cpp_api/s_node.h b/src/script/cpp_api/s_node.h
index bff6072b9df9c813d3443265cfdf700031c9ce10..a8c9b3a79ae607fb29dc96cf7b8eee5fbbbf179d 100644
--- a/src/script/cpp_api/s_node.h
+++ b/src/script/cpp_api/s_node.h
@@ -26,7 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "cpp_api/s_base.h"
 #include "cpp_api/s_nodemeta.h"
 
-class MapNode;
+struct MapNode;
 class ServerActiveObject;
 
 class ScriptApiNode
diff --git a/src/script/cpp_api/s_nodemeta.h b/src/script/cpp_api/s_nodemeta.h
index 9be126c62c3d591682df85fca16754e4ae977126..c2ebeba6d5d2c76ca7cf395bd714df663187ea77 100644
--- a/src/script/cpp_api/s_nodemeta.h
+++ b/src/script/cpp_api/s_nodemeta.h
@@ -24,7 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "cpp_api/s_item.h"
 #include "irr_v3d.h"
 
-class ItemStack;
+struct ItemStack;
 
 class ScriptApiNodemeta
 		: virtual public ScriptApiBase,
diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp
index 58cf337edf9a4760c7ac3c1abf97d75e6ee1bd16..a287281a90d4013c5aaa64fd9c3c0af217881875 100644
--- a/src/script/lua_api/l_env.cpp
+++ b/src/script/lua_api/l_env.cpp
@@ -550,7 +550,7 @@ int ModApiEnvMod::l_line_of_sight(lua_State *L) {
 	GET_ENV_PTR;
 
 	// read position 1 from lua
-	v3f pos1 = checkFloatPos(L, 2);
+	v3f pos1 = checkFloatPos(L, 1);
 	// read position 2 from lua
 	v3f pos2 = checkFloatPos(L, 2);
 	//read step size from lua
@@ -566,14 +566,14 @@ int ModApiEnvMod::l_find_path(lua_State *L)
 {
 	GET_ENV_PTR;
 
-	v3s16 pos1                  = read_v3s16(L, 2);
-	v3s16 pos2                  = read_v3s16(L, 3);
-	unsigned int searchdistance = luaL_checkint(L, 4);
-	unsigned int max_jump       = luaL_checkint(L, 5);
-	unsigned int max_drop       = luaL_checkint(L, 6);
+	v3s16 pos1                  = read_v3s16(L, 1);
+	v3s16 pos2                  = read_v3s16(L, 2);
+	unsigned int searchdistance = luaL_checkint(L, 3);
+	unsigned int max_jump       = luaL_checkint(L, 4);
+	unsigned int max_drop       = luaL_checkint(L, 5);
 	algorithm algo              = A_PLAIN_NP;
-	if(! lua_isnil(L, 7)) {
-		std::string algorithm       = luaL_checkstring(L,7);
+	if(! lua_isnil(L, 6)) {
+		std::string algorithm       = luaL_checkstring(L,6);
 
 		if (algorithm == "A*")
 			algo = A_PLAIN;
@@ -680,6 +680,8 @@ bool ModApiEnvMod::Initialize(lua_State *L,int top)
 	retval &= API_FCT(get_perlin_map);
 	retval &= API_FCT(clear_objects);
 	retval &= API_FCT(spawn_tree);
+	retval &= API_FCT(find_path);
+	retval &= API_FCT(line_of_sight);
 
 	return retval;
 }
diff --git a/src/script/lua_api/l_inventory.cpp b/src/script/lua_api/l_inventory.cpp
index 1404c3c8a026fcbf00ca6c57506f1cda50aeab8b..f57a4e8cd8561ab7ca6e01f1029661c22d646930 100644
--- a/src/script/lua_api/l_inventory.cpp
+++ b/src/script/lua_api/l_inventory.cpp
@@ -121,6 +121,9 @@ int InvRef::l_set_size(lua_State *L)
 	const char *listname = luaL_checkstring(L, 2);
 	int newsize = luaL_checknumber(L, 3);
 	Inventory *inv = getinv(L, ref);
+	if(inv == NULL){
+		return 0;
+	}
 	if(newsize == 0){
 		inv->deleteList(listname);
 		reportInventoryChange(L, ref);
@@ -144,6 +147,9 @@ int InvRef::l_set_width(lua_State *L)
 	const char *listname = luaL_checkstring(L, 2);
 	int newwidth = luaL_checknumber(L, 3);
 	Inventory *inv = getinv(L, ref);
+	if(inv == NULL){
+		return 0;
+	}
 	InventoryList *list = inv->getList(listname);
 	if(list){
 		list->setWidth(newwidth);
@@ -195,7 +201,11 @@ int InvRef::l_get_list(lua_State *L)
 	InvRef *ref = checkobject(L, 1);
 	const char *listname = luaL_checkstring(L, 2);
 	Inventory *inv = getinv(L, ref);
-	push_inventory_list(inv, listname, L);
+	if(inv){
+		push_inventory_list(inv, listname, L);
+	} else {
+		lua_pushnil(L);
+	}
 	return 1;
 }
 
@@ -206,6 +216,9 @@ int InvRef::l_set_list(lua_State *L)
 	InvRef *ref = checkobject(L, 1);
 	const char *listname = luaL_checkstring(L, 2);
 	Inventory *inv = getinv(L, ref);
+	if(inv == NULL){
+		return 0;
+	}
 	InventoryList *list = inv->getList(listname);
 	if(list)
 		read_inventory_list(inv, listname, L, 3,
diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp
index 1e45610a65bd3ba13d5274b06c785a70af8e536c..f90b59285bdde7de38a9c71888cb70f472b83c5f 100644
--- a/src/script/lua_api/l_object.cpp
+++ b/src/script/lua_api/l_object.cpp
@@ -62,6 +62,7 @@ struct EnumString es_HudBuiltinElement[] =
 	{HUD_FLAG_HEALTHBAR_VISIBLE, "healthbar"},
 	{HUD_FLAG_CROSSHAIR_VISIBLE, "crosshair"},
 	{HUD_FLAG_WIELDITEM_VISIBLE, "wielditem"},
+	{HUD_FLAG_BREATHBAR_VISIBLE, "breathbar"},
 	{0, NULL},
 };
 
diff --git a/src/script/lua_api/luaapi.cpp b/src/script/lua_api/luaapi.cpp
index b75304b3abfc253ce78bba0a75e07fc0f6a565ab..e19c9095266e0bc2fc70c221ccd4121e135939cf 100644
--- a/src/script/lua_api/luaapi.cpp
+++ b/src/script/lua_api/luaapi.cpp
@@ -43,6 +43,14 @@ struct EnumString ModApiBasic::es_OreType[] =
 	{0, NULL},
 };
 
+struct EnumString ModApiBasic::es_DecorationType[] =
+{
+	{DECO_SIMPLE,    "simple"},
+	{DECO_SCHEMATIC, "schematic"},
+	{DECO_LSYSTEM,   "lsystem"},
+	{0, NULL},
+};
+
 
 ModApiBasic::ModApiBasic() : ModApiBase() {
 }
@@ -72,7 +80,7 @@ bool ModApiBasic::Initialize(lua_State* L,int top) {
 	retval &= API_FCT(get_ban_list);
 	retval &= API_FCT(get_ban_description);
 	retval &= API_FCT(ban_player);
-	retval &= API_FCT(unban_player_of_ip);
+	retval &= API_FCT(unban_player_or_ip);
 	retval &= API_FCT(get_password_hash);
 	retval &= API_FCT(notify_authentication_modified);
 
@@ -92,17 +100,36 @@ bool ModApiBasic::Initialize(lua_State* L,int top) {
 	retval &= API_FCT(rollback_revert_actions_by);
 
 	retval &= API_FCT(register_ore);
+	retval &= API_FCT(register_decoration);
 
 	return retval;
 }
 
-// debug(text)
+// debug(...)
 // Writes a line to dstream
 int ModApiBasic::l_debug(lua_State *L)
 {
 	NO_MAP_LOCK_REQUIRED;
-	std::string text = lua_tostring(L, 1);
-	dstream << text << std::endl;
+	// Handle multiple parameters to behave like standard lua print()
+	int n = lua_gettop(L);
+	lua_getglobal(L, "tostring");
+	for(int i = 1; i <= n; i++){
+		/*
+			Call tostring(i-th argument).
+			This is what print() does, and it behaves a bit
+			differently from directly calling lua_tostring.
+		*/
+		lua_pushvalue(L, -1);  /* function to be called */
+		lua_pushvalue(L, i);   /* value to print */
+		lua_call(L, 1, 1);
+		const char *s = lua_tostring(L, -1);
+		if(i>1)
+			dstream << "\t";
+		if(s)
+			dstream << s;
+		lua_pop(L, 1);
+	}
+	dstream << std::endl;
 	return 0;
 }
 
@@ -162,30 +189,28 @@ int ModApiBasic::l_register_biome(lua_State *L)
 	}
 
 	enum BiomeTerrainType terrain = (BiomeTerrainType)getenumfield(L, index,
-	"terrain_type", es_BiomeTerrainType, BIOME_TERRAIN_NORMAL);
+				"terrain_type", es_BiomeTerrainType, BIOME_TERRAIN_NORMAL);
 	Biome *b = bmgr->createBiome(terrain);
 
-	b->name = getstringfield_default(L, index, "name", "");
-	b->top_nodename = getstringfield_default(L, index, "top_node", "");
-	b->top_depth = getintfield_default(L, index, "top_depth", 0);
+	b->name            = getstringfield_default(L, index, "name", "");
+	b->top_nodename    = getstringfield_default(L, index, "top_node", "");
+	b->top_depth       = getintfield_default(L, index, "top_depth", 0);
 	b->filler_nodename = getstringfield_default(L, index, "filler_node", "");
-	b->filler_height = getintfield_default(L, index, "filler_height", 0);
-	b->height_min = getintfield_default(L, index, "height_min", 0);
-	b->height_max = getintfield_default(L, index, "height_max", 0);
-	b->heat_point = getfloatfield_default(L, index, "heat_point", 0.);
-	b->humidity_point = getfloatfield_default(L, index, "humidity_point", 0.);
-
-	b->flags = 0; //reserved
-	b->c_top = CONTENT_IGNORE;
+	b->filler_height   = getintfield_default(L, index, "filler_height", 0);
+	b->height_min      = getintfield_default(L, index, "height_min", 0);
+	b->height_max      = getintfield_default(L, index, "height_max", 0);
+	b->heat_point      = getfloatfield_default(L, index, "heat_point", 0.);
+	b->humidity_point  = getfloatfield_default(L, index, "humidity_point", 0.);
+
+	b->flags    = 0; //reserved
+	b->c_top    = CONTENT_IGNORE;
 	b->c_filler = CONTENT_IGNORE;
+	verbosestream << "register_biome: " << b->name << std::endl;
 	bmgr->addBiome(b);
 
-	verbosestream << "register_biome: " << b->name << std::endl;
 	return 0;
 }
 
-
-
 // setting_set(name, value)
 int ModApiBasic::l_setting_set(lua_State *L)
 {
@@ -353,7 +378,7 @@ int ModApiBasic::l_ban_player(lua_State *L)
 }
 
 // unban_player_or_ip()
-int ModApiBasic::l_unban_player_of_ip(lua_State *L)
+int ModApiBasic::l_unban_player_or_ip(lua_State *L)
 {
 	NO_MAP_LOCK_REQUIRED;
 	const char * ip_or_name = luaL_checkstring(L, 1);
@@ -650,4 +675,111 @@ int ModApiBasic::l_register_ore(lua_State *L)
 	return 0;
 }
 
+// register_decoration({lots of stuff})
+int ModApiBasic::l_register_decoration(lua_State *L)
+{
+	int index = 1;
+	luaL_checktype(L, index, LUA_TTABLE);
+	
+	EmergeManager *emerge = getServer(L)->getEmergeManager();
+	BiomeDefManager *bdef = emerge->biomedef;
+
+	enum DecorationType decotype = (DecorationType)getenumfield(L, index,
+				"deco_type", es_DecorationType, -1);
+	if (decotype == -1) {
+		errorstream << "register_decoration: unrecognized "
+			"decoration placement type";
+		return 0;
+	}
+	
+	Decoration *deco = createDecoration(decotype);
+	if (!deco) {
+		errorstream << "register_decoration: decoration placement type "
+			<< decotype << " not implemented";
+		return 0;
+	}
+
+	deco->c_place_on    = CONTENT_IGNORE;
+	deco->place_on_name = getstringfield_default(L, index, "place_on", "ignore");
+	deco->sidelen       = getintfield_default(L, index, "sidelen", 8);
+	deco->fill_ratio    = getfloatfield_default(L, index, "fill_ratio", 0.02);
+	
+	lua_getfield(L, index, "noise_params");
+	deco->np = read_noiseparams(L, -1);
+	lua_pop(L, 1);
+	
+	lua_getfield(L, index, "biomes");
+	if (lua_istable(L, -1)) {
+		lua_pushnil(L);
+		while (lua_next(L, -2)) {
+			const char *s = lua_tostring(L, -1);
+			u8 biomeid = bdef->getBiomeIdByName(s);
+			if (biomeid)
+				deco->biomes.insert(biomeid);
+
+			lua_pop(L, 1);
+		}
+		lua_pop(L, 1);
+	}
+	
+	switch (decotype) {
+		case DECO_SIMPLE: {
+			DecoSimple *dsimple = (DecoSimple *)deco;
+			dsimple->c_deco     = CONTENT_IGNORE;
+			dsimple->c_spawnby  = CONTENT_IGNORE;
+			dsimple->spawnby_name    = getstringfield_default(L, index, "spawn_by", "air");
+			dsimple->deco_height     = getintfield_default(L, index, "height", 1);
+			dsimple->deco_height_max = getintfield_default(L, index, "height_max", 0);
+			dsimple->nspawnby        = getintfield_default(L, index, "num_spawn_by", -1);
+			
+			lua_getfield(L, index, "decoration");
+			if (lua_istable(L, -1)) {
+				lua_pushnil(L);
+				while (lua_next(L, -2)) {
+					const char *s = lua_tostring(L, -1);
+					std::string str(s);
+					dsimple->decolist_names.push_back(str);
+
+					lua_pop(L, 1);
+				}
+			} else if (lua_isstring(L, -1)) {
+				dsimple->deco_name  = std::string(lua_tostring(L, -1));
+			} else {
+				dsimple->deco_name = std::string("air");
+			}
+			lua_pop(L, 1);
+			
+			if (dsimple->deco_height <= 0) {
+				errorstream << "register_decoration: simple decoration height"
+					" must be greater than 0" << std::endl;
+				delete dsimple;
+				return 0;
+			}
+
+			break; }
+		case DECO_SCHEMATIC: {
+			//DecoSchematic *decoschematic = (DecoSchematic *)deco;
+			
+			break; }
+		case DECO_LSYSTEM: {
+			//DecoLSystem *decolsystem = (DecoLSystem *)deco;
+		
+			break; }
+	}
+	
+	if (deco->sidelen <= 0) {
+		errorstream << "register_decoration: sidelen must be "
+			"greater than 0" << std::endl;
+		delete deco;
+		return 0;
+	}
+	
+	emerge->decorations.push_back(deco);
+
+	verbosestream << "register_decoration: decoration '" << deco->getName()
+		<< "' registered" << std::endl;
+	return 0;
+}
+
+
 ModApiBasic modapibasic_prototype;
diff --git a/src/script/lua_api/luaapi.h b/src/script/lua_api/luaapi.h
index 592046965ca6b3251f3174f202400e81c84ab8f6..d03c14117c4b14a4276c1897d8c8dc6d59bcb8f8 100644
--- a/src/script/lua_api/luaapi.h
+++ b/src/script/lua_api/luaapi.h
@@ -45,9 +45,6 @@ class ModApiBasic : public ModApiBase {
 	// get_server_status()
 	static int l_get_server_status(lua_State *L);
 
-	// register_biome_groups({frequencies})
-	static int l_register_biome_groups(lua_State *L);
-
 	// register_biome({lots of stuff})
 	static int l_register_biome(lua_State *L);
 
@@ -85,7 +82,7 @@ class ModApiBasic : public ModApiBase {
 	static int l_ban_player(lua_State *L);
 
 	// unban_player_or_ip()
-	static int l_unban_player_of_ip(lua_State *L);
+	static int l_unban_player_or_ip(lua_State *L);
 
 	// show_formspec(playername,formname,formspec)
 	static int l_show_formspec(lua_State *L);
@@ -130,9 +127,15 @@ class ModApiBasic : public ModApiBase {
 	// rollback_revert_actions_by(actor, seconds) -> bool, log messages
 	static int l_rollback_revert_actions_by(lua_State *L);
 
+	// register_ore(oredesc)
 	static int l_register_ore(lua_State *L);
+	
+	// register_decoration(deco)
+	static int l_register_decoration(lua_State *L);
 
 	static struct EnumString es_OreType[];
+	static struct EnumString es_DecorationType[];
+
 };
 
 
diff --git a/src/server.cpp b/src/server.cpp
index 4268bb8098fe3009c5e8a58d81f24b8846249914..7963aeaaee1d7e6c55f5a2db8c5b7642e0f6c18b 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -2401,6 +2401,18 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
 
 			setInventoryModified(da->from_inv);
 
+			/*
+				Disable dropping items out of craftpreview
+			*/
+			if(da->from_list == "craftpreview")
+			{
+				infostream<<"Ignoring IDropAction from "
+						<<(da->from_inv.dump())<<":"<<da->from_list
+						<<" because src is "<<da->from_list<<std::endl;
+				delete a;
+				return;
+			}
+
 			// Disallow dropping items if not allowed to interact
 			if(!checkPriv(player->getName(), "interact"))
 			{
diff --git a/src/test.cpp b/src/test.cpp
index 3a0316e172083f8529c368e498444c23f2fbca05..5267b27687d66b8cea5d205e84efdb8e72b06f36 100644
--- a/src/test.cpp
+++ b/src/test.cpp
@@ -1452,7 +1452,7 @@ struct TestConnection: public TestBase
 		// Server should not have added client yet
 		UASSERT(hand_server.count == 0);
 		
-		sleep_ms(50);
+		sleep_ms(100);
 
 		try
 		{
diff --git a/src/tile.cpp b/src/tile.cpp
index 5f25e123bdd21556029e407cd81304a7e3cbee91..f176d154911dd22a529f9591feaa0327acb3c8b9 100644
--- a/src/tile.cpp
+++ b/src/tile.cpp
@@ -364,14 +364,14 @@ class TextureSource : public IWritableTextureSource
 	// Gets a separate texture
 	video::ITexture* getTextureRaw(const std::string &name)
 	{
-		AtlasPointer ap = getTexture(name + "^[forcesingle");
+		AtlasPointer ap = getTexture(name + m_forcesingle_suffix);
 		return ap.atlas;
 	}
 
 	// Gets a separate texture atlas pointer
 	AtlasPointer getTextureRawAP(const AtlasPointer &ap)
 	{
-		return getTexture(getTextureName(ap.id) + "^[forcesingle");
+		return getTexture(getTextureName(ap.id) + m_forcesingle_suffix);
 	}
 
 	// Returns a pointer to the irrlicht device
@@ -437,9 +437,14 @@ class TextureSource : public IWritableTextureSource
 	// Main texture atlas. This is filled at startup and is then not touched.
 	video::IImage *m_main_atlas_image;
 	video::ITexture *m_main_atlas_texture;
+	std::string m_forcesingle_suffix;
 
 	// Queued texture fetches (to be processed by the main thread)
 	RequestQueue<std::string, u32, u8, u8> m_get_texture_queue;
+
+	// Textures that have been overwritten with other ones
+	// but can't be deleted because the ITexture* might still be used
+	std::list<video::ITexture*> m_texture_trash;
 };
 
 IWritableTextureSource* createTextureSource(IrrlichtDevice *device)
@@ -485,6 +490,16 @@ TextureSource::~TextureSource()
 	}
 	m_atlaspointer_cache.clear();
 
+	for (std::list<video::ITexture*>::iterator iter =
+			m_texture_trash.begin(); iter != m_texture_trash.end();
+			iter++)
+	{
+		video::ITexture *t = *iter;
+
+		//cleanup trashed texture
+		driver->removeTexture(t);
+	}
+
 	infostream << "~TextureSource() "<< textures_before << "/"
 			<< driver->getTextureCount() << std::endl;
 }
@@ -870,7 +885,7 @@ void TextureSource::rebuildImagesAndTextures()
 		sap->intsize = img->getDimension();
 
 		if (t_old != 0)
-			driver->removeTexture(t_old);
+			m_texture_trash.push_back(t_old);
 	}
 }
 
@@ -1123,6 +1138,8 @@ void TextureSource::buildMainAtlas(class IGameDef *gamedef)
 			<<atlaspath<<std::endl;
 	fs::RecursiveDelete(atlaspath);
 	driver->writeImageToFile(atlas_img, atlaspath.c_str());*/
+
+	m_forcesingle_suffix = "^[forcesingle";
 }
 
 video::IImage* generate_image_from_scratch(std::string name,
diff --git a/textures/base/pack/fontdejavusansmono.png b/textures/base/pack/fontdejavusansmono.png
index 416a74f8a936a751ded741dede30d7a0ff1f7181..02ad4135297ec116293ca7f671cd896b659a4829 100644
Binary files a/textures/base/pack/fontdejavusansmono.png and b/textures/base/pack/fontdejavusansmono.png differ
diff --git a/textures/base/pack/fontlucida.png b/textures/base/pack/fontlucida.png
index c63fa02b7ab511b4241f224123f4739eab333f5e..ab7bb70b8b1003583cb5ce1221623aaef11def82 100644
Binary files a/textures/base/pack/fontlucida.png and b/textures/base/pack/fontlucida.png differ
diff --git a/textures/base/pack/logo.png b/textures/base/pack/logo.png
index f341e88925a2b9fd935d60627cc2ab6a009922d1..89be884a29c0cf09acfe0986d4a357b22d3dc9ad 100644
Binary files a/textures/base/pack/logo.png and b/textures/base/pack/logo.png differ
diff --git a/textures/base/pack/menu_header.png b/textures/base/pack/menu_header.png
index c22192d0f8d8a7c2e0dfe0b624b31f5c5218a27e..abf24038e97789e3bd4e42c1016b9ab271b62c9a 100644
Binary files a/textures/base/pack/menu_header.png and b/textures/base/pack/menu_header.png differ
diff --git a/textures/base/pack/smoke_puff.png b/textures/base/pack/smoke_puff.png
index e346d204ce5af072890042beae581140c39a3d03..e0f038f0a50952de80513f2ac44ddad3caea519a 100644
Binary files a/textures/base/pack/smoke_puff.png and b/textures/base/pack/smoke_puff.png differ
diff --git a/textures/base/pack/sunrisebg.png b/textures/base/pack/sunrisebg.png
index d8b010ebb63e6b2e4f689e82d3cd766a92ecd6d7..1d03dd3c3eb765ab6af34a9fd2007a7be85b378d 100644
Binary files a/textures/base/pack/sunrisebg.png and b/textures/base/pack/sunrisebg.png differ
diff --git a/textures/base/pack/unknown_item.png b/textures/base/pack/unknown_item.png
index 35cabf0ad21f6a0a698e3482ad97ac87e0fec529..27a3450eb8501a89a6ae880cbbe5f4c5463e72f1 100644
Binary files a/textures/base/pack/unknown_item.png and b/textures/base/pack/unknown_item.png differ
diff --git a/textures/base/pack/unknown_node.png b/textures/base/pack/unknown_node.png
index 9cae26d5c385b471588437bd7df4d44ddeb1cf7f..cb59ff4677a745d8e9b5c4f4ccd9a357e3f4db0c 100644
Binary files a/textures/base/pack/unknown_node.png and b/textures/base/pack/unknown_node.png differ
diff --git a/textures/base/pack/unknown_object.png b/textures/base/pack/unknown_object.png
index 4d6a98d569c16acda00e87c8ad997002ad8ce61c..c0166c31f8ff34468d52ff0accbb6bd592261e6c 100644
Binary files a/textures/base/pack/unknown_object.png and b/textures/base/pack/unknown_object.png differ