From a65db15b5caf92e1e18c07880ea62b8ff5ce61ff Mon Sep 17 00:00:00 2001 From: NO11 Date: Sat, 29 May 2021 19:21:15 +0000 Subject: [PATCH 001/116] Totem particle textures --- .../textures/mcl_particles_totem1.png | Bin 0 -> 148 bytes .../textures/mcl_particles_totem2.png | Bin 0 -> 154 bytes .../textures/mcl_particles_totem3.png | Bin 0 -> 155 bytes .../textures/mcl_particles_totem4.png | Bin 0 -> 165 bytes 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 mods/CORE/mcl_particles/textures/mcl_particles_totem1.png create mode 100644 mods/CORE/mcl_particles/textures/mcl_particles_totem2.png create mode 100644 mods/CORE/mcl_particles/textures/mcl_particles_totem3.png create mode 100644 mods/CORE/mcl_particles/textures/mcl_particles_totem4.png diff --git a/mods/CORE/mcl_particles/textures/mcl_particles_totem1.png b/mods/CORE/mcl_particles/textures/mcl_particles_totem1.png new file mode 100644 index 0000000000000000000000000000000000000000..15fe082e104d5d524ab2fa7b9af63c29c196756d GIT binary patch literal 148 zcmeAS@N?(olHy`uVBq!ia0y~yVBiE{4mJh`h6fYb1Q-|?*pj^6T^PXNr}OT5kaU4Z zWHAE+-(e7DJf6QIg@J*Ay~NYkmHjEJsF;#OCqL&81_lO2PZ!4!iOb0e3$znlp8fg% p|G#}q(?mhN<1Rg(K0M9*3=B?(SlHg|7mxs%?&<31vd$@?2>=a_CAk0q literal 0 HcmV?d00001 diff --git a/mods/CORE/mcl_particles/textures/mcl_particles_totem2.png b/mods/CORE/mcl_particles/textures/mcl_particles_totem2.png new file mode 100644 index 0000000000000000000000000000000000000000..2ab88983d5bc683b0c80841c53d820b10179f03b GIT binary patch literal 154 zcmeAS@N?(olHy`uVBq!ia0y~yVBiE{4mJh`h6fYb1Q-|?*pj^6T^PXNr}OT5kaU4Z zWHAE+-(e7DJf6QIg@J*Ay~NYkmHjEJsF;$n1ED%d@dG_c3 x|Nr(eO%o>yIty-MDrxmO5^>zc)I5-%fnoW79u9Av_rV}bJYD@<);T3K0RWENDmwrG literal 0 HcmV?d00001 diff --git a/mods/CORE/mcl_particles/textures/mcl_particles_totem4.png b/mods/CORE/mcl_particles/textures/mcl_particles_totem4.png new file mode 100644 index 0000000000000000000000000000000000000000..d6e6502b7fd0c0d1a68c8afdcea112d4693e07db GIT binary patch literal 165 zcmeAS@N?(olHy`uVBq!ia0y~yVBiE{4mJh`h6fYb1Q-|?*pj^6T^PXNr}OT5kaU4Z zWHAE+-(e7DJf6QIg@J*Ay~NYkmHjEJsF;#b(3S&w3=9lLo-U3d5|@(`6qpQ@ivRup z|6gA3;E59*3ppYgcR9Jma7_?35`3(tHc7_sf^SQWy9fh=F1HAmbMc|+AnQC`{an^L HB{Ts5&IT&{ literal 0 HcmV?d00001 From 75e263debca16802eabb977cbae1f1895dd32bc5 Mon Sep 17 00:00:00 2001 From: NO11 Date: Sat, 29 May 2021 19:24:16 +0000 Subject: [PATCH 002/116] Add code for totem partciles --- mods/ITEMS/mcl_totems/init.lua | 48 ++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_totems/init.lua b/mods/ITEMS/mcl_totems/init.lua index 499d7362d..e64404c2c 100644 --- a/mods/ITEMS/mcl_totems/init.lua +++ b/mods/ITEMS/mcl_totems/init.lua @@ -4,6 +4,41 @@ minetest.register_on_leaveplayer(function(player) hud_totem[player] = nil end) +-- Totem particle registration +-- TODO: real MC colors, these are randomly selected colors: +local colors = {"#7FFF00", "#698B22", "#BCEE68", "#EEEE00", "#C5F007"} +for c, color in pairs(colors) do + local colorizing = ".png^[colorize:"..color + for n = 1, 4 do + minetest.register_entity("mcl_totems:totem_particle"..n.."_color"..c, { + physical = true, + collide_with_objects = false, + collisionbox = {-0.02,-0.02,-0.02, 0.02,0.02,0.02}, + pointable = false, + visual = "sprite", + visual_size = {x=0.2, y=0.2}, + textures = {"mcl_particles_totem"..n..colorizing}, + spritediv = {x=1, y=1}, + initial_sprite_basepos = {x=0, y=0}, + static_save = false, + glow = 5, + on_activate = function(self, staticdata) + self.object:set_velocity({x = math.random(-4, 4)*math.random(), y = math.random(-1, 4)*math.random(), z = math.random(-4, 4)*math.random()}) + minetest.after(0.3, function() + self.object:set_acceleration({x=0, y=-4, z=0}) + self.object:set_velocity({x=0, y=0, z=0}) + end) + end, + on_step = function(self, dtime) + local r = math.random(1,80) + if r == 1 then + self.object:remove() + end + end + }) + end +end + -- Save the player from death when holding totem of undying in hand mcl_damage.register_modifier(function(obj, damage, reason) if obj:is_player() then @@ -32,7 +67,16 @@ mcl_damage.register_modifier(function(obj, damage, reason) -- Effects minetest.sound_play({name = "mcl_totems_totem", gain=1}, {pos=ppos, max_hear_distance=16}, true) - -- Big totem overlay + --Particles + for i = 1, 200 do + local particle = "mcl_totems:totem_particle"..math.random(1, 4).."_color"..math.random(1, 5) + minetest.after(math.random(1, 2)*math.random(), function() + local new_pos = obj:get_pos() + minetest.add_entity({x=new_pos.x, y=new_pos.y + 1, z=new_pos.z}, particle) + end) + end + + -- Big totem overlay if not hud_totem[obj] then hud_totem[obj] = obj:hud_add({ hud_elem_type = "image", @@ -55,4 +99,4 @@ mcl_damage.register_modifier(function(obj, damage, reason) end end end -end, 1000) +end, 1000) \ No newline at end of file From ee21a24fb61705bedfee8b2ad935b1e389018a58 Mon Sep 17 00:00:00 2001 From: NO11 Date: Mon, 7 Jun 2021 17:13:50 +0000 Subject: [PATCH 003/116] Don't register a separate entity for every particle --- mods/ITEMS/mcl_totems/init.lua | 60 ++++++++++++++++------------------ 1 file changed, 28 insertions(+), 32 deletions(-) diff --git a/mods/ITEMS/mcl_totems/init.lua b/mods/ITEMS/mcl_totems/init.lua index e64404c2c..a6429f7b8 100644 --- a/mods/ITEMS/mcl_totems/init.lua +++ b/mods/ITEMS/mcl_totems/init.lua @@ -7,37 +7,34 @@ end) -- Totem particle registration -- TODO: real MC colors, these are randomly selected colors: local colors = {"#7FFF00", "#698B22", "#BCEE68", "#EEEE00", "#C5F007"} -for c, color in pairs(colors) do - local colorizing = ".png^[colorize:"..color - for n = 1, 4 do - minetest.register_entity("mcl_totems:totem_particle"..n.."_color"..c, { - physical = true, - collide_with_objects = false, - collisionbox = {-0.02,-0.02,-0.02, 0.02,0.02,0.02}, - pointable = false, - visual = "sprite", - visual_size = {x=0.2, y=0.2}, - textures = {"mcl_particles_totem"..n..colorizing}, - spritediv = {x=1, y=1}, - initial_sprite_basepos = {x=0, y=0}, - static_save = false, - glow = 5, - on_activate = function(self, staticdata) - self.object:set_velocity({x = math.random(-4, 4)*math.random(), y = math.random(-1, 4)*math.random(), z = math.random(-4, 4)*math.random()}) - minetest.after(0.3, function() - self.object:set_acceleration({x=0, y=-4, z=0}) - self.object:set_velocity({x=0, y=0, z=0}) - end) - end, - on_step = function(self, dtime) - local r = math.random(1,80) - if r == 1 then - self.object:remove() - end - end +minetest.register_entity("mcl_totems:totem_particle", { + physical = true, + collide_with_objects = false, + collisionbox = {-0.02,-0.02,-0.02, 0.02,0.02,0.02}, + pointable = false, + visual = "sprite", + visual_size = {x=0.2, y=0.2}, + spritediv = {x=1, y=1}, + initial_sprite_basepos = {x=0, y=0}, + static_save = false, + glow = 5, + on_activate = function(self, staticdata) + self.object:set_properties({ + textures = {"mcl_particles_totem"..math.random(1, 4)..".png^[colorize:"..colors[math.random(#colors)]} }) + self.object:set_velocity({x = math.random(-4, 4)*math.random(), y = math.random(-1, 4)*math.random(), z = math.random(-4, 4)*math.random()}) + minetest.after(0.3, function() + self.object:set_acceleration({x=0, y=-4, z=0}) + self.object:set_velocity({x=0, y=0, z=0}) + end) + end, + on_step = function(self, dtime) + local r = math.random(1,50) + if r == 1 then + self.object:remove() + end end -end +}) -- Save the player from death when holding totem of undying in hand mcl_damage.register_modifier(function(obj, damage, reason) @@ -68,11 +65,10 @@ mcl_damage.register_modifier(function(obj, damage, reason) minetest.sound_play({name = "mcl_totems_totem", gain=1}, {pos=ppos, max_hear_distance=16}, true) --Particles - for i = 1, 200 do - local particle = "mcl_totems:totem_particle"..math.random(1, 4).."_color"..math.random(1, 5) + for i = 1, 150 do minetest.after(math.random(1, 2)*math.random(), function() local new_pos = obj:get_pos() - minetest.add_entity({x=new_pos.x, y=new_pos.y + 1, z=new_pos.z}, particle) + minetest.add_entity({x = new_pos.x, y = new_pos.y + 1, z = new_pos.z}, "mcl_totems:totem_particle") end) end From 99ccd9ea4c77d09a7e4062f16819a3bbdff9fe53 Mon Sep 17 00:00:00 2001 From: NO11 Date: Tue, 8 Jun 2021 15:13:00 +0000 Subject: [PATCH 004/116] Fix possible crash --- mods/ITEMS/mcl_totems/init.lua | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/mods/ITEMS/mcl_totems/init.lua b/mods/ITEMS/mcl_totems/init.lua index a6429f7b8..1847d579b 100644 --- a/mods/ITEMS/mcl_totems/init.lua +++ b/mods/ITEMS/mcl_totems/init.lua @@ -22,8 +22,11 @@ minetest.register_entity("mcl_totems:totem_particle", { self.object:set_properties({ textures = {"mcl_particles_totem"..math.random(1, 4)..".png^[colorize:"..colors[math.random(#colors)]} }) - self.object:set_velocity({x = math.random(-4, 4)*math.random(), y = math.random(-1, 4)*math.random(), z = math.random(-4, 4)*math.random()}) - minetest.after(0.3, function() + local t = math.random(1, 2)*math.random() + minetest.after(t, function() + self.object:set_velocity({x = math.random(-4, 4)*math.random(), y = math.random(-1, 4)*math.random(), z = math.random(-4, 4)*math.random()}) + end) + minetest.after(0.3 + t, function() self.object:set_acceleration({x=0, y=-4, z=0}) self.object:set_velocity({x=0, y=0, z=0}) end) @@ -65,12 +68,14 @@ mcl_damage.register_modifier(function(obj, damage, reason) minetest.sound_play({name = "mcl_totems_totem", gain=1}, {pos=ppos, max_hear_distance=16}, true) --Particles - for i = 1, 150 do - minetest.after(math.random(1, 2)*math.random(), function() - local new_pos = obj:get_pos() + + minetest.after(0.1, function() + local new_pos = obj:get_pos() + if not new_pos then return end + for i = 1, 150 do minetest.add_entity({x = new_pos.x, y = new_pos.y + 1, z = new_pos.z}, "mcl_totems:totem_particle") - end) - end + end + end) -- Big totem overlay if not hud_totem[obj] then From ee2fa60cae6f151720c1ac7949218f7fee6d4013 Mon Sep 17 00:00:00 2001 From: NO11 Date: Wed, 9 Jun 2021 14:47:42 +0000 Subject: [PATCH 005/116] local totem particle position --- mods/ITEMS/mcl_totems/init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_totems/init.lua b/mods/ITEMS/mcl_totems/init.lua index 1847d579b..ecdc20da0 100644 --- a/mods/ITEMS/mcl_totems/init.lua +++ b/mods/ITEMS/mcl_totems/init.lua @@ -72,8 +72,9 @@ mcl_damage.register_modifier(function(obj, damage, reason) minetest.after(0.1, function() local new_pos = obj:get_pos() if not new_pos then return end + local particlepos = {x = new_pos.x, y = new_pos.y + 1, z = new_pos.z} for i = 1, 150 do - minetest.add_entity({x = new_pos.x, y = new_pos.y + 1, z = new_pos.z}, "mcl_totems:totem_particle") + minetest.add_entity(particlepos, "mcl_totems:totem_particle") end end) From 509568b4b01e7529af9c8ad1e00980eba7bbd648 Mon Sep 17 00:00:00 2001 From: NO11 Date: Thu, 8 Jul 2021 16:49:19 +0000 Subject: [PATCH 006/116] Use real Minecraft colors for totem particles! --- mods/ITEMS/mcl_totems/init.lua | 38 ++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/mods/ITEMS/mcl_totems/init.lua b/mods/ITEMS/mcl_totems/init.lua index ecdc20da0..2311e88d7 100644 --- a/mods/ITEMS/mcl_totems/init.lua +++ b/mods/ITEMS/mcl_totems/init.lua @@ -5,8 +5,32 @@ minetest.register_on_leaveplayer(function(player) end) -- Totem particle registration --- TODO: real MC colors, these are randomly selected colors: -local colors = {"#7FFF00", "#698B22", "#BCEE68", "#EEEE00", "#C5F007"} +function rgb_to_hex(rgb) + local hexadecimal = "#" + + for key, value in pairs(rgb) do + local hex = "" + + while value > 0 do + local index = math.fmod(value, 16) + 1 + value = math.floor(value / 16) + hex = string.sub("0123456789ABCDEF", index, index) .. hex + end + + local len = string.len(hex) + + if len == 0 then + hex = "00" + elseif len == 1 then + hex = "0" .. hex + end + + hexadecimal = hexadecimal .. hex + end + + return hexadecimal +end + minetest.register_entity("mcl_totems:totem_particle", { physical = true, collide_with_objects = false, @@ -17,10 +41,16 @@ minetest.register_entity("mcl_totems:totem_particle", { spritediv = {x=1, y=1}, initial_sprite_basepos = {x=0, y=0}, static_save = false, - glow = 5, + glow = 14, on_activate = function(self, staticdata) + local color + if math.random(0, 3) == 0 then + color = rgb_to_hex({ (0.6 + math.random() * 0.2) * 255, (0.6 + math.random() * 0.3) * 255, (math.random() * 0.2) * 255 }) + else + color = rgb_to_hex({ (0.1 + math.random() * 0.4) * 255, (0.6 + math.random() * 0.3) * 255, (math.random() * 0.2) * 255 }) + end self.object:set_properties({ - textures = {"mcl_particles_totem"..math.random(1, 4)..".png^[colorize:"..colors[math.random(#colors)]} + textures = { "mcl_particles_totem"..math.random(1, 4)..".png^[colorize:"..color } }) local t = math.random(1, 2)*math.random() minetest.after(t, function() From 5ceb48fcb13ae20a4295cc7c0d4cbcfa30c26a8c Mon Sep 17 00:00:00 2001 From: NO11 Date: Mon, 12 Jul 2021 18:05:52 +0000 Subject: [PATCH 007/116] Faster rgb to hex --- mods/ITEMS/mcl_totems/init.lua | 61 +++++++++++----------------------- 1 file changed, 20 insertions(+), 41 deletions(-) diff --git a/mods/ITEMS/mcl_totems/init.lua b/mods/ITEMS/mcl_totems/init.lua index 2311e88d7..5f9b254a3 100644 --- a/mods/ITEMS/mcl_totems/init.lua +++ b/mods/ITEMS/mcl_totems/init.lua @@ -5,64 +5,43 @@ minetest.register_on_leaveplayer(function(player) end) -- Totem particle registration -function rgb_to_hex(rgb) - local hexadecimal = "#" - for key, value in pairs(rgb) do - local hex = "" - - while value > 0 do - local index = math.fmod(value, 16) + 1 - value = math.floor(value / 16) - hex = string.sub("0123456789ABCDEF", index, index) .. hex - end - - local len = string.len(hex) - - if len == 0 then - hex = "00" - elseif len == 1 then - hex = "0" .. hex - end - - hexadecimal = hexadecimal .. hex - end - - return hexadecimal +function rgb_to_hex(r, g, b) + return string.format("%02x%02x%02x", r, g, b) end minetest.register_entity("mcl_totems:totem_particle", { physical = true, collide_with_objects = false, - collisionbox = {-0.02,-0.02,-0.02, 0.02,0.02,0.02}, + collisionbox = { -0.02, -0.02, -0.02, 0.02, 0.02, 0.02 }, pointable = false, visual = "sprite", - visual_size = {x=0.2, y=0.2}, - spritediv = {x=1, y=1}, - initial_sprite_basepos = {x=0, y=0}, + visual_size = { x = 0.2, y = 0.2 }, + spritediv = { x = 1, y = 1 }, + initial_sprite_basepos = { x = 0, y = 0 }, static_save = false, glow = 14, on_activate = function(self, staticdata) local color if math.random(0, 3) == 0 then - color = rgb_to_hex({ (0.6 + math.random() * 0.2) * 255, (0.6 + math.random() * 0.3) * 255, (math.random() * 0.2) * 255 }) + color = rgb_to_hex( 153 + math.random() * 51, 153 + math.random() * 76.5, math.random() * 51) else - color = rgb_to_hex({ (0.1 + math.random() * 0.4) * 255, (0.6 + math.random() * 0.3) * 255, (math.random() * 0.2) * 255 }) + color = rgb_to_hex(25.5 + math.random() * 102, 153 + math.random() * 76.5, math.random() * 51) end self.object:set_properties({ - textures = { "mcl_particles_totem"..math.random(1, 4)..".png^[colorize:"..color } + textures = { "mcl_particles_totem"..math.random(1, 4)..".png^[colorize:#"..color } }) local t = math.random(1, 2)*math.random() minetest.after(t, function() - self.object:set_velocity({x = math.random(-4, 4)*math.random(), y = math.random(-1, 4)*math.random(), z = math.random(-4, 4)*math.random()}) + self.object:set_velocity({ x = math.random(-4, 4) * math.random(), y = math.random(-1, 4) * math.random(), z = math.random(-4, 4) * math.random() }) end) minetest.after(0.3 + t, function() - self.object:set_acceleration({x=0, y=-4, z=0}) - self.object:set_velocity({x=0, y=0, z=0}) + self.object:set_acceleration({ x = 0, y = -4, z = 0 }) + self.object:set_velocity({ x = 0, y = 0, z = 0 }) end) end, on_step = function(self, dtime) - local r = math.random(1,50) + local r = math.random(1, 50) if r == 1 then self.object:remove() end @@ -79,7 +58,7 @@ mcl_damage.register_modifier(function(obj, damage, reason) local ppos = obj:get_pos() local pnname = minetest.get_node(ppos).name -- Some exceptions when _not_ to save the player - for n=1, #mobs_mc.misc.totem_fail_nodes do + for n = 1, #mobs_mc.misc.totem_fail_nodes do if pnname == mobs_mc.misc.totem_fail_nodes[n] then return end @@ -95,14 +74,14 @@ mcl_damage.register_modifier(function(obj, damage, reason) end -- Effects - minetest.sound_play({name = "mcl_totems_totem", gain=1}, {pos=ppos, max_hear_distance=16}, true) + minetest.sound_play({ name = "mcl_totems_totem", gain = 1 }, { pos = ppos, max_hear_distance = 16 }, true) --Particles minetest.after(0.1, function() local new_pos = obj:get_pos() if not new_pos then return end - local particlepos = {x = new_pos.x, y = new_pos.y + 1, z = new_pos.z} + local particlepos = { x = new_pos.x, y = new_pos.y + 1, z = new_pos.z } for i = 1, 150 do minetest.add_entity(particlepos, "mcl_totems:totem_particle") end @@ -113,9 +92,9 @@ mcl_damage.register_modifier(function(obj, damage, reason) hud_totem[obj] = obj:hud_add({ hud_elem_type = "image", text = "mcl_totems_totem.png", - position = { x=0.5, y=1 }, - scale = { x=17, y=17 }, - offset = { x=0, y=-178 }, + position = { x = 0.5, y = 1 }, + scale = { x = 17, y = 17 }, + offset = { x = 0, y = -178 }, z_index = 100, }) minetest.after(3, function() @@ -131,4 +110,4 @@ mcl_damage.register_modifier(function(obj, damage, reason) end end end -end, 1000) \ No newline at end of file +end, 1000) From 2b322a451f9ecd71918c9eeb6f40a386d031bfea Mon Sep 17 00:00:00 2001 From: NO11 Date: Thu, 26 Aug 2021 10:17:15 +0000 Subject: [PATCH 008/116] remove space --- mods/ITEMS/mcl_totems/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_totems/init.lua b/mods/ITEMS/mcl_totems/init.lua index 5f9b254a3..2206fcb2a 100644 --- a/mods/ITEMS/mcl_totems/init.lua +++ b/mods/ITEMS/mcl_totems/init.lua @@ -87,7 +87,7 @@ mcl_damage.register_modifier(function(obj, damage, reason) end end) - -- Big totem overlay + -- Big totem overlay if not hud_totem[obj] then hud_totem[obj] = obj:hud_add({ hud_elem_type = "image", From e5c5a785533115a82cea5414f61e6844ed47b27d Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Sun, 24 Oct 2021 20:13:34 +0200 Subject: [PATCH 009/116] Update contribution guidelines --- CODE_OF_CONDUCT.md | 128 +++++++++++++++++++++++++++++++ CONTRIBUTING.md | 186 ++++++++++++++++++++++++++------------------- 2 files changed, 236 insertions(+), 78 deletions(-) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..8086a2f44 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,128 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +eliasfleckenstein@web.de. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1b5098a4f..84ac10f20 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,101 +1,127 @@ -# Contributing to MineClone 2 -So you want to contribute to MineClone 2? +# Contributing to MineClone2 +So you want to contribute to MineClone2? Wow, thank you! :-) But first, some things to note: -MineClone 2's development target is to make a free software clone of Minecraft, -***version 1.12***, ***PC edition***, *** + Optifine features supported by the Minetest Engine ***. +MineClone2's development target is to make a free software clone of Minecraft, +***version 1.17***, ***Java Edition***, *** + Optifine features supported by the Minetest Engine***. The priority is making polished features up to version 1.12. -MineClone 2 is maintained by three persons. Namely, kay27, EliasFleckenstein and jordan4ibanez. You can find us -in the Minetest forums (forums.minetest.net), in IRC in the #mineclone2 -channel on irc.freenode.net. And finally, you can send e-mails to - or . +MineClone2 is maintained by Nicu and Fleckenstein. If you have any +problems or questions, contact us (See Links section below). -By sending us patches or asking us to include your changes in this game, -you agree that they fall under the terms of the LGPLv2.1, which basically -means they will become part of a free software. +You can help with MineClone2's development in many different ways, +whether you're a programmer or not. -## The suggested workflow -We don't **dictate** your workflow, but in order to work with us in an efficient -way, you can follow these suggestions: +## Links +* [Mesehub](https://git.minetest.land/MineClone2/MineClone2) +* [Discord](https://discord.gg/xE4z8EEpDC) +* [YouTube](https://www.youtube.com/channel/UClI_YcsXMF3KNeJtoBfnk9A) +* [IRC](https://web.libera.chat/#mineclone2) +* [Matrix](https://app.element.io/#/room/#mc2:matrix.org) +* [Reddit](https://www.reddit.com/r/MineClone2/) +* [Minetest forums](https://forum.minetest.net/viewtopic.php?f=50&t=16407) -For small and medium changes: +## Using git +MineClone2 is developed using the version control system [git](https://git-scm.com/). If you want to +contribute code to the project, it is **highly recommended** that you learn the git basics. +However, if you're not a programmer or don't plan to help with the coding part of the development, +it's still useful if you know it - in case you want to contribute files that are not related to code, +or to easily keep your game updated and test out pull requests. However, it's not required in this +case. -* Fork the repository +## How you can help as a non-programmer + +As someone who does not know how to write programs in Lua or does not +know how to use the Minetest API, you can still help us out a lot. +For example, by opening an issue in the [Issue tracker](https://git.minetest.land/MineClone2/MineClone2/issues), you can +report a bug or request a feature. + +### Rules about both bugs and feature requests +* Stay polite towards the developers and anyone else involved in the discussion. +* Choose a descriptive title. +* Try to use proper english and please start the title with a capital letter. +* Always check the currently opened issues before creating a new one. Don't report bugs that have already been reported or request features that already have been requested. +* If you know about Minetest's inner workings, please think about whether the bug / the feature that you are reporting / requesting is actually an issue with Minetest itself, and if it is, head to the [Minetest issue tracker](https://github.com/minetest/minetest/issues) instead. +* If you need any help regarding creating a Mesehub account or opening an issue, feel free to ask on the Discord / Matrix server or the IRC channel. + +### Reporting bugs +* A bug is an unintended behavior or, in the worst case, a crash. However, it is not a bug if you believe something is missing in the game. In this case, please read "Requesting features" +* If you report a crash, always include the error message. If you play in singleplayer, post a screenshot of the message that minetest showed when the crash happened (or copy the message into your issue). If you are a server admin, you can find error messages in the log file of the server. +* Tell us which MineClone2 and minetest versions you are using. +* It's always useful to tell us what you were doing to trigger the bug, e.g. before the crash happened or what causes the faulty behavior + +### Requesting features +* Make sure the feature you request is Minecraft 1.17 Java Edition or Optifine behavior. +* Don't beg for something to be implemented. We are not going to rethink our development roadmap because someone sais "Pls pls make this I'm waiting for this so bad!!!11!". +* Check whether the feature has been implemented in a newer version of MineClone2, in case you are not using the latest one. + +### Testing code +If you want to help us with speeding up MineClone2 development and making the game more stable, a great way to do that is by testing out new features from contributors. +For most new things that get into the game, a pull request is created. A pull request is essentially a programmer saying "Look, I modified the game, please apply my changes to the upstream version of the game". +However, every programmer makes mistakes sometimes, some of which are hard to spot. You can help by downloading this modified version of the game and trying it out - then you tell us whether the code works and does what it claims to do or whether you have encountered any issues. +You can find currently open pull requests here: . Note that pull requests that start with a `WIP:` are not done yet, and therefore might not work, so it's not very useful to try them out yet. + +### Profiling +If you own a server, a great way to help us improve MineClone2's code is by giving us profiler results. Profiler results give us detailed information about the game's performance and let us know where the real troublespots are. This way we can make the game faster. +Minetest has a built in profiler. Simply set `profiler.load = true` in your configuration file and restart the server. After running the server for some time, just run `/profiler save` in chat - then you will find a file in the world directory containing the results. Open a new issue and upload the file. You can name the issue " profiler results". + +### Let us know your opinion +It is always encouraged to actively contribute to issue discussions, let us know what you think about a topic and help us make decisions. + +### Crediting +If you opened or have contributed to an issue, you receive the `Community` role on our Discord (after asking for it). + +## How you can help as a programmer +(Almost) all the MineClone2 development is done using pull requests. If you feel like a problem needs to fixed or you want to make a new feature, you could start writing the code right away and notifying us when you're, but it it never hurts to discuss things first. If there is no issue on the topic, open one. If there is an issue, tell us that you'd like to take care of it, to avoid duplicate work. Note that we appreciate any effort, so even if you are a relatively new programmer, you can already contribute to the project - if you have problems or questions regarding git, Lua, or the Minetest API - or the MineClone2 codebase, feel free to ask them on our Discord. +By asking us to include your changes in this game, you agree that they fall under the terms of the GPLv3, which basically means they will become part of a free software. +If your code leads to bugs or crashes after being merged, it is your responsibility to fix them as soon as possible. + +### The recommended workflow +* Fork the repository (in case you have not already) * Do your change in a new branch * Create a pull request to get your changes merged into master +* Keep your pull request up to date by regulary merging upstream +* After the pull request got merged, you can delete the branch -For small changes, sending us a patch is also good. +### Git Guidelines +* We use merge rather than rebase or squash merge +* We don't use git submodules. +* Your commit names should be relatively descriptive, e.g. when saying "Fix #issueid", the commit message should also contain the title of the issue. -For big changes: Same as above, but consider notifying us first to avoid -duplicate work and possible tears of rejection. ;-) +### Code Guidelines +* Each mod must provide `mod.conf`. +* Each mod which add API functions should store functions inside a global table named like the mod. +* Public functions should not use self references but rather just access the table directly. +* Use modern Minetest API +* Use spaces instead of tabs +* Even if it improves performance, it is discouraged to localize variables at the beggining of files, since if another mod overrides some of the functions / variables you localized, you will still have a reference to the old function. -For trusted people, we might give them direct commit access to this -repository. In this case, you obviously don't need to fork, but you still -need to show your contributions align with the project goals. We still -reserve the right to revert everything that we don't like. -For bigger changes, we strongly recommend to use feature branches and -discuss with me first. +### Changes to Gameplay +Pull Requests that change gameplay have to be properly researched and need to state their sources. These PRs also need Fleckenstein's approval before they are merged. +You can use these sources: -If your code causes bugs and crashes, it is your responsibility to fix them as soon as possible. +* Minecraft code (Name the source file and line, however DONT post any proprietary code). You can use MCP to decompile Minecraft. +* Testing things inside of Minecraft (Attach screenshots / video footage of the results) +* Official Minecraft Wiki (Include a link to the page) -We mostly use plain merging rather than rebasing or squash merging. +### Developer status +Active and trusted contributors are often granted write access to the MineClone2 repository. However you should not push things directly to MineClone2 master - rather, do your work on a branch on your private repo, then create a pull request. This way other people can review your changes and make sure they work before they get merged. You are allowed to merge PRs if they have recieved the necessary feedback. +You may also be assigned to issues or pull requests as a developer. In this case it is your responsibility to fix the issue / review and merge the pull request when it is ready. You can also unassign yourself from the issue / PR if you have no time or don't want to take care of it for some other reason (after all, everyone is a volunteer and we can't expect you to do work that you are not intrested in) - the important thing is really that you make sure to inform us if you won't take care of something that has been assigned to you. +Also, please assign yourself to something that you want to work on to avoid duplicate work. +As a developer, it should be easy to reach you about your code. You should be on the Discord (or, if you really don't like Discord, Matrix or IRC). -Your commit names should be relatively descriptive, e.g. when saying "Fix #issueid", the commit message should also contain the title of the issue. +### Maintainer status +Maintainers are responsible for making sure issues are addressed and pull requests are reviewed and merged, by assigning either themselves or Developers to issues / PRs. +Maintainers are responsible for making releases, making sure guidelines are kept and making project decisions based on what the community wants. +Maintainers grant/revoke developer access. -Contributors will be credited in `CREDITS.md`. +Currently there are two maintainers with different responsibility fields: -## Code Style +* Fleckenstein - responsible for gameplay review, technical guidelines and issue/PR delegation +* Nicu - responsible for community related issues -Each mod must provide `mod.conf`. -Each mod which add API functions should store functions inside a global table named like the mod. -Public functions should not use self references but rather just access the table directly. -Functions should be defined in this way: -``` -function mcl_xyz.stuff(param) end -``` -Insteed of this way: -``` -mcl_xyz.stuff = function(param) end -``` -Indentation must be unified, more likely with tabs. - -Time sensitive mods should make a local copy of most used API functions to improve performances. -``` -local vector = vector -local get_node = minetest.get_node -``` - - -## Features > 1.12 - -If you want to make a feature that was added in a Minecraft version later than 1.12, you should fork MineClone5 (mineclone5 branch in the repository) and add your changes to this. - -## What we accept - -* Every MC features up to version 1.12 JE. -* Every already finished and working good features from versions above (only when making a MineClone5 PR / Contribution). -* Except features which couldn't be done easily and bugfree because of Minetest engine limitations. Eg. we CAN extend world boundaries by playing with map chunks, just teleporting player onto next layer after 31000 , but it would cost too much (time, code, bugs, performance, stability, etc). -* Some features, approved by the rest of the community, I mean maybe some voting and really missing any negative feedback. - -## What we reject - -* Any features which cause critical bugs, sending them to rework/fix or trying to fix immediately. -* Some small portions of big entirely missing features which just definitely break gamplay balance give nothing useful -* Controversial features, which some people support while others do not should be discussed well, with publishing forum announcements, at least during the week. In case if there are still doubts - send them into the mod. - -## Reporting bugs -Report all bugs and missing Minecraft features here: - - - -## Direct discussion -We have an IRC channel! Join us on #mineclone2 in freenode.net. - - - -## Creating releases +#### Creating releases * Launch MineClone2 to make sure it still runs * Update the version number in README.md * Use `git tag ` to tag the latest commit with the version number @@ -103,3 +129,7 @@ We have an IRC channel! Join us on #mineclone2 in freenode.net. * Update ContentDB (https://content.minetest.net/packages/Wuzzy/mineclone2/) * Update first post in forum thread (https://forum.minetest.net/viewtopic.php?f=50&t=16407) * Post release announcement and changelog in forums + +## Crediting +Contributors, Developers and Maintainers will be credited in `CREDITS.md`. If you make your first time contribution, please add yourself to this file. +There are also Discord roles for Contributors, Developers and Maintainers. From 5c55ddff1e77db995979c6e64457190455fa07f5 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Sun, 24 Oct 2021 20:21:54 +0200 Subject: [PATCH 010/116] Delete merge artifact --- CONTRIBUTING.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 67554d9fa..84ac10f20 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -81,7 +81,6 @@ If your code leads to bugs or crashes after being merged, it is your responsibil * Fork the repository (in case you have not already) * Do your change in a new branch * Create a pull request to get your changes merged into master -<<<<<<< HEAD * Keep your pull request up to date by regulary merging upstream * After the pull request got merged, you can delete the branch From 832e634e3bae8e37657a5e8eb23950d6c37c0509 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Sun, 24 Oct 2021 20:44:37 +0200 Subject: [PATCH 011/116] Use tabs instead of spaces, spaces are braindead --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 84ac10f20..b47ab9aa0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -94,7 +94,7 @@ If your code leads to bugs or crashes after being merged, it is your responsibil * Each mod which add API functions should store functions inside a global table named like the mod. * Public functions should not use self references but rather just access the table directly. * Use modern Minetest API -* Use spaces instead of tabs +* Use tabs instead of spaces * Even if it improves performance, it is discouraged to localize variables at the beggining of files, since if another mod overrides some of the functions / variables you localized, you will still have a reference to the old function. ### Changes to Gameplay From dafe860e56ac7ce866affe414fe7eef20b5fd3db Mon Sep 17 00:00:00 2001 From: NO11 Date: Sun, 24 Oct 2021 19:31:51 +0000 Subject: [PATCH 012/116] simple totem particles --- mods/ITEMS/mcl_totems/init.lua | 77 +++++++++------------------------- 1 file changed, 20 insertions(+), 57 deletions(-) diff --git a/mods/ITEMS/mcl_totems/init.lua b/mods/ITEMS/mcl_totems/init.lua index 2206fcb2a..79b2c8de0 100644 --- a/mods/ITEMS/mcl_totems/init.lua +++ b/mods/ITEMS/mcl_totems/init.lua @@ -4,49 +4,7 @@ minetest.register_on_leaveplayer(function(player) hud_totem[player] = nil end) --- Totem particle registration - -function rgb_to_hex(r, g, b) - return string.format("%02x%02x%02x", r, g, b) -end - -minetest.register_entity("mcl_totems:totem_particle", { - physical = true, - collide_with_objects = false, - collisionbox = { -0.02, -0.02, -0.02, 0.02, 0.02, 0.02 }, - pointable = false, - visual = "sprite", - visual_size = { x = 0.2, y = 0.2 }, - spritediv = { x = 1, y = 1 }, - initial_sprite_basepos = { x = 0, y = 0 }, - static_save = false, - glow = 14, - on_activate = function(self, staticdata) - local color - if math.random(0, 3) == 0 then - color = rgb_to_hex( 153 + math.random() * 51, 153 + math.random() * 76.5, math.random() * 51) - else - color = rgb_to_hex(25.5 + math.random() * 102, 153 + math.random() * 76.5, math.random() * 51) - end - self.object:set_properties({ - textures = { "mcl_particles_totem"..math.random(1, 4)..".png^[colorize:#"..color } - }) - local t = math.random(1, 2)*math.random() - minetest.after(t, function() - self.object:set_velocity({ x = math.random(-4, 4) * math.random(), y = math.random(-1, 4) * math.random(), z = math.random(-4, 4) * math.random() }) - end) - minetest.after(0.3 + t, function() - self.object:set_acceleration({ x = 0, y = -4, z = 0 }) - self.object:set_velocity({ x = 0, y = 0, z = 0 }) - end) - end, - on_step = function(self, dtime) - local r = math.random(1, 50) - if r == 1 then - self.object:remove() - end - end -}) +local particle_colors = {"98BF22", "C49E09", "337D0B", "B0B021", "1E9200"} -- TODO: real MC colors -- Save the player from death when holding totem of undying in hand mcl_damage.register_modifier(function(obj, damage, reason) @@ -74,27 +32,32 @@ mcl_damage.register_modifier(function(obj, damage, reason) end -- Effects - minetest.sound_play({ name = "mcl_totems_totem", gain = 1 }, { pos = ppos, max_hear_distance = 16 }, true) - - --Particles + minetest.sound_play({name = "mcl_totems_totem", gain = 1}, {pos=ppos, max_hear_distance = 16}, true) - minetest.after(0.1, function() - local new_pos = obj:get_pos() - if not new_pos then return end - local particlepos = { x = new_pos.x, y = new_pos.y + 1, z = new_pos.z } - for i = 1, 150 do - minetest.add_entity(particlepos, "mcl_totems:totem_particle") - end - end) + for i = 1, 100 do + minetest.add_particle({ + pos = vector.offset(ppos, 0, math.random(-10, 10) / 10, 0), + velocity = vector.new(math.random(-15, 15) / 10, math.random(0, 15) / 10, math.random(-15, 15) / 10), + acceleration = vector.new(0, -math.random(1, 10) / 10, 0), + expirationtime = math.random(1, 3), + size = math.random(1, 2), + collisiondetection = true, + collision_removal = true, + object_collision = false, + texture = "mcl_particles_totem" .. math.random(1, 4) .. ".png^[colorize:#" .. particle_colors[math.random(#particle_colors)], + glow = 10, + }) + + end -- Big totem overlay if not hud_totem[obj] then hud_totem[obj] = obj:hud_add({ hud_elem_type = "image", text = "mcl_totems_totem.png", - position = { x = 0.5, y = 1 }, - scale = { x = 17, y = 17 }, - offset = { x = 0, y = -178 }, + position = {x = 0.5, y = 1}, + scale = {x = 17, y = 17}, + offset = {x = 0, y = -178}, z_index = 100, }) minetest.after(3, function() From 6e94550a12ad7685a18e09fc5235238ac0a06770 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 08:44:12 +0000 Subject: [PATCH 013/116] Clarification about tab indent Signed-off-by: Elias Fleckenstein --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b47ab9aa0..1765a8799 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -94,7 +94,7 @@ If your code leads to bugs or crashes after being merged, it is your responsibil * Each mod which add API functions should store functions inside a global table named like the mod. * Public functions should not use self references but rather just access the table directly. * Use modern Minetest API -* Use tabs instead of spaces +* Use tabs for indentation (rather than spaces) * Even if it improves performance, it is discouraged to localize variables at the beggining of files, since if another mod overrides some of the functions / variables you localized, you will still have a reference to the old function. ### Changes to Gameplay From f3693138c85a3f91a79a5f26ab10bcc914e02062 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 08:46:33 +0000 Subject: [PATCH 014/116] Use proper English Signed-off-by: Elias Fleckenstein --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1765a8799..ebea65736 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,7 +5,7 @@ Wow, thank you! :-) But first, some things to note: MineClone2's development target is to make a free software clone of Minecraft, -***version 1.17***, ***Java Edition***, *** + Optifine features supported by the Minetest Engine***. The priority is making polished features up to version 1.12. +***version 1.17***, ***Java Edition***, *** + Optifine features supported by the Minetest Engine ***. The priority is making polished features up to version 1.12. MineClone2 is maintained by Nicu and Fleckenstein. If you have any problems or questions, contact us (See Links section below). @@ -40,7 +40,7 @@ report a bug or request a feature. ### Rules about both bugs and feature requests * Stay polite towards the developers and anyone else involved in the discussion. * Choose a descriptive title. -* Try to use proper english and please start the title with a capital letter. +* Try to use proper English and please start the title with a capital letter. * Always check the currently opened issues before creating a new one. Don't report bugs that have already been reported or request features that already have been requested. * If you know about Minetest's inner workings, please think about whether the bug / the feature that you are reporting / requesting is actually an issue with Minetest itself, and if it is, head to the [Minetest issue tracker](https://github.com/minetest/minetest/issues) instead. * If you need any help regarding creating a Mesehub account or opening an issue, feel free to ask on the Discord / Matrix server or the IRC channel. From b18e077ba3d99c0f2a3660a8b7a9bc5f973b98f4 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 08:47:56 +0000 Subject: [PATCH 015/116] Markdown fix to development target info Signed-off-by: Elias Fleckenstein --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ebea65736..4f3bc9c39 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,7 +5,7 @@ Wow, thank you! :-) But first, some things to note: MineClone2's development target is to make a free software clone of Minecraft, -***version 1.17***, ***Java Edition***, *** + Optifine features supported by the Minetest Engine ***. The priority is making polished features up to version 1.12. +***version 1.17***, ***Java Edition***, ***+ Optifine features supported by the Minetest Engine***. The priority is making polished features up to version 1.12. MineClone2 is maintained by Nicu and Fleckenstein. If you have any problems or questions, contact us (See Links section below). From b9999195ec99104aaa5ff6584600893c2bb739c8 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 16:52:56 +0200 Subject: [PATCH 016/116] Add publishing releases to my responsibility field --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b47ab9aa0..e9a14a54f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -118,7 +118,7 @@ Maintainers grant/revoke developer access. Currently there are two maintainers with different responsibility fields: -* Fleckenstein - responsible for gameplay review, technical guidelines and issue/PR delegation +* Fleckenstein - responsible for gameplay review, publishing releases, technical guidelines and issue/PR delegation * Nicu - responsible for community related issues #### Creating releases From 664244d25c5212bd672b3e42db70489a46771162 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 17:20:58 +0200 Subject: [PATCH 017/116] Make sure PRs are tested at least twice before being merged --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e9a14a54f..eaced68fa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -106,7 +106,7 @@ You can use these sources: * Official Minecraft Wiki (Include a link to the page) ### Developer status -Active and trusted contributors are often granted write access to the MineClone2 repository. However you should not push things directly to MineClone2 master - rather, do your work on a branch on your private repo, then create a pull request. This way other people can review your changes and make sure they work before they get merged. You are allowed to merge PRs if they have recieved the necessary feedback. +Active and trusted contributors are often granted write access to the MineClone2 repository. However you should not push things directly to MineClone2 master - rather, do your work on a branch on your private repo, then create a pull request. This way other people can review your changes and make sure they work before they get merged. You are allowed to merge PRs if they have recieved the necessary feedback and have been tested to not lead to any crashes and do what they claim to do by at least two different people. You may also be assigned to issues or pull requests as a developer. In this case it is your responsibility to fix the issue / review and merge the pull request when it is ready. You can also unassign yourself from the issue / PR if you have no time or don't want to take care of it for some other reason (after all, everyone is a volunteer and we can't expect you to do work that you are not intrested in) - the important thing is really that you make sure to inform us if you won't take care of something that has been assigned to you. Also, please assign yourself to something that you want to work on to avoid duplicate work. As a developer, it should be easy to reach you about your code. You should be on the Discord (or, if you really don't like Discord, Matrix or IRC). From 4b1606eaee2d5da2c36e1892efae3bae37d3b13e Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 18:26:31 +0200 Subject: [PATCH 018/116] Update 'git for non-programmers' section --- CONTRIBUTING.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 79d08e22a..93b52c32b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -25,10 +25,10 @@ whether you're a programmer or not. ## Using git MineClone2 is developed using the version control system [git](https://git-scm.com/). If you want to contribute code to the project, it is **highly recommended** that you learn the git basics. -However, if you're not a programmer or don't plan to help with the coding part of the development, -it's still useful if you know it - in case you want to contribute files that are not related to code, -or to easily keep your game updated and test out pull requests. However, it's not required in this -case. +For non-programmers and people who do not plan to contribute code to Mineclone2, git is not required. +However, git is a tool that will be referenced frequently because of its usefulness. +As such, it is valuable in learning how git works and its terminology. It can also help you in +keeping your game updated, and easily testing pull requests. ## How you can help as a non-programmer From 27f35fe422c560bad9109e09460ff36a9f1f024a Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 18:48:11 +0200 Subject: [PATCH 019/116] Add info about discord server in 'Let us know your opinion' section --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 93b52c32b..1e1b20778 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -67,7 +67,7 @@ If you own a server, a great way to help us improve MineClone2's code is by givi Minetest has a built in profiler. Simply set `profiler.load = true` in your configuration file and restart the server. After running the server for some time, just run `/profiler save` in chat - then you will find a file in the world directory containing the results. Open a new issue and upload the file. You can name the issue " profiler results". ### Let us know your opinion -It is always encouraged to actively contribute to issue discussions, let us know what you think about a topic and help us make decisions. +It is always encouraged to actively contribute to issue discussions on MeseHub, let us know what you think about a topic and help us make decisions. Also, note that a lot of discussion takes place on the Discord server, so it's definitely worth checking it out. ### Crediting If you opened or have contributed to an issue, you receive the `Community` role on our Discord (after asking for it). From d2242363889327ecc44ef1c1924f3f16160e2604 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 18:58:30 +0200 Subject: [PATCH 020/116] Consistency about line length (not a convention, just something applied to this file) --- CONTRIBUTING.md | 201 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 147 insertions(+), 54 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1e1b20778..7e914ac17 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,8 +4,10 @@ Wow, thank you! :-) But first, some things to note: -MineClone2's development target is to make a free software clone of Minecraft, -***version 1.17***, ***Java Edition***, ***+ Optifine features supported by the Minetest Engine***. The priority is making polished features up to version 1.12. +MineClone2's development target is to make a free software clone of +Minecraft, ***version 1.17***, ***Java Edition***, ***+ Optifine +features supported by the Minetest Engine***. The priority is making +polished features up to version 1.12. MineClone2 is maintained by Nicu and Fleckenstein. If you have any problems or questions, contact us (See Links section below). @@ -23,59 +25,116 @@ whether you're a programmer or not. * [Minetest forums](https://forum.minetest.net/viewtopic.php?f=50&t=16407) ## Using git -MineClone2 is developed using the version control system [git](https://git-scm.com/). If you want to -contribute code to the project, it is **highly recommended** that you learn the git basics. -For non-programmers and people who do not plan to contribute code to Mineclone2, git is not required. -However, git is a tool that will be referenced frequently because of its usefulness. -As such, it is valuable in learning how git works and its terminology. It can also help you in +MineClone2 is developed using the version control system +[git](https://git-scm.com/). If you want to contribute code to the +project, it is **highly recommended** that you learn the git basics. +For non-programmers and people who do not plan to contribute code to +Mineclone2, git is not required. However, git is a tool that will be +referenced frequently because of its usefulness. As such, it is valuable +in learning how git works and its terminology. It can also help you in keeping your game updated, and easily testing pull requests. ## How you can help as a non-programmer As someone who does not know how to write programs in Lua or does not -know how to use the Minetest API, you can still help us out a lot. -For example, by opening an issue in the [Issue tracker](https://git.minetest.land/MineClone2/MineClone2/issues), you can -report a bug or request a feature. +know how to use the Minetest API, you can still help us out a lot. For +example, by opening an issue in the +[Issue tracker](https://git.minetest.land/MineClone2/MineClone2/issues), +you can report a bug or request a feature. ### Rules about both bugs and feature requests -* Stay polite towards the developers and anyone else involved in the discussion. +* Stay polite towards the developers and anyone else involved in the +discussion. * Choose a descriptive title. -* Try to use proper English and please start the title with a capital letter. -* Always check the currently opened issues before creating a new one. Don't report bugs that have already been reported or request features that already have been requested. -* If you know about Minetest's inner workings, please think about whether the bug / the feature that you are reporting / requesting is actually an issue with Minetest itself, and if it is, head to the [Minetest issue tracker](https://github.com/minetest/minetest/issues) instead. -* If you need any help regarding creating a Mesehub account or opening an issue, feel free to ask on the Discord / Matrix server or the IRC channel. +* Try to use proper English and please start the title with a capital +letter. +* Always check the currently opened issues before creating a new one. +Don't report bugs that have already been reported or request features +that already have been requested. +* If you know about Minetest's inner workings, please think about +whether the bug / the feature that you are reporting / requesting is +actually an issue with Minetest itself, and if it is, head to the +[Minetest issue tracker](https://github.com/minetest/minetest/issues) +instead. +* If you need any help regarding creating a Mesehub account or opening +an issue, feel free to ask on the Discord / Matrix server or the IRC +channel. ### Reporting bugs -* A bug is an unintended behavior or, in the worst case, a crash. However, it is not a bug if you believe something is missing in the game. In this case, please read "Requesting features" -* If you report a crash, always include the error message. If you play in singleplayer, post a screenshot of the message that minetest showed when the crash happened (or copy the message into your issue). If you are a server admin, you can find error messages in the log file of the server. +* A bug is an unintended behavior or, in the worst case, a crash. +However, it is not a bug if you believe something is missing in the +game. In this case, please read "Requesting features" +* If you report a crash, always include the error message. If you play +in singleplayer, post a screenshot of the message that minetest showed +when the crash happened (or copy the message into your issue). If you +are a server admin, you can find error messages in the log file of the +server. * Tell us which MineClone2 and minetest versions you are using. -* It's always useful to tell us what you were doing to trigger the bug, e.g. before the crash happened or what causes the faulty behavior +* It's always useful to tell us what you were doing to trigger the bug, +e.g. before the crash happened or what causes the faulty behavior ### Requesting features -* Make sure the feature you request is Minecraft 1.17 Java Edition or Optifine behavior. -* Don't beg for something to be implemented. We are not going to rethink our development roadmap because someone sais "Pls pls make this I'm waiting for this so bad!!!11!". -* Check whether the feature has been implemented in a newer version of MineClone2, in case you are not using the latest one. +* Make sure the feature you request is Minecraft 1.17 Java Edition or +Optifine behavior. +* Don't beg for something to be implemented. We are not going to rethink +our development roadmap because someone sais "Pls pls make this I'm +waiting for this so bad!!!11!". +* Check whether the feature has been implemented in a newer version of +MineClone2, in case you are not using the latest one. ### Testing code -If you want to help us with speeding up MineClone2 development and making the game more stable, a great way to do that is by testing out new features from contributors. -For most new things that get into the game, a pull request is created. A pull request is essentially a programmer saying "Look, I modified the game, please apply my changes to the upstream version of the game". -However, every programmer makes mistakes sometimes, some of which are hard to spot. You can help by downloading this modified version of the game and trying it out - then you tell us whether the code works and does what it claims to do or whether you have encountered any issues. -You can find currently open pull requests here: . Note that pull requests that start with a `WIP:` are not done yet, and therefore might not work, so it's not very useful to try them out yet. +If you want to help us with speeding up MineClone2 development and +making the game more stable, a great way to do that is by testing out +new features from contributors. For most new things that get into the +game, a pull request is created. A pull request is essentially a +programmer saying "Look, I modified the game, please apply my changes +to the upstream version of the game". However, every programmer makes +mistakes sometimes, some of which are hard to spot. You can help by +downloading this modified version of the game and trying it out - then +you tell us whether the code works and does what it claims to do or +whether you have encountered any issues. You can find currently open +pull requests here: +. Note that pull +requests that start with a `WIP:` are not done yet, and therefore might +not work, so it's not very useful to try them out yet. ### Profiling -If you own a server, a great way to help us improve MineClone2's code is by giving us profiler results. Profiler results give us detailed information about the game's performance and let us know where the real troublespots are. This way we can make the game faster. -Minetest has a built in profiler. Simply set `profiler.load = true` in your configuration file and restart the server. After running the server for some time, just run `/profiler save` in chat - then you will find a file in the world directory containing the results. Open a new issue and upload the file. You can name the issue " profiler results". +If you own a server, a great way to help us improve MineClone2's code +is by giving us profiler results. Profiler results give us detailed +information about the game's performance and let us know where the real +troublespots are. This way we can make the game faster. Minetest has a +built in profiler. Simply set `profiler.load = true` in your +configuration file and restart the server. After running the server for +some time, just run `/profiler save` in chat - then you will find a file +in the world directory containing the results. Open a new issue and +upload the file. You can name the issue " profiler +results". ### Let us know your opinion -It is always encouraged to actively contribute to issue discussions on MeseHub, let us know what you think about a topic and help us make decisions. Also, note that a lot of discussion takes place on the Discord server, so it's definitely worth checking it out. +It is always encouraged to actively contribute to issue discussions on +MeseHub, let us know what you think about a topic and help us make +decisions. Also, note that a lot of discussion takes place on the +Discord server, so it's definitely worth checking it out. ### Crediting -If you opened or have contributed to an issue, you receive the `Community` role on our Discord (after asking for it). +If you opened or have contributed to an issue, you receive the +`Community` role on our Discord (after asking for it). ## How you can help as a programmer -(Almost) all the MineClone2 development is done using pull requests. If you feel like a problem needs to fixed or you want to make a new feature, you could start writing the code right away and notifying us when you're, but it it never hurts to discuss things first. If there is no issue on the topic, open one. If there is an issue, tell us that you'd like to take care of it, to avoid duplicate work. Note that we appreciate any effort, so even if you are a relatively new programmer, you can already contribute to the project - if you have problems or questions regarding git, Lua, or the Minetest API - or the MineClone2 codebase, feel free to ask them on our Discord. -By asking us to include your changes in this game, you agree that they fall under the terms of the GPLv3, which basically means they will become part of a free software. -If your code leads to bugs or crashes after being merged, it is your responsibility to fix them as soon as possible. +(Almost) all the MineClone2 development is done using pull requests. +If you feel like a problem needs to fixed or you want to make a new +feature, you could start writing the code right away and notifying us +when you're, but it it never hurts to discuss things first. If there is +no issue on the topic, open one. If there is an issue, tell us that +you'd like to take care of it, to avoid duplicate work. Note that we +appreciate any effort, so even if you are a relatively new programmer, +you can already contribute to the project - if you have problems or +questions regarding git, Lua, or the Minetest API - or the MineClone2 +codebase, feel free to ask them on our Discord. By asking us to include +your changes in this game, you agree that they fall under the terms of +the GPLv3, which basically means they will become part of a free +software. If your code leads to bugs or crashes after being merged, it +is your responsibility to fix them as soon as possible. ### The recommended workflow * Fork the repository (in case you have not already) @@ -87,49 +146,83 @@ If your code leads to bugs or crashes after being merged, it is your responsibil ### Git Guidelines * We use merge rather than rebase or squash merge * We don't use git submodules. -* Your commit names should be relatively descriptive, e.g. when saying "Fix #issueid", the commit message should also contain the title of the issue. +* Your commit names should be relatively descriptive, e.g. when saying +"Fix #issueid", the commit message should also contain the title of the +issue. ### Code Guidelines * Each mod must provide `mod.conf`. -* Each mod which add API functions should store functions inside a global table named like the mod. -* Public functions should not use self references but rather just access the table directly. +* Each mod which add API functions should store functions inside a +global table named like the mod. +* Public functions should not use self references but rather just access +the table directly. * Use modern Minetest API * Use tabs for indentation (rather than spaces) -* Even if it improves performance, it is discouraged to localize variables at the beggining of files, since if another mod overrides some of the functions / variables you localized, you will still have a reference to the old function. +* Even if it improves performance, it is discouraged to localize +variables at the beggining of files, since if another mod overrides some +of the functions / variables you localized, you will still have a +reference to the old function. ### Changes to Gameplay -Pull Requests that change gameplay have to be properly researched and need to state their sources. These PRs also need Fleckenstein's approval before they are merged. +Pull Requests that change gameplay have to be properly researched and +need to state their sources. These PRs also need Fleckenstein's approval +before they are merged. You can use these sources: -* Minecraft code (Name the source file and line, however DONT post any proprietary code). You can use MCP to decompile Minecraft. -* Testing things inside of Minecraft (Attach screenshots / video footage of the results) +* Minecraft code (Name the source file and line, however DONT post any +proprietary code). You can use MCP to decompile Minecraft. +* Testing things inside of Minecraft (Attach screenshots / video footage +of the results) * Official Minecraft Wiki (Include a link to the page) ### Developer status -Active and trusted contributors are often granted write access to the MineClone2 repository. However you should not push things directly to MineClone2 master - rather, do your work on a branch on your private repo, then create a pull request. This way other people can review your changes and make sure they work before they get merged. You are allowed to merge PRs if they have recieved the necessary feedback and have been tested to not lead to any crashes and do what they claim to do by at least two different people. -You may also be assigned to issues or pull requests as a developer. In this case it is your responsibility to fix the issue / review and merge the pull request when it is ready. You can also unassign yourself from the issue / PR if you have no time or don't want to take care of it for some other reason (after all, everyone is a volunteer and we can't expect you to do work that you are not intrested in) - the important thing is really that you make sure to inform us if you won't take care of something that has been assigned to you. -Also, please assign yourself to something that you want to work on to avoid duplicate work. -As a developer, it should be easy to reach you about your code. You should be on the Discord (or, if you really don't like Discord, Matrix or IRC). +Active and trusted contributors are often granted write access to the +MineClone2 repository. However you should not push things directly to +MineClone2 master - rather, do your work on a branch on your private +repo, then create a pull request. This way other people can review your +changes and make sure they work before they get merged. You are allowed +to merge PRs if they have recieved the necessary feedback and have been +tested to not lead to any crashes and do what they claim to do by at +least two different people. You may also be assigned to issues or pull +requests as a developer. In this case it is your responsibility to fix +the issue / review and merge the pull request when it is ready. You can +also unassign yourself from the issue / PR if you have no time or don't +want to take care of it for some other reason (after all, everyone is a +volunteer and we can't expect you to do work that you are not intrested +in) - the important thing is really that you make sure to inform us if +you won't take care of something that has been assigned to you. Also, +please assign yourself to something that you want to work on to avoid +duplicate work. As a developer, it should be easy to reach you about +your code. You should be on the Discord (or, if you really don't like +Discord, Matrix or IRC). ### Maintainer status -Maintainers are responsible for making sure issues are addressed and pull requests are reviewed and merged, by assigning either themselves or Developers to issues / PRs. -Maintainers are responsible for making releases, making sure guidelines are kept and making project decisions based on what the community wants. -Maintainers grant/revoke developer access. +Maintainers are responsible for making sure issues are addressed and +pull requests are reviewed and merged, by assigning either themselves or +Developers to issues / PRs. Maintainers are responsible for making +releases, making sure guidelines are kept and making project decisions +based on what the community wants. Maintainers grant/revoke developer +access. Currently there are two maintainers with different +responsibility fields: -Currently there are two maintainers with different responsibility fields: - -* Fleckenstein - responsible for gameplay review, publishing releases, technical guidelines and issue/PR delegation +* Fleckenstein - responsible for gameplay review, publishing releases, +technical guidelines and issue/PR delegation * Nicu - responsible for community related issues #### Creating releases * Launch MineClone2 to make sure it still runs * Update the version number in README.md -* Use `git tag ` to tag the latest commit with the version number +* Use `git tag ` to tag the latest commit with the +version number * Push to repo (don't forget `--tags`!) -* Update ContentDB (https://content.minetest.net/packages/Wuzzy/mineclone2/) -* Update first post in forum thread (https://forum.minetest.net/viewtopic.php?f=50&t=16407) +* Update ContentDB +(https://content.minetest.net/packages/Wuzzy/mineclone2/) +* Update first post in forum thread +(https://forum.minetest.net/viewtopic.php?f=50&t=16407) * Post release announcement and changelog in forums ## Crediting -Contributors, Developers and Maintainers will be credited in `CREDITS.md`. If you make your first time contribution, please add yourself to this file. -There are also Discord roles for Contributors, Developers and Maintainers. +Contributors, Developers and Maintainers will be credited in +`CREDITS.md`. If you make your first time contribution, please add +yourself to this file. There are also Discord roles for Contributors, +Developers and Maintainers. From 74890101520d4b04578dbc333aab38ea6cdf6eca Mon Sep 17 00:00:00 2001 From: NO11 Date: Mon, 25 Oct 2021 17:08:38 +0000 Subject: [PATCH 021/116] Use particlespawners instead of single particles --- mods/ITEMS/mcl_totems/init.lua | 37 +++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/mods/ITEMS/mcl_totems/init.lua b/mods/ITEMS/mcl_totems/init.lua index 79b2c8de0..aa188855f 100644 --- a/mods/ITEMS/mcl_totems/init.lua +++ b/mods/ITEMS/mcl_totems/init.lua @@ -34,20 +34,29 @@ mcl_damage.register_modifier(function(obj, damage, reason) -- Effects minetest.sound_play({name = "mcl_totems_totem", gain = 1}, {pos=ppos, max_hear_distance = 16}, true) - for i = 1, 100 do - minetest.add_particle({ - pos = vector.offset(ppos, 0, math.random(-10, 10) / 10, 0), - velocity = vector.new(math.random(-15, 15) / 10, math.random(0, 15) / 10, math.random(-15, 15) / 10), - acceleration = vector.new(0, -math.random(1, 10) / 10, 0), - expirationtime = math.random(1, 3), - size = math.random(1, 2), - collisiondetection = true, - collision_removal = true, - object_collision = false, - texture = "mcl_particles_totem" .. math.random(1, 4) .. ".png^[colorize:#" .. particle_colors[math.random(#particle_colors)], - glow = 10, - }) - + for i = 1, 4 do + for c = 1, #particle_colors do + minetest.add_particlespawner({ + amount = math.round(100/(4 * #particle_colors)), + time = 1, + minpos = vector.offset(ppos, 0, -1, 0), + maxpos = vector.offset(ppos, 0, 1, 0), + minvel = vector.new(-1.5, 0, -1.5), + maxvel = vector.new(1.5, 1.5, 1.5), + minacc = vector.new(0, -0.1, 0), + maxacc = vector.new(0, -1, 0), + minexptime = 1, + maxexptime = 3, + minsize = 1, + maxsize = 2, + collisiondetection = true, + collision_removal = true, + object_collision = false, + vertical = false, + texture = "mcl_particles_totem" .. i .. ".png^[colorize:#" .. particle_colors[c], + glow = 10, + }) + end end -- Big totem overlay From a6def5e9bb7ddc3e70b13be51e4a53f1f33dcbba Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 19:14:53 +0200 Subject: [PATCH 022/116] Remove guideline about localizing variables --- CONTRIBUTING.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7e914ac17..722deefaf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -158,10 +158,6 @@ global table named like the mod. the table directly. * Use modern Minetest API * Use tabs for indentation (rather than spaces) -* Even if it improves performance, it is discouraged to localize -variables at the beggining of files, since if another mod overrides some -of the functions / variables you localized, you will still have a -reference to the old function. ### Changes to Gameplay Pull Requests that change gameplay have to be properly researched and From 6580bcab5a80644f940dbaf172b64979bbe5d6d5 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 19:15:26 +0200 Subject: [PATCH 023/116] Add info about Minestorm and add links for MCP and Minestorm --- CONTRIBUTING.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 722deefaf..f9d97c063 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -166,7 +166,10 @@ before they are merged. You can use these sources: * Minecraft code (Name the source file and line, however DONT post any -proprietary code). You can use MCP to decompile Minecraft. +proprietary code). You can use +[MCP](https://minecraft.fandom.com/wiki/Programs_and_editors/Mod_Coder_Pack) +to decompile Minecraft or look at +[Minestorm](https://github.com/Minestom/Minestom) code. * Testing things inside of Minecraft (Attach screenshots / video footage of the results) * Official Minecraft Wiki (Include a link to the page) From 362de4c920453f838349f43261f2cd9f46ba6951 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 19:16:24 +0200 Subject: [PATCH 024/116] Add minecraft wiki link --- CONTRIBUTING.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f9d97c063..3637bdf1c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -172,7 +172,8 @@ to decompile Minecraft or look at [Minestorm](https://github.com/Minestom/Minestom) code. * Testing things inside of Minecraft (Attach screenshots / video footage of the results) -* Official Minecraft Wiki (Include a link to the page) +* [Official Minecraft Wiki](https://minecraft.fandom.com/wiki/Minecraft_Wiki) +(Include a link to the specific page you used) ### Developer status Active and trusted contributors are often granted write access to the From 3a422e3afc91a9dded5f613770b776759a2f8376 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 19:25:48 +0200 Subject: [PATCH 025/116] Reword 'understandable English' rule --- CONTRIBUTING.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3637bdf1c..03a76ce57 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -46,8 +46,9 @@ you can report a bug or request a feature. * Stay polite towards the developers and anyone else involved in the discussion. * Choose a descriptive title. -* Try to use proper English and please start the title with a capital -letter. +* Please write in plain, understandable English. It will be easier to +communicate. +* Please start the issue title with a capital letter. * Always check the currently opened issues before creating a new one. Don't report bugs that have already been reported or request features that already have been requested. From 756d28e2c61300205731e0cd370329e2dbb3a708 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 19:31:07 +0200 Subject: [PATCH 026/116] Use iliekprogrammar's wording in the begging rule --- CONTRIBUTING.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 03a76ce57..df3b5c059 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -77,9 +77,10 @@ e.g. before the crash happened or what causes the faulty behavior ### Requesting features * Make sure the feature you request is Minecraft 1.17 Java Edition or Optifine behavior. -* Don't beg for something to be implemented. We are not going to rethink -our development roadmap because someone sais "Pls pls make this I'm -waiting for this so bad!!!11!". +* Begging or excessive attention seeking does not help us in the +slightest, and may very well disrupt Mineclone2 development. It's better +to put that energy into helping or researching the feature in question. +After all, we're just volunteers working on our spare time. * Check whether the feature has been implemented in a newer version of MineClone2, in case you are not using the latest one. From 7707c3132c4da6c6f5db246d802c589610ab100d Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 19:46:13 +0200 Subject: [PATCH 027/116] Fix duplicate and forgotten word in 'helping as a programmer' section --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index df3b5c059..9b209d912 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -126,8 +126,8 @@ If you opened or have contributed to an issue, you receive the (Almost) all the MineClone2 development is done using pull requests. If you feel like a problem needs to fixed or you want to make a new feature, you could start writing the code right away and notifying us -when you're, but it it never hurts to discuss things first. If there is -no issue on the topic, open one. If there is an issue, tell us that +when you're done, but it never hurts to discuss things first. If there +is no issue on the topic, open one. If there is an issue, tell us that you'd like to take care of it, to avoid duplicate work. Note that we appreciate any effort, so even if you are a relatively new programmer, you can already contribute to the project - if you have problems or From c9987884358cff0548af0d017b5d073274aaa00a Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 19:48:14 +0200 Subject: [PATCH 028/116] Reword 'help for junior devs' section --- CONTRIBUTING.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9b209d912..cd7f9c465 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -128,15 +128,17 @@ If you feel like a problem needs to fixed or you want to make a new feature, you could start writing the code right away and notifying us when you're done, but it never hurts to discuss things first. If there is no issue on the topic, open one. If there is an issue, tell us that -you'd like to take care of it, to avoid duplicate work. Note that we -appreciate any effort, so even if you are a relatively new programmer, -you can already contribute to the project - if you have problems or -questions regarding git, Lua, or the Minetest API - or the MineClone2 -codebase, feel free to ask them on our Discord. By asking us to include -your changes in this game, you agree that they fall under the terms of -the GPLv3, which basically means they will become part of a free -software. If your code leads to bugs or crashes after being merged, it -is your responsibility to fix them as soon as possible. +you'd like to take care of it, to avoid duplicate work. We appreciate +any contributing effort to Mineclone2. If you are a relatively new +programmer, you can reach us on Discord, Matrix or IRC for questions +about git, Lua, Minetest API, Mineclone2 codebase or anything related +to MineClone2. We can help you avoid writing code that would be deemed +inadequeate, or help you become familiar with Mineclone2 better, or even +help using development tools. By asking us to include your changes in +this game, you agree that they fall under the terms of the GPLv3, which +basically means they will become part of a free software. If your code +leads to bugs or crashes after being merged, it is your responsibility +to fix them as soon as possible. ### The recommended workflow * Fork the repository (in case you have not already) From 5edf27ac88cbbbd249e781f0ca623b1f3696733f Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 19:54:10 +0200 Subject: [PATCH 029/116] Reword 'bug responsibility' section --- CONTRIBUTING.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cd7f9c465..66a1a3452 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -136,9 +136,10 @@ to MineClone2. We can help you avoid writing code that would be deemed inadequeate, or help you become familiar with Mineclone2 better, or even help using development tools. By asking us to include your changes in this game, you agree that they fall under the terms of the GPLv3, which -basically means they will become part of a free software. If your code -leads to bugs or crashes after being merged, it is your responsibility -to fix them as soon as possible. +basically means they will become part of a free software. Sometimes, +your code may cause crashes or bugs - we try to avoid such scenarios by +testing everytime before merging it, but if your merged work causes +problems, we ask you fix the issues as soon as possible. ### The recommended workflow * Fork the repository (in case you have not already) From 7f43ba6e36f857374803025664f0855dc7abceac Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 19:56:03 +0200 Subject: [PATCH 030/116] Clarify rule about merging upstream --- CONTRIBUTING.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 66a1a3452..ec0974e63 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -145,7 +145,9 @@ problems, we ask you fix the issues as soon as possible. * Fork the repository (in case you have not already) * Do your change in a new branch * Create a pull request to get your changes merged into master -* Keep your pull request up to date by regulary merging upstream +* Keep your pull request up to date by regulary merging upstream. It is +imperative that conflicts are resolved prior to merging the pull +request. * After the pull request got merged, you can delete the branch ### Git Guidelines From a877c615a5723e3a83bb5b42b90dd9f1938d67be Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 20:01:12 +0200 Subject: [PATCH 031/116] Clarify tabs usage: Use spaces for alignment --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ec0974e63..dfe2d9265 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -164,7 +164,7 @@ global table named like the mod. * Public functions should not use self references but rather just access the table directly. * Use modern Minetest API -* Use tabs for indentation (rather than spaces) +* Tabs should be used for indent, spaces for alignment ### Changes to Gameplay Pull Requests that change gameplay have to be properly researched and From 6e7827902cb9f5951550139cdb7d32c350aa7f1c Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 20:04:08 +0200 Subject: [PATCH 032/116] Use the wording 'reproduce a problem' in the reporting bugs section --- CONTRIBUTING.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dfe2d9265..3d29321c7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -71,8 +71,9 @@ when the crash happened (or copy the message into your issue). If you are a server admin, you can find error messages in the log file of the server. * Tell us which MineClone2 and minetest versions you are using. -* It's always useful to tell us what you were doing to trigger the bug, -e.g. before the crash happened or what causes the faulty behavior +* Tell us how to reproduce the problem: What you were doing to trigger +the bug, e.g. before the crash happened or what causes the faulty +behavior. ### Requesting features * Make sure the feature you request is Minecraft 1.17 Java Edition or From fba30eccd67e54852d98c320732c8add0a6acb2b Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 20:04:51 +0200 Subject: [PATCH 033/116] Add rule about double quotes for strings --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3d29321c7..c829fa3f3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -166,6 +166,7 @@ global table named like the mod. the table directly. * Use modern Minetest API * Tabs should be used for indent, spaces for alignment +* Use double quotes for strings ### Changes to Gameplay Pull Requests that change gameplay have to be properly researched and From 47fbb0c176b849a14cc7f62d9a026303f73d5d37 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 20:18:03 +0200 Subject: [PATCH 034/116] Mod naming convention, snake case convention --- CONTRIBUTING.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c829fa3f3..3495d4ad3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -160,6 +160,7 @@ issue. ### Code Guidelines * Each mod must provide `mod.conf`. +* Mod names are snake case, and newly added mods start with `mcl_` * Each mod which add API functions should store functions inside a global table named like the mod. * Public functions should not use self references but rather just access @@ -167,6 +168,7 @@ the table directly. * Use modern Minetest API * Tabs should be used for indent, spaces for alignment * Use double quotes for strings +* Use snake_case rather than CamelCase ### Changes to Gameplay Pull Requests that change gameplay have to be properly researched and From a80438d58e7aec6bfb817578633099226138ffd4 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 20:21:45 +0200 Subject: [PATCH 035/116] Advice about atomic commits --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3495d4ad3..926fab212 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -157,6 +157,7 @@ request. * Your commit names should be relatively descriptive, e.g. when saying "Fix #issueid", the commit message should also contain the title of the issue. +* Try to keep your commits as atomic as possible ### Code Guidelines * Each mod must provide `mod.conf`. From 64660617964c6a51fa5a7237446e7ebeab8ef8db Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 20:33:45 +0200 Subject: [PATCH 036/116] Add back function declaration guideline, provide examples for code style guidelines --- CONTRIBUTING.md | 79 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 71 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 926fab212..827497799 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -161,15 +161,78 @@ issue. ### Code Guidelines * Each mod must provide `mod.conf`. -* Mod names are snake case, and newly added mods start with `mcl_` -* Each mod which add API functions should store functions inside a -global table named like the mod. +* Mod names are snake case, and newly added mods start with `mcl_`, e.g. +`mcl_core`, `mcl_farming`, `mcl_monster_eggs` +* To export functions, store them inside a global table named like the +mod, e.g. + +```lua +mcl_example = {} + +function mcl_example.do_something() + -- ... +end + +``` + * Public functions should not use self references but rather just access -the table directly. -* Use modern Minetest API -* Tabs should be used for indent, spaces for alignment -* Use double quotes for strings -* Use snake_case rather than CamelCase +the table directly, e.g. + +```lua +-- bad +function mcl_example:do_something() +end + +-- good +function mcl_example.do_something() +end +``` + +* Use modern Minetest API, e.g. no usage of `minetest.env` +* Tabs should be used for indent, spaces for alignment, e.g. + +```lua + +-- use tabs for indent + +for i = 1, 10 do + if i % 3 == 0 then + print(i) + end +end + +-- use tabs for indent and spaces to align things + +some_table = { + {"a string", 5}, + {"a very much longer string", 10}, +} +``` + +* Use double quotes for strings, e.g. `"asdf"` rather than `'asdf'` +* Use snake_case rather than CamelCase, e.g. `my_function` rather than +`MyFunction` +* Dont declare functions as an assignment, e.g. + +```lua +-- bad +local some_local_func = function() + -- ... +end + +my_mod.some_func = function() + -- ... +end + +-- good +local function some_local_func() + -- ... +end + +function my_mod.some_func() + -- ... +end +``` ### Changes to Gameplay Pull Requests that change gameplay have to be properly researched and From da5e703675429381932b8d8fb9c863ccd3d16f96 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 20:36:29 +0200 Subject: [PATCH 037/116] Clarify that 'make atomic commits' is just an advise --- CONTRIBUTING.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 827497799..1f2d1d0de 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -157,7 +157,8 @@ request. * Your commit names should be relatively descriptive, e.g. when saying "Fix #issueid", the commit message should also contain the title of the issue. -* Try to keep your commits as atomic as possible +* Try to keep your commits as atomic as possible (advise, but completely +optional) ### Code Guidelines * Each mod must provide `mod.conf`. From f3d16d264cb46f1659b85795a75c1b762be4b615 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 20:41:09 +0200 Subject: [PATCH 038/116] Add notice about Minetest not supporting capital letters in modnames --- CONTRIBUTING.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1f2d1d0de..9c235880d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -163,7 +163,8 @@ optional) ### Code Guidelines * Each mod must provide `mod.conf`. * Mod names are snake case, and newly added mods start with `mcl_`, e.g. -`mcl_core`, `mcl_farming`, `mcl_monster_eggs` +`mcl_core`, `mcl_farming`, `mcl_monster_eggs`. Keep in mind Minetest +does not support capital letters in mod names. * To export functions, store them inside a global table named like the mod, e.g. From eccba76732bff067bf677bee46acfc51e1298234 Mon Sep 17 00:00:00 2001 From: NO11 Date: Mon, 25 Oct 2021 20:25:34 +0000 Subject: [PATCH 039/116] Use math.floor instead of math.round --- mods/ITEMS/mcl_totems/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_totems/init.lua b/mods/ITEMS/mcl_totems/init.lua index aa188855f..b11e68df7 100644 --- a/mods/ITEMS/mcl_totems/init.lua +++ b/mods/ITEMS/mcl_totems/init.lua @@ -37,7 +37,7 @@ mcl_damage.register_modifier(function(obj, damage, reason) for i = 1, 4 do for c = 1, #particle_colors do minetest.add_particlespawner({ - amount = math.round(100/(4 * #particle_colors)), + amount = math.floor(100 / (4 * #particle_colors)), time = 1, minpos = vector.offset(ppos, 0, -1, 0), maxpos = vector.offset(ppos, 0, 1, 0), From 30f7c638f377f7a2387974736ccd6ac171e5b0a6 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 22:55:48 +0200 Subject: [PATCH 040/116] mcl_enchanting: Add spanish translations and update template Credit to: todoporlalibertad Reviewed by j45 --- .../locale/mcl_enchanting.es.tr | 123 +++++++++++ mods/ITEMS/mcl_enchanting/locale/template.txt | 205 ++++++++++-------- 2 files changed, 240 insertions(+), 88 deletions(-) create mode 100644 mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.es.tr diff --git a/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.es.tr b/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.es.tr new file mode 100644 index 000000000..a977e8fe6 --- /dev/null +++ b/mods/ITEMS/mcl_enchanting/locale/mcl_enchanting.es.tr @@ -0,0 +1,123 @@ +# textdomain: mcl_enchanting + + +### enchantments.lua ### + +Arrows passes through multiple objects.=Las flechas atraviesan multiples enemigos. +Arrows set target on fire.=Las flechas prenderan los enemigos. +Bane of Arthropods=Perdición de los Artrópodos +Channeling=Conductividad + +Channels a bolt of lightning toward a target. Works only during thunderstorms and if target is unobstructed with opaque blocks.=Canaliza los rayos de una tormenta hacia el enemigo. + +Curse of Vanishing=Maldición de Desaparición +Decreases crossbow charging time.=Disminuye el tiempo de carga de las ballestas. +Decreases time until rod catches something.=Disminuye el tiempo que tardan en picar los cebos en la pesca. +Depth Strider=Agilidad acuática +Efficiency=Eficiencia +Extends underwater breathing time.=Aumenta el tiempo de mantener la respiración. +Fire Aspect=Aspecto Ígneo +Flame=Fuego +Fortune=Fortuna +Frost Walker=Paso Helado +Impaling=Empalamiento +Increases arrow damage.=Incrementa el daño de las flechas. +Increases arrow knockback.=Incrementa el empuje de las flechas. +Increases certain block drops.=Incrementa la cantidad de objetos que sueltan los bloques. + +Increases damage and applies Slowness IV to arthropod mobs (spiders, cave spiders, silverfish and endermites).=Incrementa el daño y ralentiza a los artrópodos. (arañas, lepismas, endermitas, etc) + +Increases damage to undead mobs.=Incrementa el daño contra no-muertos. +Increases damage.=Incrementa el daño. +Increases item durability.=Incrementa la durabilidad de una herramienta. +Increases knockback.=Incrementa el empuje. +Increases mining speed.=Incrementa la velocidad de picado. +Increases mob loot.=Incrementa el botín de los enemigos. +Increases rate of good loot (enchanting books, etc.)=Incrementa la probabilidad de encontrar tesoros. +Increases sweeping attack damage.=Incrementa el daño de efecto area. +Increases underwater movement speed.=Incrementa la velocidad de nado bajo el agua. +Increases walking speed on soul sand.=Incrementa la velocidad al caminar sobre arena de Almas. +Infinity=Infinidad +Item destroyed on death.=El objeto se destruye tras tu muerte. +Knockback=Empuje +Looting=Botín +Loyalty=Lealtad +Luck of the Sea=Suerte Marina +Lure=Atracción +Mending=Reparación +Mined blocks drop themselves.=Los bloques se minarán enteros. +Multishot=Multidisparo +Piercing=Perforación +Power=Poder +Punch=Retroceso +Quick Charge=Carga Rápida +Repair the item while gaining XP orbs.=Repara los objetos portados al recibir orbes de experiencia. +Respiration=Respiración +Riptide=Propulsión acuática +Sets target on fire.=Incencia al enemigo. +Sharpness=Filo +Shoot 3 arrows at the cost of one.=Dispara 3 flechas al precio de una. +Shooting consumes no regular arrows.=No se consumiran las flechas lanzadas. +Silk Touch=Toque de Seda +Smite=Golpeo +Soul Speed=Velocidad de Almas +Sweeping Edge=Filo Arrasador +Trident deals additional damage to ocean mobs.=Incrementa el daño del tridente sobre criaturas acuáticas. + +Trident launches player with itself when thrown. Works only in water or rain.=El tridente impulsa al portador dentro del agua o bajo la lluvia. + +Trident returns after being thrown. Higher levels reduce return time.=El tridente regresa al portador tras lanzarlo. + +Turns water beneath the player into frosted ice and prevents the damage from magma blocks.=Congela el agua bajo tus pies y evita el daño de los bloques de magma. + +Unbreaking=Irrompibilidad + +### engine.lua ### + +@1 Enchantment Levels=Nivel de encantamiento: @1 +@1 Lapis Lazuli=@1 Lapis Lázuli +Inventory=Inventario +Level requirement: @1=Nivel requerido: @1 + +### init.lua ### + +'@1' is not a valid number='@1' no es un número válido +'@1' is not a valid number.='@1' no es un número válido + []= [] +@1 can't be combined with @2.=@1 no se puede combinar con @2 + +After finally selecting your enchantment; left-click on the selection, and you will see both the lapis lazuli and your experience levels consumed. And, an enchanted item left in its place.=Despues elige tu encantamiento, los niveles de experiencia y el lapis lázuli seran consumidos y el encantamiento aplicado al objeto. + +After placing your items in the slots, the enchanting options will be shown. Hover over the options to read what is available to you.=Coloca el objeto en su ranura yse mostraran los encantamientos a elegir. + +Enchant=Encantamiento +Enchant an item=Encantar objeto +Enchanted Book=Libro Encantado +Enchanting Table=Mesa de Encantamientos + +Enchanting Tables will let you enchant armors, tools, weapons, and books with various abilities. But, at the cost of some experience, and lapis lazuli.=La mesa de Encantamientos dara a tus herramientas, armas o armadura algunas habilidades magicas. Pero a coste de algo de experiencia y lapis lázuli. + +Enchanting succeded.=Encantado correctamente. +Forcefully enchant an item=Encantar objeto a la fuerza. + +Place a tool, armor, weapon or book into the top left slot, and then place 1-3 Lapis Lazuli in the slot to the right.=Coloca una herramienta, arma, armadura o libro sobre la ranura izquierda, coloca de 1 a 3 Lapis lázulis en la ranura derecha. + +Player '@1' cannot be found.=Jugador @1 no encontrado. +Rightclick the Enchanting Table to open the enchanting menu.=Clic derecho sobre la mesa de encantamientos para abrir la interfaz. +Spend experience, and lapis to enchant various items.=Experiencia y Lapis para encantar varios objetos. + +The number you have entered (@1) is too big, it must be at most @2.=@1 es muy grande, debe ser menor que @2 + +The number you have entered (@1) is too small, it must be at least @2.=@1 es muy pequeño, debe ser mayor a @2 + +The selected enchantment can't be added to the target item.=El encantamiento seleccionado no puede añadirse a ese objeto. +The target doesn't hold an item.=El jugador no sujeta un objeto. +The target item is not enchantable.=El objeto del jugador no se puede encantar. +There is no such enchantment '@1'.=@1 no es un encantamiento. + +These options are randomized, and dependent on experience level; but the enchantment strength can be increased.=Las opciones seran aleatorias dependiendo del nivel de experiencia, los niveles de encantamiento pueden ser aumentados. + +To increase the enchantment strength, place bookshelves around the enchanting table. However, you will need to keep 1 air node between the table, & the bookshelves to empower the enchanting table.=Para aumentar los niveles de encantamientos, coloca librerias alrededor y cerca de la mesa de encantamientos. + +Usage: /enchant []=Usa: /enchant [] +Usage: /forceenchant []=Usa /forceenchant [] diff --git a/mods/ITEMS/mcl_enchanting/locale/template.txt b/mods/ITEMS/mcl_enchanting/locale/template.txt index 08fa82097..1f540d6d3 100644 --- a/mods/ITEMS/mcl_enchanting/locale/template.txt +++ b/mods/ITEMS/mcl_enchanting/locale/template.txt @@ -1,100 +1,129 @@ # textdomain: mcl_enchanting -Aqua Affinity= -Increases underwater mining speed.= -Bane of Arthropods= -Increases damage and applies Slowness IV to arthropod mobs (spiders, cave spiders, silverfish and endermites).= -Blast Protection= -Reduces explosion damage and knockback.= -Channeling= -Channels a bolt of lightning toward a target. Works only during thunderstorms and if target is unobstructed with opaque blocks.= -Curse of Binding= -Item cannot be removed from armor slots except due to death, breaking or in Creative Mode.= -Curse of Vanishing= -Item destroyed on death.= -Depth Strider= -Increases underwater movement speed.= -Efficiency= -Increases mining speed.= -Feather Falling= -Reduces fall damage.= -Fire Aspect= -Sets target on fire.= -Fire Protection= -Reduces fire damage.= -Flame= -Arrows set target on fire.= -Fortune= -Increases certain block drops.= -Frost Walker= -Turns water beneath the player into frosted ice and prevents the damage from magma blocks.= -Impaling= -Trident deals additional damage to ocean mobs.= -Infinity= -Shooting consumes no regular arrows.= -Knockback= -Increases knockback.= -Looting= -Increases mob loot.= -Loyalty= -Trident returns after being thrown. Higher levels reduce return time.= -Luck of the Sea= -Increases rate of good loot (enchanting books, etc.)= -Lure= -Decreases time until rod catches something.= -Mending= -Repair the item while gaining XP orbs.= -Multishot= -Shoot 3 arrows at the cost of one.= -Piercing= + + +### enchantments.lua ### + Arrows passes through multiple objects.= -Power= -Increases arrow damage.= -Projectile Protection= -Reduces projectile damage.= -Protection= -Reduces most types of damage by 4% for each level.= -Punch= -Increases arrow knockback.= -Quick Charge= +Arrows set target on fire.= +Bane of Arthropods= +Channeling= + +Channels a bolt of lightning toward a target. Works only during thunderstorms and if target is unobstructed with opaque blocks.= + +Curse of Vanishing= Decreases crossbow charging time.= -Respiration= +Decreases time until rod catches something.= +Depth Strider= +Efficiency= Extends underwater breathing time.= -Riptide= -Trident launches player with itself when thrown. Works only in water or rain.= -Sharpness= -Increases damage.= -Silk Touch= -Mined blocks drop themselves.= -Smite= +Fire Aspect= +Flame= +Fortune= +Frost Walker= +Impaling= +Increases arrow damage.= +Increases arrow knockback.= +Increases certain block drops.= + +Increases damage and applies Slowness IV to arthropod mobs (spiders, cave spiders, silverfish and endermites).= + Increases damage to undead mobs.= -Soul Speed= -Increases walking speed on soul sand.= -Sweeping Edge= -Increases sweeping attack damage.= -Thorns= -Reflects some of the damage taken when hit, at the cost of reducing durability with each proc.= -Unbreaking= +Increases damage.= Increases item durability.= -Inventory= -@1 Lapis Lazuli= +Increases knockback.= +Increases mining speed.= +Increases mob loot.= +Increases rate of good loot (enchanting books, etc.)= +Increases sweeping attack damage.= +Increases underwater movement speed.= +Increases walking speed on soul sand.= +Infinity= +Item destroyed on death.= +Knockback= +Looting= +Loyalty= +Luck of the Sea= +Lure= +Mending= +Mined blocks drop themselves.= +Multishot= +Piercing= +Power= +Punch= +Quick Charge= +Repair the item while gaining XP orbs.= +Respiration= +Riptide= +Sets target on fire.= +Sharpness= +Shoot 3 arrows at the cost of one.= +Shooting consumes no regular arrows.= +Silk Touch= +Smite= +Soul Speed= +Sweeping Edge= +Trident deals additional damage to ocean mobs.= + +Trident launches player with itself when thrown. Works only in water or rain.= + +Trident returns after being thrown. Higher levels reduce return time.= + +Turns water beneath the player into frosted ice and prevents the damage from magma blocks.= + +Unbreaking= + +### engine.lua ### + @1 Enchantment Levels= +@1 Lapis Lazuli= +Inventory= Level requirement: @1= -Enchant an item= - []= -Usage: /enchant []= -Player '@1' cannot be found.= -There is no such enchantment '@1'.= -The target doesn't hold an item.= -The selected enchantment can't be added to the target item.= + +### init.lua ### + '@1' is not a valid number= -The number you have entered (@1) is too big, it must be at most @2.= -The number you have entered (@1) is too small, it must be at least @2.= -@1 can't be combined with @2.= -Enchanting succeded.= -Forcefully enchant an item= -Usage: /forceenchant []= -The target item is not enchantable.= '@1' is not a valid number.= + []= +@1 can't be combined with @2.= + +After finally selecting your enchantment; left-click on the selection, and you will see both the lapis lazuli and your experience levels consumed. And, an enchanted item left in its place.= + +After placing your items in the slots, the enchanting options will be shown. Hover over the options to read what is available to you.= + +Enchant= +Enchant an item= Enchanted Book= Enchanting Table= -Enchant= + +Enchanting Tables will let you enchant armors, tools, weapons, and books with various abilities. But, at the cost of some experience, and lapis lazuli.= + +Enchanting succeded.= +Forcefully enchant an item= + +Place a tool, armor, weapon or book into the top left slot, and then place 1-3 Lapis Lazuli in the slot to the right.= + +Player '@1' cannot be found.= +Rightclick the Enchanting Table to open the enchanting menu.= +Spend experience, and lapis to enchant various items.= + +The number you have entered (@1) is too big, it must be at most @2.= + +The number you have entered (@1) is too small, it must be at least @2.= + +The selected enchantment can't be added to the target item.= +The target doesn't hold an item.= +The target item is not enchantable.= +There is no such enchantment '@1'.= + +These options are randomized, and dependent on experience level; but the enchantment strength can be increased.= + +To increase the enchantment strength, place bookshelves around the enchanting table. However, you will need to keep 1 air node between the table, & the bookshelves to empower the enchanting table.= + +Usage: /enchant []= +Usage: /forceenchant []= + + +##### not used anymore ##### + +# textdomain: mcl_enchanting +Aqua Affinity= From 0369465630508956cb75d1c2c055e71a67b74b73 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 25 Oct 2021 22:59:21 +0200 Subject: [PATCH 041/116] Add todoporlalibertad to translation credits --- CREDITS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.md b/CREDITS.md index 296e7c23b..de3dcae61 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -110,6 +110,7 @@ * wuniversales * kay27 * pitchum +* todoporlalibertad ## Special thanks * celeron55 for creating Minetest From 4e8e6fbb51a6a110619dbe0f2d6acccbc87dfa60 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Tue, 26 Oct 2021 11:42:33 +0200 Subject: [PATCH 042/116] Update development target section --- CONTRIBUTING.md | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9c235880d..6cdd0db6e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,10 +4,22 @@ Wow, thank you! :-) But first, some things to note: -MineClone2's development target is to make a free software clone of -Minecraft, ***version 1.17***, ***Java Edition***, ***+ Optifine -features supported by the Minetest Engine***. The priority is making -polished features up to version 1.12. +MineClone2's development target is to... + +- Crucially, create a stable, moddable, free/libre clone of Minecraft +based on the Minetest engine with polished features, usable in both +singleplayer and multiplayer. Currently, most of **Minecraft Java +Edition 1.12.2** features are already implemented and polishing existing +features are prioritised over new feature requests. +- With lessened priority yet strictly, implement features targetting +**Minecraft version 1.17 + Optifine** (Optifine only as far as supported +by the Minetest Engine). This means features in parity with the listed +Minecraft experiences are prioritised over those that don't fulfill this +scope. +- Optionally, create a performant experience that will run relatively +well on really low spec computers. Unfortunately, due to Minecraft's +mechanisms and Minetest engine's limitations along with a very small +playerbase on low spec computers, optimizations are hard to investigate. MineClone2 is maintained by Nicu and Fleckenstein. If you have any problems or questions, contact us (See Links section below). @@ -298,7 +310,7 @@ version number (https://forum.minetest.net/viewtopic.php?f=50&t=16407) * Post release announcement and changelog in forums -## Crediting +### Crediting Contributors, Developers and Maintainers will be credited in `CREDITS.md`. If you make your first time contribution, please add yourself to this file. There are also Discord roles for Contributors, From e341b2a6fe22c879abb66353a7539fd32320bb27 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Tue, 26 Oct 2021 11:55:08 +0200 Subject: [PATCH 043/116] Split code contributor section --- CONTRIBUTING.md | 81 ++++++++++++++++++++++++++++--------------------- 1 file changed, 46 insertions(+), 35 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6cdd0db6e..6c5aa2cd1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -137,24 +137,8 @@ If you opened or have contributed to an issue, you receive the ## How you can help as a programmer (Almost) all the MineClone2 development is done using pull requests. -If you feel like a problem needs to fixed or you want to make a new -feature, you could start writing the code right away and notifying us -when you're done, but it never hurts to discuss things first. If there -is no issue on the topic, open one. If there is an issue, tell us that -you'd like to take care of it, to avoid duplicate work. We appreciate -any contributing effort to Mineclone2. If you are a relatively new -programmer, you can reach us on Discord, Matrix or IRC for questions -about git, Lua, Minetest API, Mineclone2 codebase or anything related -to MineClone2. We can help you avoid writing code that would be deemed -inadequeate, or help you become familiar with Mineclone2 better, or even -help using development tools. By asking us to include your changes in -this game, you agree that they fall under the terms of the GPLv3, which -basically means they will become part of a free software. Sometimes, -your code may cause crashes or bugs - we try to avoid such scenarios by -testing everytime before merging it, but if your merged work causes -problems, we ask you fix the issues as soon as possible. -### The recommended workflow +### Recommended workflow * Fork the repository (in case you have not already) * Do your change in a new branch * Create a pull request to get your changes merged into master @@ -163,7 +147,45 @@ imperative that conflicts are resolved prior to merging the pull request. * After the pull request got merged, you can delete the branch -### Git Guidelines +### Discuss first +If you feel like a problem needs to fixed or you want to make a new +feature, you could start writing the code right away and notifying us +when you're done, but it never hurts to discuss things first. If there +is no issue on the topic, open one. If there is an issue, tell us that +you'd like to take care of it, to avoid duplicate work. + +### Don't hesitate to ask for help +We appreciate any contributing effort to MineClone2. If you are a +relatively new programmer, you can reach us on Discord, Matrix or IRC +for questions about git, Lua, Minetest API, MineClone2 codebase or +anything related to MineClone2. We can help you avoid writing code that +would be deemed inadequeate, or help you become familiar with MineClone2 +better, or even help using development tools. + +### Maintain your own code, even if alreay got merged +Sometimes, your code may cause crashes or bugs - we try to avoid such +scenarios by testing everytime before merging it, but if your merged +work causes problems, we ask you fix the issues as soon as possible. + +### Changing Gameplay +Pull Requests that change gameplay have to be properly researched and +need to state their sources. These PRs also need Fleckenstein's approval +before they are merged. +You can use these sources: + +* Minecraft code (Name the source file and line, however DONT post any +proprietary code). You can use +[MCP](https://minecraft.fandom.com/wiki/Programs_and_editors/Mod_Coder_Pack) +to decompile Minecraft or look at +[Minestorm](https://github.com/Minestom/Minestom) code. +* Testing things inside of Minecraft (Attach screenshots / video footage +of the results) +* [Official Minecraft Wiki](https://minecraft.fandom.com/wiki/Minecraft_Wiki) +(Include a link to the specific page you used) + +### Keep our guidelines + +#### Git Guidelines * We use merge rather than rebase or squash merge * We don't use git submodules. * Your commit names should be relatively descriptive, e.g. when saying @@ -172,7 +194,7 @@ issue. * Try to keep your commits as atomic as possible (advise, but completely optional) -### Code Guidelines +#### Code Guidelines * Each mod must provide `mod.conf`. * Mod names are snake case, and newly added mods start with `mcl_`, e.g. `mcl_core`, `mcl_farming`, `mcl_monster_eggs`. Keep in mind Minetest @@ -226,7 +248,7 @@ some_table = { * Use double quotes for strings, e.g. `"asdf"` rather than `'asdf'` * Use snake_case rather than CamelCase, e.g. `my_function` rather than `MyFunction` -* Dont declare functions as an assignment, e.g. +* Don't declare functions as an assignment, e.g. ```lua -- bad @@ -248,21 +270,10 @@ function my_mod.some_func() end ``` -### Changes to Gameplay -Pull Requests that change gameplay have to be properly researched and -need to state their sources. These PRs also need Fleckenstein's approval -before they are merged. -You can use these sources: - -* Minecraft code (Name the source file and line, however DONT post any -proprietary code). You can use -[MCP](https://minecraft.fandom.com/wiki/Programs_and_editors/Mod_Coder_Pack) -to decompile Minecraft or look at -[Minestorm](https://github.com/Minestom/Minestom) code. -* Testing things inside of Minecraft (Attach screenshots / video footage -of the results) -* [Official Minecraft Wiki](https://minecraft.fandom.com/wiki/Minecraft_Wiki) -(Include a link to the specific page you used) +### Licensing +By asking us to include your changes in +this game, you agree that they fall under the terms of the GPLv3, which +basically means they will become part of a free software. ### Developer status Active and trusted contributors are often granted write access to the From a0789e72f04ee7c5bbc03c1fcf68e082eceac980 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Tue, 26 Oct 2021 11:57:17 +0200 Subject: [PATCH 044/116] Move licensing down, just before crediting --- CONTRIBUTING.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6c5aa2cd1..f7e21d481 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -270,11 +270,6 @@ function my_mod.some_func() end ``` -### Licensing -By asking us to include your changes in -this game, you agree that they fall under the terms of the GPLv3, which -basically means they will become part of a free software. - ### Developer status Active and trusted contributors are often granted write access to the MineClone2 repository. However you should not push things directly to @@ -321,6 +316,11 @@ version number (https://forum.minetest.net/viewtopic.php?f=50&t=16407) * Post release announcement and changelog in forums +### Licensing +By asking us to include your changes in +this game, you agree that they fall under the terms of the GPLv3, which +basically means they will become part of a free software. + ### Crediting Contributors, Developers and Maintainers will be credited in `CREDITS.md`. If you make your first time contribution, please add From 70425e9f30611ab7dcbbbf5518ed113fdf1e1809 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Tue, 26 Oct 2021 11:59:32 +0200 Subject: [PATCH 045/116] Split profiling section --- CONTRIBUTING.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f7e21d481..1f063a062 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -117,11 +117,13 @@ not work, so it's not very useful to try them out yet. If you own a server, a great way to help us improve MineClone2's code is by giving us profiler results. Profiler results give us detailed information about the game's performance and let us know where the real -troublespots are. This way we can make the game faster. Minetest has a -built in profiler. Simply set `profiler.load = true` in your -configuration file and restart the server. After running the server for -some time, just run `/profiler save` in chat - then you will find a file -in the world directory containing the results. Open a new issue and +troublespots are. This way we can make the game faster. + +#### Using Minetest's profiler +Minetest has a built in profiler. Simply set `profiler.load = true` in +your configuration file and restart the server. After running the server +for some time, just run `/profiler save` in chat - then you will find a +file in the world directory containing the results. Open a new issue and upload the file. You can name the issue " profiler results". From ea0f52763c2b183368b8a0f4690c34d060bdafac Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Tue, 26 Oct 2021 12:04:16 +0200 Subject: [PATCH 046/116] Split developer responsibilities into a list --- CONTRIBUTING.md | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1f063a062..58762bfcb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -274,22 +274,27 @@ end ### Developer status Active and trusted contributors are often granted write access to the -MineClone2 repository. However you should not push things directly to +MineClone2 repository. + +#### Developer responsibilities +- You should not push things directly to MineClone2 master - rather, do your work on a branch on your private repo, then create a pull request. This way other people can review your -changes and make sure they work before they get merged. You are allowed -to merge PRs if they have recieved the necessary feedback and have been +changes and make sure they work before they get merged. +- Merge PRs if they have recieved the necessary feedback and have been tested to not lead to any crashes and do what they claim to do by at -least two different people. You may also be assigned to issues or pull +least two different people. +- You may also be assigned to issues or pull requests as a developer. In this case it is your responsibility to fix the issue / review and merge the pull request when it is ready. You can also unassign yourself from the issue / PR if you have no time or don't want to take care of it for some other reason (after all, everyone is a volunteer and we can't expect you to do work that you are not intrested -in) - the important thing is really that you make sure to inform us if -you won't take care of something that has been assigned to you. Also, -please assign yourself to something that you want to work on to avoid -duplicate work. As a developer, it should be easy to reach you about +in) - **the important thing is that you make sure to inform us if you +won't take care of something that has been assigned to you.** +- Please assign yourself to something that you want to work on to avoid +duplicate work. +- As a developer, it should be easy to reach you about your code. You should be on the Discord (or, if you really don't like Discord, Matrix or IRC). From 1bd972bff7cf48e7076cc28f5c03a6067f5b27b2 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Tue, 26 Oct 2021 12:11:18 +0200 Subject: [PATCH 047/116] Split maintainer responsibilities into list --- CONTRIBUTING.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 58762bfcb..fed4885b4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -299,19 +299,25 @@ your code. You should be on the Discord (or, if you really don't like Discord, Matrix or IRC). ### Maintainer status -Maintainers are responsible for making sure issues are addressed and -pull requests are reviewed and merged, by assigning either themselves or -Developers to issues / PRs. Maintainers are responsible for making -releases, making sure guidelines are kept and making project decisions -based on what the community wants. Maintainers grant/revoke developer -access. Currently there are two maintainers with different -responsibility fields: +Maintainers carry the main responsibility for the project. +#### Maintainer responsibilities +- Making sure issues are addressed and pull requests are reviewed and +merged, by assigning either themselves or Developers to issues / PRs +- Making releases +- Making sure guidelines are kept +- Making project decisions based on what the community wants +- Granting/revoking developer access +- Enforcing the code of conduct (See CODE_OF_CONDUCT.md) +- Moderating official community spaces (See Links section) +- Resolving conflicts and problems within the community + +#### Current maintainers * Fleckenstein - responsible for gameplay review, publishing releases, technical guidelines and issue/PR delegation * Nicu - responsible for community related issues -#### Creating releases +#### Release process * Launch MineClone2 to make sure it still runs * Update the version number in README.md * Use `git tag ` to tag the latest commit with the From 64ebdd0f18beabe915bcabed52b52bf1bb7433e5 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Tue, 26 Oct 2021 12:16:00 +0200 Subject: [PATCH 048/116] Update line length in licensing section --- CONTRIBUTING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fed4885b4..eb93cc2ff 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -330,9 +330,9 @@ version number * Post release announcement and changelog in forums ### Licensing -By asking us to include your changes in -this game, you agree that they fall under the terms of the GPLv3, which -basically means they will become part of a free software. +By asking us to include your changes in this game, you agree that they +fall under the terms of the GPLv3, which basically means they will +become part of a free software. ### Crediting Contributors, Developers and Maintainers will be credited in From 0c567c7921b63d2b690577cd45de2467bdbebb43 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Tue, 26 Oct 2021 12:22:21 +0200 Subject: [PATCH 049/116] Update maintainer section in CREDITS.md (leave kay27 in, but remove jordan since he never did any maintainance work) --- CREDITS.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CREDITS.md b/CREDITS.md index de3dcae61..3d039f6b1 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -8,8 +8,8 @@ ## Maintainers * Fleckenstein +* Nicu * kay27 -* jordan4ibanez ## Developers * bzoss @@ -19,7 +19,6 @@ * iliekprogrammar * MysticTempest * Rootyjr -* Nicu * aligator * Code-Sploit * NO11 From c315d155e1a51a678931be04b16ae9bcc3cf91ae Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Tue, 26 Oct 2021 12:35:19 +0200 Subject: [PATCH 050/116] Update CREDITS.md --- CREDITS.md | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/CREDITS.md b/CREDITS.md index 3d039f6b1..95884dcac 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -22,6 +22,8 @@ * aligator * Code-Sploit * NO11 +* cora +* jordan4ibanez ## Contributors * Laurent Rocher @@ -47,8 +49,24 @@ * dBeans * nickolas360 * yutyo -* ztianyang +* Tianyang Zhang * j45 +* Marcin Serwin +* erlehmann +* E +* Benjamin Schötz +* Doloment +* Sydney Gems +* talamh +* Emily2255 +* Emojigit +* FinishedFragment +* sfan5 +* Blue Blancmange +* Jared Moody +* SmallJoker +* Sven792 +* aldum ## MineClone5 * kay27 @@ -73,7 +91,6 @@ * Rochambeau * rubenwardy * stu -* jordan4ibanez * 4aiman * Kahrl * Krock @@ -102,6 +119,7 @@ * xMrVizzy * yutyo * NO11 +* kay27 ## Translations * Wuzzy @@ -110,6 +128,7 @@ * kay27 * pitchum * todoporlalibertad +* Marcin Serwin ## Special thanks * celeron55 for creating Minetest From 797da20fa7d4c83f411a4c2586ed16b1c1da913a Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Tue, 26 Oct 2021 13:08:07 +0200 Subject: [PATCH 051/116] Add script to automatically generate ingame credits from CREDITS.md --- mods/HUD/mcl_credits/init.lua | 121 +------------------------ mods/HUD/mcl_credits/people.lua | 141 ++++++++++++++++++++++++++++++ tools/generate_ingame_credits.lua | 49 +++++++++++ 3 files changed, 193 insertions(+), 118 deletions(-) create mode 100644 mods/HUD/mcl_credits/people.lua create mode 100755 tools/generate_ingame_credits.lua diff --git a/mods/HUD/mcl_credits/init.lua b/mods/HUD/mcl_credits/init.lua index 235b2a3cb..db3ac8436 100644 --- a/mods/HUD/mcl_credits/init.lua +++ b/mods/HUD/mcl_credits/init.lua @@ -3,123 +3,8 @@ local S = minetest.get_translator(modname) mcl_credits = { players = {}, -} - -mcl_credits.description = S("A faithful Open Source clone of Minecraft") - --- Sub-lists are sorted by number of commits, but the list should not be rearranged (-> new contributors are just added at the end of the list) -mcl_credits.people = { - { S("Creator of MineClone"), 0x0A9400, { - "davedevils", - }}, - { S("Creator of MineClone2"), 0xFBF837, { - "Wuzzy", - }}, - { S("Maintainers"), 0xFF51D5, { - "Fleckenstein", - "kay27", - "oilboi", - }}, - { S("Developers"), 0xF84355, { - "bzoss", - "AFCMS", - "epCode", - "ryvnf", - "iliekprogrammar", - "MysticTempest", - "Rootyjr", - "Nicu", - "aligator", - "Code-Sploit", - "NO11", - }}, - { S("Contributors"), 0x52FF00, { - "Laurent Rocher", - "HimbeerserverDE", - "TechDudie", - "Alexander Minges", - "ArTee3", - "ZeDique la Ruleta", - "pitchum", - "wuniversales", - "Bu-Gee", - "David McMackins II", - "Nicholas Niro", - "Wouters Dorian", - "Blue Blancmange", - "Jared Moody", - "Li0n", - "Midgard", - "Saku Laesvuori", - "Yukitty", - "ZedekThePD", - "aldum", - "dBeans", - "nickolas360", - "yutyo", - "ztianyang", - "j45", - }}, - {"MineClone5", 0xA60014, { - "kay27", - "Debiankaios", - "epCode", - "NO11", - "j45", - }}, - { S("Original Mod Authors"), 0x343434, { - "Wuzzy", - "Fleckenstein", - "BlockMen", - "TenPlus1", - "PilzAdam", - "ryvnf", - "stujones11", - "Arcelmi", - "celeron55", - "maikerumine", - "GunshipPenguin", - "Qwertymine3", - "Rochambeau", - "rubenwardy", - "stu", - "oilboi", - "4aiman", - "Kahrl", - "Krock", - "UgnilJoZ", - "lordfingle", - "22i", - "bzoss", - "kilbith", - "xeranas", - "kddekadenz", - "sofar", - "4Evergreen4", - "jordan4ibanez", - "paramat", - }}, - { S("3D Models"), 0x0019FF, { - "22i", - "tobyplowy", - "epCode", - }}, - { S("Textures"), 0xFF9705, { - "XSSheep", - "Wuzzy", - "kingoscargames", - "leorockway", - "xMrVizzy", - "yutyo", - "NO11", - }}, - { S("Translations"), 0x00FF60, { - "Wuzzy", - "Rocher Laurent", - "wuniversales", - "kay27", - "pitchum", - }}, + description = S("A faithful Open Source clone of Minecraft"), + people = dofile(minetest.get_modpath(modname) .. "/people.lua"), } local function add_hud_element(def, huds, y) @@ -243,7 +128,7 @@ minetest.register_globalstep(function(dtime) y = y - 5 end end - + if y > -100 then if id == huds.icon then y = math.max(400, y) diff --git a/mods/HUD/mcl_credits/people.lua b/mods/HUD/mcl_credits/people.lua new file mode 100644 index 000000000..2861b5052 --- /dev/null +++ b/mods/HUD/mcl_credits/people.lua @@ -0,0 +1,141 @@ +local modname = minetest.get_current_modname() +local S = minetest.get_translator(modname) + +return { + {S("Creator of MineClone"), 0x0A9400, { + "davedevils", + }}, + {S("Creator of MineClone2"), 0xFBF837, { + "Wuzzy", + }}, + {S("Maintainers"), 0xFF51D5, { + "Fleckenstein", + "Nicu", + "kay27", + }}, + {S("Developers"), 0xF84355, { + "bzoss", + "AFCMS", + "epCode", + "ryvnf", + "iliekprogrammar", + "MysticTempest", + "Rootyjr", + "aligator", + "Code-Sploit", + "NO11", + "cora", + "jordan4ibanez", + }}, + {S("Contributors"), 0x52FF00, { + "Laurent Rocher", + "HimbeerserverDE", + "TechDudie", + "Alexander Minges", + "ArTee3", + "ZeDique la Ruleta", + "pitchum", + "wuniversales", + "Bu-Gee", + "David McMackins II", + "Nicholas Niro", + "Wouters Dorian", + "Blue Blancmange", + "Jared Moody", + "Li0n", + "Midgard", + "Saku Laesvuori", + "Yukitty", + "ZedekThePD", + "aldum", + "dBeans", + "nickolas360", + "yutyo", + "Tianyang Zhang", + "j45", + "Marcin Serwin", + "erlehmann", + "E", + "Benjamin Schötz", + "Doloment", + "Sydney Gems", + "talamh", + "Emily2255", + "Emojigit", + "FinishedFragment", + "sfan5", + "Blue Blancmange", + "Jared Moody", + "SmallJoker", + "Sven792", + "aldum", + }}, + {S("MineClone5"), 0xA60014, { + "kay27", + "Debiankaios", + "epCode", + "NO11", + "j45", + }}, + {S("Original Mod Authors"), 0x343434, { + "Wuzzy", + "Fleckenstein", + "BlockMen", + "TenPlus1", + "PilzAdam", + "ryvnf", + "stujones11", + "Arcelmi", + "celeron55", + "maikerumine", + "GunshipPenguin", + "Qwertymine3", + "Rochambeau", + "rubenwardy", + "stu", + "4aiman", + "Kahrl", + "Krock", + "UgnilJoZ", + "lordfingle", + "22i", + "bzoss", + "kilbith", + "xeranas", + "kddekadenz", + "sofar", + "4Evergreen4", + "jordan4ibanez", + "paramat", + }}, + {S("3D Models"), 0x0019FF, { + "22i", + "tobyplowy", + "epCode", + }}, + {S("Textures"), 0xFF9705, { + "XSSheep", + "Wuzzy", + "kingoscargames", + "leorockway", + "xMrVizzy", + "yutyo", + "NO11", + "kay27", + }}, + {S("Translations"), 0x00FF60, { + "Wuzzy", + "Rocher Laurent", + "wuniversales", + "kay27", + "pitchum", + "todoporlalibertad", + "Marcin Serwin", + }}, + {S("Special thanks"), 0x00E9FF, { + "celeron55 for creating Minetest", + "Jordach for the jukebox music compilation from Big Freaking Dig", + "The workaholics who spent way too much time writing for the Minecraft Wiki. It's an invaluable resource for creating this game", + "Notch and Jeb for being the major forces behind Minecraft", + }}, +} diff --git a/tools/generate_ingame_credits.lua b/tools/generate_ingame_credits.lua new file mode 100755 index 000000000..89b633ef0 --- /dev/null +++ b/tools/generate_ingame_credits.lua @@ -0,0 +1,49 @@ +#! /usr/bin/env lua +-- Script to automatically generate mods/HUD/mcl_credits/people.lua from CREDITS.md +-- Run from MCL2 root folder + +local colors = { + ["Creator of MineClone"] = "0x0A9400", + ["Creator of MineClone2"] = "0xFBF837", + ["Maintainers"] = "0xFF51D5", + ["Developers"] = "0xF84355", + ["Contributors"] = "0x52FF00", + ["MineClone5"] = "0xA60014", + ["Original Mod Authors"] = "0x343434", + ["3D Models"] = "0x0019FF", + ["Textures"] = "0xFF9705", + ["Translations"] = "0x00FF60", + ["Special thanks"] = "0x00E9FF", +} + +local from = io.open("CREDITS.md", "r") +local to = io.open("mods/HUD/mcl_credits/people.lua", "w") + +to:write([[ +local modname = minetest.get_current_modname() +local S = minetest.get_translator(modname) + +]]) + +to:write("return {\n") + +local started_block = false + +for line in from:lines() do + if line:find("## ") == 1 then + if started_block then + to:write("\t}},\n") + end + local title = line:sub(4, #line) + to:write("\t{S(\"" .. title .. "\"), " .. (colors[title] or "0xFFFFFF") .. ", {\n") + started_block = true + elseif line:find("*") == 1 then + to:write("\t\t\"" .. line:sub(3, #line) .. "\",\n") + end +end + +if started_block then + to:write("\t}},\n") +end + +to:write("}\n") From 835076ea4b2ed25d850ce2452b858fd26ab4364f Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Tue, 26 Oct 2021 14:28:40 +0200 Subject: [PATCH 052/116] Document asset contributions --- CONTRIBUTING.md | 57 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index eb93cc2ff..e817f81bd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -113,6 +113,63 @@ pull requests here: requests that start with a `WIP:` are not done yet, and therefore might not work, so it's not very useful to try them out yet. +### Contributing assets +Due to license problems, MineClone2 can unfortunately not use +Minecraft's assets, therefore we are always looking for asset +contributions. To contribute assets, it can be useful to learn git +basics and read the section for Programmers of this document, however +this is not required. It's also a good idea to join the Discord server +(or alternatively IRC or Matrix). + +#### Textures +For textures we use the Pixel Perfection texture pack. This is mostly +enough; however in some cases - e.g. for newer minecraft features, it's +useful to have texture artists around. If you want to make such +contributions, join our Discord server. Demands for textures will be +communicated there. + +#### Sounds +MineClone2 currently does not have a consistent way to handle sounds. +The sounds in the game come from different sources, like the SnowZone +ressource pack or minetest_game. Unfortunately, MineClone2 does not play +a sound in every situation you would get one in Minecraft. Any help with +sounds is greatly appreciated, however if you add new sounds you should +probably work together with a programmer, to write the code to actually +play these sounds in game. + +#### 3D Models +Most of the 3D Models in MineClone2 come from +[22i's repository](https://github.com/22i/minecraft-voxel-blender-models). +Similar to the textures, we need people that can make 3D Models with +Blender on demand. Many of the models have to be patched, some new +animations have to be added etc. + +#### Translations + +##### Workflow +To add/update support for your language to MineClone2, you should take +the steps documented in the section for Programmers, add/update the +translation files of the mods that you want to update. You can add +support for all mods, just some of them or only one mod; you can update +the translation file entirely or only partly; basically any effort is +valued. If your changes are small, you can also send them to developers +via E-Mail, Discord, IRC or Matrix - they will credit you appropriately. + +##### Things to note +You can use the script at `tools/check_translate_files.py` to compare +the translation files for the language you are working on with the +template files, to see what is missing and what is out of date with +the template file. However, template files are often incomplete and/or +out of date, sometimes they don't match the code. You can update the +translation files if that is required, you can also modifiy the code in +your translation PR if it's related to translation. You can also work on +multiple languages at the same time in one PR. + +#### Crediting +Asset contributions will be credited in their own respective sections in +CREDITS.md. If you have commited the results yourself, you will also be +credited in the Contributors section. + ### Profiling If you own a server, a great way to help us improve MineClone2's code is by giving us profiler results. Profiler results give us detailed From 19689dd857c047fb857489ed4385b4c5440400c6 Mon Sep 17 00:00:00 2001 From: NO11 Date: Tue, 26 Oct 2021 16:50:10 +0000 Subject: [PATCH 053/116] Use enchanted golden apple for thing banner --- mods/ITEMS/mcl_banners/patterncraft.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_banners/patterncraft.lua b/mods/ITEMS/mcl_banners/patterncraft.lua index 79778a665..767235b1e 100644 --- a/mods/ITEMS/mcl_banners/patterncraft.lua +++ b/mods/ITEMS/mcl_banners/patterncraft.lua @@ -119,8 +119,7 @@ local patterns = { name = N("@1 Thing Charge"), type = "shapeless", - -- TODO: Replace with enchanted golden apple - { e, "mcl_core:apple_gold", d }, + { e, "mcl_core:apple_gold_enchanted", d }, }, ["rhombus"] = { name = N("@1 Lozenge"), From d30e014233957a0b31f06c0e0f753ab005028282 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 27 Oct 2021 18:40:45 +0200 Subject: [PATCH 054/116] Mineclone2 -> MineClone2 --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e817f81bd..bd02346b4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -41,7 +41,7 @@ MineClone2 is developed using the version control system [git](https://git-scm.com/). If you want to contribute code to the project, it is **highly recommended** that you learn the git basics. For non-programmers and people who do not plan to contribute code to -Mineclone2, git is not required. However, git is a tool that will be +MineClone2, git is not required. However, git is a tool that will be referenced frequently because of its usefulness. As such, it is valuable in learning how git works and its terminology. It can also help you in keeping your game updated, and easily testing pull requests. @@ -91,7 +91,7 @@ behavior. * Make sure the feature you request is Minecraft 1.17 Java Edition or Optifine behavior. * Begging or excessive attention seeking does not help us in the -slightest, and may very well disrupt Mineclone2 development. It's better +slightest, and may very well disrupt MineClone2 development. It's better to put that energy into helping or researching the feature in question. After all, we're just volunteers working on our spare time. * Check whether the feature has been implemented in a newer version of From 90796ec7b44d0eab168c77cae2c205e2b296b62f Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 27 Oct 2021 18:42:11 +0200 Subject: [PATCH 055/116] can unfortunately not -> unfortunately cannot --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bd02346b4..d200085ff 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -114,7 +114,7 @@ requests that start with a `WIP:` are not done yet, and therefore might not work, so it's not very useful to try them out yet. ### Contributing assets -Due to license problems, MineClone2 can unfortunately not use +Due to license problems, MineClone2 unfortunately cannot use Minecraft's assets, therefore we are always looking for asset contributions. To contribute assets, it can be useful to learn git basics and read the section for Programmers of this document, however From 61dccfb9e529be38be73fea6cf1f90827e410e26 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 27 Oct 2021 18:44:10 +0200 Subject: [PATCH 056/116] Reword up to date guideline for feature requests --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d200085ff..482bd6c00 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -94,8 +94,8 @@ Optifine behavior. slightest, and may very well disrupt MineClone2 development. It's better to put that energy into helping or researching the feature in question. After all, we're just volunteers working on our spare time. -* Check whether the feature has been implemented in a newer version of -MineClone2, in case you are not using the latest one. +* Ensure the requested feature has not been implemented in MineClone2 +latest or development versions. ### Testing code If you want to help us with speeding up MineClone2 development and From c1934c4f3a7d720854a9ece52fc7d34213733d59 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 27 Oct 2021 18:45:37 +0200 Subject: [PATCH 057/116] Reword feature request alignment with development goals guideline --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 482bd6c00..d8929c9e5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -88,8 +88,8 @@ the bug, e.g. before the crash happened or what causes the faulty behavior. ### Requesting features -* Make sure the feature you request is Minecraft 1.17 Java Edition or -Optifine behavior. +* Ensure the requested feature fulfills our development targets and +goals. * Begging or excessive attention seeking does not help us in the slightest, and may very well disrupt MineClone2 development. It's better to put that energy into helping or researching the feature in question. From 938911e7e383e0f625574c40c49e4ce1b5f551e6 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 27 Oct 2021 18:46:58 +0200 Subject: [PATCH 058/116] even help using -> assist you use --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d8929c9e5..949b61ddb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -219,7 +219,7 @@ relatively new programmer, you can reach us on Discord, Matrix or IRC for questions about git, Lua, Minetest API, MineClone2 codebase or anything related to MineClone2. We can help you avoid writing code that would be deemed inadequeate, or help you become familiar with MineClone2 -better, or even help using development tools. +better, or assist you use development tools. ### Maintain your own code, even if alreay got merged Sometimes, your code may cause crashes or bugs - we try to avoid such From fb2a501a9c5d104096b968cb13ea97e11c75f46b Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 27 Oct 2021 18:47:38 +0200 Subject: [PATCH 059/116] Keep our guidelines -> Stick to our guidelines --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 949b61ddb..a6385f627 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -242,7 +242,7 @@ of the results) * [Official Minecraft Wiki](https://minecraft.fandom.com/wiki/Minecraft_Wiki) (Include a link to the specific page you used) -### Keep our guidelines +### Stick to our guidelines #### Git Guidelines * We use merge rather than rebase or squash merge From 4db9952a84df35d96b127b40a2e93735ae2e8b83 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 27 Oct 2021 18:48:38 +0200 Subject: [PATCH 060/116] if -> only when --- CONTRIBUTING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a6385f627..35b3eaa3e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -338,9 +338,9 @@ MineClone2 repository. MineClone2 master - rather, do your work on a branch on your private repo, then create a pull request. This way other people can review your changes and make sure they work before they get merged. -- Merge PRs if they have recieved the necessary feedback and have been -tested to not lead to any crashes and do what they claim to do by at -least two different people. +- Merge PRs only when they have recieved the necessary feedback and have +been tested to not lead to any crashes and do what they claim to do by +at least two different people. - You may also be assigned to issues or pull requests as a developer. In this case it is your responsibility to fix the issue / review and merge the pull request when it is ready. You can From 11e364b3ec7bc472f04f6d17cc38113ea5aacd97 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 27 Oct 2021 18:52:26 +0200 Subject: [PATCH 061/116] Give development target it's own headline --- CONTRIBUTING.md | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 35b3eaa3e..c328ca371 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,10 +2,13 @@ So you want to contribute to MineClone2? Wow, thank you! :-) -But first, some things to note: +MineClone2 is maintained by Nicu and Fleckenstein. If you have any +problems or questions, contact us (See Links section below). -MineClone2's development target is to... +You can help with MineClone2's development in many different ways, +whether you're a programmer or not. +## MineClone2's development target is to... - Crucially, create a stable, moddable, free/libre clone of Minecraft based on the Minetest engine with polished features, usable in both singleplayer and multiplayer. Currently, most of **Minecraft Java @@ -21,12 +24,6 @@ well on really low spec computers. Unfortunately, due to Minecraft's mechanisms and Minetest engine's limitations along with a very small playerbase on low spec computers, optimizations are hard to investigate. -MineClone2 is maintained by Nicu and Fleckenstein. If you have any -problems or questions, contact us (See Links section below). - -You can help with MineClone2's development in many different ways, -whether you're a programmer or not. - ## Links * [Mesehub](https://git.minetest.land/MineClone2/MineClone2) * [Discord](https://discord.gg/xE4z8EEpDC) From 6fd8ff8865af2841366a730239e9babc465cb65d Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 27 Oct 2021 18:54:39 +0200 Subject: [PATCH 062/116] testing -> test --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c328ca371..56876fad1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -40,8 +40,8 @@ project, it is **highly recommended** that you learn the git basics. For non-programmers and people who do not plan to contribute code to MineClone2, git is not required. However, git is a tool that will be referenced frequently because of its usefulness. As such, it is valuable -in learning how git works and its terminology. It can also help you in -keeping your game updated, and easily testing pull requests. +in learning how git works and its terminology. It can also help you +keeping your game updated, and easily test pull requests. ## How you can help as a non-programmer From bbdd8f55eb28acf6245864f3eeff8aa0071949a6 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Thu, 28 Oct 2021 09:34:39 +0200 Subject: [PATCH 063/116] Reword 'reporting issues' part in 'testing pull requests' section --- CONTRIBUTING.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 56876fad1..de3ae536e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -103,9 +103,10 @@ programmer saying "Look, I modified the game, please apply my changes to the upstream version of the game". However, every programmer makes mistakes sometimes, some of which are hard to spot. You can help by downloading this modified version of the game and trying it out - then -you tell us whether the code works and does what it claims to do or -whether you have encountered any issues. You can find currently open -pull requests here: +tell us if the code works as expected without any issues. Ideally, you +would report issues will pull requests similar to when you were +reporting bugs that are the mainline (See Reporting bugs section). You +can find currently open pull requests here: . Note that pull requests that start with a `WIP:` are not done yet, and therefore might not work, so it's not very useful to try them out yet. From 5b37f5600504608e3cd0dbffc1c43c15a6b6c14d Mon Sep 17 00:00:00 2001 From: NO11 Date: Thu, 28 Oct 2021 09:43:14 +0000 Subject: [PATCH 064/116] Remove small gray border of buttons in creative inventory pages --- mods/HUD/mcl_inventory/creative.lua | 1339 +++++++++++++-------------- 1 file changed, 669 insertions(+), 670 deletions(-) diff --git a/mods/HUD/mcl_inventory/creative.lua b/mods/HUD/mcl_inventory/creative.lua index ff9cccf9e..2be0be4bc 100644 --- a/mods/HUD/mcl_inventory/creative.lua +++ b/mods/HUD/mcl_inventory/creative.lua @@ -1,670 +1,669 @@ -local S = minetest.get_translator(minetest.get_current_modname()) -local F = minetest.formspec_escape - --- Prepare player info table -local players = {} - --- Containing all the items for each Creative Mode tab -local inventory_lists = {} - ---local mod_player = minetest.get_modpath("mcl_player") - --- Create tables -local builtin_filter_ids = {"blocks","deco","redstone","rail","food","tools","combat","mobs","brew","matr","misc","all"} -for _, f in pairs(builtin_filter_ids) do - inventory_lists[f] = {} -end - -local function replace_enchanted_books(tbl) - for k, item in ipairs(tbl) do - if item:find("mcl_enchanting:book_enchanted") == 1 then - local _, enchantment, level = item:match("(%a+) ([_%w]+) (%d+)") - level = level and tonumber(level) - if enchantment and level then - tbl[k] = mcl_enchanting.enchant(ItemStack("mcl_enchanting:book_enchanted"), enchantment, level) - end - end - end -end - ---[[ Populate all the item tables. We only do this once. Note this code must be -executed after loading all the other mods in order to work. ]] -minetest.register_on_mods_loaded(function() - for name,def in pairs(minetest.registered_items) do - if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0) and def.description and def.description ~= "" then - local function is_redstone(def) - return def.mesecons or def.groups.mesecon or def.groups.mesecon_conductor_craftable or def.groups.mesecon_effecor_off - end - local function is_tool(def) - return def.groups.tool or (def.tool_capabilities and def.tool_capabilities.damage_groups == nil) - end - local function is_weapon_or_armor(def) - return def.groups.weapon or def.groups.weapon_ranged or def.groups.ammo or def.groups.combat_item or ((def.groups.armor_head or def.groups.armor_torso or def.groups.armor_legs or def.groups.armor_feet or def.groups.horse_armor) and def.groups.non_combat_armor ~= 1) - end - -- Is set to true if it was added in any category besides misc - local nonmisc = false - if def.groups.building_block then - table.insert(inventory_lists["blocks"], name) - nonmisc = true - end - if def.groups.deco_block then - table.insert(inventory_lists["deco"], name) - nonmisc = true - end - if is_redstone(def) then - table.insert(inventory_lists["redstone"], name) - nonmisc = true - end - if def.groups.transport then - table.insert(inventory_lists["rail"], name) - nonmisc = true - end - if (def.groups.food and not def.groups.brewitem) or def.groups.eatable then - table.insert(inventory_lists["food"], name) - nonmisc = true - end - if is_tool(def) then - table.insert(inventory_lists["tools"], name) - nonmisc = true - end - if is_weapon_or_armor(def) then - table.insert(inventory_lists["combat"], name) - nonmisc = true - end - if def.groups.spawn_egg == 1 then - table.insert(inventory_lists["mobs"], name) - nonmisc = true - end - if def.groups.brewitem then - table.insert(inventory_lists["brew"], name) - nonmisc = true - end - if def.groups.craftitem then - table.insert(inventory_lists["matr"], name) - nonmisc = true - end - -- Misc. category is for everything which is not in any other category - if not nonmisc then - table.insert(inventory_lists["misc"], name) - end - - table.insert(inventory_lists["all"], name) - end - end - - for ench, def in pairs(mcl_enchanting.enchantments) do - local str = "mcl_enchanting:book_enchanted " .. ench .. " " .. def.max_level - if def.inv_tool_tab then - table.insert(inventory_lists["tools"], str) - end - if def.inv_combat_tab then - table.insert(inventory_lists["combat"], str) - end - table.insert(inventory_lists["all"], str) - end - - for _, to_sort in pairs(inventory_lists) do - table.sort(to_sort) - replace_enchanted_books(to_sort) - end -end) - -local function filter_item(name, description, lang, filter) - local desc - if not lang then - desc = string.lower(description) - else - desc = string.lower(minetest.get_translated_string(lang, description)) - end - return string.find(name, filter) or string.find(desc, filter) -end - -local function set_inv_search(filter, player) - local playername = player:get_player_name() - local inv = minetest.get_inventory({type="detached", name="creative_"..playername}) - local creative_list = {} - local lang = minetest.get_player_information(playername).lang_code - for name,def in pairs(minetest.registered_items) do - if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0) and def.description and def.description ~= "" then - if filter_item(string.lower(def.name), def.description, lang, filter) then - table.insert(creative_list, name) - end - end - end - for ench, def in pairs(mcl_enchanting.enchantments) do - for i = 1, def.max_level do - local stack = mcl_enchanting.enchant(ItemStack("mcl_enchanting:book_enchanted"), ench, i) - if filter_item("mcl_enchanting:book_enchanted", minetest.strip_colors(stack:get_description()), lang, filter) then - table.insert(creative_list, "mcl_enchanting:book_enchanted " .. ench .. " " .. i) - end - end - end - table.sort(creative_list) - replace_enchanted_books(creative_list) - - inv:set_size("main", #creative_list) - inv:set_list("main", creative_list) -end - -local function set_inv_page(page, player) - local playername = player:get_player_name() - local inv = minetest.get_inventory({type="detached", name="creative_"..playername}) - inv:set_size("main", 0) - local creative_list = {} - if inventory_lists[page] then -- Standard filter - creative_list = inventory_lists[page] - end - inv:set_size("main", #creative_list) - inv:set_list("main", creative_list) -end - -local function init(player) - local playername = player:get_player_name() - minetest.create_detached_inventory("creative_"..playername, { - allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) - if minetest.is_creative_enabled(playername) then - return count - else - return 0 - end - end, - allow_put = function(inv, listname, index, stack, player) - return 0 - end, - allow_take = function(inv, listname, index, stack, player) - if minetest.is_creative_enabled(player:get_player_name()) then - return -1 - else - return 0 - end - end, - }, playername) - set_inv_page("all", player) -end - --- Create the trash field -local trash = minetest.create_detached_inventory("trash", { - allow_put = function(inv, listname, index, stack, player) - if minetest.is_creative_enabled(player:get_player_name()) then - return stack:get_count() - else - return 0 - end - end, - on_put = function(inv, listname, index, stack, player) - inv:set_stack(listname, index, "") - end, -}) -trash:set_size("main", 1) - -local noffset = {} -- numeric tab offset -local offset = {} -- string offset: -local boffset = {} -- -local hoch = {} -local filtername = {} ---local bg = {} - -local noffset_x_start = -0.24 -local noffset_x = noffset_x_start -local noffset_y = -0.25 -local function next_noffset(id, right) - if right then - noffset[id] = { 8.94, noffset_y } - else - noffset[id] = { noffset_x, noffset_y } - noffset_x = noffset_x + 1.25 - end -end - --- Upper row -next_noffset("blocks") -next_noffset("deco") -next_noffset("redstone") -next_noffset("rail") -next_noffset("brew") -next_noffset("misc") -next_noffset("nix", true) - -noffset_x = noffset_x_start -noffset_y = 8.12 - --- Lower row -next_noffset("food") -next_noffset("tools") -next_noffset("combat") -next_noffset("mobs") -next_noffset("matr") -next_noffset("inv", true) - -for k,v in pairs(noffset) do - offset[k] = tostring(v[1]) .. "," .. tostring(v[2]) - boffset[k] = tostring(v[1]+0.19) .. "," .. tostring(v[2]+0.25) -end - -hoch["blocks"] = "" -hoch["deco"] = "" -hoch["redstone"] = "" -hoch["rail"] = "" -hoch["brew"] = "" -hoch["misc"] = "" -hoch["nix"] = "" -hoch["default"] = "" -hoch["food"] = "_down" -hoch["tools"] = "_down" -hoch["combat"] = "_down" -hoch["mobs"] = "_down" -hoch["matr"] = "_down" -hoch["inv"] = "_down" - -filtername["blocks"] = S("Building Blocks") -filtername["deco"] = S("Decoration Blocks") -filtername["redstone"] = S("Redstone") -filtername["rail"] = S("Transportation") -filtername["misc"] = S("Miscellaneous") -filtername["nix"] = S("Search Items") -filtername["food"] = S("Foodstuffs") -filtername["tools"] = S("Tools") -filtername["combat"] = S("Combat") -filtername["mobs"] = S("Mobs") -filtername["brew"] = S("Brewing") -filtername["matr"] = S("Materials") -filtername["inv"] = S("Survival Inventory") - ---local dark_bg = "crafting_creative_bg_dark.png" - ---[[local function reset_menu_item_bg() - bg["blocks"] = dark_bg - bg["deco"] = dark_bg - bg["redstone"] = dark_bg - bg["rail"] = dark_bg - bg["misc"] = dark_bg - bg["nix"] = dark_bg - bg["food"] = dark_bg - bg["tools"] = dark_bg - bg["combat"] = dark_bg - bg["mobs"] = dark_bg - bg["brew"] = dark_bg - bg["matr"] = dark_bg - bg["inv"] = dark_bg - bg["default"] = dark_bg -end]] - - -function mcl_inventory.set_creative_formspec(player, start_i, pagenum, inv_size, show, page, filter) - --reset_menu_item_bg() - pagenum = math.floor(pagenum) or 1 - - local playername = player:get_player_name() - - if not inv_size then - if page == "nix" then - local inv = minetest.get_inventory({type="detached", name="creative_"..playername}) - inv_size = inv:get_size("main") - elseif page and page ~= "inv" then - inv_size = #(inventory_lists[page]) - else - inv_size = 0 - end - end - local pagemax = math.max(1, math.floor((inv_size-1) / (9*5) + 1)) - local name = "nix" - local main_list - local listrings = "listring[detached:creative_"..playername..";main]".. - "listring[current_player;main]".. - "listring[detached:trash;main]" - - if page then - name = page - if players[playername] then - players[playername].page = page - end - end - --bg[name] = "crafting_creative_bg.png" - - local inv_bg = "crafting_inventory_creative.png" - if name == "inv" then - inv_bg = "crafting_inventory_creative_survival.png" - - -- Show armor and player image - local player_preview - if minetest.settings:get_bool("3d_player_preview", true) then - player_preview = mcl_player.get_player_formspec_model(player, 3.9, 1.4, 1.2333, 2.4666, "") - else - player_preview = "image[3.9,1.4;1.2333,2.4666;"..mcl_player.player_get_preview(player).."]" - end - - -- Background images for armor slots (hide if occupied) - local armor_slot_imgs = "" - local inv = player:get_inventory() - if inv:get_stack("armor", 2):is_empty() then - armor_slot_imgs = armor_slot_imgs .. "image[2.5,1.3;1,1;mcl_inventory_empty_armor_slot_helmet.png]" - end - if inv:get_stack("armor", 3):is_empty() then - armor_slot_imgs = armor_slot_imgs .. "image[2.5,2.75;1,1;mcl_inventory_empty_armor_slot_chestplate.png]" - end - if inv:get_stack("armor", 4):is_empty() then - armor_slot_imgs = armor_slot_imgs .. "image[5.5,1.3;1,1;mcl_inventory_empty_armor_slot_leggings.png]" - end - if inv:get_stack("armor", 5):is_empty() then - armor_slot_imgs = armor_slot_imgs .. "image[5.5,2.75;1,1;mcl_inventory_empty_armor_slot_boots.png]" - end - - -- Survival inventory slots - main_list = "list[current_player;main;0,3.75;9,3;9]".. - mcl_formspec.get_itemslot_bg(0,3.75,9,3).. - -- armor - "list[current_player;armor;2.5,1.3;1,1;1]".. - "list[current_player;armor;2.5,2.75;1,1;2]".. - "list[current_player;armor;5.5,1.3;1,1;3]".. - "list[current_player;armor;5.5,2.75;1,1;4]".. - mcl_formspec.get_itemslot_bg(2.5,1.3,1,1).. - mcl_formspec.get_itemslot_bg(2.5,2.75,1,1).. - mcl_formspec.get_itemslot_bg(5.5,1.3,1,1).. - mcl_formspec.get_itemslot_bg(5.5,2.75,1,1).. - armor_slot_imgs.. - -- player preview - player_preview.. - -- crafting guide button - "image_button[9,1;1,1;craftguide_book.png;__mcl_craftguide;]".. - "tooltip[__mcl_craftguide;"..F(S("Recipe book")).."]".. - -- help button - "image_button[9,2;1,1;doc_button_icon_lores.png;__mcl_doc;]".. - "tooltip[__mcl_doc;"..F(S("Help")).."]".. - -- skins button - "image_button[9,3;1,1;mcl_skins_button.png;__mcl_skins;]".. - "tooltip[__mcl_skins;"..F(S("Select player skin")).."]".. - -- achievements button - "image_button[9,4;1,1;mcl_achievements_button.png;__mcl_achievements;]".. - --"style_type[image_button;border=;bgimg=;bgimg_pressed=]".. - "tooltip[__mcl_achievements;"..F(S("Achievements")).."]" - - -- For shortcuts - listrings = listrings .. - "listring[detached:"..playername.."_armor;armor]".. - "listring[current_player;main]" - else - -- Creative inventory slots - main_list = "list[detached:creative_"..playername..";main;0,1.75;9,5;"..tostring(start_i).."]".. - mcl_formspec.get_itemslot_bg(0,1.75,9,5).. - -- Page buttons - "label[9.0,5.5;"..F(S("@1/@2", pagenum, pagemax)).."]".. - "image_button[9.0,6.0;0.7,0.7;crafting_creative_prev.png;creative_prev;]".. - "image_button[9.5,6.0;0.7,0.7;crafting_creative_next.png;creative_next;]" - end - - local tab_icon = { - blocks = "mcl_core:brick_block", - deco = "mcl_flowers:peony", - redstone = "mesecons:redstone", - rail = "mcl_minecarts:golden_rail", - misc = "mcl_buckets:bucket_lava", - nix = "mcl_compass:compass", - food = "mcl_core:apple", - tools = "mcl_core:axe_iron", - combat = "mcl_core:sword_gold", - mobs = "mobs_mc:cow", - brew = "mcl_potions:dragon_breath", - matr = "mcl_core:stick", - inv = "mcl_chests:chest", - } - local function tab(current_tab, this_tab) - local bg_img - if current_tab == this_tab then - bg_img = "crafting_creative_active"..hoch[this_tab]..".png" - else - bg_img = "crafting_creative_inactive"..hoch[this_tab]..".png" - end - return - "style["..this_tab..";border=false;bgimg=;bgimg_pressed=]".. - "item_image_button[" .. boffset[this_tab] ..";1,1;"..tab_icon[this_tab]..";"..this_tab..";]".. - "image[" .. offset[this_tab] .. ";1.5,1.44;" .. bg_img .. "]" .. - "image[" .. boffset[this_tab] .. ";1,1;crafting_creative_marker.png]" - end - local caption = "" - if name ~= "inv" and filtername[name] then - caption = "label[0,1.2;"..F(minetest.colorize("#313131", filtername[name])).."]" - end - - local formspec = "size[10,9.3]".. - "no_prepend[]".. - mcl_vars.gui_nonbg..mcl_vars.gui_bg_color.. - "background[-0.19,-0.25;10.5,9.87;"..inv_bg.."]".. - "label[-5,-5;"..name.."]".. - tab(name, "blocks") .. - "tooltip[blocks;"..F(filtername["blocks"]).."]".. - tab(name, "deco") .. - "tooltip[deco;"..F(filtername["deco"]).."]".. - tab(name, "redstone") .. - "tooltip[redstone;"..F(filtername["redstone"]).."]".. - tab(name, "rail") .. - "tooltip[rail;"..F(filtername["rail"]).."]".. - tab(name, "misc") .. - "tooltip[misc;"..F(filtername["misc"]).."]".. - tab(name, "nix") .. - "tooltip[nix;"..F(filtername["nix"]).."]".. - caption.. - "list[current_player;main;0,7;9,1;]".. - mcl_formspec.get_itemslot_bg(0,7,9,1).. - main_list.. - tab(name, "food") .. - "tooltip[food;"..F(filtername["food"]).."]".. - tab(name, "tools") .. - "tooltip[tools;"..F(filtername["tools"]).."]".. - tab(name, "combat") .. - "tooltip[combat;"..F(filtername["combat"]).."]".. - tab(name, "mobs") .. - "tooltip[mobs;"..F(filtername["mobs"]).."]".. - tab(name, "brew") .. - "tooltip[brew;"..F(filtername["brew"]).."]".. - tab(name, "matr") .. - "tooltip[matr;"..F(filtername["matr"]).."]".. - tab(name, "inv") .. - "tooltip[inv;"..F(filtername["inv"]).."]".. - "list[detached:trash;main;9,7;1,1;]".. - mcl_formspec.get_itemslot_bg(9,7,1,1).. - "image[9,7;1,1;crafting_creative_trash.png]".. - listrings - - if name == "nix" then - if filter == nil then - filter = "" - end - formspec = formspec .. "field[5.3,1.34;4,0.75;search;;"..minetest.formspec_escape(filter).."]" - formspec = formspec .. "field_close_on_enter[search;false]" - end - if pagenum then formspec = formspec .. "p"..tostring(pagenum) end - player:set_inventory_formspec(formspec) -end - -minetest.register_on_player_receive_fields(function(player, formname, fields) - local page = nil - - if not minetest.is_creative_enabled(player:get_player_name()) then - return - end - if formname ~= "" or fields.quit == "true" then - -- No-op if formspec closed or not player inventory (formname == "") - return - end - - local name = player:get_player_name() - - if fields.blocks then - if players[name].page == "blocks" then return end - set_inv_page("blocks",player) - page = "blocks" - elseif fields.deco then - if players[name].page == "deco" then return end - set_inv_page("deco",player) - page = "deco" - elseif fields.redstone then - if players[name].page == "redstone" then return end - set_inv_page("redstone",player) - page = "redstone" - elseif fields.rail then - if players[name].page == "rail" then return end - set_inv_page("rail",player) - page = "rail" - elseif fields.misc then - if players[name].page == "misc" then return end - set_inv_page("misc",player) - page = "misc" - elseif fields.nix then - set_inv_page("all",player) - page = "nix" - elseif fields.food then - if players[name].page == "food" then return end - set_inv_page("food",player) - page = "food" - elseif fields.tools then - if players[name].page == "tools" then return end - set_inv_page("tools",player) - page = "tools" - elseif fields.combat then - if players[name].page == "combat" then return end - set_inv_page("combat",player) - page = "combat" - elseif fields.mobs then - if players[name].page == "mobs" then return end - set_inv_page("mobs",player) - page = "mobs" - elseif fields.brew then - if players[name].page == "brew" then return end - set_inv_page("brew",player) - page = "brew" - elseif fields.matr then - if players[name].page == "matr" then return end - set_inv_page("matr",player) - page = "matr" - elseif fields.inv then - if players[name].page == "inv" then return end - page = "inv" - elseif fields.search == "" and not fields.creative_next and not fields.creative_prev then - set_inv_page("all", player) - page = "nix" - elseif fields.search and not fields.creative_next and not fields.creative_prev then - set_inv_search(string.lower(fields.search),player) - page = "nix" - end - - if page then - players[name].page = page - end - if players[name].page then - page = players[name].page - end - - -- Figure out current scroll bar from formspec - --local formspec = player:get_inventory_formspec() - - local start_i = players[name].start_i - - if fields.creative_prev then - start_i = start_i - 9*5 - elseif fields.creative_next then - start_i = start_i + 9*5 - else - -- Reset scroll bar if not scrolled - start_i = 0 - end - if start_i < 0 then - start_i = start_i + 9*5 - end - - local inv_size - if page == "nix" then - local inv = minetest.get_inventory({type="detached", name="creative_"..name}) - inv_size = inv:get_size("main") - elseif page and page ~= "inv" then - inv_size = #(inventory_lists[page]) - else - inv_size = 0 - end - - if start_i >= inv_size then - start_i = start_i - 9*5 - end - if start_i < 0 or start_i >= inv_size then - start_i = 0 - end - players[name].start_i = start_i - - local filter = "" - if not fields.nix and fields.search and fields.search ~= "" then - filter = fields.search - players[name].filter = filter - end - - mcl_inventory.set_creative_formspec(player, start_i, start_i / (9*5) + 1, inv_size, false, page, filter) -end) - - -if minetest.is_creative_enabled("") then - minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack) - -- Place infinite nodes, except for shulker boxes - local group = minetest.get_item_group(itemstack:get_name(), "shulker_box") - return group == 0 or group == nil - end) - - function minetest.handle_node_drops(pos, drops, digger) - if not digger or not digger:is_player() then - for _,item in ipairs(drops) do - minetest.add_item(pos, item) - end - end - local inv = digger:get_inventory() - if inv then - for _,item in ipairs(drops) do - if not inv:contains_item("main", item, true) then - inv:add_item("main", item) - end - end - end - end - - mcl_inventory.update_inventory_formspec = function(player) - local page - - local name = player:get_player_name() - - if players[name].page then - page = players[name].page - else - page = "nix" - end - - -- Figure out current scroll bar from formspec - --local formspec = player:get_inventory_formspec() - local start_i = players[name].start_i - - local inv_size - if page == "nix" then - local inv = minetest.get_inventory({type="detached", name="creative_"..name}) - inv_size = inv:get_size("main") - elseif page and page ~= "inv" then - inv_size = #(inventory_lists[page]) - else - inv_size = 0 - end - - local filter = players[name].filter - if filter == nil then - filter = "" - end - - mcl_inventory.set_creative_formspec(player, start_i, start_i / (9*5) + 1, inv_size, false, page, filter) - end -end - -minetest.register_on_joinplayer(function(player) - -- Initialize variables and inventory - local name = player:get_player_name() - if not players[name] then - players[name] = {} - players[name].page = "nix" - players[name].filter = "" - players[name].start_i = 0 - end - init(player) - mcl_inventory.set_creative_formspec(player, 0, 1, nil, false, "nix", "") -end) +local S = minetest.get_translator(minetest.get_current_modname()) +local F = minetest.formspec_escape + +-- Prepare player info table +local players = {} + +-- Containing all the items for each Creative Mode tab +local inventory_lists = {} + +--local mod_player = minetest.get_modpath("mcl_player") + +-- Create tables +local builtin_filter_ids = {"blocks","deco","redstone","rail","food","tools","combat","mobs","brew","matr","misc","all"} +for _, f in pairs(builtin_filter_ids) do + inventory_lists[f] = {} +end + +local function replace_enchanted_books(tbl) + for k, item in ipairs(tbl) do + if item:find("mcl_enchanting:book_enchanted") == 1 then + local _, enchantment, level = item:match("(%a+) ([_%w]+) (%d+)") + level = level and tonumber(level) + if enchantment and level then + tbl[k] = mcl_enchanting.enchant(ItemStack("mcl_enchanting:book_enchanted"), enchantment, level) + end + end + end +end + +--[[ Populate all the item tables. We only do this once. Note this code must be +executed after loading all the other mods in order to work. ]] +minetest.register_on_mods_loaded(function() + for name,def in pairs(minetest.registered_items) do + if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0) and def.description and def.description ~= "" then + local function is_redstone(def) + return def.mesecons or def.groups.mesecon or def.groups.mesecon_conductor_craftable or def.groups.mesecon_effecor_off + end + local function is_tool(def) + return def.groups.tool or (def.tool_capabilities and def.tool_capabilities.damage_groups == nil) + end + local function is_weapon_or_armor(def) + return def.groups.weapon or def.groups.weapon_ranged or def.groups.ammo or def.groups.combat_item or ((def.groups.armor_head or def.groups.armor_torso or def.groups.armor_legs or def.groups.armor_feet or def.groups.horse_armor) and def.groups.non_combat_armor ~= 1) + end + -- Is set to true if it was added in any category besides misc + local nonmisc = false + if def.groups.building_block then + table.insert(inventory_lists["blocks"], name) + nonmisc = true + end + if def.groups.deco_block then + table.insert(inventory_lists["deco"], name) + nonmisc = true + end + if is_redstone(def) then + table.insert(inventory_lists["redstone"], name) + nonmisc = true + end + if def.groups.transport then + table.insert(inventory_lists["rail"], name) + nonmisc = true + end + if (def.groups.food and not def.groups.brewitem) or def.groups.eatable then + table.insert(inventory_lists["food"], name) + nonmisc = true + end + if is_tool(def) then + table.insert(inventory_lists["tools"], name) + nonmisc = true + end + if is_weapon_or_armor(def) then + table.insert(inventory_lists["combat"], name) + nonmisc = true + end + if def.groups.spawn_egg == 1 then + table.insert(inventory_lists["mobs"], name) + nonmisc = true + end + if def.groups.brewitem then + table.insert(inventory_lists["brew"], name) + nonmisc = true + end + if def.groups.craftitem then + table.insert(inventory_lists["matr"], name) + nonmisc = true + end + -- Misc. category is for everything which is not in any other category + if not nonmisc then + table.insert(inventory_lists["misc"], name) + end + + table.insert(inventory_lists["all"], name) + end + end + + for ench, def in pairs(mcl_enchanting.enchantments) do + local str = "mcl_enchanting:book_enchanted " .. ench .. " " .. def.max_level + if def.inv_tool_tab then + table.insert(inventory_lists["tools"], str) + end + if def.inv_combat_tab then + table.insert(inventory_lists["combat"], str) + end + table.insert(inventory_lists["all"], str) + end + + for _, to_sort in pairs(inventory_lists) do + table.sort(to_sort) + replace_enchanted_books(to_sort) + end +end) + +local function filter_item(name, description, lang, filter) + local desc + if not lang then + desc = string.lower(description) + else + desc = string.lower(minetest.get_translated_string(lang, description)) + end + return string.find(name, filter) or string.find(desc, filter) +end + +local function set_inv_search(filter, player) + local playername = player:get_player_name() + local inv = minetest.get_inventory({type="detached", name="creative_"..playername}) + local creative_list = {} + local lang = minetest.get_player_information(playername).lang_code + for name,def in pairs(minetest.registered_items) do + if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0) and def.description and def.description ~= "" then + if filter_item(string.lower(def.name), def.description, lang, filter) then + table.insert(creative_list, name) + end + end + end + for ench, def in pairs(mcl_enchanting.enchantments) do + for i = 1, def.max_level do + local stack = mcl_enchanting.enchant(ItemStack("mcl_enchanting:book_enchanted"), ench, i) + if filter_item("mcl_enchanting:book_enchanted", minetest.strip_colors(stack:get_description()), lang, filter) then + table.insert(creative_list, "mcl_enchanting:book_enchanted " .. ench .. " " .. i) + end + end + end + table.sort(creative_list) + replace_enchanted_books(creative_list) + + inv:set_size("main", #creative_list) + inv:set_list("main", creative_list) +end + +local function set_inv_page(page, player) + local playername = player:get_player_name() + local inv = minetest.get_inventory({type="detached", name="creative_"..playername}) + inv:set_size("main", 0) + local creative_list = {} + if inventory_lists[page] then -- Standard filter + creative_list = inventory_lists[page] + end + inv:set_size("main", #creative_list) + inv:set_list("main", creative_list) +end + +local function init(player) + local playername = player:get_player_name() + minetest.create_detached_inventory("creative_"..playername, { + allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) + if minetest.is_creative_enabled(playername) then + return count + else + return 0 + end + end, + allow_put = function(inv, listname, index, stack, player) + return 0 + end, + allow_take = function(inv, listname, index, stack, player) + if minetest.is_creative_enabled(player:get_player_name()) then + return -1 + else + return 0 + end + end, + }, playername) + set_inv_page("all", player) +end + +-- Create the trash field +local trash = minetest.create_detached_inventory("trash", { + allow_put = function(inv, listname, index, stack, player) + if minetest.is_creative_enabled(player:get_player_name()) then + return stack:get_count() + else + return 0 + end + end, + on_put = function(inv, listname, index, stack, player) + inv:set_stack(listname, index, "") + end, +}) +trash:set_size("main", 1) + +local noffset = {} -- numeric tab offset +local offset = {} -- string offset: +local boffset = {} -- +local hoch = {} +local filtername = {} +--local bg = {} + +local noffset_x_start = -0.24 +local noffset_x = noffset_x_start +local noffset_y = -0.25 +local function next_noffset(id, right) + if right then + noffset[id] = { 8.94, noffset_y } + else + noffset[id] = { noffset_x, noffset_y } + noffset_x = noffset_x + 1.25 + end +end + +-- Upper row +next_noffset("blocks") +next_noffset("deco") +next_noffset("redstone") +next_noffset("rail") +next_noffset("brew") +next_noffset("misc") +next_noffset("nix", true) + +noffset_x = noffset_x_start +noffset_y = 8.12 + +-- Lower row +next_noffset("food") +next_noffset("tools") +next_noffset("combat") +next_noffset("mobs") +next_noffset("matr") +next_noffset("inv", true) + +for k,v in pairs(noffset) do + offset[k] = tostring(v[1]) .. "," .. tostring(v[2]) + boffset[k] = tostring(v[1]+0.19) .. "," .. tostring(v[2]+0.25) +end + +hoch["blocks"] = "" +hoch["deco"] = "" +hoch["redstone"] = "" +hoch["rail"] = "" +hoch["brew"] = "" +hoch["misc"] = "" +hoch["nix"] = "" +hoch["default"] = "" +hoch["food"] = "_down" +hoch["tools"] = "_down" +hoch["combat"] = "_down" +hoch["mobs"] = "_down" +hoch["matr"] = "_down" +hoch["inv"] = "_down" + +filtername["blocks"] = S("Building Blocks") +filtername["deco"] = S("Decoration Blocks") +filtername["redstone"] = S("Redstone") +filtername["rail"] = S("Transportation") +filtername["misc"] = S("Miscellaneous") +filtername["nix"] = S("Search Items") +filtername["food"] = S("Foodstuffs") +filtername["tools"] = S("Tools") +filtername["combat"] = S("Combat") +filtername["mobs"] = S("Mobs") +filtername["brew"] = S("Brewing") +filtername["matr"] = S("Materials") +filtername["inv"] = S("Survival Inventory") + +--local dark_bg = "crafting_creative_bg_dark.png" + +--[[local function reset_menu_item_bg() + bg["blocks"] = dark_bg + bg["deco"] = dark_bg + bg["redstone"] = dark_bg + bg["rail"] = dark_bg + bg["misc"] = dark_bg + bg["nix"] = dark_bg + bg["food"] = dark_bg + bg["tools"] = dark_bg + bg["combat"] = dark_bg + bg["mobs"] = dark_bg + bg["brew"] = dark_bg + bg["matr"] = dark_bg + bg["inv"] = dark_bg + bg["default"] = dark_bg +end]] + + +function mcl_inventory.set_creative_formspec(player, start_i, pagenum, inv_size, show, page, filter) + --reset_menu_item_bg() + pagenum = math.floor(pagenum) or 1 + + local playername = player:get_player_name() + + if not inv_size then + if page == "nix" then + local inv = minetest.get_inventory({type="detached", name="creative_"..playername}) + inv_size = inv:get_size("main") + elseif page and page ~= "inv" then + inv_size = #(inventory_lists[page]) + else + inv_size = 0 + end + end + local pagemax = math.max(1, math.floor((inv_size-1) / (9*5) + 1)) + local name = "nix" + local main_list + local listrings = "listring[detached:creative_"..playername..";main]".. + "listring[current_player;main]".. + "listring[detached:trash;main]" + + if page then + name = page + if players[playername] then + players[playername].page = page + end + end + --bg[name] = "crafting_creative_bg.png" + + local inv_bg = "crafting_inventory_creative.png" + if name == "inv" then + inv_bg = "crafting_inventory_creative_survival.png" + + -- Show armor and player image + local player_preview + if minetest.settings:get_bool("3d_player_preview", true) then + player_preview = mcl_player.get_player_formspec_model(player, 3.9, 1.4, 1.2333, 2.4666, "") + else + player_preview = "image[3.9,1.4;1.2333,2.4666;"..mcl_player.player_get_preview(player).."]" + end + + -- Background images for armor slots (hide if occupied) + local armor_slot_imgs = "" + local inv = player:get_inventory() + if inv:get_stack("armor", 2):is_empty() then + armor_slot_imgs = armor_slot_imgs .. "image[2.5,1.3;1,1;mcl_inventory_empty_armor_slot_helmet.png]" + end + if inv:get_stack("armor", 3):is_empty() then + armor_slot_imgs = armor_slot_imgs .. "image[2.5,2.75;1,1;mcl_inventory_empty_armor_slot_chestplate.png]" + end + if inv:get_stack("armor", 4):is_empty() then + armor_slot_imgs = armor_slot_imgs .. "image[5.5,1.3;1,1;mcl_inventory_empty_armor_slot_leggings.png]" + end + if inv:get_stack("armor", 5):is_empty() then + armor_slot_imgs = armor_slot_imgs .. "image[5.5,2.75;1,1;mcl_inventory_empty_armor_slot_boots.png]" + end + + -- Survival inventory slots + main_list = "list[current_player;main;0,3.75;9,3;9]".. + mcl_formspec.get_itemslot_bg(0,3.75,9,3).. + -- armor + "list[current_player;armor;2.5,1.3;1,1;1]".. + "list[current_player;armor;2.5,2.75;1,1;2]".. + "list[current_player;armor;5.5,1.3;1,1;3]".. + "list[current_player;armor;5.5,2.75;1,1;4]".. + mcl_formspec.get_itemslot_bg(2.5,1.3,1,1).. + mcl_formspec.get_itemslot_bg(2.5,2.75,1,1).. + mcl_formspec.get_itemslot_bg(5.5,1.3,1,1).. + mcl_formspec.get_itemslot_bg(5.5,2.75,1,1).. + armor_slot_imgs.. + -- player preview + player_preview.. + -- crafting guide button + "image_button[9,1;1,1;craftguide_book.png;__mcl_craftguide;]".. + "tooltip[__mcl_craftguide;"..F(S("Recipe book")).."]".. + -- help button + "image_button[9,2;1,1;doc_button_icon_lores.png;__mcl_doc;]".. + "tooltip[__mcl_doc;"..F(S("Help")).."]".. + -- skins button + "image_button[9,3;1,1;mcl_skins_button.png;__mcl_skins;]".. + "tooltip[__mcl_skins;"..F(S("Select player skin")).."]".. + -- achievements button + "image_button[9,4;1,1;mcl_achievements_button.png;__mcl_achievements;]".. + --"style_type[image_button;border=;bgimg=;bgimg_pressed=]".. + "tooltip[__mcl_achievements;"..F(S("Achievements")).."]" + + -- For shortcuts + listrings = listrings .. + "listring[detached:"..playername.."_armor;armor]".. + "listring[current_player;main]" + else + -- Creative inventory slots + main_list = "list[detached:creative_"..playername..";main;0,1.75;9,5;"..tostring(start_i).."]".. + mcl_formspec.get_itemslot_bg(0,1.75,9,5).. + -- Page buttons + "label[9.0,5.5;"..F(S("@1/@2", pagenum, pagemax)).."]".. + "image_button[9.0,6.0;0.7,0.7;crafting_creative_prev.png;creative_prev;]".. + "image_button[9.5,6.0;0.7,0.7;crafting_creative_next.png;creative_next;]" + end + + local tab_icon = { + blocks = "mcl_core:brick_block", + deco = "mcl_flowers:peony", + redstone = "mesecons:redstone", + rail = "mcl_minecarts:golden_rail", + misc = "mcl_buckets:bucket_lava", + nix = "mcl_compass:compass", + food = "mcl_core:apple", + tools = "mcl_core:axe_iron", + combat = "mcl_core:sword_gold", + mobs = "mobs_mc:cow", + brew = "mcl_potions:dragon_breath", + matr = "mcl_core:stick", + inv = "mcl_chests:chest", + } + local function tab(current_tab, this_tab) + local bg_img + if current_tab == this_tab then + bg_img = "crafting_creative_active"..hoch[this_tab]..".png" + else + bg_img = "crafting_creative_inactive"..hoch[this_tab]..".png" + end + return + "style["..this_tab..";border=false;bgimg=;bgimg_pressed=]".. + "item_image_button[" .. boffset[this_tab] ..";1,1;"..tab_icon[this_tab]..";"..this_tab..";]".. + "image[" .. offset[this_tab] .. ";1.5,1.44;" .. bg_img .. "]" + end + local caption = "" + if name ~= "inv" and filtername[name] then + caption = "label[0,1.2;"..F(minetest.colorize("#313131", filtername[name])).."]" + end + + local formspec = "size[10,9.3]".. + "no_prepend[]".. + mcl_vars.gui_nonbg..mcl_vars.gui_bg_color.. + "background[-0.19,-0.25;10.5,9.87;"..inv_bg.."]".. + "label[-5,-5;"..name.."]".. + tab(name, "blocks") .. + "tooltip[blocks;"..F(filtername["blocks"]).."]".. + tab(name, "deco") .. + "tooltip[deco;"..F(filtername["deco"]).."]".. + tab(name, "redstone") .. + "tooltip[redstone;"..F(filtername["redstone"]).."]".. + tab(name, "rail") .. + "tooltip[rail;"..F(filtername["rail"]).."]".. + tab(name, "misc") .. + "tooltip[misc;"..F(filtername["misc"]).."]".. + tab(name, "nix") .. + "tooltip[nix;"..F(filtername["nix"]).."]".. + caption.. + "list[current_player;main;0,7;9,1;]".. + mcl_formspec.get_itemslot_bg(0,7,9,1).. + main_list.. + tab(name, "food") .. + "tooltip[food;"..F(filtername["food"]).."]".. + tab(name, "tools") .. + "tooltip[tools;"..F(filtername["tools"]).."]".. + tab(name, "combat") .. + "tooltip[combat;"..F(filtername["combat"]).."]".. + tab(name, "mobs") .. + "tooltip[mobs;"..F(filtername["mobs"]).."]".. + tab(name, "brew") .. + "tooltip[brew;"..F(filtername["brew"]).."]".. + tab(name, "matr") .. + "tooltip[matr;"..F(filtername["matr"]).."]".. + tab(name, "inv") .. + "tooltip[inv;"..F(filtername["inv"]).."]".. + "list[detached:trash;main;9,7;1,1;]".. + mcl_formspec.get_itemslot_bg(9,7,1,1).. + "image[9,7;1,1;crafting_creative_trash.png]".. + listrings + + if name == "nix" then + if filter == nil then + filter = "" + end + formspec = formspec .. "field[5.3,1.34;4,0.75;search;;"..minetest.formspec_escape(filter).."]" + formspec = formspec .. "field_close_on_enter[search;false]" + end + if pagenum then formspec = formspec .. "p"..tostring(pagenum) end + player:set_inventory_formspec(formspec) +end + +minetest.register_on_player_receive_fields(function(player, formname, fields) + local page = nil + + if not minetest.is_creative_enabled(player:get_player_name()) then + return + end + if formname ~= "" or fields.quit == "true" then + -- No-op if formspec closed or not player inventory (formname == "") + return + end + + local name = player:get_player_name() + + if fields.blocks then + if players[name].page == "blocks" then return end + set_inv_page("blocks",player) + page = "blocks" + elseif fields.deco then + if players[name].page == "deco" then return end + set_inv_page("deco",player) + page = "deco" + elseif fields.redstone then + if players[name].page == "redstone" then return end + set_inv_page("redstone",player) + page = "redstone" + elseif fields.rail then + if players[name].page == "rail" then return end + set_inv_page("rail",player) + page = "rail" + elseif fields.misc then + if players[name].page == "misc" then return end + set_inv_page("misc",player) + page = "misc" + elseif fields.nix then + set_inv_page("all",player) + page = "nix" + elseif fields.food then + if players[name].page == "food" then return end + set_inv_page("food",player) + page = "food" + elseif fields.tools then + if players[name].page == "tools" then return end + set_inv_page("tools",player) + page = "tools" + elseif fields.combat then + if players[name].page == "combat" then return end + set_inv_page("combat",player) + page = "combat" + elseif fields.mobs then + if players[name].page == "mobs" then return end + set_inv_page("mobs",player) + page = "mobs" + elseif fields.brew then + if players[name].page == "brew" then return end + set_inv_page("brew",player) + page = "brew" + elseif fields.matr then + if players[name].page == "matr" then return end + set_inv_page("matr",player) + page = "matr" + elseif fields.inv then + if players[name].page == "inv" then return end + page = "inv" + elseif fields.search == "" and not fields.creative_next and not fields.creative_prev then + set_inv_page("all", player) + page = "nix" + elseif fields.search and not fields.creative_next and not fields.creative_prev then + set_inv_search(string.lower(fields.search),player) + page = "nix" + end + + if page then + players[name].page = page + end + if players[name].page then + page = players[name].page + end + + -- Figure out current scroll bar from formspec + --local formspec = player:get_inventory_formspec() + + local start_i = players[name].start_i + + if fields.creative_prev then + start_i = start_i - 9*5 + elseif fields.creative_next then + start_i = start_i + 9*5 + else + -- Reset scroll bar if not scrolled + start_i = 0 + end + if start_i < 0 then + start_i = start_i + 9*5 + end + + local inv_size + if page == "nix" then + local inv = minetest.get_inventory({type="detached", name="creative_"..name}) + inv_size = inv:get_size("main") + elseif page and page ~= "inv" then + inv_size = #(inventory_lists[page]) + else + inv_size = 0 + end + + if start_i >= inv_size then + start_i = start_i - 9*5 + end + if start_i < 0 or start_i >= inv_size then + start_i = 0 + end + players[name].start_i = start_i + + local filter = "" + if not fields.nix and fields.search and fields.search ~= "" then + filter = fields.search + players[name].filter = filter + end + + mcl_inventory.set_creative_formspec(player, start_i, start_i / (9*5) + 1, inv_size, false, page, filter) +end) + + +if minetest.is_creative_enabled("") then + minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack) + -- Place infinite nodes, except for shulker boxes + local group = minetest.get_item_group(itemstack:get_name(), "shulker_box") + return group == 0 or group == nil + end) + + function minetest.handle_node_drops(pos, drops, digger) + if not digger or not digger:is_player() then + for _,item in ipairs(drops) do + minetest.add_item(pos, item) + end + end + local inv = digger:get_inventory() + if inv then + for _,item in ipairs(drops) do + if not inv:contains_item("main", item, true) then + inv:add_item("main", item) + end + end + end + end + + mcl_inventory.update_inventory_formspec = function(player) + local page + + local name = player:get_player_name() + + if players[name].page then + page = players[name].page + else + page = "nix" + end + + -- Figure out current scroll bar from formspec + --local formspec = player:get_inventory_formspec() + local start_i = players[name].start_i + + local inv_size + if page == "nix" then + local inv = minetest.get_inventory({type="detached", name="creative_"..name}) + inv_size = inv:get_size("main") + elseif page and page ~= "inv" then + inv_size = #(inventory_lists[page]) + else + inv_size = 0 + end + + local filter = players[name].filter + if filter == nil then + filter = "" + end + + mcl_inventory.set_creative_formspec(player, start_i, start_i / (9*5) + 1, inv_size, false, page, filter) + end +end + +minetest.register_on_joinplayer(function(player) + -- Initialize variables and inventory + local name = player:get_player_name() + if not players[name] then + players[name] = {} + players[name].page = "nix" + players[name].filter = "" + players[name].start_i = 0 + end + init(player) + mcl_inventory.set_creative_formspec(player, 0, 1, nil, false, "nix", "") +end) From 28b73042114ae4a7f1077d41d1e0cff8d224be64 Mon Sep 17 00:00:00 2001 From: NO11 Date: Tue, 2 Nov 2021 22:55:49 +0100 Subject: [PATCH 065/116] Break minecart it's near a cactus (Fix #924) --- mods/ENTITIES/mcl_minecarts/init.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_minecarts/init.lua b/mods/ENTITIES/mcl_minecarts/init.lua index 4d3873cc2..119a13523 100644 --- a/mods/ENTITIES/mcl_minecarts/init.lua +++ b/mods/ENTITIES/mcl_minecarts/init.lua @@ -198,7 +198,20 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o else self._last_float_check = self._last_float_check + dtime end - local pos, rou_pos, node + + local pos, rou_pos, node = self.object:get_pos() + local r = 0.6 + for _, node_pos in pairs({{r, 0}, {0, r}, {-r, 0}, {0, -r}}) do + if minetest.get_node(vector.offset(pos, node_pos[1], 0, node_pos[2])).name == "mcl_core:cactus" then + detach_driver(self) + for d = 1, #drop do + minetest.add_item(pos, drop[d]) + end + self.object:remove() + return + end + end + -- Drop minecart if it isn't on a rail anymore if self._last_float_check >= mcl_minecarts.check_float_time then pos = self.object:get_pos() From db696d0e2b41e41c5859c0748a046144c3cf5981 Mon Sep 17 00:00:00 2001 From: Artem Arbatsky Date: Fri, 24 Sep 2021 16:50:54 +0500 Subject: [PATCH 066/116] Add missing call for on_die function --- mods/ENTITIES/mcl_mobs/api/mob_functions/death_logic.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/death_logic.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/death_logic.lua index 45e46d3db..03e6789ed 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/death_logic.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/death_logic.lua @@ -122,7 +122,10 @@ mobs.death_logic = function(self, dtime) if self.death_animation_timer >= 1.25 then item_drop(self,false,1) mobs.death_effect(self) - mcl_experience.throw_experience(self.object:get_pos(), math_random(self.xp_min, self.xp_max)) + mcl_experience.throw_experience(self.object:get_pos(), math_random(self.xp_min, self.xp_max)) + if self.on_die then + self.on_die(self, self.object:get_pos()) + end self.object:remove() return end @@ -155,4 +158,4 @@ mobs.death_logic = function(self, dtime) if self.pause_timer <= 0 then mobs.set_velocity(self,0) end -end \ No newline at end of file +end From 2607d40f1fcb4680f324aea4ad733fbe48a0fbfa Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Sat, 17 Jul 2021 07:23:20 +0200 Subject: [PATCH 067/116] Add script to show packets count from debug logs Mineclonia has inherited mods from MineClone 2 that send a lot of network packets. This behaviour wastes bandwith and is most likely a major reason for the unusually high amount of lag that MineClone2 and Mineclonia have. Many network packets that are sent by Mineclonia are entirely useless. Analyzing minetest log files to figure out what kind of packets are sent and how often is a first step in getting rid of useless traffic. --- tools/analyze-packet-spam | 60 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100755 tools/analyze-packet-spam diff --git a/tools/analyze-packet-spam b/tools/analyze-packet-spam new file mode 100755 index 000000000..310616fd9 --- /dev/null +++ b/tools/analyze-packet-spam @@ -0,0 +1,60 @@ +#!/bin/sh -eu +# analyze-packet-spam – show minetest client packet count per second +# Copyright © 2021 Nils Dagsson Moskopp (erlehmann) + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# Dieses Programm hat das Ziel, die Medienkompetenz der Leser zu +# steigern. Gelegentlich packe ich sogar einen handfesten Buffer +# Overflow oder eine Format String Vulnerability zwischen die anderen +# Codezeilen und schreibe das auch nicht dran. + +# This script takes a minetest log with at least INFO log level and +# outputs the MINETEST network protocol packet count per second. + +# To collect such a log file of minetest running for 10 minutes, run: +# timeout 600 minetest --info >log.txt 2>&1 >/dev/null + +# To get packet counts from that file, run: +# ./analyze-packet-spam "${TEMPFILE}" + +TIMESTAMP_START=$( <"${TEMPFILE}" head -n1 |cut -d' ' -f1 ) +TIMESTAMP_END=$( <"${TEMPFILE}" tail -n1 |cut -d' ' -f1 ) +DURATION=$(( 30 + ${TIMESTAMP_END} - ${TIMESTAMP_START} )) + +PACKET_NAME_SEEN='' +<"${TEMPFILE}" tac \ + |while read _ PACKET_NAME PACKET_COUNT; do + case "${PACKET_NAME_SEEN}" in + *"${PACKET_NAME}"*) + ;; + *) + PACKET_COUNT_PER_SECOND=$( + printf '1k %s %s /p' "${PACKET_COUNT}" "${DURATION}" \ + |dc + ) + printf '%s\t%s\n' "${PACKET_COUNT_PER_SECOND}" "${PACKET_NAME}" + PACKET_NAME_SEEN="${PACKET_NAME_SEEN} ${PACKET_NAME}" + ;; + esac + done + +unlink "${TEMPFILE}" From 148575a05b8d0204155e0d5ce4cf1dcd45490f19 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 3 Nov 2021 16:28:13 +0100 Subject: [PATCH 068/116] Remove unused hud_manager.hud_exists function --- mods/HUD/mcl_experience/init.lua | 9 --------- 1 file changed, 9 deletions(-) diff --git a/mods/HUD/mcl_experience/init.lua b/mods/HUD/mcl_experience/init.lua index e514ffc19..b7175ccfb 100644 --- a/mods/HUD/mcl_experience/init.lua +++ b/mods/HUD/mcl_experience/init.lua @@ -116,15 +116,6 @@ function hud_manager.change_hud(data) end end --- gets if hud exists -function hud_manager.hud_exists(player,hud_name) - local name = player:get_player_name() - if player_huds[name] and player_huds[name][hud_name] then - return true - else - return false - end -end ------------------- -- saves specific users data for when they relog From a4e73886d566d2718ed6700731dd57198faa5744 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 3 Nov 2021 19:36:57 +0100 Subject: [PATCH 069/116] Rework XP API --- mods/ENTITIES/mcl_item_entity/init.lua | 4 +- .../api/mob_functions/death_logic.lua | 4 +- mods/ENTITIES/mobs_mc/ender_dragon.lua | 2 +- mods/HUD/mcl_experience/bottle.lua | 63 ++ mods/HUD/mcl_experience/command.lua | 39 + mods/HUD/mcl_experience/init.lua | 723 ++++-------------- mods/HUD/mcl_experience/orb.lua | 220 ++++++ .../{experience.ogg => mcl_experience.ogg} | Bin ...vel_up.ogg => mcl_experience_level_up.ogg} | Bin ...erience_bar.png => mcl_experience_bar.png} | Bin ....png => mcl_experience_bar_background.png} | Bin ...erience_orb.png => mcl_experience_orb.png} | Bin mods/ITEMS/mcl_enchanting/enchantments.lua | 43 ++ mods/ITEMS/mcl_enchanting/engine.lua | 6 +- mods/ITEMS/mcl_fishing/init.lua | 6 +- mods/ITEMS/mcl_furnaces/init.lua | 4 +- mods/ITEMS/mcl_mobspawners/init.lua | 2 +- 17 files changed, 538 insertions(+), 578 deletions(-) create mode 100644 mods/HUD/mcl_experience/bottle.lua create mode 100644 mods/HUD/mcl_experience/command.lua create mode 100644 mods/HUD/mcl_experience/orb.lua rename mods/HUD/mcl_experience/sounds/{experience.ogg => mcl_experience.ogg} (100%) rename mods/HUD/mcl_experience/sounds/{level_up.ogg => mcl_experience_level_up.ogg} (100%) rename mods/HUD/mcl_experience/textures/{experience_bar.png => mcl_experience_bar.png} (100%) rename mods/HUD/mcl_experience/textures/{experience_bar_background.png => mcl_experience_bar_background.png} (100%) rename mods/HUD/mcl_experience/textures/{experience_orb.png => mcl_experience_orb.png} (100%) diff --git a/mods/ENTITIES/mcl_item_entity/init.lua b/mods/ENTITIES/mcl_item_entity/init.lua index cfd141f04..678f8e2b7 100644 --- a/mods/ENTITIES/mcl_item_entity/init.lua +++ b/mods/ENTITIES/mcl_item_entity/init.lua @@ -290,10 +290,10 @@ function minetest.handle_node_drops(pos, drops, digger) end end - if digger and mcl_experience.throw_experience and not silk_touch_drop then + if digger and mcl_experience.throw_xp and not silk_touch_drop then local experience_amount = minetest.get_item_group(dug_node.name,"xp") if experience_amount > 0 then - mcl_experience.throw_experience(pos, experience_amount) + mcl_experience.throw_xp(pos, experience_amount) end end diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/death_logic.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/death_logic.lua index 45e46d3db..27d0030ea 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/death_logic.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/death_logic.lua @@ -122,7 +122,7 @@ mobs.death_logic = function(self, dtime) if self.death_animation_timer >= 1.25 then item_drop(self,false,1) mobs.death_effect(self) - mcl_experience.throw_experience(self.object:get_pos(), math_random(self.xp_min, self.xp_max)) + mcl_experience.throw_xp(self.object:get_pos(), math_random(self.xp_min, self.xp_max)) self.object:remove() return end @@ -155,4 +155,4 @@ mobs.death_logic = function(self, dtime) if self.pause_timer <= 0 then mobs.set_velocity(self,0) end -end \ No newline at end of file +end diff --git a/mods/ENTITIES/mobs_mc/ender_dragon.lua b/mods/ENTITIES/mobs_mc/ender_dragon.lua index bafb3f84a..3634e20f4 100644 --- a/mods/ENTITIES/mobs_mc/ender_dragon.lua +++ b/mods/ENTITIES/mobs_mc/ender_dragon.lua @@ -103,7 +103,7 @@ mobs:register_mob("mobs_mc:enderdragon", { mcl_portals.spawn_gateway_portal() mcl_structures.call_struct(self._portal_pos, "end_exit_portal_open") if self._initial then - mcl_experience.throw_experience(pos, 11500) -- 500 + 11500 = 12000 + mcl_experience.throw_xp(pos, 11500) -- 500 + 11500 = 12000 minetest.set_node(vector.add(self._portal_pos, vector.new(3, 5, 3)), {name = mobs_mc.items.dragon_egg}) end end diff --git a/mods/HUD/mcl_experience/bottle.lua b/mods/HUD/mcl_experience/bottle.lua new file mode 100644 index 000000000..10e42a57d --- /dev/null +++ b/mods/HUD/mcl_experience/bottle.lua @@ -0,0 +1,63 @@ +local S = minetest.get_translator(minetest.get_current_modname()) + +minetest.register_entity("mcl_experience:bottle",{ + textures = {"mcl_experience_bottle.png"}, + hp_max = 1, + visual_size = {x = 0.35, y = 0.35}, + collisionbox = {-0.1, -0.1, -0.1, 0.1, 0.1, 0.1}, + pointable = false, + on_step = function(self, dtime) + local pos = self.object:get_pos() + local node = minetest.get_node(pos) + local n = node.name + if n ~= "air" and n ~= "mcl_portals:portal" and n ~= "mcl_portals:portal_end" and minetest.get_item_group(n, "liquid") == 0 then + minetest.sound_play("mcl_potions_breaking_glass", {pos = pos, max_hear_distance = 16, gain = 1}) + mcl_experience.throw_xp(pos, math.random(3, 11)) + minetest.add_particlespawner({ + amount = 50, + time = 0.1, + minpos = vector.add(pos, vector.new(-0.1, 0.5, -0.1)), + maxpos = vector.add(pos, vector.new( 0.1, 0.6, 0.1)), + minvel = vector.new(-2, 0, -2), + maxvel = vector.new( 2, 2, 2), + minacc = vector.new(0, 0, 0), + maxacc = vector.new(0, 0, 0), + minexptime = 0.5, + maxexptime = 1.25, + minsize = 1, + maxsize = 2, + collisiondetection = true, + vertical = false, + texture = "mcl_particles_effect.png^[colorize:blue:127", + }) + self.object:remove() + end + end, +}) + +local function throw_xp_bottle(pos, dir, velocity) + minetest.sound_play("mcl_throwing_throw", {pos = pos, gain = 0.4, max_hear_distance = 16}, true) + local obj = minetest.add_entity(pos, "mcl_experience:bottle") + obj:set_velocity(vector.multiply(dir, velocity)) + local acceleration = vector.multiply(dir, -3) + acceleration.y = -9.81 + obj:set_acceleration(acceleration) +end + +minetest.register_craftitem("mcl_experience:bottle", { + description = "Bottle o' Enchanting", + inventory_image = "mcl_experience_bottle.png", + wield_image = "mcl_experience_bottle.png", + stack_max = 64, + on_use = function(itemstack, placer, pointed_thing) + throw_xp_bottle(vector.add(placer:get_pos(), vector.new(0, 1.5, 0)), placer:get_look_dir(), 10) + if not minetest.is_creative_enabled(placer:get_player_name()) then + itemstack:take_item() + end + return itemstack + end, + _on_dispense = function(_, pos, _, _, dir) + throw_xp_bottle(vector.add(pos, vector.multiply(dir, 0.51)), dir, 10) + end +}) + diff --git a/mods/HUD/mcl_experience/command.lua b/mods/HUD/mcl_experience/command.lua new file mode 100644 index 000000000..040031b5a --- /dev/null +++ b/mods/HUD/mcl_experience/command.lua @@ -0,0 +1,39 @@ +local S = minetest.get_translator(minetest.get_current_modname()) + +minetest.register_chatcommand("xp", { + params = S("[[] ]"), + description = S("Gives a player some XP"), + privs = {server=true}, + func = function(name, params) + local player, xp = nil, 1000 + local P, i = {}, 0 + for str in string.gmatch(params, "([^ ]+)") do + i = i + 1 + P[i] = str + end + if i > 2 then + return false, S("Error: Too many parameters!") + end + if i > 0 then + xp = tonumber(P[i]) + end + if i < 2 then + player = minetest.get_player_by_name(name) + end + if i == 2 then + player = minetest.get_player_by_name(P[1]) + end + + if not xp then + return false, S("Error: Incorrect value of XP") + end + + if not player then + return false, S("Error: Player not found") + end + + mcl_experience.add_xp(player, xp) + + return true, S("Added @1 XP to @2, total: @3, experience level: @4", tostring(xp), player:get_player_name(), tostring(mcl_experience.get_xp(player)), tostring(mcl_experience.get_level(player))) + end, +}) diff --git a/mods/HUD/mcl_experience/init.lua b/mods/HUD/mcl_experience/init.lua index b7175ccfb..aea805fa2 100644 --- a/mods/HUD/mcl_experience/init.lua +++ b/mods/HUD/mcl_experience/init.lua @@ -1,632 +1,227 @@ -local S = minetest.get_translator(minetest.get_current_modname()) - -mcl_experience = {} - -local vector = vector -local math = math -local string = string - -local pool = {} -local registered_nodes -local max_xp = 2^31-1 -local max_orb_age = 300 -- seconds - -local gravity = {x = 0, y = -((tonumber(minetest.settings:get("movement_gravity"))) or 9.81), z = 0} -local size_min, size_max = 20, 59 -- percents -local delta_size = size_max - size_min -local size_to_xp = { - {-32768, 2}, -- 1 - { 3, 6}, -- 2 - { 7, 16}, -- 3 - { 17, 36}, -- 4 - { 37, 72}, -- 5 - { 73, 148}, -- 6 - { 149, 306}, -- 7 - { 307, 616}, -- 8 - { 617, 1236}, -- 9 - { 1237, 2476}, --10 - { 2477, 32767} --11 +mcl_experience = { + on_add_xp = {}, } -local function xp_to_size(xp) - local i, l = 1, #size_to_xp - while (xp > size_to_xp[i][1]) and (i < l) do - i = i + 1 - end - return ((i-1) / (l-1) * delta_size + size_min)/100 -end +local modpath = minetest.get_modpath(minetest.get_current_modname()) -minetest.register_on_mods_loaded(function() - registered_nodes = minetest.registered_nodes -end) +dofile(modpath .. "/command.lua") +dofile(modpath .. "/orb.lua") +dofile(modpath .. "/bottle.lua") -local function load_data(player) - local name = player:get_player_name() - pool[name] = {} - local temp_pool = pool[name] - local meta = player:get_meta() - temp_pool.xp = meta:get_int("xp") or 0 - temp_pool.level = mcl_experience.xp_to_level(temp_pool.xp) - temp_pool.bar, temp_pool.bar_step, temp_pool.xp_next_level = mcl_experience.xp_to_bar(temp_pool.xp, temp_pool.level) - temp_pool.last_time= minetest.get_us_time()/1000000 -end +-- local storage --- saves data to be utilized on next login -local function save_data(player) - local name = player:get_player_name() - local temp_pool = pool[name] - local meta = player:get_meta() - meta:set_int("xp", temp_pool.xp) - pool[name] = nil -end +local hud_bars = {} +local hud_levels = {} +local caches = {} -local player_huds = {} -- the list of players hud lists (3d array) -hud_manager = {} -- hud manager class +-- helpers --- terminate the player's list on leave -minetest.register_on_leaveplayer(function(player) - local name = player:get_player_name() - player_huds[name] = nil -end) - --- create instance of new hud -function hud_manager.add_hud(player,hud_name,def) - local name = player:get_player_name() - if minetest.is_creative_enabled(name) then - return - end - local local_hud = player:hud_add({ - hud_elem_type = def.hud_elem_type, - position = def.position, - text = def.text, - text2 = def.text2, - number = def.number, - item = def.item, - direction = def.direction, - size = def.size, - offset = def.offset, - z_index = def.z_index, - alignment = def.alignment, - scale = def.scale, - }) - -- create new 3d array here - -- depends.txt is not needed - -- with it here - if not player_huds[name] then - player_huds[name] = {} - end - - player_huds[name][hud_name] = local_hud -end - --- delete instance of hud -function hud_manager.remove_hud(player,hud_name) - local name = player:get_player_name() - if player_huds[name] and player_huds[name][hud_name] then - player:hud_remove(player_huds[name][hud_name]) - player_huds[name][hud_name] = nil - end -end - --- change element of hud -function hud_manager.change_hud(data) - local name = data.player:get_player_name() - if player_huds[name] and player_huds[name][data.hud_name] then - data.player:hud_change(player_huds[name][data.hud_name], data.element, data.data) - end -end - -------------------- - --- saves specific users data for when they relog -minetest.register_on_leaveplayer(function(player) - save_data(player) -end) - --- is used for shutdowns to save all data -local function save_all() - for name,_ in pairs(pool) do - local player = minetest.get_player_by_name(name) - if player then - save_data(player) - end - end -end - --- save all data to mod storage on shutdown -minetest.register_on_shutdown(function() - save_all() -end) - - -function mcl_experience.get_player_xp_level(player) - local name = player:get_player_name() - return pool[name].level -end - -function mcl_experience.set_player_xp_level(player,level) - local name = player:get_player_name() - if level == pool[name].level then - return - end - pool[name].level = level - pool[name].xp, pool[name].bar_step, pool[name].xp_next_level = mcl_experience.bar_to_xp(pool[name].bar, level) - hud_manager.change_hud({player = player, hud_name = "xp_level", element = "text", data = tostring(level)}) - -- we may don't update the bar -end - -local name -local temp_pool -minetest.register_on_joinplayer(function(player) - - load_data(player) - - name = player:get_player_name() - temp_pool = pool[name] - - hud_manager.add_hud(player,"experience_bar", - { - hud_elem_type = "image", - name = "experience bar", - text = "experience_bar_background.png^[lowpart:" .. math.floor(temp_pool.bar / 36 * 100) .. ":experience_bar.png^[transformR270", - position = {x=0.5, y=1}, - offset = {x = (-9 * 28) - 3, y = -(48 + 24 + 16 - 5)}, - scale = {x = 2.8, y = 3.0}, - alignment = { x = 1, y = 1 }, - z_index = 11, - }) - - hud_manager.add_hud(player,"xp_level", - { - hud_elem_type = "text", position = {x=0.5, y=1}, - name = "xp_level", text = tostring(temp_pool.level), - number = 0x80FF20, - offset = {x = 0, y = -(48 + 24 + 24)}, - z_index = 12, - }) -end) - -function mcl_experience.xp_to_level(xp) +local function xp_to_level(xp) local xp = xp or 0 local a, b, c, D + if xp > 1507 then - a, b, c = 4.5, -162.5, 2220-xp + a, b, c = 4.5, -162.5, 2220 - xp elseif xp > 352 then - a, b, c = 2.5, -40.5, 360-xp + a, b, c = 2.5, -40.5, 360 - xp else a, b, c = 1, 6, -xp end - D = b*b-4*a*c + + D = b * b - 4 * a * c + if D == 0 then - return math.floor(-b/2/a) - elseif D > 0 then - local v1, v2 = -b/2/a, math.sqrt(D)/2/a - return math.floor((math.max(v1-v2, v1+v2))) + return math.floor(-b / 2 / a) + elseif D > 0 then + local v1, v2 = -b / 2 / a, math.sqrt(D) / 2 / a + return math.floor(math.max(v1 - v2, v1 + v2)) end + return 0 end -function mcl_experience.level_to_xp(level) - if (level >= 1 and level <= 16) then +local function level_to_xp(level) + if level >= 1 and level <= 16 then return math.floor(math.pow(level, 2) + 6 * level) - elseif (level >= 17 and level <= 31) then + elseif level >= 17 and level <= 31 then return math.floor(2.5 * math.pow(level, 2) - 40.5 * level + 360) elseif level >= 32 then - return math.floor(4.5 * math.pow(level, 2) - 162.5 * level + 2220); + return math.floor(4.5 * math.pow(level, 2) - 162.5 * level + 2220) end + return 0 end -function mcl_experience.xp_to_bar(xp, level) - local level = level or mcl_experience.xp_to_level(xp) - local xp_this_level = mcl_experience.level_to_xp(level) - local xp_next_level = mcl_experience.level_to_xp(level+1) - local bar_step = 36 / (xp_next_level-xp_this_level) - local bar = (xp-xp_this_level) * bar_step - return bar, bar_step, xp_next_level +local function calculate_bounds(level) + return level_to_xp(level), level_to_xp(level + 1) end -function mcl_experience.bar_to_xp(bar, level) - local xp_this_level = mcl_experience.level_to_xp(level) - local xp_next_level = mcl_experience.level_to_xp(level+1) - local bar_step = 36 / (xp_next_level-xp_this_level) - local xp = xp_this_level + math.floor(bar/36*(xp_next_level-xp_this_level)) - return xp, bar_step, xp_next_level +local function xp_to_bar(xp, level) + local xp_min, xp_max = calculate_bounds(level) + + return (xp - xp_min) / (xp_max - xp_min) end -function mcl_experience.add_experience(player, experience) - local name = player:get_player_name() - local temp_pool = pool[name] +local function bar_to_xp(bar, level) + local xp_min, xp_max = calculate_bounds(level) - local inv = player:get_inventory() - local candidates = { - {list = "main", index = player:get_wield_index()}, - {list = "armor", index = 2}, - {list = "armor", index = 3}, - {list = "armor", index = 4}, - {list = "armor", index = 5}, - } - local final_candidates = {} - for _, can in ipairs(candidates) do - local stack = inv:get_stack(can.list, can.index) - local wear = stack:get_wear() - if mcl_enchanting.has_enchantment(stack, "mending") and wear > 0 then - can.stack = stack - can.wear = wear - table.insert(final_candidates, can) - end - end - if #final_candidates > 0 then - local can = final_candidates[math.random(#final_candidates)] - local stack, list, index, wear = can.stack, can.list, can.index, can.wear - local uses = mcl_util.calculate_durability(stack) - local multiplier = 2 * 65535 / uses - local repair = experience * multiplier - local new_wear = wear - repair - if new_wear < 0 then - experience = math.floor(-new_wear / multiplier + 0.5) - new_wear = 0 - else - experience = 0 - end - stack:set_wear(math.floor(new_wear)) - inv:set_stack(list, index, stack) - end + return xp_min + bar * (xp_max - xp_min) +end - local old_bar, old_xp, old_level = temp_pool.bar, temp_pool.xp, temp_pool.level - temp_pool.xp = math.min(math.max(temp_pool.xp + experience, 0), max_xp) +local function get_time() + return minetest.get_us_time() / 1000000 +end - if (temp_pool.xp < temp_pool.xp_next_level) and (temp_pool.xp >= old_xp) then - temp_pool.bar = temp_pool.bar + temp_pool.bar_step * experience - else - temp_pool.level = mcl_experience.xp_to_level(temp_pool.xp) - temp_pool.bar, temp_pool.bar_step, temp_pool.xp_next_level = mcl_experience.xp_to_bar(temp_pool.xp, temp_pool.level) - end +-- api - if old_bar ~= temp_pool.bar then - hud_manager.change_hud({player = player, hud_name = "experience_bar", element = "text", data = "experience_bar_background.png^[lowpart:" .. math.floor(temp_pool.bar / 36 * 100) .. ":experience_bar.png^[transformR270",}) - end +function mcl_experience.get_level(player) + return caches[player].level +end - if experience > 0 and minetest.get_us_time()/1000000 - temp_pool.last_time > 0.01 then - if old_level ~= temp_pool.level then - minetest.sound_play("level_up",{gain=0.2,to_player = name}) - temp_pool.last_time = minetest.get_us_time()/1000000 + 0.2 - else - minetest.sound_play("experience",{gain=0.1,to_player = name,pitch=math.random(75,99)/100}) - temp_pool.last_time = minetest.get_us_time()/1000000 - end - end +function mcl_experience.set_level(player, level) + local cache = caches[player] - if old_level ~= temp_pool.level then - hud_manager.change_hud({player = player, hud_name = "xp_level", element = "text", data = tostring(temp_pool.level)}) + if level ~= cache.level then + mcl_experience.set_xp(player, math.floor(bar_to_xp(xp_to_bar(mcl_experience.get_xp(player), cache.level), level))) end end ---reset player level -local name -local temp_pool -local xp_amount -minetest.register_on_dieplayer(function(player) - if minetest.settings:get_bool("mcl_keepInventory", false) then - return - end +function mcl_experience.get_xp(player) + return player:get_meta():get_int("xp") +end - name = player:get_player_name() - temp_pool = pool[name] - xp_amount = temp_pool.xp +function mcl_experience.set_xp(player, xp) + player:get_meta():set_int("xp", xp) - temp_pool.xp = 0 - temp_pool.level = 0 - temp_pool.bar, temp_pool.bar_step, temp_pool.xp_next_level = mcl_experience.xp_to_bar(temp_pool.xp, temp_pool.level) + mcl_experience.update(player) +end - hud_manager.change_hud({player = player, hud_name = "xp_level", element = "text", data = tostring(temp_pool.level)}) - hud_manager.change_hud({player = player, hud_name = "experience_bar", element = "text", data = "experience_bar_background.png^[lowpart:" .. math.floor(temp_pool.bar / 36 * 100) .. ":experience_bar.png^[transformR270",}) +function mcl_experience.add_xp(player, xp) + for _, cb in ipairs(mcl_experience.on_add_xp) do + xp = cb.func(player, xp) or xp - mcl_experience.throw_experience(player:get_pos(), xp_amount) -end) - -local collector, pos, pos2 -local direction, distance, player_velocity, goal -local currentvel, acceleration, multiplier, velocity -local node, vel, def -local is_moving, is_slippery, slippery, slip_factor -local size -local function xp_step(self, dtime) - --if item set to be collected then only execute go to player - if self.collected == true then - if not self.collector then - self.collected = false - return - end - collector = minetest.get_player_by_name(self.collector) - if collector and collector:get_hp() > 0 and vector.distance(self.object:get_pos(),collector:get_pos()) < 7.25 then - self.object:set_acceleration(vector.new(0,0,0)) - self.disable_physics(self) - --get the variables - pos = self.object:get_pos() - pos2 = collector:get_pos() - - player_velocity = collector:get_velocity() or collector:get_player_velocity() - - pos2.y = pos2.y + 0.8 - - direction = vector.direction(pos,pos2) - distance = vector.distance(pos2,pos) - multiplier = distance - if multiplier < 1 then - multiplier = 1 - end - goal = vector.multiply(direction,multiplier) - currentvel = self.object:get_velocity() - - if distance > 1 then - multiplier = 20 - distance - velocity = vector.multiply(direction,multiplier) - goal = velocity - acceleration = vector.new(goal.x-currentvel.x,goal.y-currentvel.y,goal.z-currentvel.z) - self.object:add_velocity(vector.add(acceleration,player_velocity)) - elseif distance < 0.8 then - mcl_experience.add_experience(collector, self._xp) - self.object:remove() - end - return - else - self.collector = nil - self.enable_physics(self) + if xp == 0 then + break end end + local cache = caches[player] + local old_level = cache.level - self.age = self.age + dtime - if self.age > max_orb_age then - self.object:remove() - return - end + mcl_experience.set_xp(player, mcl_experience.get_xp(player) + xp) - pos = self.object:get_pos() + local current_time = get_time() - if pos then - node = minetest.get_node_or_nil({ - x = pos.x, - y = pos.y -0.25, - z = pos.z - }) - else - return - end + if current_time - cache.last_time > 0.01 then + local name = player:get_player_name() - -- Remove nodes in 'ignore' - if node and node.name == "ignore" then - self.object:remove() - return - end - - if not self.physical_state then - return -- Don't do anything - end - - -- Slide on slippery nodes - vel = self.object:get_velocity() - def = node and registered_nodes[node.name] - is_moving = (def and not def.walkable) or - vel.x ~= 0 or vel.y ~= 0 or vel.z ~= 0 - is_slippery = false - - if def and def.walkable then - slippery = minetest.get_item_group(node.name, "slippery") - is_slippery = slippery ~= 0 - if is_slippery and (math.abs(vel.x) > 0.2 or math.abs(vel.z) > 0.2) then - -- Horizontal deceleration - slip_factor = 4.0 / (slippery + 4) - self.object:set_acceleration({ - x = -vel.x * slip_factor, - y = 0, - z = -vel.z * slip_factor + if old_level == cache.level then + minetest.sound_play("mcl_experience", { + to_player = name, + gain = 0.1, + pitch = math.random(75, 99) / 100, }) - elseif vel.y == 0 then - is_moving = false + + cache.last_time = current_time + else + minetest.sound_play("mcl_experience_level_up", { + to_player = name, + gain = 0.2, + }) + + cache.last_time = current_time + 0.2 end end - - if self.moving_state == is_moving and self.slippery_state == is_slippery then - -- Do not update anything until the moving state changes - return - end - - self.moving_state = is_moving - self.slippery_state = is_slippery - - if is_moving then - self.object:set_acceleration(gravity) - else - self.object:set_acceleration({x = 0, y = 0, z = 0}) - self.object:set_velocity({x = 0, y = 0, z = 0}) - end end -minetest.register_entity("mcl_experience:orb", { - initial_properties = { - hp_max = 1, - physical = true, - collide_with_objects = false, - collisionbox = {-0.2, -0.2, -0.2, 0.2, 0.2, 0.2}, - visual = "sprite", - visual_size = {x = 0.4, y = 0.4}, - textures = {name="experience_orb.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0}}, - spritediv = {x = 1, y = 14}, - initial_sprite_basepos = {x = 0, y = 0}, - is_visible = true, - pointable = false, - static_save = false, - }, - moving_state = true, - slippery_state = false, - physical_state = true, - -- Item expiry - age = 0, - -- Pushing item out of solid nodes - force_out = nil, - force_out_start = nil, - --Collection Variables - collectable = false, - try_timer = 0, - collected = false, - delete_timer = 0, - radius = 4, - - - on_activate = function(self, staticdata, dtime_s) - self.object:set_velocity(vector.new( - math.random(-2,2)*math.random(), - math.random(2,5), - math.random(-2,2)*math.random() - )) - self.object:set_armor_groups({immortal = 1}) - self.object:set_velocity({x = 0, y = 2, z = 0}) - self.object:set_acceleration(gravity) - local xp = tonumber(staticdata) - self._xp = xp - size = xp_to_size(xp) - self.object:set_properties({ - visual_size = {x = size, y = size}, - glow = 14, - }) - self.object:set_sprite({x=1,y=math.random(1,14)}, 14, 0.05, false) - end, - - enable_physics = function(self) - if not self.physical_state then - self.physical_state = true - self.object:set_properties({physical = true}) - self.object:set_velocity({x=0, y=0, z=0}) - self.object:set_acceleration(gravity) - end - end, - - disable_physics = function(self) - if self.physical_state then - self.physical_state = false - self.object:set_properties({physical = false}) - self.object:set_velocity({x=0, y=0, z=0}) - self.object:set_acceleration({x=0, y=0, z=0}) - end - end, - on_step = function(self, dtime) - xp_step(self, dtime) - end, -}) - -minetest.register_chatcommand("xp", { - params = S("[[] ]"), - description = S("Gives a player some XP"), - privs = {server=true}, - func = function(name, params) - local player, xp = nil, 1000 - local P, i = {}, 0 - for str in string.gmatch(params, "([^ ]+)") do - i = i + 1 - P[i] = str - end - if i > 2 then - return false, S("Error: Too many parameters!") - end - if i > 0 then - xp = tonumber(P[i]) - end - if i < 2 then - player = minetest.get_player_by_name(name) - end - if i == 2 then - player = minetest.get_player_by_name(P[1]) - end - if not xp then - return false, S("Error: Incorrect value of XP") - end - if not player then - return false, S("Error: Player not found") - end - mcl_experience.add_experience(player, xp) - local playername = player:get_player_name() - minetest.chat_send_player(name, S("Added @1 XP to @2, total: @3, experience level: @4", tostring(xp), playername, tostring(pool[playername].xp), tostring(pool[playername].level))) - end, -}) - -function mcl_experience.throw_experience(pos, amount) +function mcl_experience.throw_xp(pos, total_xp) local i, j = 0, 0 - local obj, xp - while i < amount and j < 100 do - xp = math.min(math.random(1, math.min(32767, amount-math.floor(i/2))), amount-i) - obj = minetest.add_entity(pos, "mcl_experience:orb", tostring(xp)) + + while i < total_xp and j < 100 do + local xp = math.min(math.random(1, math.min(32767, total_xp - math.floor(i / 2))), total_xp - i) + local obj = minetest.add_entity(pos, "mcl_experience:orb", tostring(xp)) + if not obj then return false end - obj:set_velocity({ - x=math.random(-2,2)*math.random(), - y=math.random(2,5), - z=math.random(-2,2)*math.random() - }) + + obj:set_velocity(vector.new( + math.random(-2, 2) * math.random(), + math.random( 2, 5), + math.random(-2, 2) * math.random() + )) + i = i + xp j = j + 1 end end -minetest.register_entity("mcl_experience:bottle",{ - textures = {"mcl_experience_bottle.png"}, - hp_max = 1, - visual_size = {x = 0.35, y = 0.35}, - collisionbox = {-0.1, -0.1, -0.1, 0.1, 0.1, 0.1}, - pointable = false, - on_step = function(self, dtime) - local pos = self.object:get_pos() - local node = minetest.get_node(pos) - local n = node.name - if n ~= "air" and n ~= "mcl_portals:portal" and n ~= "mcl_portals:portal_end" and minetest.get_item_group(n, "liquid") == 0 then - minetest.sound_play("mcl_potions_breaking_glass", {pos = pos, max_hear_distance = 16, gain = 1}) - mcl_experience.throw_experience(pos, math.random(3, 11)) - minetest.add_particlespawner({ - amount = 50, - time = 0.1, - minpos = vector.add(pos, vector.new(-0.1, 0.5, -0.1)), - maxpos = vector.add(pos, vector.new( 0.1, 0.6, 0.1)), - minvel = vector.new(-2, 0, -2), - maxvel = vector.new( 2, 2, 2), - minacc = vector.new(0, 0, 0), - maxacc = vector.new(0, 0, 0), - minexptime = 0.5, - maxexptime = 1.25, - minsize = 1, - maxsize = 2, - collisiondetection = true, - vertical = false, - texture = "mcl_particles_effect.png^[colorize:blue:127", - }) - self.object:remove() - end - end, -}) +function mcl_experience.update(player) + local xp = mcl_experience.get_xp(player) + local cache = caches[player] -local function throw_xp_bottle(pos, dir, velocity) - minetest.sound_play("mcl_throwing_throw", {pos = pos, gain = 0.4, max_hear_distance = 16}, true) - local obj = minetest.add_entity(pos, "mcl_experience:bottle") - obj:set_velocity(vector.multiply(dir, velocity)) - local acceleration = vector.multiply(dir, -3) - acceleration.y = -9.81 - obj:set_acceleration(acceleration) + cache.level = xp_to_level(xp) + + if not minetest.is_creative_enabled(player:get_player_name()) then + player:hud_change(hud_bars[player], "text", "mcl_experience_bar_background.png^[lowpart:" + .. math.floor(math.floor(xp_to_bar(xp, cache.level) * 18) / 18 * 100) + .. ":mcl_experience_bar.png^[transformR270" + ) + + if cache.level == 0 then + player:hud_change(hud_levels[player], "text", "") + else + player:hud_change(hud_levels[player], "text", tostring(cache.level)) + end + end end -minetest.register_craftitem("mcl_experience:bottle", { - description = "Bottle o' Enchanting", - inventory_image = "mcl_experience_bottle.png", - wield_image = "mcl_experience_bottle.png", - stack_max = 64, - on_use = function(itemstack, placer, pointed_thing) - throw_xp_bottle(vector.add(placer:get_pos(), vector.new(0, 1.5, 0)), placer:get_look_dir(), 10) - if not minetest.is_creative_enabled(placer:get_player_name()) then - itemstack:take_item() - end - return itemstack - end, - _on_dispense = function(_, pos, _, _, dir) - throw_xp_bottle(vector.add(pos, vector.multiply(dir, 0.51)), dir, 10) +function mcl_experience.register_on_add_xp(func, priority) + table.insert(mcl_experience.on_add_xp, {func = func, priority = priority or 0}) +end + +-- callbacks + +minetest.register_on_joinplayer(function(player) + caches[player] = { + last_time = get_time(), + } + + if not minetest.is_creative_enabled(player:get_player_name()) then + hud_bars[player] = player:hud_add({ + hud_elem_type = "image", + position = {x = 0.5, y = 1}, + offset = {x = (-9 * 28) - 3, y = -(48 + 24 + 16 - 5)}, + scale = {x = 2.8, y = 3.0}, + alignment = {x = 1, y = 1}, + z_index = 11, + }) + + hud_levels[player] = player:hud_add({ + hud_elem_type = "text", + position = {x = 0.5, y = 1}, + number = 0x80FF20, + offset = {x = 0, y = -(48 + 24 + 24)}, + z_index = 12, + }) end -}) + + mcl_experience.update(player) +end) + +minetest.register_on_leaveplayer(function(player) + hud_bars[player] = nil + hud_levels[player] = nil + caches[player] = nil +end) + +minetest.register_on_dieplayer(function(player) + if not minetest.settings:get_bool("mcl_keepInventory", false) then + mcl_experience.throw_xp(player:get_pos(), mcl_experience.get_xp(player)) + mcl_experience.set_xp(player, 0) + end +end) + +minetest.register_on_mods_loaded(function() + table.sort(mcl_experience.on_add_xp, function(a, b) return a.priority < b.priority end) +end) diff --git a/mods/HUD/mcl_experience/orb.lua b/mods/HUD/mcl_experience/orb.lua new file mode 100644 index 000000000..9aecce00d --- /dev/null +++ b/mods/HUD/mcl_experience/orb.lua @@ -0,0 +1,220 @@ +local size_min, size_max = 20, 59 +local delta_size = size_max - size_min + +local size_to_xp = { + {-32768, 2}, -- 1 + { 3, 6}, -- 2 + { 7, 16}, -- 3 + { 17, 36}, -- 4 + { 37, 72}, -- 5 + { 73, 148}, -- 6 + { 149, 306}, -- 7 + { 307, 616}, -- 8 + { 617, 1236}, -- 9 + { 1237, 2476}, -- 10 + { 2477, 32767} -- 11 +} + +local function xp_to_size(xp) + local i, l = 1, #size_to_xp + + while xp > size_to_xp[i][1] and i < l do + i = i + 1 + end + + return ((i - 1) / (l - 1) * delta_size + size_min) / 100 +end + +local max_orb_age = 300 -- seconds +local gravity = vector.new(0, -((tonumber(minetest.settings:get("movement_gravity"))) or 9.81), 0) + +local collector, pos, pos2 +local direction, distance, player_velocity, goal +local currentvel, acceleration, multiplier, velocity +local node, vel, def +local is_moving, is_slippery, slippery, slip_factor +local size +local function xp_step(self, dtime) + --if item set to be collected then only execute go to player + if self.collected == true then + if not self.collector then + self.collected = false + return + end + collector = minetest.get_player_by_name(self.collector) + if collector and collector:get_hp() > 0 and vector.distance(self.object:get_pos(),collector:get_pos()) < 7.25 then + self.object:set_acceleration(vector.new(0,0,0)) + self.disable_physics(self) + --get the variables + pos = self.object:get_pos() + pos2 = collector:get_pos() + + player_velocity = collector:get_velocity() or collector:get_player_velocity() + + pos2.y = pos2.y + 0.8 + + direction = vector.direction(pos,pos2) + distance = vector.distance(pos2,pos) + multiplier = distance + if multiplier < 1 then + multiplier = 1 + end + goal = vector.multiply(direction,multiplier) + currentvel = self.object:get_velocity() + + if distance > 1 then + multiplier = 20 - distance + velocity = vector.multiply(direction,multiplier) + goal = velocity + acceleration = vector.new(goal.x-currentvel.x,goal.y-currentvel.y,goal.z-currentvel.z) + self.object:add_velocity(vector.add(acceleration,player_velocity)) + elseif distance < 0.8 then + mcl_experience.add_xp(collector, self._xp) + self.object:remove() + end + return + else + self.collector = nil + self.enable_physics(self) + end + end + + + self.age = self.age + dtime + if self.age > max_orb_age then + self.object:remove() + return + end + + pos = self.object:get_pos() + + if pos then + node = minetest.get_node_or_nil({ + x = pos.x, + y = pos.y -0.25, + z = pos.z + }) + else + return + end + + -- Remove nodes in 'ignore' + if node and node.name == "ignore" then + self.object:remove() + return + end + + if not self.physical_state then + return -- Don't do anything + end + + -- Slide on slippery nodes + vel = self.object:get_velocity() + def = node and minetest.registered_nodes[node.name] + is_moving = (def and not def.walkable) or + vel.x ~= 0 or vel.y ~= 0 or vel.z ~= 0 + is_slippery = false + + if def and def.walkable then + slippery = minetest.get_item_group(node.name, "slippery") + is_slippery = slippery ~= 0 + if is_slippery and (math.abs(vel.x) > 0.2 or math.abs(vel.z) > 0.2) then + -- Horizontal deceleration + slip_factor = 4.0 / (slippery + 4) + self.object:set_acceleration({ + x = -vel.x * slip_factor, + y = 0, + z = -vel.z * slip_factor + }) + elseif vel.y == 0 then + is_moving = false + end + end + + if self.moving_state == is_moving and self.slippery_state == is_slippery then + -- Do not update anything until the moving state changes + return + end + + self.moving_state = is_moving + self.slippery_state = is_slippery + + if is_moving then + self.object:set_acceleration(gravity) + else + self.object:set_acceleration({x = 0, y = 0, z = 0}) + self.object:set_velocity({x = 0, y = 0, z = 0}) + end +end + +minetest.register_entity("mcl_experience:orb", { + initial_properties = { + hp_max = 1, + physical = true, + collide_with_objects = false, + collisionbox = {-0.2, -0.2, -0.2, 0.2, 0.2, 0.2}, + visual = "sprite", + visual_size = {x = 0.4, y = 0.4}, + textures = {name="mcl_experience_orb.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0}}, + spritediv = {x = 1, y = 14}, + initial_sprite_basepos = {x = 0, y = 0}, + is_visible = true, + pointable = false, + static_save = false, + }, + moving_state = true, + slippery_state = false, + physical_state = true, + -- Item expiry + age = 0, + -- Pushing item out of solid nodes + force_out = nil, + force_out_start = nil, + --Collection Variables + collectable = false, + try_timer = 0, + collected = false, + delete_timer = 0, + radius = 4, + + + on_activate = function(self, staticdata, dtime_s) + self.object:set_velocity(vector.new( + math.random(-2,2)*math.random(), + math.random(2,5), + math.random(-2,2)*math.random() + )) + self.object:set_armor_groups({immortal = 1}) + self.object:set_velocity({x = 0, y = 2, z = 0}) + self.object:set_acceleration(gravity) + local xp = tonumber(staticdata) + self._xp = xp + size = xp_to_size(xp) + self.object:set_properties({ + visual_size = {x = size, y = size}, + glow = 14, + }) + self.object:set_sprite({x=1,y=math.random(1,14)}, 14, 0.05, false) + end, + + enable_physics = function(self) + if not self.physical_state then + self.physical_state = true + self.object:set_properties({physical = true}) + self.object:set_velocity({x=0, y=0, z=0}) + self.object:set_acceleration(gravity) + end + end, + + disable_physics = function(self) + if self.physical_state then + self.physical_state = false + self.object:set_properties({physical = false}) + self.object:set_velocity({x=0, y=0, z=0}) + self.object:set_acceleration({x=0, y=0, z=0}) + end + end, + on_step = function(self, dtime) + xp_step(self, dtime) + end, +}) diff --git a/mods/HUD/mcl_experience/sounds/experience.ogg b/mods/HUD/mcl_experience/sounds/mcl_experience.ogg similarity index 100% rename from mods/HUD/mcl_experience/sounds/experience.ogg rename to mods/HUD/mcl_experience/sounds/mcl_experience.ogg diff --git a/mods/HUD/mcl_experience/sounds/level_up.ogg b/mods/HUD/mcl_experience/sounds/mcl_experience_level_up.ogg similarity index 100% rename from mods/HUD/mcl_experience/sounds/level_up.ogg rename to mods/HUD/mcl_experience/sounds/mcl_experience_level_up.ogg diff --git a/mods/HUD/mcl_experience/textures/experience_bar.png b/mods/HUD/mcl_experience/textures/mcl_experience_bar.png similarity index 100% rename from mods/HUD/mcl_experience/textures/experience_bar.png rename to mods/HUD/mcl_experience/textures/mcl_experience_bar.png diff --git a/mods/HUD/mcl_experience/textures/experience_bar_background.png b/mods/HUD/mcl_experience/textures/mcl_experience_bar_background.png similarity index 100% rename from mods/HUD/mcl_experience/textures/experience_bar_background.png rename to mods/HUD/mcl_experience/textures/mcl_experience_bar_background.png diff --git a/mods/HUD/mcl_experience/textures/experience_orb.png b/mods/HUD/mcl_experience/textures/mcl_experience_orb.png similarity index 100% rename from mods/HUD/mcl_experience/textures/experience_orb.png rename to mods/HUD/mcl_experience/textures/mcl_experience_orb.png diff --git a/mods/ITEMS/mcl_enchanting/enchantments.lua b/mods/ITEMS/mcl_enchanting/enchantments.lua index 17b6b6ac6..e876baf31 100644 --- a/mods/ITEMS/mcl_enchanting/enchantments.lua +++ b/mods/ITEMS/mcl_enchanting/enchantments.lua @@ -379,6 +379,49 @@ mcl_enchanting.enchantments.mending = { inv_tool_tab = true, } +mcl_experience.register_on_add_xp(function(player, xp) + local inv = player:get_inventory() + + local candidates = { + {list = "main", index = player:get_wield_index()}, + {list = "armor", index = 2}, + {list = "armor", index = 3}, + {list = "armor", index = 4}, + {list = "armor", index = 5}, + } + + local final_candidates = {} + for _, can in ipairs(candidates) do + local stack = inv:get_stack(can.list, can.index) + local wear = stack:get_wear() + if mcl_enchanting.has_enchantment(stack, "mending") and wear > 0 then + can.stack = stack + can.wear = wear + table.insert(final_candidates, can) + end + end + + if #final_candidates > 0 then + local can = final_candidates[math.random(#final_candidates)] + local stack, list, index, wear = can.stack, can.list, can.index, can.wear + local uses = mcl_util.calculate_durability(stack) + local multiplier = 2 * 65535 / uses + local repair = xp * multiplier + local new_wear = wear - repair + + if new_wear < 0 then + xp = math.floor(-new_wear / multiplier + 0.5) + new_wear = 0 + else + xp = 0 + end + + stack:set_wear(math.floor(new_wear)) + inv:set_stack(list, index, stack) + end + + return xp +end, 0) mcl_enchanting.enchantments.multishot = { name = S("Multishot"), diff --git a/mods/ITEMS/mcl_enchanting/engine.lua b/mods/ITEMS/mcl_enchanting/engine.lua index 6050aeed2..02425945c 100644 --- a/mods/ITEMS/mcl_enchanting/engine.lua +++ b/mods/ITEMS/mcl_enchanting/engine.lua @@ -499,7 +499,7 @@ function mcl_enchanting.show_enchanting_formspec(player) .. "real_coordinates[true]" .. "image[3.15,0.6;7.6,4.1;mcl_enchanting_button_background.png]" local itemstack = inv:get_stack("enchanting_item", 1) - local player_levels = mcl_experience.get_player_xp_level(player) + local player_levels = mcl_experience.get_level(player) local y = 0.65 local any_enchantment = false local table_slots = mcl_enchanting.get_table_slots(player, itemstack, num_bookshelves) @@ -549,11 +549,11 @@ function mcl_enchanting.handle_formspec_fields(player, formname, fields) if not slot then return end - local player_level = mcl_experience.get_player_xp_level(player) + local player_level = mcl_experience.get_level(player) if player_level < slot.level_requirement then return end - mcl_experience.set_player_xp_level(player, player_level - button_pressed) + mcl_experience.set_level(player, player_level - button_pressed) inv:remove_item("enchanting_lapis", cost) mcl_enchanting.set_enchanted_itemstring(itemstack) mcl_enchanting.set_enchantments(itemstack, slot.enchantments) diff --git a/mods/ITEMS/mcl_fishing/init.lua b/mods/ITEMS/mcl_fishing/init.lua index e0c78832f..ade0be818 100644 --- a/mods/ITEMS/mcl_fishing/init.lua +++ b/mods/ITEMS/mcl_fishing/init.lua @@ -37,7 +37,7 @@ local fish = function(itemstack, player, pointed_thing) local num = 0 local ent = nil local noent = true - + local durability = 65 local unbreaking = mcl_enchanting.get_enchantment(itemstack, "unbreaking") if unbreaking > 0 then @@ -117,8 +117,8 @@ local fish = function(itemstack, player, pointed_thing) else minetest.add_item(pos, item) end - if mcl_experience.throw_experience then - mcl_experience.throw_experience(pos, math.random(1,6)) + if mcl_experience.throw_xp then + mcl_experience.throw_xp(pos, math.random(1,6)) end if not minetest.is_creative_enabled(player:get_player_name()) then diff --git a/mods/ITEMS/mcl_furnaces/init.lua b/mods/ITEMS/mcl_furnaces/init.lua index ca43b275a..dca476762 100644 --- a/mods/ITEMS/mcl_furnaces/init.lua +++ b/mods/ITEMS/mcl_furnaces/init.lua @@ -75,9 +75,9 @@ local function give_xp(pos, player) local xp = meta:get_int("xp") if xp > 0 then if player then - mcl_experience.add_experience(player, xp) + mcl_experience.add_xp(player, xp) else - mcl_experience.throw_experience(vector.add(pos, dir), xp) + mcl_experience.throw_xp(vector.add(pos, dir), xp) end meta:set_int("xp", 0) end diff --git a/mods/ITEMS/mcl_mobspawners/init.lua b/mods/ITEMS/mcl_mobspawners/init.lua index b756d4a6d..6e4b24c96 100644 --- a/mods/ITEMS/mcl_mobspawners/init.lua +++ b/mods/ITEMS/mcl_mobspawners/init.lua @@ -317,7 +317,7 @@ minetest.register_node("mcl_mobspawners:spawner", { if obj then obj:remove() end - mcl_experience.throw_experience(pos, math.random(15, 43)) + mcl_experience.throw_xp(pos, math.random(15, 43)) end, on_punch = function(pos) From 34f329a9d559c326e1c198ce1fbbfa16c1edee8e Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 3 Nov 2021 19:57:21 +0100 Subject: [PATCH 070/116] TextureConverter: Implement grass palette conversion Source: https://minecraft.fandom.com/wiki/Tint Since the MineClone2 biomes do not entirely match with the Minecraft ones I picked the Minecraft biomes that seem to match them best. This also changes the palette index of the nether to match the desert instead of the mesa biome and changes the color of grass blocks in item form to the default minecraft one. --- mods/ITEMS/mcl_core/nodes_base.lua | 2 +- mods/MAPGEN/mcl_biomes/init.lua | 2 +- tools/Texture_Converter.py | 67 +++++++++++++++++++++--------- 3 files changed, 50 insertions(+), 21 deletions(-) diff --git a/mods/ITEMS/mcl_core/nodes_base.lua b/mods/ITEMS/mcl_core/nodes_base.lua index abc650bb0..fe1ee58c2 100644 --- a/mods/ITEMS/mcl_core/nodes_base.lua +++ b/mods/ITEMS/mcl_core/nodes_base.lua @@ -365,7 +365,7 @@ minetest.register_node("mcl_core:dirt_with_grass", { overlay_tiles = {"mcl_core_grass_block_top.png", "", {name="mcl_core_grass_block_side_overlay.png", tileable_vertical=false}}, palette = "mcl_core_palette_grass.png", palette_index = 0, - color = "#55aa60", + color = "#8EB971", is_ground_content = true, stack_max = 64, groups = {handy=1,shovely=1,dirt=2,grass_block=1, grass_block_no_snow=1, soil=1, soil_sapling=2, soil_sugarcane=1, cultivatable=2, spreading_dirt_type=1, enderman_takable=1, building_block=1}, diff --git a/mods/MAPGEN/mcl_biomes/init.lua b/mods/MAPGEN/mcl_biomes/init.lua index a630dba04..a04822439 100644 --- a/mods/MAPGEN/mcl_biomes/init.lua +++ b/mods/MAPGEN/mcl_biomes/init.lua @@ -1496,7 +1496,7 @@ local function register_dimension_biomes() heat_point = 100, humidity_point = 0, _mcl_biome_type = "hot", - _mcl_palette_index = 19, + _mcl_palette_index = 17, }) --[[ THE END ]] diff --git a/tools/Texture_Converter.py b/tools/Texture_Converter.py index 820fa9c08..bdf249113 100755 --- a/tools/Texture_Converter.py +++ b/tools/Texture_Converter.py @@ -118,17 +118,6 @@ def colorize_alpha(colormap, source, colormap_pixel, texture_size, destination): colorize(colormap, source, colormap_pixel, texture_size, tempfile2.name) os.system("composite -compose Dst_In "+source+" "+tempfile2.name+" -alpha Set "+destination) -# This function is unused atm. -# TODO: Implemnt colormap extraction -def extract_colormap(colormap, colormap_pixel, positions): - os.system("convert -size 16x16 canvas:black "+tempfile1.name) - x=0 - y=0 - for p in positions: - os.system("convert "+colormap+" -crop 1x1+"+colormap_pixel+" -depth 8 "+tempfile2.name) - os.system("composite -geometry 16x16+"+x+"+"+y+" "+tempfile2.name) - x = x+1 - def target_dir(directory): if make_texture_pack: return output_dir + "/" + output_dir_name @@ -397,20 +386,60 @@ def convert_textures(): colorize_alpha(FOLIAG, tex_dir+"/blocks/vine.png", "16+39", str(PXSIZE), target_dir("/mods/ITEMS/mcl_core/textures")+"/mcl_core_vine.png") # Tall grass, fern (inventory images) - pcol = "49+172" # Plains grass color + pcol = "50+173" # Plains grass color colorize_alpha(GRASS, tex_dir+"/blocks/tallgrass.png", pcol, str(PXSIZE), target_dir("/mods/ITEMS/mcl_flowers/textures")+"/mcl_flowers_tallgrass_inv.png") colorize_alpha(GRASS, tex_dir+"/blocks/fern.png", pcol, str(PXSIZE), target_dir("/mods/ITEMS/mcl_flowers/textures")+"/mcl_flowers_fern_inv.png") colorize_alpha(GRASS, tex_dir+"/blocks/double_plant_fern_top.png", pcol, str(PXSIZE), target_dir("/mods/ITEMS/mcl_flowers/textures")+"/mcl_flowers_double_plant_fern_inv.png") colorize_alpha(GRASS, tex_dir+"/blocks/double_plant_grass_top.png", pcol, str(PXSIZE), target_dir("/mods/ITEMS/mcl_flowers/textures")+"/mcl_flowers_double_plant_grass_inv.png") - # TODO: Convert grass palette - - offset = [ - [ pcol, "", "grass" ], # Default grass: Plains + # Convert grass palette: https://minecraft.fandom.com/wiki/Tint + grass_colors = [ + # [Coords or #Color, AdditionalTint], # Index - Minecraft biome name (MineClone2 biome names) + ["50+173"], # 0 - Plains (flat, Plains, Plains_beach, Plains_ocean, End) + ["0+255"], # 1 - Savanna (Savanna, Savanna_beach, Savanna_ocean) + ["255+255"], # 2 - Ice Spikes (IcePlainsSpikes, IcePlainsSpikes_ocean) + ["255+255"], # 3 - Snowy Taiga (ColdTaiga, ColdTaiga_beach, ColdTaiga_beach_water, ColdTaiga_ocean) + ["178+193"], # 4 - Giant Tree Taiga (MegaTaiga, MegaTaiga_ocean) + ["178+193"], # 5 - Giant Tree Taiga (MegaSpruceTaiga, MegaSpruceTaiga_ocean) + ["203+239"], # 6 - Montains (ExtremeHills, ExtremeHills_beach, ExtremeHills_ocean) + ["203+239"], # 7 - Montains (ExtremeHillsM, ExtremeHillsM_ocean) + ["203+239"], # 8 - Montains (ExtremeHills+, ExtremeHills+_snowtop, ExtremeHills+_ocean) + ["50+173"], # 9 - Beach (StoneBeach, StoneBeach_ocean) + ["255+255"], # 10 - Snowy Tundra (IcePlains, IcePlains_ocean) + ["50+173"], # 11 - Sunflower Plains (SunflowerPlains, SunflowerPlains_ocean) + ["191+203"], # 12 - Taiga (Taiga, Taiga_beach, Taiga_ocean) + ["76+112"], # 13 - Forest (Forest, Forest_beach, Forest_ocean) + ["76+112"], # 14 - Flower Forest (FlowerForest, FlowerForest_beach, FlowerForest_ocean) + ["101+163"], # 15 - Birch Forest (BirchForest, BirchForest_ocean) + ["101+163"], # 16 - Birch Forest Hills (BirchForestM, BirchForestM_ocean) + ["0+255"], # 17 - Desert and Nether (Desert, Desert_ocean, Nether) + ["76+112", "#28340A"], # 18 - Dark Forest (RoofedForest, RoofedForest_ocean) + ["#90814d"], # 19 - Mesa (Mesa, Mesa_sandlevel, Mesa_ocean, ) + ["#90814d"], # 20 - Mesa (MesaBryce, MesaBryce_sandlevel, MesaBryce_ocean) + ["#90814d"], # 21 - Mesa (MesaPlateauF, MesaPlateauF_grasstop, MesaPlateauF_sandlevel, MesaPlateauF_ocean) + ["#90814d"], # 22 - Mesa (MesaPlateauFM, MesaPlateauFM_grasstop, MesaPlateauFM_sandlevel, MesaPlateauFM_ocean) + ["0+255"], # 23 - Shattered Savanna (or Savanna Plateau ?) (SavannaM, SavannaM_ocean) + ["12+36"], # 24 - Jungle (Jungle, Jungle_shore, Jungle_ocean) + ["12+36"], # 25 - Modified Jungle (JungleM, JungleM_shore, JungleM_ocean) + ["12+61"], # 26 - Jungle Edge (JungleEdge, JungleEdge_ocean) + ["12+61"], # 27 - Modified Jungle Edge (JungleEdgeM, JungleEdgeM_ocean) + ["#6A7039"], # 28 - Swamp (Swampland, Swampland_shore, Swampland_ocean) + ["25+25"], # 29 - Mushroom Fields and Mushroom Field Shore (MushroomIsland, MushroomIslandShore, MushroomIsland_ocean) ] - for o in offset: - colorize(GRASS, tex_dir+"/blocks/grass_top.png", o[0], str(PXSIZE), target_dir("/mods/ITEMS/mcl_core/textures")+"/default_"+o[2]+".png") - colorize_alpha(GRASS, tex_dir+"/blocks/grass_side_overlay.png", o[0], str(PXSIZE), target_dir("/mods/ITEMS/mcl_core/textures")+"/default_"+o[2]+"_side.png") + + grass_palette_file = target_dir("/mods/ITEMS/mcl_core/textures") + "/mcl_core_palette_grass.png" + os.system("convert -size 16x16 canvas:transparent " + grass_palette_file) + + for i, color in enumerate(grass_colors): + if color[0][0] == "#": + os.system("convert -size 1x1 xc:\"" + color[0] + "\" " + tempfile1.name + ".png") + else: + os.system("convert " + GRASS + " -crop 1x1+" + color[0] + " " + tempfile1.name + ".png") + + if len(color) > 1: + os.system("convert " + tempfile1.name + ".png \\( -size 1x1 xc:\"" + color[1] + "\" \\) -compose blend -define compose:args=50,50 -composite " + tempfile1.name + ".png") + + os.system("convert " + grass_palette_file + " \\( " + tempfile1.name + ".png -geometry +" + str(i % 16) + "+" + str(int(i / 16)) + " \\) -composite " + grass_palette_file) # Metadata if make_texture_pack: From 970988cb39bcd1ab35e17de886ffdd46aa52eee0 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 4 Aug 2021 12:41:25 +0200 Subject: [PATCH 071/116] Add sugar cane colorisation --- mods/ITEMS/mcl_core/functions.lua | 10 +++++++--- mods/ITEMS/mcl_core/nodes_cactuscane.lua | 13 +++++++++++++ .../mcl_core/textures/default_papyrus.png | Bin 277 -> 1953 bytes 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_core/functions.lua b/mods/ITEMS/mcl_core/functions.lua index 2ef73af72..d2ff3690a 100644 --- a/mods/ITEMS/mcl_core/functions.lua +++ b/mods/ITEMS/mcl_core/functions.lua @@ -773,8 +773,7 @@ end local grass_spread_randomizer = PseudoRandom(minetest.get_mapgen_setting("seed")) --- Return appropriate grass block node for pos -function mcl_core.get_grass_block_type(pos) +function mcl_core.get_grass_palette_index(pos) local biome_data = minetest.get_biome_data(pos) local index = 0 if biome_data then @@ -785,7 +784,12 @@ function mcl_core.get_grass_block_type(pos) index = reg_biome._mcl_palette_index end end - return {name="mcl_core:dirt_with_grass", param2=index} + return index +end + +-- Return appropriate grass block node for pos +function mcl_core.get_grass_block_type(pos) + return {name = "mcl_core:dirt_with_grass", param2 = mcl_core.get_grass_palette_index(pos)} end ------------------------------ diff --git a/mods/ITEMS/mcl_core/nodes_cactuscane.lua b/mods/ITEMS/mcl_core/nodes_cactuscane.lua index 839102534..e61d6df80 100644 --- a/mods/ITEMS/mcl_core/nodes_cactuscane.lua +++ b/mods/ITEMS/mcl_core/nodes_cactuscane.lua @@ -53,7 +53,10 @@ minetest.register_node("mcl_core:reeds", { _doc_items_longdesc = S("Sugar canes are a plant which has some uses in crafting. Sugar canes will slowly grow up to 3 blocks when they are next to water and are placed on a grass block, dirt, sand, red sand, podzol or coarse dirt. When a sugar cane is broken, all sugar canes connected above will break as well."), _doc_items_usagehelp = S("Sugar canes can only be placed top of other sugar canes and on top of blocks on which they would grow."), drawtype = "plantlike", + paramtype2 = "color", tiles = {"default_papyrus.png"}, + palette = "mcl_core_palette_grass.png", + palette_index = 0, inventory_image = "mcl_core_reeds.png", wield_image = "mcl_core_reeds.png", paramtype = "light", @@ -79,6 +82,7 @@ minetest.register_node("mcl_core:reeds", { groups = {dig_immediate=3, craftitem=1, deco_block=1, plant=1, non_mycelium_plant=1, dig_by_piston=1}, sounds = mcl_sounds.node_sound_leaves_defaults(), node_placement_prediction = "", + drop = "mcl_core:reeds", -- to prevent color inheritation on_place = mcl_util.generate_on_place_plant_function(function(place_pos, place_node) local soil_pos = {x=place_pos.x, y=place_pos.y-1, z=place_pos.z} local soil_node = minetest.get_node_or_nil(soil_pos) @@ -114,6 +118,15 @@ minetest.register_node("mcl_core:reeds", { return false end), + on_construct = function(pos) + local node = minetest.get_node(pos) + if node.param2 == 0 then + node.param2 = mcl_core.get_grass_palette_index(pos) + if node.param2 ~= 0 then + minetest.set_node(pos, node) + end + end + end, _mcl_blast_resistance = 0, _mcl_hardness = 0, }) diff --git a/mods/ITEMS/mcl_core/textures/default_papyrus.png b/mods/ITEMS/mcl_core/textures/default_papyrus.png index b6e2062ec6e5f4d2bf5c2a41437627ac6935e687..c928402f9507ddf95b93d2c43f31738a09356b81 100644 GIT binary patch delta 1951 zcmV;Q2VnS>0-+C(7=H)^0002B`ZwwT00i-RR9JLUVRs;Ka&Km7Y-J#Hd2nSQWq4_3 z004N}tyfuc?I;ZW*D87mNFavgFjl=C^zvI^z}G|alBzbb(G^%a=m_CJ{r69Uf8-+c z1`IoIgSAR76HK5ef>*~C#uJqp&-p_w;i88*J@3bANsmJ)bWuADFIs@N9SXemsrLL(xTfIyeTVF$u_Jc{_mWGeDOhFA46^-_kAk6sKO_VrgfLM0g!Q zzUlRLL!XZIMt?-t0Vd@h%b9m;#kW?E)kR|^qIPD~2sSP=GBHWW^?1!nb8@rDZnPlH ztEjS2UQ|{|TE>7RtTaG_1tT`BqtBQHqM=GodZH{ub)DCa0%hHKGQD9Vr-LrSAn8mM zv=%jOEI9mz;V+{X&jn>Fp&08_f7#%>!QV7!E%y+i@_##4f{S`y3yjWOf66Q&1l#0| zM}SwG^sA5jkyI51d4$=^0;5WYiNtv3mL5E7na9!}TL{6GX+T0GzFEMa76z0>&1g|M zB8Mn(^g>V+EpbbISzwa>AW6VT=q4 zA71$$0e<$jgitwe@j`VsuK4s0(u7soCpPo{~A{3;lv+ zy?^TB?bUm)b9(U@RrD}r?`f-li!SyKPH{-SEvfp)yAs7IQe`yqr%*P?kmOv;u1sa? zSvW=H7wtK7Gem?5_p>9 zY7N#f+O$@jDS!UVm|sQoDWl!Z&awE-7wrcHy+*tB{j<2erZFmL7|_&}q5|!&h0_q<@5M>+ITC z8P+}^`^f%go~faEC&JF-()of3-|Us7#T|P7Md;u&c4xX-y)l%Xyxbn#o=$z+`D{BYoJ%7KQugYl#Z^zlmE5^N;(jKRiJJBlGM`%4gZA0`$ z->BRVLikGzFVW8a9)`vXGSGP*wer|cXPsAH^sD~E*z_v{c?UOV`?KJ!C4hWUZB`fH zu!O>2e+k@rxO}OcYqw|IOnZsjW;5HkzK?ePH2aXsUTbhqbDw0w7p&?N+kakOlMlcE z{{iyl_o#?U>4X3P0V8QcLr_UWLm+T+Z)Rz1WdHzpoSl%dO2beThQHRJrRX4vgE(Yx zEx6dpr78r$LW~uxPHEC&F*k-JrT7NEi9SpRLGTTH0R?CO8yy_X;)TQiaX9Dy@4e7; zlgJd#9+knLU8vG1 z%S&h+h`aMLv#etCb`TtiAH;5K(pdZ?-i=Lc+3p4=nMFUI_BN~I^y1w1RXcc`(8tGR z#EdBkB^_z1&M{r~r5-sU_Y_3Zgt2;a&6M1T3ORWkiUuOxrY3K@%762fGLpwsUN+$l zBTt)${on7kkF#pCv9-v;Jgizvs^(+@?~kxHgpFrtU)N-{e!s0|rd!SY^NnAA?NBgF z<9F8p0007FOGiWi|A&vvzW@LL32;bRa{vGf6951U69E94oEQKA00(qQO+^Rg2m}fd z2@>7nWdHyH21!IgRDUSXZPC9<13?f5@ZTOO6m4X=GKHOm5Ku^$*GOR*u)f}ag}qOZ z&h+{KR=$9wusCci4g@{YNlYVak#mjUR6Fc9^Zl8?by}DQMn);BT?F7ZEnJ13t!hPU zP^EpRpxEnKHW=XXyn|A1`h+Ig^1|h`$=vICPdiZ13Ysl?q~)-g8*F|8tQK llh9+?wVNdCEf~PDfp2QAPj|0&ecJ#4002ovPDHLkV1niRxds3L delta 261 zcmZ3;Kb2{ML_G^L0|Ud`yN`kx7#MT|d_r6q7#PZ@2YIII#~H{bv^WLkn%%#DUoTwO zEX9J|zkIA>Q02Ngg~8?g~v4lR9#NFXYX% zX(c@mw=!*h^>N#jWF8#{!MCZJSv-wSXB4wC9o#$wHow}q#l@WM8uJ;&<3?UrBqI0> zteJROq68-_zBjc_2C_((JF}urUT~+m>G^{sI9!Xbfpvn0|SGntDnm{ Hr-UW|Y&cq) From 47340386e20501cad0d2e7a0deba2a64a0022c0a Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 3 Nov 2021 20:55:33 +0100 Subject: [PATCH 072/116] Turn parethesized sentence about voluntary work into normal one --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index de3ae536e..6d46237ca 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -343,9 +343,9 @@ at least two different people. requests as a developer. In this case it is your responsibility to fix the issue / review and merge the pull request when it is ready. You can also unassign yourself from the issue / PR if you have no time or don't -want to take care of it for some other reason (after all, everyone is a +want to take care of it for some other reason. After all, everyone is a volunteer and we can't expect you to do work that you are not intrested -in) - **the important thing is that you make sure to inform us if you +in. **The important thing is that you make sure to inform us if you won't take care of something that has been assigned to you.** - Please assign yourself to something that you want to work on to avoid duplicate work. From 4d93e13f80873075b492a35ef340ab49f2b6ff4f Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 3 Nov 2021 20:59:27 +0100 Subject: [PATCH 073/116] Reword developer presence in public discussion rooms rule --- CONTRIBUTING.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6d46237ca..bbe097c0c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -349,9 +349,10 @@ in. **The important thing is that you make sure to inform us if you won't take care of something that has been assigned to you.** - Please assign yourself to something that you want to work on to avoid duplicate work. -- As a developer, it should be easy to reach you about -your code. You should be on the Discord (or, if you really don't like -Discord, Matrix or IRC). +- As a developer, it should be easy to reach you about your work. You +should be in at least one of the public MineClone2 discussion rooms - +preferrably Discord, but if you really don't like Discord, Matrix +or IRC are fine too. ### Maintainer status Maintainers carry the main responsibility for the project. From 6473494cbcf66e2454d33bc7b678dbf0c21ccdd1 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 3 Nov 2021 21:01:43 +0100 Subject: [PATCH 074/116] prioritised -> prioritized --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bbe097c0c..ad9090930 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,11 +13,11 @@ whether you're a programmer or not. based on the Minetest engine with polished features, usable in both singleplayer and multiplayer. Currently, most of **Minecraft Java Edition 1.12.2** features are already implemented and polishing existing -features are prioritised over new feature requests. +features are prioritized over new feature requests. - With lessened priority yet strictly, implement features targetting **Minecraft version 1.17 + Optifine** (Optifine only as far as supported by the Minetest Engine). This means features in parity with the listed -Minecraft experiences are prioritised over those that don't fulfill this +Minecraft experiences are prioritized over those that don't fulfill this scope. - Optionally, create a performant experience that will run relatively well on really low spec computers. Unfortunately, due to Minecraft's From c2f0f0297be67de7ddc5775c5a5a63de9b5bb637 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 3 Nov 2021 21:02:15 +0100 Subject: [PATCH 075/116] Optifine -> OptiFine --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ad9090930..ed5d2704d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,7 +15,7 @@ singleplayer and multiplayer. Currently, most of **Minecraft Java Edition 1.12.2** features are already implemented and polishing existing features are prioritized over new feature requests. - With lessened priority yet strictly, implement features targetting -**Minecraft version 1.17 + Optifine** (Optifine only as far as supported +**Minecraft version 1.17 + OptiFine** (OptiFine only as far as supported by the Minetest Engine). This means features in parity with the listed Minecraft experiences are prioritized over those that don't fulfill this scope. From 7c1777c53ac4ae388b1127d0266c5ec801fed4fb Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 3 Nov 2021 21:03:17 +0100 Subject: [PATCH 076/116] minetest -> Minetest --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ed5d2704d..ea1175534 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -75,11 +75,11 @@ channel. However, it is not a bug if you believe something is missing in the game. In this case, please read "Requesting features" * If you report a crash, always include the error message. If you play -in singleplayer, post a screenshot of the message that minetest showed +in singleplayer, post a screenshot of the message that Minetest showed when the crash happened (or copy the message into your issue). If you are a server admin, you can find error messages in the log file of the server. -* Tell us which MineClone2 and minetest versions you are using. +* Tell us which MineClone2 and Minetest versions you are using. * Tell us how to reproduce the problem: What you were doing to trigger the bug, e.g. before the crash happened or what causes the faulty behavior. From faff9316e0b21cc32aa73e5f9fda7993ce56d1f1 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 3 Nov 2021 21:03:58 +0100 Subject: [PATCH 077/116] minecraft -> Minecraft --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ea1175534..e8711bceb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -121,7 +121,7 @@ this is not required. It's also a good idea to join the Discord server #### Textures For textures we use the Pixel Perfection texture pack. This is mostly -enough; however in some cases - e.g. for newer minecraft features, it's +enough; however in some cases - e.g. for newer Minecraft features, it's useful to have texture artists around. If you want to make such contributions, join our Discord server. Demands for textures will be communicated there. From 6000c29171b7bcee909293addb60fb2fe012fd58 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 3 Nov 2021 21:04:52 +0100 Subject: [PATCH 078/116] ressource -> resource --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e8711bceb..3f9186a32 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -129,7 +129,7 @@ communicated there. #### Sounds MineClone2 currently does not have a consistent way to handle sounds. The sounds in the game come from different sources, like the SnowZone -ressource pack or minetest_game. Unfortunately, MineClone2 does not play +resource pack or minetest_game. Unfortunately, MineClone2 does not play a sound in every situation you would get one in Minecraft. Any help with sounds is greatly appreciated, however if you add new sounds you should probably work together with a programmer, to write the code to actually From d6907970111ea975cd3fbbbb1f403721514fef7f Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 3 Nov 2021 21:05:38 +0100 Subject: [PATCH 079/116] commited -> committed --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3f9186a32..f69a83015 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -159,7 +159,7 @@ the translation files for the language you are working on with the template files, to see what is missing and what is out of date with the template file. However, template files are often incomplete and/or out of date, sometimes they don't match the code. You can update the -translation files if that is required, you can also modifiy the code in +translation files if that is required, you can also modify the code in your translation PR if it's related to translation. You can also work on multiple languages at the same time in one PR. From cdf6533e0ac2c1321c5a048d28db3556af6d4161 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 3 Nov 2021 21:06:08 +0100 Subject: [PATCH 080/116] regulary -> regularly --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f69a83015..2246e4bf9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -199,7 +199,7 @@ If you opened or have contributed to an issue, you receive the * Fork the repository (in case you have not already) * Do your change in a new branch * Create a pull request to get your changes merged into master -* Keep your pull request up to date by regulary merging upstream. It is +* Keep your pull request up to date by regularly merging upstream. It is imperative that conflicts are resolved prior to merging the pull request. * After the pull request got merged, you can delete the branch From bb6fe65aa5a3bb04b094f71851067e25b42b901b Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 3 Nov 2021 21:06:35 +0100 Subject: [PATCH 081/116] inadequeate -> inadequate --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2246e4bf9..bc90905e0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -216,7 +216,7 @@ We appreciate any contributing effort to MineClone2. If you are a relatively new programmer, you can reach us on Discord, Matrix or IRC for questions about git, Lua, Minetest API, MineClone2 codebase or anything related to MineClone2. We can help you avoid writing code that -would be deemed inadequeate, or help you become familiar with MineClone2 +would be deemed inadequate, or help you become familiar with MineClone2 better, or assist you use development tools. ### Maintain your own code, even if alreay got merged From e70161501f3a01ac7c1ef3f3e895e1b07f334ec9 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 3 Nov 2021 21:06:58 +0100 Subject: [PATCH 082/116] alreay -> already --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bc90905e0..b9f277a69 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -219,7 +219,7 @@ anything related to MineClone2. We can help you avoid writing code that would be deemed inadequate, or help you become familiar with MineClone2 better, or assist you use development tools. -### Maintain your own code, even if alreay got merged +### Maintain your own code, even if already got merged Sometimes, your code may cause crashes or bugs - we try to avoid such scenarios by testing everytime before merging it, but if your merged work causes problems, we ask you fix the issues as soon as possible. From 18dd1cabd0e523d25323a881071eb717b47bdeea Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 3 Nov 2021 21:07:28 +0100 Subject: [PATCH 083/116] everytime -> every time --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b9f277a69..4e4be4ff7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -221,7 +221,7 @@ better, or assist you use development tools. ### Maintain your own code, even if already got merged Sometimes, your code may cause crashes or bugs - we try to avoid such -scenarios by testing everytime before merging it, but if your merged +scenarios by testing every time before merging it, but if your merged work causes problems, we ask you fix the issues as soon as possible. ### Changing Gameplay From 39f66eb4a025c8e4207ccadd690eb0467b8701be Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 3 Nov 2021 21:08:11 +0100 Subject: [PATCH 084/116] repo -> repository --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4e4be4ff7..b9f443573 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -334,8 +334,8 @@ MineClone2 repository. #### Developer responsibilities - You should not push things directly to MineClone2 master - rather, do your work on a branch on your private -repo, then create a pull request. This way other people can review your -changes and make sure they work before they get merged. +repository, then create a pull request. This way other people can review +your changes and make sure they work before they get merged. - Merge PRs only when they have recieved the necessary feedback and have been tested to not lead to any crashes and do what they claim to do by at least two different people. From 46d1dd42d4f2c5ca4fd839fdf683c102c95ff5e7 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 3 Nov 2021 21:08:47 +0100 Subject: [PATCH 085/116] recieved -> received --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b9f443573..67cc2c3e6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -336,7 +336,7 @@ MineClone2 repository. MineClone2 master - rather, do your work on a branch on your private repository, then create a pull request. This way other people can review your changes and make sure they work before they get merged. -- Merge PRs only when they have recieved the necessary feedback and have +- Merge PRs only when they have received the necessary feedback and have been tested to not lead to any crashes and do what they claim to do by at least two different people. - You may also be assigned to issues or pull From 61d0dc8182d37e2da33e3d6c7d0e082d813e3e20 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 3 Nov 2021 21:09:13 +0100 Subject: [PATCH 086/116] intrested -> interested --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 67cc2c3e6..8ab8ee818 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -344,7 +344,7 @@ requests as a developer. In this case it is your responsibility to fix the issue / review and merge the pull request when it is ready. You can also unassign yourself from the issue / PR if you have no time or don't want to take care of it for some other reason. After all, everyone is a -volunteer and we can't expect you to do work that you are not intrested +volunteer and we can't expect you to do work that you are not interested in. **The important thing is that you make sure to inform us if you won't take care of something that has been assigned to you.** - Please assign yourself to something that you want to work on to avoid From c6e9d763d673816251d37c03eb19318c7bd8a8a6 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 3 Nov 2021 21:09:57 +0100 Subject: [PATCH 087/116] repo -> repository (in release process documentation) --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8ab8ee818..2b1f16ad8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -378,7 +378,7 @@ technical guidelines and issue/PR delegation * Update the version number in README.md * Use `git tag ` to tag the latest commit with the version number -* Push to repo (don't forget `--tags`!) +* Push to repository (don't forget `--tags`!) * Update ContentDB (https://content.minetest.net/packages/Wuzzy/mineclone2/) * Update first post in forum thread From 24ca8252a9aa97303475b6e15aac21ac65f0804f Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 3 Nov 2021 21:14:22 +0100 Subject: [PATCH 088/116] community wants -> community feedback --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2b1f16ad8..961e16cee 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -362,7 +362,7 @@ Maintainers carry the main responsibility for the project. merged, by assigning either themselves or Developers to issues / PRs - Making releases - Making sure guidelines are kept -- Making project decisions based on what the community wants +- Making project decisions based on community feedback - Granting/revoking developer access - Enforcing the code of conduct (See CODE_OF_CONDUCT.md) - Moderating official community spaces (See Links section) From a77e79d985fc384ea49810b1feb2d625a9c9feac Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 3 Nov 2021 21:15:20 +0100 Subject: [PATCH 089/116] where the real troublespots are -> places to investigate optimization issues --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 961e16cee..7abbcc5ea 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -171,8 +171,8 @@ credited in the Contributors section. ### Profiling If you own a server, a great way to help us improve MineClone2's code is by giving us profiler results. Profiler results give us detailed -information about the game's performance and let us know where the real -troublespots are. This way we can make the game faster. +information about the game's performance and let us know places to +investigate optimization issues. This way we can make the game faster. #### Using Minetest's profiler Minetest has a built in profiler. Simply set `profiler.load = true` in From f9e7f584926946148c22675fa816e30ab8e366d0 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Thu, 4 Nov 2021 12:21:06 +0100 Subject: [PATCH 090/116] Reword necessary PR feedback section --- CONTRIBUTING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7abbcc5ea..5d84ea47b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -336,9 +336,9 @@ MineClone2 repository. MineClone2 master - rather, do your work on a branch on your private repository, then create a pull request. This way other people can review your changes and make sure they work before they get merged. -- Merge PRs only when they have received the necessary feedback and have -been tested to not lead to any crashes and do what they claim to do by -at least two different people. +- Merge PRs only when they have recieved the necessary feedback and have +been tested by at least two different people (including the author of +the pull request), to avoid crashes or the introduction of new bugs. - You may also be assigned to issues or pull requests as a developer. In this case it is your responsibility to fix the issue / review and merge the pull request when it is ready. You can From b937b38b1c24f14e25e24621978110ed1b7602bd Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Thu, 4 Nov 2021 12:26:14 +0100 Subject: [PATCH 091/116] Separate translations and assets --- CONTRIBUTING.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5d84ea47b..5e00fddd8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -142,9 +142,14 @@ Similar to the textures, we need people that can make 3D Models with Blender on demand. Many of the models have to be patched, some new animations have to be added etc. -#### Translations +#### Crediting +Asset contributions will be credited in their own respective sections in +CREDITS.md. If you have commited the results yourself, you will also be +credited in the Contributors section. -##### Workflow +### Contributing Translations + +#### Workflow To add/update support for your language to MineClone2, you should take the steps documented in the section for Programmers, add/update the translation files of the mods that you want to update. You can add @@ -153,7 +158,7 @@ the translation file entirely or only partly; basically any effort is valued. If your changes are small, you can also send them to developers via E-Mail, Discord, IRC or Matrix - they will credit you appropriately. -##### Things to note +#### Things to note You can use the script at `tools/check_translate_files.py` to compare the translation files for the language you are working on with the template files, to see what is missing and what is out of date with @@ -164,9 +169,9 @@ your translation PR if it's related to translation. You can also work on multiple languages at the same time in one PR. #### Crediting -Asset contributions will be credited in their own respective sections in -CREDITS.md. If you have commited the results yourself, you will also be -credited in the Contributors section. +Translation contributions will be credited in their own in CREDITS.md. +If you have commited the results yourself, you will also be credited in +the Contributors section. ### Profiling If you own a server, a great way to help us improve MineClone2's code From 649f481b51162e4314da28c58769d9730e9b216c Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Thu, 4 Nov 2021 12:28:36 +0100 Subject: [PATCH 092/116] provide example for non-descriptive title --- CONTRIBUTING.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5e00fddd8..9be680d6a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -54,7 +54,8 @@ you can report a bug or request a feature. ### Rules about both bugs and feature requests * Stay polite towards the developers and anyone else involved in the discussion. -* Choose a descriptive title. +* Choose a descriptive title (e.g. not just "crash", "bug" or "question" +). * Please write in plain, understandable English. It will be easier to communicate. * Please start the issue title with a capital letter. From 4a3a8841cdf956807e4b97a7dee2774ae873a930 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Thu, 4 Nov 2021 12:31:13 +0100 Subject: [PATCH 093/116] Add ingame credits script to release process --- CONTRIBUTING.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9be680d6a..e8ea2bf5b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -380,6 +380,8 @@ technical guidelines and issue/PR delegation * Nicu - responsible for community related issues #### Release process +* Run `tools/generate_ingame_credits.lua` to update the ingame credits +from `CREDITS.md` and commit the result (if anything changed) * Launch MineClone2 to make sure it still runs * Update the version number in README.md * Use `git tag ` to tag the latest commit with the From ce4c0ed4c199028ebb69614629e7ece31a395e4b Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Thu, 4 Nov 2021 12:56:34 +0100 Subject: [PATCH 094/116] free -> free/libre --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e8ea2bf5b..de13bce7d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -396,7 +396,7 @@ version number ### Licensing By asking us to include your changes in this game, you agree that they fall under the terms of the GPLv3, which basically means they will -become part of a free software. +become part of a free/libre software. ### Crediting Contributors, Developers and Maintainers will be credited in From be86b603f8391d733f174bb6ccd44869f8327948 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Thu, 4 Nov 2021 13:14:35 +0100 Subject: [PATCH 095/116] Update README.md to reflect new contribution guidelines --- README.md | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 034d381ab..fe32f0039 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# MineClone 2 +# MineClone2 An unofficial Minecraft-like game for Minetest. Forked from MineClone by davedevils. Developed by many people. Not developed or endorsed by Mojang AB. @@ -69,9 +69,9 @@ an explanation. This game requires [Minetest](http://minetest.net) to run (version 5.3.0 or later). So you need to install Minetest first. Only stable versions of Minetest are officially supported. -There is no support for running MineClone 2 in development versions of Minetest. +There is no support for running MineClone2 in development versions of Minetest. -To install MineClone 2 (if you haven't already), move this directory into the +To install MineClone2 (if you haven't already), move this directory into the “games” directory of your Minetest data directory. Consult the help of Minetest to learn more. @@ -86,20 +86,21 @@ The MineClone2 repository is hosted at Mesehub. To contribute or report issues, * Reddit: * Minetest forums: -## Project description -The main goal of **MineClone 2** is to be a clone of Minecraft and to be released as free software. - -* **Target of development: Minecraft, PC Edition, version 1.12** (later known as “Java Edition”) -* MineClone2 also includes Optifine features supported by the Minetest -* In general, Minecraft is aimed to be cloned as good as possible -* Cloning the gameplay has highest priority -* MineClone 2 will use different assets, but with a similar style -* Limitations found in Minetest will be documented in the course of development -* Features of later Minecraft versions are collected in the mineclone5 branch - -## Using features from newer versions of Minecraft -For > 1.12 features, checkout MineClone5. It includes features from newer Minecraft versions. -Download it here: https://git.minetest.land/MineClone2/MineClone2/src/branch/mineclone5 +## Target +- Crucially, create a stable, moddable, free/libre clone of Minecraft +based on the Minetest engine with polished features, usable in both +singleplayer and multiplayer. Currently, most of **Minecraft Java +Edition 1.12.2** features are already implemented and polishing existing +features are prioritized over new feature requests. +- With lessened priority yet strictly, implement features targetting +**Minecraft version 1.17 + OptiFine** (OptiFine only as far as supported +by the Minetest Engine). This means features in parity with the listed +Minecraft experiences are prioritized over those that don't fulfill this +scope. +- Optionally, create a performant experience that will run relatively +well on really low spec computers. Unfortunately, due to Minecraft's +mechanisms and Minetest engine's limitations along with a very small +playerbase on low spec computers, optimizations are hard to investigate. ## Completion status This game is currently in **beta** stage. @@ -186,7 +187,7 @@ Technical differences from Minecraft: * Different engine (Minetest) * Different easter eggs -… and finally, MineClone 2 is free software (“free” as in “freedom”)! +… and finally, MineClone2 is free software (“free” as in “freedom”)! ## Other readme files From 23ca11c8e1b0f4e802ea5b41ac63c32136dc760a Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Thu, 4 Nov 2021 01:53:58 +0100 Subject: [PATCH 096/116] Use RLE compression in tga_encoder --- mods/CORE/tga_encoder/init.lua | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/mods/CORE/tga_encoder/init.lua b/mods/CORE/tga_encoder/init.lua index 96afda5e1..973e44855 100644 --- a/mods/CORE/tga_encoder/init.lua +++ b/mods/CORE/tga_encoder/init.lua @@ -38,18 +38,31 @@ function image:encode_header() self.data = self.data .. string.char(0) -- image id .. string.char(0) -- color map type - .. string.char(2) -- image type (uncompressed true-color image = 2) + .. string.char(10) -- image type (RLE RGB = 10) self:encode_colormap_spec() -- color map specification self:encode_image_spec() -- image specification end function image:encode_data() + local current_pixel = '' + local previous_pixel = '' + local count = 1 + local encoded = '' + local rle_packet = '' for _, row in ipairs(self.pixels) do for _, pixel in ipairs(row) do - self.data = self.data - .. string.char(pixel[3], pixel[2], pixel[1]) + current_pixel = string.char(pixel[3], pixel[2], pixel[1]) + if current_pixel ~= previous_pixel or count == 128 then + encoded = encoded .. rle_packet + count = 1 + previous_pixel = current_pixel + else + count = count + 1 + end + rle_packet = string.char(128 + count - 1) .. current_pixel end end + self.data = self.data .. encoded .. rle_packet end function image:encode_footer() From 4926c0560da96ef4d0677487212fac519f6c2083 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Thu, 4 Nov 2021 15:15:28 +0100 Subject: [PATCH 097/116] Speed up TGA encoding by creating fewer strings --- mods/CORE/tga_encoder/init.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mods/CORE/tga_encoder/init.lua b/mods/CORE/tga_encoder/init.lua index 973e44855..39309c9c9 100644 --- a/mods/CORE/tga_encoder/init.lua +++ b/mods/CORE/tga_encoder/init.lua @@ -47,13 +47,13 @@ function image:encode_data() local current_pixel = '' local previous_pixel = '' local count = 1 - local encoded = '' + local packets = {} local rle_packet = '' for _, row in ipairs(self.pixels) do for _, pixel in ipairs(row) do current_pixel = string.char(pixel[3], pixel[2], pixel[1]) if current_pixel ~= previous_pixel or count == 128 then - encoded = encoded .. rle_packet + packets[#packets +1] = rle_packet count = 1 previous_pixel = current_pixel else @@ -62,7 +62,8 @@ function image:encode_data() rle_packet = string.char(128 + count - 1) .. current_pixel end end - self.data = self.data .. encoded .. rle_packet + packets[#packets +1] = rle_packet + self.data = self.data .. table.concat(packets) end function image:encode_footer() From d1d11f97406500ada5fe8e29577a36bd5bd6bf31 Mon Sep 17 00:00:00 2001 From: Dieter44 <55900078+Dieter44@users.noreply.github.com> Date: Thu, 4 Nov 2021 20:58:54 +0100 Subject: [PATCH 098/116] Fixed debug hudbars for player saturation and exhaustion when mcl_hunger_debug=true is set in .config file --- mods/PLAYER/mcl_hunger/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/PLAYER/mcl_hunger/init.lua b/mods/PLAYER/mcl_hunger/init.lua index 8c154700a..90a622a18 100644 --- a/mods/PLAYER/mcl_hunger/init.lua +++ b/mods/PLAYER/mcl_hunger/init.lua @@ -91,8 +91,8 @@ end -- register saturation hudbar hb.register_hudbar("hunger", 0xFFFFFF, S("Food"), { icon = "hbhunger_icon.png", bgicon = "hbhunger_bgicon.png", bar = "hbhunger_bar.png" }, 1, 20, 20, false) if mcl_hunger.debug then - hb.register_hudbar("saturation", 0xFFFFFF, S("Saturation"), { icon = "mcl_hunger_icon_saturation.png", bgicon = "mcl_hunger_bgicon_saturation.png", bar = "mcl_hunger_bar_saturation.png" }, 1, mcl_hunger.SATURATION_INIT, 200, false, S("%s: %.1f/%d")) - hb.register_hudbar("exhaustion", 0xFFFFFF, S("Exhaust."), { icon = "mcl_hunger_icon_exhaustion.png", bgicon = "mcl_hunger_bgicon_exhaustion.png", bar = "mcl_hunger_bar_exhaustion.png" }, 1, 0, mcl_hunger.EXHAUST_LVL, false, S("%s: %d/%d")) + hb.register_hudbar("saturation", 0xFFFFFF, S("Saturation"), { icon = "mcl_hunger_icon_saturation.png", bgicon = "mcl_hunger_bgicon_saturation.png", bar = "mcl_hunger_bar_saturation.png" }, 1, mcl_hunger.SATURATION_INIT, 200, false) + hb.register_hudbar("exhaustion", 0xFFFFFF, S("Exhaust."), { icon = "mcl_hunger_icon_exhaustion.png", bgicon = "mcl_hunger_bgicon_exhaustion.png", bar = "mcl_hunger_bar_exhaustion.png" }, 1, 0, mcl_hunger.EXHAUST_LVL, false) end minetest.register_on_joinplayer(function(player) From d0d60804a39da1b8d8a980861440b1146747ec20 Mon Sep 17 00:00:00 2001 From: Dieter44 <55900078+Dieter44@users.noreply.github.com> Date: Thu, 4 Nov 2021 21:01:28 +0100 Subject: [PATCH 099/116] Implemented health regeneration mechanics as described in minecraft wiki. Saturation values and different regeneration speeds now used. --- mods/PLAYER/mcl_hunger/init.lua | 84 +++++++++++++++++++-------------- 1 file changed, 48 insertions(+), 36 deletions(-) diff --git a/mods/PLAYER/mcl_hunger/init.lua b/mods/PLAYER/mcl_hunger/init.lua index 90a622a18..535ccbed1 100644 --- a/mods/PLAYER/mcl_hunger/init.lua +++ b/mods/PLAYER/mcl_hunger/init.lua @@ -134,46 +134,58 @@ minetest.register_on_player_hpchange(function(player, hp_change) end end) -local main_timer = 0 -local timer = 0 -- Half second timer -local timerMult = 1 -- Cycles from 0 to 7, each time when timer hits half a second -minetest.register_globalstep(function(dtime) - main_timer = main_timer + dtime - timer = timer + dtime - if main_timer > mcl_hunger.HUD_TICK or timer > 0.25 then - if main_timer > mcl_hunger.HUD_TICK then main_timer = 0 end - for _,player in pairs(minetest.get_connected_players()) do - local name = player:get_player_name() - local h = tonumber(mcl_hunger.get_hunger(player)) - local hp = player:get_hp() - if timer > 0.25 then - -- Slow health regeneration, and hunger damage (every 4s). - -- Regeneration rate based on tutorial video . - -- Minecraft Wiki seems to be wrong in claiming that full hunger gives 0.5s regen rate. - if timerMult == 0 then - if h >= 18 and hp > 0 and hp < 20 then - -- +1 HP, +exhaustion - player:set_hp(hp+1) - mcl_hunger.exhaust(name, mcl_hunger.EXHAUST_REGEN) - mcl_hunger.update_exhaustion_hud(player, mcl_hunger.get_exhaustion(player)) - elseif h == 0 then - -- Damage hungry player down to 1 HP - -- TODO: Allow starvation at higher difficulty levels - if hp-1 > 0 then - mcl_util.deal_damage(player, 1, {type = "starve"}) + +local fastFoodTickTimer = 0 -- 0.5 second cycle +local slowFoodTickTimer = 0 -- 4 second cycle +minetest.register_globalstep(function(dtime) + fastFoodTickTimer = fastFoodTickTimer + dtime + slowFoodTickTimer = slowFoodTickTimer + dtime + + local fastTimerWrapped = false -- if the fastFoodTickTimer wrapped around and everything dependent should be updated + local slowTimerWrapped = false + + if fastFoodTickTimer > 0.5 then + fastFoodTickTimer = 0 + fastTimerWrapped = true + end + if slowFoodTickTimer > 4.0 then + slowFoodTickTimer = 0 + slowTimerWrapped = true + end + + if fastTimerWrapped or slowTimerWrapped then -- only update players if something must be updated + for _,player in ipairs(minetest.get_connected_players()) do + + local playerName = player:get_player_name() + local foodLevel = mcl_hunger.get_hunger(player) + local foodSaturationLevel = mcl_hunger.get_saturation(player) + local playerHealth = player:get_hp() + + if playerHealth < 20 then + if foodLevel == 20 and foodSaturationLevel >= 6 then -- fast regeneration (2 health per second) + if fastTimerWrapped then + player:set_hp(playerHealth+1) + mcl_hunger.exhaust(playerName, mcl_hunger.EXHAUST_REGEN) + mcl_hunger.update_exhaustion_hud(player, mcl_hunger.get_exhaustion(player)) + end + elseif foodLevel >= 18 then -- slow regeneration (1 health every 4 seconds) + if slowTimerWrapped then + player:set_hp(playerHealth+1) + mcl_hunger.exhaust(playerName, mcl_hunger.EXHAUST_REGEN) + mcl_hunger.update_exhaustion_hud(player, mcl_hunger.get_exhaustion(player)) end end end - - end - end - end - if timer > 0.25 then - timer = 0 - timerMult = timerMult + 2 - if timerMult > 7 then - timerMult = 0 + + if foodLevel == 0 then --starvation + maximumStarvation = 1 -- the amount of health at which a player will stop to get harmed by starvation (10 for Easy, 1 for Normal, 0 for Hard) + -- TODO: implement Minecraft-like difficulty modes and the update maximumStarvation here + if playerHealth > maximumStarvation and slowTimerWrapped then + mcl_util.deal_damage(player, 1, {type = "starve"}) + end + end + end end end) From 1b259f928bb32e30208235d17560097ba059b047 Mon Sep 17 00:00:00 2001 From: NO11 Date: Sat, 6 Nov 2021 13:12:03 +0000 Subject: [PATCH 100/116] Add simple bone meal API - callback api - particle api --- mods/ITEMS/mcl_dye/init.lua | 83 ++++++++++++++++++++++--------------- 1 file changed, 49 insertions(+), 34 deletions(-) diff --git a/mods/ITEMS/mcl_dye/init.lua b/mods/ITEMS/mcl_dye/init.lua index b9b5d92ac..274e31fcf 100644 --- a/mods/ITEMS/mcl_dye/init.lua +++ b/mods/ITEMS/mcl_dye/init.lua @@ -128,26 +128,35 @@ for _, row in ipairs(dyelocal.dyes) do end -- Bone Meal -local function bone_meal_particle(pos) +function mcl_dye.add_bone_meal_particle(pos, def) + if not def then + def = {} + end minetest.add_particlespawner({ - amount = 10, - time = 0.1, - minpos = { x = pos.x - 0.5, y = pos.y - 0.5, z = pos.z - 0.5 }, - maxpos = { x = pos.x + 0.5, y = pos.y + 0.5, z = pos.z + 0.5 }, - minvel = { x = 0, y = 0, z = 0}, - maxvel = { x = 0, y = 0, z = 0}, - minacc = { x = 0, y = 0, z = 0}, - maxacc = { x = 0, y = 0, z = 0}, - minexptime = 1, - maxexptime = 4, - minsize = 0.7, - maxsize = 2.4, + amount = def.amount or 10, + time = def.time or 0.1, + minpos = def.minpos or vector.subtract(pos, 0.5), + maxpos = def.maxpos or vector.add(pos, 0.5), + minvel = def.minvel or vector.new(0, 0, 0), + maxvel = def.maxvel or vector.new(0, 0, 0), + minacc = def.minacc or vector.new(0, 0, 0), + minacc = def.minacc or vector.new(0, 0, 0), + minexptime = def.minexptime or 1, + maxexptime = def.maxexptime or 4, + minsize = def.minsize or 0.7, + maxsize = def.maxsize or 2.4, texture = "mcl_particles_bonemeal.png^[colorize:#00EE00:125", -- TODO: real MC color - glow = 5, + glow = def.glow or 5, }) end -function mcl_dye.apply_bone_meal(pointed_thing) +mcl_dye.bone_meal_callbacks = {} + +function mcl_dye.register_on_bone_meal_apply(func) + table.insert(mcl_dye.bone_meal_callbacks, func) +end + +local function apply_bone_meal(pointed_thing) -- Bone meal currently spawns all flowers found in the plains. local flowers_table_plains = { "mcl_flowers:dandelion", @@ -183,14 +192,21 @@ function mcl_dye.apply_bone_meal(pointed_thing) local pos = pointed_thing.under local n = minetest.get_node(pos) if n.name == "" then return false end + + for _, func in pairs(mcl_dye.bone_meal_callbacks) do + if func(pointed_thing, user) then + return true + end + end + if minetest.get_item_group(n.name, "sapling") >= 1 then - bone_meal_particle(pos) + mcl_dye.add_bone_meal_particle(pos) -- Saplings: 45% chance to advance growth stage if math.random(1,100) <= 45 then return mcl_core.grow_sapling(pos, n) end elseif minetest.get_item_group(n.name, "mushroom") == 1 then - bone_meal_particle(pos) + mcl_dye.add_bone_meal_particle(pos) -- Try to grow huge mushroom -- Must be on a dirt-type block @@ -240,39 +256,37 @@ function mcl_dye.apply_bone_meal(pointed_thing) return false -- Wheat, Potato, Carrot, Pumpkin Stem, Melon Stem: Advance by 2-5 stages elseif string.find(n.name, "mcl_farming:wheat_") then - bone_meal_particle(pos) + mcl_dye.add_bone_meal_particle(pos) local stages = math.random(2, 5) return mcl_farming:grow_plant("plant_wheat", pos, n, stages, true) elseif string.find(n.name, "mcl_farming:potato_") then - bone_meal_particle(pos) + mcl_dye.add_bone_meal_particle(pos) local stages = math.random(2, 5) return mcl_farming:grow_plant("plant_potato", pos, n, stages, true) elseif string.find(n.name, "mcl_farming:carrot_") then - bone_meal_particle(pos) + mcl_dye.add_bone_meal_particle(pos) local stages = math.random(2, 5) return mcl_farming:grow_plant("plant_carrot", pos, n, stages, true) elseif string.find(n.name, "mcl_farming:pumpkin_") then - bone_meal_particle(pos) + mcl_dye.add_bone_meal_particle(pos) local stages = math.random(2, 5) return mcl_farming:grow_plant("plant_pumpkin_stem", pos, n, stages, true) elseif string.find(n.name, "mcl_farming:melontige_") then - bone_meal_particle(pos) + mcl_dye.add_bone_meal_particle(pos) local stages = math.random(2, 5) return mcl_farming:grow_plant("plant_melon_stem", pos, n, stages, true) elseif string.find(n.name, "mcl_farming:beetroot_") then - bone_meal_particle(pos) + mcl_dye.add_bone_meal_particle(pos) -- Beetroot: 75% chance to advance to next stage if math.random(1, 100) <= 75 then return mcl_farming:grow_plant("plant_beetroot", pos, n, 1, true) end elseif n.name == "mcl_cocoas:cocoa_1" or n.name == "mcl_cocoas:cocoa_2" then - bone_meal_particle(pos) + mcl_dye.add_bone_meal_particle(pos) -- Cocoa: Advance by 1 stage mcl_cocoas.grow(pos) return true elseif minetest.get_item_group(n.name, "grass_block") == 1 then - local grass_block_pos = {x = pos.x, y = pos.y + 1, z = pos.z} - bone_meal_particle(grass_block_pos) -- Grass Block: Generate tall grass and random flowers all over the place for i = -2, 2 do for j = -2, 2 do @@ -285,6 +299,7 @@ function mcl_dye.apply_bone_meal(pointed_thing) -- Randomly generate flowers, tall grass or nothing if math.random(1,100) <= 90 then -- 90% tall grass, 10% flower + mcl_dye.add_bone_meal_particle(pos, {amount = 4}) if math.random(1,100) <= 90 then local col = n2.param2 minetest.add_node(pos, {name="mcl_flowers:tallgrass", param2=col}) @@ -314,24 +329,24 @@ function mcl_dye.apply_bone_meal(pointed_thing) -- Double flowers: Drop corresponding item elseif n.name == "mcl_flowers:rose_bush" or n.name == "mcl_flowers:rose_bush_top" then - bone_meal_particle(pos) + mcl_dye.add_bone_meal_particle(pos) minetest.add_item(pos, "mcl_flowers:rose_bush") return true elseif n.name == "mcl_flowers:peony" or n.name == "mcl_flowers:peony_top" then - bone_meal_particle(pos) + mcl_dye.add_bone_meal_particle(pos) minetest.add_item(pos, "mcl_flowers:peony") return true elseif n.name == "mcl_flowers:lilac" or n.name == "mcl_flowers:lilac_top" then - bone_meal_particle(pos) + mcl_dye.add_bone_meal_particle(pos) minetest.add_item(pos, "mcl_flowers:lilac") return true elseif n.name == "mcl_flowers:sunflower" or n.name == "mcl_flowers:sunflower_top" then - bone_meal_particle(pos) + mcl_dye.add_bone_meal_particle(pos) minetest.add_item(pos, "mcl_flowers:sunflower") return true elseif n.name == "mcl_flowers:tallgrass" then - bone_meal_particle(pos) + mcl_dye.add_bone_meal_particle(pos) -- Tall Grass: Grow into double tallgrass local toppos = { x=pos.x, y=pos.y+1, z=pos.z } local topnode = minetest.get_node(toppos) @@ -342,7 +357,7 @@ function mcl_dye.apply_bone_meal(pointed_thing) end elseif n.name == "mcl_flowers:fern" then - bone_meal_particle(pos) + mcl_dye.add_bone_meal_particle(pos) -- Fern: Grow into large fern local toppos = { x=pos.x, y=pos.y+1, z=pos.z } local topnode = minetest.get_node(toppos) @@ -374,7 +389,7 @@ minetest.register_craftitem("mcl_dye:white", { end -- Use the bone meal on the ground - if(mcl_dye.apply_bone_meal(pointed_thing) and (not minetest.is_creative_enabled(user:get_player_name()))) then + if (apply_bone_meal(pointed_thing, user) and (not minetest.is_creative_enabled(user:get_player_name()))) then itemstack:take_item() end return itemstack @@ -387,7 +402,7 @@ minetest.register_craftitem("mcl_dye:white", { else pointed_thing = { above = pos, under = droppos } end - local success = mcl_dye.apply_bone_meal(pointed_thing) + local success = apply_bone_meal(pointed_thing, nil) if success then stack:take_item() end From 7bbc1e99519e12e47e0f88d84b9a999aa0affdb4 Mon Sep 17 00:00:00 2001 From: NO11 Date: Sat, 6 Nov 2021 13:34:22 +0000 Subject: [PATCH 101/116] Add API.md for bone meal API --- mods/ITEMS/mcl_dye/API.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 mods/ITEMS/mcl_dye/API.md diff --git a/mods/ITEMS/mcl_dye/API.md b/mods/ITEMS/mcl_dye/API.md new file mode 100644 index 000000000..04169f966 --- /dev/null +++ b/mods/ITEMS/mcl_dye/API.md @@ -0,0 +1,14 @@ +# mcl_dye + +# Bone meal API +Callback and particle functions. + +## mcl_dye.add_bone_meal_particle(pos, def) +Spawns standard or custom bone meal particles. +* `pos`: position, is ignored if you define def.minpos and def.maxpos +* `def`: (optional) particle definition + +## mcl_dye.register_on_bone_meal_apply(function(pointed_thing, user)) +Called when the bone meal is applied anywhere. +* `pointed_thing`: exact pointing location (see Minetest API), where the bone meal is applied +* `user`: ObjectRef of the player who aplied the bone meal, can be nil! \ No newline at end of file From ea46c8741bc8e89b789ff63ef3e989e8e490ec37 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Sun, 7 Nov 2021 20:29:11 +0100 Subject: [PATCH 102/116] Add OpenCollective link and credits --- CONTRIBUTING.md | 8 ++++++++ CREDITS.md | 3 +++ README.md | 1 + mods/HUD/mcl_credits/people.lua | 3 +++ tools/generate_ingame_credits.lua | 1 + 5 files changed, 16 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index de13bce7d..27a820d87 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -32,6 +32,7 @@ playerbase on low spec computers, optimizations are hard to investigate. * [Matrix](https://app.element.io/#/room/#mc2:matrix.org) * [Reddit](https://www.reddit.com/r/MineClone2/) * [Minetest forums](https://forum.minetest.net/viewtopic.php?f=50&t=16407) +* [OpenCollective](https://opencollective.com/mineclone2) ## Using git MineClone2 is developed using the version control system @@ -194,9 +195,16 @@ MeseHub, let us know what you think about a topic and help us make decisions. Also, note that a lot of discussion takes place on the Discord server, so it's definitely worth checking it out. +### Funding +You can help pay for our infrastructure (Mesehub) by donating to our +OpenCollective link (See Links section). + ### Crediting If you opened or have contributed to an issue, you receive the `Community` role on our Discord (after asking for it). +OpenCollective Funders are credited in their own section in +`CREDITS.md` and receive a special role "Funder" on our discord (unless +they have made their donation Incognito). ## How you can help as a programmer (Almost) all the MineClone2 development is done using pull requests. diff --git a/CREDITS.md b/CREDITS.md index 95884dcac..dfbe58375 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -130,6 +130,9 @@ * todoporlalibertad * Marcin Serwin +## Funders +* 40W + ## Special thanks * celeron55 for creating Minetest * Jordach for the jukebox music compilation from Big Freaking Dig diff --git a/README.md b/README.md index fe32f0039..b8dc50f1f 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,7 @@ The MineClone2 repository is hosted at Mesehub. To contribute or report issues, * Matrix: * Reddit: * Minetest forums: +* OpenCollective: ## Target - Crucially, create a stable, moddable, free/libre clone of Minecraft diff --git a/mods/HUD/mcl_credits/people.lua b/mods/HUD/mcl_credits/people.lua index 2861b5052..8f1d4c2e9 100644 --- a/mods/HUD/mcl_credits/people.lua +++ b/mods/HUD/mcl_credits/people.lua @@ -132,6 +132,9 @@ return { "todoporlalibertad", "Marcin Serwin", }}, + {S("Funders"), 0xF7FF00, { + "40W", + }}, {S("Special thanks"), 0x00E9FF, { "celeron55 for creating Minetest", "Jordach for the jukebox music compilation from Big Freaking Dig", diff --git a/tools/generate_ingame_credits.lua b/tools/generate_ingame_credits.lua index 89b633ef0..db124aaf6 100755 --- a/tools/generate_ingame_credits.lua +++ b/tools/generate_ingame_credits.lua @@ -13,6 +13,7 @@ local colors = { ["3D Models"] = "0x0019FF", ["Textures"] = "0xFF9705", ["Translations"] = "0x00FF60", + ["Funders"] = "0xF7FF00", ["Special thanks"] = "0x00E9FF", } From a34ae040c8ea78d8a4f697bbce7485365f549f0a Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 8 Nov 2021 14:02:22 +0100 Subject: [PATCH 103/116] Add ContentDB links --- CONTRIBUTING.md | 1 + README.md | 1 + 2 files changed, 2 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 27a820d87..a7383df79 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -32,6 +32,7 @@ playerbase on low spec computers, optimizations are hard to investigate. * [Matrix](https://app.element.io/#/room/#mc2:matrix.org) * [Reddit](https://www.reddit.com/r/MineClone2/) * [Minetest forums](https://forum.minetest.net/viewtopic.php?f=50&t=16407) +* [ContentDB](https://content.minetest.net/packages/wuzzy/mineclone2/) * [OpenCollective](https://opencollective.com/mineclone2) ## Using git diff --git a/README.md b/README.md index b8dc50f1f..8f8f0b1e6 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,7 @@ The MineClone2 repository is hosted at Mesehub. To contribute or report issues, * Matrix: * Reddit: * Minetest forums: +* ContentDB: * OpenCollective: ## Target From 30ce6f8a779d5f4a3ab564c46b3d7ecbdaaf11b5 Mon Sep 17 00:00:00 2001 From: NO11 Date: Mon, 8 Nov 2021 13:16:20 +0000 Subject: [PATCH 104/116] Fix typo min -> max --- mods/ITEMS/mcl_dye/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_dye/init.lua b/mods/ITEMS/mcl_dye/init.lua index 274e31fcf..2f6b0f105 100644 --- a/mods/ITEMS/mcl_dye/init.lua +++ b/mods/ITEMS/mcl_dye/init.lua @@ -140,7 +140,7 @@ function mcl_dye.add_bone_meal_particle(pos, def) minvel = def.minvel or vector.new(0, 0, 0), maxvel = def.maxvel or vector.new(0, 0, 0), minacc = def.minacc or vector.new(0, 0, 0), - minacc = def.minacc or vector.new(0, 0, 0), + maxacc = def.maxacc or vector.new(0, 0, 0), minexptime = def.minexptime or 1, maxexptime = def.maxexptime or 4, minsize = def.minsize or 0.7, From 976f522b9d25952768a77f7d6a9ae990d186da37 Mon Sep 17 00:00:00 2001 From: Dieter44 <55900078+Dieter44@users.noreply.github.com> Date: Mon, 8 Nov 2021 15:33:53 +0100 Subject: [PATCH 105/116] Combine slowFoodTickTimer and fastFoodTickTimer to a single food_tick_timer --- mods/PLAYER/mcl_hunger/init.lua | 69 +++++++++++++-------------------- 1 file changed, 27 insertions(+), 42 deletions(-) diff --git a/mods/PLAYER/mcl_hunger/init.lua b/mods/PLAYER/mcl_hunger/init.lua index 535ccbed1..0405c28ef 100644 --- a/mods/PLAYER/mcl_hunger/init.lua +++ b/mods/PLAYER/mcl_hunger/init.lua @@ -136,57 +136,42 @@ end) -local fastFoodTickTimer = 0 -- 0.5 second cycle -local slowFoodTickTimer = 0 -- 4 second cycle + +local food_tick_timer = 0 minetest.register_globalstep(function(dtime) - fastFoodTickTimer = fastFoodTickTimer + dtime - slowFoodTickTimer = slowFoodTickTimer + dtime + food_tick_timer = food_tick_timer + dtime - local fastTimerWrapped = false -- if the fastFoodTickTimer wrapped around and everything dependent should be updated - local slowTimerWrapped = false - - if fastFoodTickTimer > 0.5 then - fastFoodTickTimer = 0 - fastTimerWrapped = true - end - if slowFoodTickTimer > 4.0 then - slowFoodTickTimer = 0 - slowTimerWrapped = true - end - - if fastTimerWrapped or slowTimerWrapped then -- only update players if something must be updated - for _,player in ipairs(minetest.get_connected_players()) do + for _,player in ipairs(minetest.get_connected_players()) do + + local player_name = player:get_player_name() + local food_level = mcl_hunger.get_hunger(player) + local food_saturation_level = mcl_hunger.get_saturation(player) + local player_health = player:get_hp() + + if food_tick_timer > 4.0 then + food_tick_timer = 0 - local playerName = player:get_player_name() - local foodLevel = mcl_hunger.get_hunger(player) - local foodSaturationLevel = mcl_hunger.get_saturation(player) - local playerHealth = player:get_hp() + if food_level >= 18 and player_health < 20 then --slow regenration + food_tick_timer = 0 + player:set_hp(player_health+1) + mcl_hunger.exhaust(player_name, mcl_hunger.EXHAUST_REGEN) + mcl_hunger.update_exhaustion_hud(player, mcl_hunger.get_exhaustion(player)) - if playerHealth < 20 then - if foodLevel == 20 and foodSaturationLevel >= 6 then -- fast regeneration (2 health per second) - if fastTimerWrapped then - player:set_hp(playerHealth+1) - mcl_hunger.exhaust(playerName, mcl_hunger.EXHAUST_REGEN) - mcl_hunger.update_exhaustion_hud(player, mcl_hunger.get_exhaustion(player)) - end - elseif foodLevel >= 18 then -- slow regeneration (1 health every 4 seconds) - if slowTimerWrapped then - player:set_hp(playerHealth+1) - mcl_hunger.exhaust(playerName, mcl_hunger.EXHAUST_REGEN) - mcl_hunger.update_exhaustion_hud(player, mcl_hunger.get_exhaustion(player)) - end - end - end - - if foodLevel == 0 then --starvation - maximumStarvation = 1 -- the amount of health at which a player will stop to get harmed by starvation (10 for Easy, 1 for Normal, 0 for Hard) + elseif food_level == 0 then --starvation + maximumStarvation = 1 --the amount of health at which a player will stop to get harmed by starvation (10 for Easy, 1 for Normal, 0 for Hard) -- TODO: implement Minecraft-like difficulty modes and the update maximumStarvation here - if playerHealth > maximumStarvation and slowTimerWrapped then + if player_health > maximumStarvation then mcl_util.deal_damage(player, 1, {type = "starve"}) end end - + + elseif food_tick_timer > 0.5 and food_level == 20 and food_saturation_level >= 6 then --fast regeneration + food_tick_timer = 0 + player:set_hp(player_health+1) + mcl_hunger.exhaust(player_name, mcl_hunger.EXHAUST_REGEN) + mcl_hunger.update_exhaustion_hud(player, mcl_hunger.get_exhaustion(player)) end + end end) From 2f053885414d0cc5d480e92d2acc63e7e7de8b1a Mon Sep 17 00:00:00 2001 From: Dieter44 <55900078+Dieter44@users.noreply.github.com> Date: Mon, 8 Nov 2021 15:49:05 +0100 Subject: [PATCH 106/116] Add one food_tick_timer per player instead of using one for all players. --- mods/PLAYER/mcl_hunger/init.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/mods/PLAYER/mcl_hunger/init.lua b/mods/PLAYER/mcl_hunger/init.lua index 0405c28ef..1e3d07a47 100644 --- a/mods/PLAYER/mcl_hunger/init.lua +++ b/mods/PLAYER/mcl_hunger/init.lua @@ -137,11 +137,16 @@ end) -local food_tick_timer = 0 +local food_tick_timers = {} --one food_tick_timer per player, keys are the player-objects minetest.register_globalstep(function(dtime) - food_tick_timer = food_tick_timer + dtime - for _,player in ipairs(minetest.get_connected_players()) do + + local food_tick_timer = food_tick_timers[player] + if food_tick_timer == nil then + food_tick_timer = 0 + else + food_tick_timer = food_tick_timer + dtime + end local player_name = player:get_player_name() local food_level = mcl_hunger.get_hunger(player) @@ -172,6 +177,7 @@ minetest.register_globalstep(function(dtime) mcl_hunger.update_exhaustion_hud(player, mcl_hunger.get_exhaustion(player)) end + food_tick_timers[player] = food_tick_timer --update food_tick_timer table end end) From e82d21040c952e78fa8c64c8a32405d311a8a43c Mon Sep 17 00:00:00 2001 From: Dieter44 <55900078+Dieter44@users.noreply.github.com> Date: Mon, 8 Nov 2021 19:15:56 +0100 Subject: [PATCH 107/116] minor changes, ipairs() replaced with pairs() --- mods/PLAYER/mcl_hunger/init.lua | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/mods/PLAYER/mcl_hunger/init.lua b/mods/PLAYER/mcl_hunger/init.lua index 1e3d07a47..3a7af7e67 100644 --- a/mods/PLAYER/mcl_hunger/init.lua +++ b/mods/PLAYER/mcl_hunger/init.lua @@ -139,15 +139,9 @@ end) local food_tick_timers = {} --one food_tick_timer per player, keys are the player-objects minetest.register_globalstep(function(dtime) - for _,player in ipairs(minetest.get_connected_players()) do + for _,player in pairs(minetest.get_connected_players()) do - local food_tick_timer = food_tick_timers[player] - if food_tick_timer == nil then - food_tick_timer = 0 - else - food_tick_timer = food_tick_timer + dtime - end - + local food_tick_timer = food_tick_timers[player] and food_tick_timers[player] + dtime or 0 local player_name = player:get_player_name() local food_level = mcl_hunger.get_hunger(player) local food_saturation_level = mcl_hunger.get_saturation(player) @@ -157,15 +151,14 @@ minetest.register_globalstep(function(dtime) food_tick_timer = 0 if food_level >= 18 and player_health < 20 then --slow regenration - food_tick_timer = 0 player:set_hp(player_health+1) mcl_hunger.exhaust(player_name, mcl_hunger.EXHAUST_REGEN) mcl_hunger.update_exhaustion_hud(player, mcl_hunger.get_exhaustion(player)) elseif food_level == 0 then --starvation - maximumStarvation = 1 --the amount of health at which a player will stop to get harmed by starvation (10 for Easy, 1 for Normal, 0 for Hard) + local maximum_starvation = 1 --the amount of health at which a player will stop to get harmed by starvation (10 for Easy, 1 for Normal, 0 for Hard) -- TODO: implement Minecraft-like difficulty modes and the update maximumStarvation here - if player_health > maximumStarvation then + if player_health > maximum_starvation then mcl_util.deal_damage(player, 1, {type = "starve"}) end end From a7bc460fae77f2a841bb7a5b9e735226373a4e44 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Tue, 9 Nov 2021 17:39:39 +0100 Subject: [PATCH 108/116] Fix boat and enchanting book texture glitches / warnings --- mods/ENTITIES/mcl_boats/init.lua | 10 ++++++++-- mods/ITEMS/mcl_enchanting/init.lua | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/mods/ENTITIES/mcl_boats/init.lua b/mods/ENTITIES/mcl_boats/init.lua index 311b07882..f46c14d46 100644 --- a/mods/ENTITIES/mcl_boats/init.lua +++ b/mods/ENTITIES/mcl_boats/init.lua @@ -115,7 +115,7 @@ local boat = { collisionbox = {-0.5, -0.35, -0.5, 0.5, 0.3, 0.5}, visual = "mesh", mesh = "mcl_boats_boat.b3d", - textures = {"mcl_boats_texture_oak_boat.png"}, + textures = {"mcl_boats_texture_oak_boat.png", "mcl_boats_texture_oak_boat.png", "mcl_boats_texture_oak_boat.png", "mcl_boats_texture_oak_boat.png", "mcl_boats_texture_oak_boat.png"}, visual_size = boat_visual_size, hp_max = boat_max_hp, damage_texture_modifier = "^[colorize:white:0", @@ -148,6 +148,11 @@ function boat.on_activate(self, staticdata, dtime_s) self._v = data.v self._last_v = self._v self._itemstring = data.itemstring + + while #data.textures < 5 do + table.insert(data.textures, data.textures[1]) + end + self.object:set_properties({textures = data.textures}) end end @@ -434,8 +439,9 @@ for b=1, #boat_ids do pos = vector.add(pos, vector.multiply(dir, boat_y_offset_ground)) end local boat = minetest.add_entity(pos, "mcl_boats:boat") + local texture = "mcl_boats_texture_"..images[b].."_boat.png" boat:get_luaentity()._itemstring = itemstring - boat:set_properties({textures = { "mcl_boats_texture_"..images[b].."_boat.png" }}) + boat:set_properties({textures = { texture, texture, texture, texture, texture }}) boat:set_yaw(placer:get_look_horizontal()) if not minetest.is_creative_enabled(placer:get_player_name()) then itemstack:take_item() diff --git a/mods/ITEMS/mcl_enchanting/init.lua b/mods/ITEMS/mcl_enchanting/init.lua index 5aec1ced6..9f9fbd271 100644 --- a/mods/ITEMS/mcl_enchanting/init.lua +++ b/mods/ITEMS/mcl_enchanting/init.lua @@ -183,7 +183,7 @@ minetest.register_entity("mcl_enchanting:book", { collisionbox = {0, 0, 0}, pointable = false, physical = false, - textures = {"mcl_enchanting_book_entity.png"}, + textures = {"mcl_enchanting_book_entity.png", "mcl_enchanting_book_entity.png", "mcl_enchanting_book_entity.png", "mcl_enchanting_book_entity.png", "mcl_enchanting_book_entity.png"}, static_save = false, }, _player_near = false, From 017bf705e9f5b549a45d448b89a0d1d347db370c Mon Sep 17 00:00:00 2001 From: Dieter44 <55900078+Dieter44@users.noreply.github.com> Date: Tue, 9 Nov 2021 19:35:32 +0100 Subject: [PATCH 109/116] Fixing that player can regenerate health in death screen and then respawn without HP being set to maximum --- mods/PLAYER/mcl_hunger/init.lua | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/mods/PLAYER/mcl_hunger/init.lua b/mods/PLAYER/mcl_hunger/init.lua index 3a7af7e67..e54fb2fb2 100644 --- a/mods/PLAYER/mcl_hunger/init.lua +++ b/mods/PLAYER/mcl_hunger/init.lua @@ -150,10 +150,12 @@ minetest.register_globalstep(function(dtime) if food_tick_timer > 4.0 then food_tick_timer = 0 - if food_level >= 18 and player_health < 20 then --slow regenration - player:set_hp(player_health+1) - mcl_hunger.exhaust(player_name, mcl_hunger.EXHAUST_REGEN) - mcl_hunger.update_exhaustion_hud(player, mcl_hunger.get_exhaustion(player)) + if food_level >= 18 then --slow regenration + if player_health > 0 and player_health < 20 then + player:set_hp(player_health+1) + mcl_hunger.exhaust(player_name, mcl_hunger.EXHAUST_REGEN) + mcl_hunger.update_exhaustion_hud(player, mcl_hunger.get_exhaustion(player)) + end elseif food_level == 0 then --starvation local maximum_starvation = 1 --the amount of health at which a player will stop to get harmed by starvation (10 for Easy, 1 for Normal, 0 for Hard) @@ -164,10 +166,12 @@ minetest.register_globalstep(function(dtime) end elseif food_tick_timer > 0.5 and food_level == 20 and food_saturation_level >= 6 then --fast regeneration - food_tick_timer = 0 - player:set_hp(player_health+1) - mcl_hunger.exhaust(player_name, mcl_hunger.EXHAUST_REGEN) - mcl_hunger.update_exhaustion_hud(player, mcl_hunger.get_exhaustion(player)) + if player_health > 0 and player_health < 20 then + food_tick_timer = 0 + player:set_hp(player_health+1) + mcl_hunger.exhaust(player_name, mcl_hunger.EXHAUST_REGEN) + mcl_hunger.update_exhaustion_hud(player, mcl_hunger.get_exhaustion(player)) + end end food_tick_timers[player] = food_tick_timer --update food_tick_timer table From fa22ec4dd0b9c70eebb108bfef004e9100655bd2 Mon Sep 17 00:00:00 2001 From: iliekprogrammar Date: Wed, 10 Nov 2021 02:50:49 +0800 Subject: [PATCH 110/116] Add helper functions to update/merge tables. --- mods/CORE/mcl_util/init.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/mods/CORE/mcl_util/init.lua b/mods/CORE/mcl_util/init.lua index 363b9b5fe..d91c86f09 100644 --- a/mods/CORE/mcl_util/init.lua +++ b/mods/CORE/mcl_util/init.lua @@ -1,5 +1,27 @@ mcl_util = {} +-- Updates all values in t using values from to*. +function table.update(t, ...) + for _, to in ipairs{...} do + for k,v in pairs(to) do + t[k] = v + end + end + return t +end + +-- Updates nil values in t using values from to*. +function table.update_nil(t, ...) + for _, to in ipairs{...} do + for k,v in pairs(to) do + if t[k] == nil then + t[k] = v + end + end + end + return t +end + -- Based on minetest.rotate_and_place --[[ From f61143758edc46cb1e4d7feef5a78d35c7c31d75 Mon Sep 17 00:00:00 2001 From: iliekprogrammar Date: Wed, 10 Nov 2021 12:54:28 +0800 Subject: [PATCH 111/116] Fix small typo in API.md --- mods/CORE/mcl_worlds/API.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/CORE/mcl_worlds/API.md b/mods/CORE/mcl_worlds/API.md index dd96b01b5..69508e924 100644 --- a/mods/CORE/mcl_worlds/API.md +++ b/mods/CORE/mcl_worlds/API.md @@ -12,7 +12,7 @@ Params: * pos: position -## mcl_worlds.y_to_layer(y) +## mcl_worlds.y_to_layer(y) This function is used to calculate the minetest y layer and dimension of the given minecraft layer. Mainly used for ore generation. Takes an Y coordinate as input and returns: @@ -78,4 +78,4 @@ Table containing all function registered with mcl_worlds.register_on_dimension_c Notify this mod of a dimension change of to * player: player, player who changed the dimension -* dimension: string, new dimension ("overworld", "nether", "end", "void") \ No newline at end of file +* dimension: string, new dimension ("overworld", "nether", "end", "void") From 8979230c4262411d8e2ae47ba8433e84e63585d1 Mon Sep 17 00:00:00 2001 From: NO11 Date: Wed, 10 Nov 2021 17:15:27 +0000 Subject: [PATCH 112/116] Several fixes for applying bone meal to grass --- mods/ITEMS/mcl_dye/init.lua | 53 +++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/mods/ITEMS/mcl_dye/init.lua b/mods/ITEMS/mcl_dye/init.lua index 2f6b0f105..2b4d8a2f2 100644 --- a/mods/ITEMS/mcl_dye/init.lua +++ b/mods/ITEMS/mcl_dye/init.lua @@ -288,38 +288,39 @@ local function apply_bone_meal(pointed_thing) return true elseif minetest.get_item_group(n.name, "grass_block") == 1 then -- Grass Block: Generate tall grass and random flowers all over the place - for i = -2, 2 do - for j = -2, 2 do - pos = pointed_thing.above - pos = {x=pos.x+i, y=pos.y, z=pos.z+j} - n = minetest.get_node(pos) - local n2 = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}) + for i = -7, 7 do + for j = -7, 7 do + for y = -1, 1 do + pos = vector.offset(pointed_thing.above, i, y, j) + n = minetest.get_node(pos) + local n2 = minetest.get_node(vector.offset(pos, 0, -1, 0)) - if n.name ~= "" and n.name == "air" and (minetest.get_item_group(n2.name, "grass_block_no_snow") == 1) then - -- Randomly generate flowers, tall grass or nothing - if math.random(1,100) <= 90 then - -- 90% tall grass, 10% flower - mcl_dye.add_bone_meal_particle(pos, {amount = 4}) - if math.random(1,100) <= 90 then - local col = n2.param2 - minetest.add_node(pos, {name="mcl_flowers:tallgrass", param2=col}) - else - local flowers_table - if mg_name == "v6" then - flowers_table = flowers_table_plains + if n.name ~= "" and n.name == "air" and (minetest.get_item_group(n2.name, "grass_block_no_snow") == 1) then + -- Randomly generate flowers, tall grass or nothing + if math.random(1, 100) <= 90 / ((math.abs(i) + math.abs(j)) / 2)then + -- 90% tall grass, 10% flower + mcl_dye.add_bone_meal_particle(pos, {amount = 4}) + if math.random(1,100) <= 90 then + local col = n2.param2 + minetest.add_node(pos, {name="mcl_flowers:tallgrass", param2=col}) else - local biome = minetest.get_biome_name(minetest.get_biome_data(pos).biome) - if biome == "Swampland" or biome == "Swampland_shore" or biome == "Swampland_ocean" or biome == "Swampland_deep_ocean" or biome == "Swampland_underground" then - flowers_table = flowers_table_swampland - elseif biome == "FlowerForest" or biome == "FlowerForest_beach" or biome == "FlowerForest_ocean" or biome == "FlowerForest_deep_ocean" or biome == "FlowerForest_underground" then - flowers_table = flowers_table_flower_forest - elseif biome == "Plains" or biome == "Plains_beach" or biome == "Plains_ocean" or biome == "Plains_deep_ocean" or biome == "Plains_underground" or biome == "SunflowerPlains" or biome == "SunflowerPlains_ocean" or biome == "SunflowerPlains_deep_ocean" or biome == "SunflowerPlains_underground" then + local flowers_table + if mg_name == "v6" then flowers_table = flowers_table_plains else - flowers_table = flowers_table_simple + local biome = minetest.get_biome_name(minetest.get_biome_data(pos).biome) + if biome == "Swampland" or biome == "Swampland_shore" or biome == "Swampland_ocean" or biome == "Swampland_deep_ocean" or biome == "Swampland_underground" then + flowers_table = flowers_table_swampland + elseif biome == "FlowerForest" or biome == "FlowerForest_beach" or biome == "FlowerForest_ocean" or biome == "FlowerForest_deep_ocean" or biome == "FlowerForest_underground" then + flowers_table = flowers_table_flower_forest + elseif biome == "Plains" or biome == "Plains_beach" or biome == "Plains_ocean" or biome == "Plains_deep_ocean" or biome == "Plains_underground" or biome == "SunflowerPlains" or biome == "SunflowerPlains_ocean" or biome == "SunflowerPlains_deep_ocean" or biome == "SunflowerPlains_underground" then + flowers_table = flowers_table_plains + else + flowers_table = flowers_table_simple + end end + minetest.add_node(pos, {name=flowers_table[math.random(1, #flowers_table)]}) end - minetest.add_node(pos, {name=flowers_table[math.random(1, #flowers_table)]}) end end end From 0564121183177331901cb5a99e501500f086e535 Mon Sep 17 00:00:00 2001 From: iliekprogrammar Date: Fri, 12 Nov 2021 02:28:27 +0800 Subject: [PATCH 113/116] Code style for #1890 --- mods/PLAYER/mcl_hunger/init.lua | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/mods/PLAYER/mcl_hunger/init.lua b/mods/PLAYER/mcl_hunger/init.lua index e54fb2fb2..21c1e0860 100644 --- a/mods/PLAYER/mcl_hunger/init.lua +++ b/mods/PLAYER/mcl_hunger/init.lua @@ -134,38 +134,37 @@ minetest.register_on_player_hpchange(function(player, hp_change) end end) - - - -local food_tick_timers = {} --one food_tick_timer per player, keys are the player-objects +local food_tick_timers = {} -- one food_tick_timer per player, keys are the player-objects minetest.register_globalstep(function(dtime) for _,player in pairs(minetest.get_connected_players()) do - + local food_tick_timer = food_tick_timers[player] and food_tick_timers[player] + dtime or 0 local player_name = player:get_player_name() local food_level = mcl_hunger.get_hunger(player) local food_saturation_level = mcl_hunger.get_saturation(player) local player_health = player:get_hp() - + if food_tick_timer > 4.0 then food_tick_timer = 0 - - if food_level >= 18 then --slow regenration + + if food_level >= 18 then -- slow regenration if player_health > 0 and player_health < 20 then player:set_hp(player_health+1) mcl_hunger.exhaust(player_name, mcl_hunger.EXHAUST_REGEN) mcl_hunger.update_exhaustion_hud(player, mcl_hunger.get_exhaustion(player)) end - - elseif food_level == 0 then --starvation - local maximum_starvation = 1 --the amount of health at which a player will stop to get harmed by starvation (10 for Easy, 1 for Normal, 0 for Hard) + + elseif food_level == 0 then -- starvation + -- the amount of health at which a player will stop to get + -- harmed by starvation (10 for Easy, 1 for Normal, 0 for Hard) + local maximum_starvation = 1 -- TODO: implement Minecraft-like difficulty modes and the update maximumStarvation here if player_health > maximum_starvation then mcl_util.deal_damage(player, 1, {type = "starve"}) end end - - elseif food_tick_timer > 0.5 and food_level == 20 and food_saturation_level >= 6 then --fast regeneration + + elseif food_tick_timer > 0.5 and food_level == 20 and food_saturation_level >= 6 then -- fast regeneration if player_health > 0 and player_health < 20 then food_tick_timer = 0 player:set_hp(player_health+1) @@ -173,8 +172,8 @@ minetest.register_globalstep(function(dtime) mcl_hunger.update_exhaustion_hud(player, mcl_hunger.get_exhaustion(player)) end end - - food_tick_timers[player] = food_tick_timer --update food_tick_timer table + + food_tick_timers[player] = food_tick_timer -- update food_tick_timer table end end) From 740f7583ef991e59b8f62ce3344744515aa2f10d Mon Sep 17 00:00:00 2001 From: iliekprogrammar Date: Fri, 12 Nov 2021 02:49:18 +0800 Subject: [PATCH 114/116] Add Dieter44 to CREDITS.md --- CREDITS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS.md b/CREDITS.md index dfbe58375..1381b1c37 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -67,6 +67,7 @@ * SmallJoker * Sven792 * aldum +* Dieter44 ## MineClone5 * kay27 From 2a08f3143561d52e01fad66a5b4dadd1b765b0a2 Mon Sep 17 00:00:00 2001 From: NO11 Date: Fri, 12 Nov 2021 14:09:59 +0000 Subject: [PATCH 115/116] Use particlespawners for better performance (sponge particles) --- mods/ITEMS/mcl_sponges/init.lua | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/mods/ITEMS/mcl_sponges/init.lua b/mods/ITEMS/mcl_sponges/init.lua index a1998ecb0..e9755479b 100644 --- a/mods/ITEMS/mcl_sponges/init.lua +++ b/mods/ITEMS/mcl_sponges/init.lua @@ -115,16 +115,22 @@ function place_wet_sponge(itemstack, placer, pointed_thing) if mcl_worlds.pos_to_dimension(pointed_thing.above) == "nether" then minetest.item_place_node(ItemStack("mcl_sponges:sponge"), placer, pointed_thing) local pos = pointed_thing.above - for n = 0, 25 do - minetest.add_particle({ - pos = {x = pos.x + math.random(-1, 1)*math.random()/2, y = pos.y + 0.6, z = pos.z + math.random(-1, 1)*math.random()/2}, - velocity = {x = 0, y = math.random(), z = 0}, - acceleration = {x=0, y=0, z=0}, - expirationtime = math.random(), + + for n = 1, 5 do + minetest.add_particlespawner({ + amount = 5, + time = 0.1, + minpos = vector.offset(pos, -0.5, 0.6, -0.5), + maxpos = vector.offset(pos, 0.5, 0.6, 0.5), + minvel = vector.new(0, 0.1, 0), + maxvel = vector.new(0, 1, 0), + minexptime = 0.1, + maxexptime = 1, + minsize = 2, + maxsize = 5, collisiondetection = false, vertical = false, - size = math.random(2, 5), - texture = "mcl_particles_sponge"..math.random(1, 5)..".png", + texture = "mcl_particles_sponge" .. n .. ".png", }) end if not minetest.is_creative_enabled(name) then From 490e40d042325302dd5a7e58880cba82be514937 Mon Sep 17 00:00:00 2001 From: NO11 Date: Fri, 12 Nov 2021 15:41:09 +0000 Subject: [PATCH 116/116] Bone meal particles: add some velocity, correct glow --- mods/ITEMS/mcl_dye/init.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_dye/init.lua b/mods/ITEMS/mcl_dye/init.lua index 2b4d8a2f2..dfb962446 100644 --- a/mods/ITEMS/mcl_dye/init.lua +++ b/mods/ITEMS/mcl_dye/init.lua @@ -137,8 +137,8 @@ function mcl_dye.add_bone_meal_particle(pos, def) time = def.time or 0.1, minpos = def.minpos or vector.subtract(pos, 0.5), maxpos = def.maxpos or vector.add(pos, 0.5), - minvel = def.minvel or vector.new(0, 0, 0), - maxvel = def.maxvel or vector.new(0, 0, 0), + minvel = def.minvel or vector.new(-0.01, 0.01, -0.01), + maxvel = def.maxvel or vector.new(0.01, 0.01, 0.01), minacc = def.minacc or vector.new(0, 0, 0), maxacc = def.maxacc or vector.new(0, 0, 0), minexptime = def.minexptime or 1, @@ -146,7 +146,7 @@ function mcl_dye.add_bone_meal_particle(pos, def) minsize = def.minsize or 0.7, maxsize = def.maxsize or 2.4, texture = "mcl_particles_bonemeal.png^[colorize:#00EE00:125", -- TODO: real MC color - glow = def.glow or 5, + glow = def.glow or 1, }) end