Compare commits

..

7 Commits

88 changed files with 550 additions and 1368 deletions

View File

@ -4,7 +4,7 @@ root = true
end_of_line = lf end_of_line = lf
[*.lua] [*.lua]
charset = utf-8 charset = utf8
indent_style = tab indent_style = tab
insert_final_newline = true insert_final_newline = true
trim_trailing_whitespace = true trim_trailing_whitespace = true

View File

@ -257,21 +257,12 @@ end
---@param dst_inventory InvRef Destination inventory to push to ---@param dst_inventory InvRef Destination inventory to push to
---@param dst_list string Name of destination inventory list to push to ---@param dst_list string Name of destination inventory list to push to
---@param condition? fun(stack: ItemStack) Condition which items are allowed to be transfered. ---@param condition? fun(stack: ItemStack) Condition which items are allowed to be transfered.
---@param count? integer Number of items to try to transfer at once
---@return integer Item stack number to be transfered ---@return integer Item stack number to be transfered
function mcl_util.select_stack(src_inventory, src_list, dst_inventory, dst_list, condition, count) function mcl_util.select_stack(src_inventory, src_list, dst_inventory, dst_list, condition)
local src_size = src_inventory:get_size(src_list) local src_size = src_inventory:get_size(src_list)
local stack local stack
for i = 1, src_size do for i = 1, src_size do
stack = src_inventory:get_stack(src_list, i) stack = src_inventory:get_stack(src_list, i)
-- Allow for partial stack movement
if count and stack:get_count() >= count then
local new_stack = ItemStack(stack)
new_stack:set_count(count)
stack = new_stack
end
if not stack:is_empty() and dst_inventory:room_for_item(dst_list, stack) and ((condition == nil or condition(stack))) then if not stack:is_empty() and dst_inventory:room_for_item(dst_list, stack) and ((condition == nil or condition(stack))) then
return i return i
end end
@ -289,22 +280,21 @@ end
-- Returns true on success and false on failure -- Returns true on success and false on failure
-- Possible failures: No item in source slot, destination inventory full -- Possible failures: No item in source slot, destination inventory full
function mcl_util.move_item(source_inventory, source_list, source_stack_id, destination_inventory, destination_list) function mcl_util.move_item(source_inventory, source_list, source_stack_id, destination_inventory, destination_list)
-- Can't move items we don't have if not source_inventory:is_empty(source_list) then
if source_inventory:is_empty(source_list) then return false end local stack = source_inventory:get_stack(source_list, source_stack_id)
if not stack:is_empty() then
-- Can't move from an empty stack local new_stack = ItemStack(stack)
local stack = source_inventory:get_stack(source_list, source_stack_id) new_stack:set_count(1)
if stack:is_empty() then return false end if not destination_inventory:room_for_item(destination_list, new_stack) then
return false
local new_stack = ItemStack(stack) end
new_stack:set_count(1) stack:take_item()
if not destination_inventory:room_for_item(destination_list, new_stack) then source_inventory:set_stack(source_list, source_stack_id, stack)
return false destination_inventory:add_item(destination_list, new_stack)
return true
end
end end
stack:take_item() return false
source_inventory:set_stack(source_list, source_stack_id, stack)
destination_inventory:add_item(destination_list, new_stack)
return true
end end
--- Try pushing item from hopper inventory to destination inventory --- Try pushing item from hopper inventory to destination inventory
@ -324,23 +314,25 @@ function mcl_util.hopper_push(pos, dst_pos)
local dst_list = 'main' local dst_list = 'main'
local dst_inv, stack_id local dst_inv, stack_id
-- Find a inventory stack in the destination
if dst_def._mcl_hoppers_on_try_push then if dst_def._mcl_hoppers_on_try_push then
dst_inv, dst_list, stack_id = dst_def._mcl_hoppers_on_try_push(dst_pos, pos, hop_inv, hop_list) dst_inv, dst_list, stack_id = dst_def._mcl_hoppers_on_try_push(dst_pos, pos, hop_inv, hop_list)
else else
local dst_meta = minetest.get_meta(dst_pos) local dst_meta = minetest.get_meta(dst_pos)
dst_inv = dst_meta:get_inventory() dst_inv = dst_meta:get_inventory()
stack_id = mcl_util.select_stack(hop_inv, hop_list, dst_inv, dst_list, nil, 1) stack_id = mcl_util.select_stack(hop_inv, hop_list, dst_inv, dst_list)
end
if not stack_id then return false end
-- Move the item
local ok = mcl_util.move_item(hop_inv, hop_list, stack_id, dst_inv, dst_list)
if dst_def._mcl_hoppers_on_after_push then
dst_def._mcl_hoppers_on_after_push(dst_pos)
end end
return ok if stack_id ~= nil then
local ok = mcl_util.move_item(hop_inv, hop_list, stack_id, dst_inv, dst_list)
if dst_def._mcl_hoppers_on_after_push then
dst_def._mcl_hoppers_on_after_push(dst_pos)
end
if ok then
return true
end
end
return false
end end
-- Try pulling from source inventory to hopper inventory -- Try pulling from source inventory to hopper inventory
@ -365,7 +357,7 @@ function mcl_util.hopper_pull(pos, src_pos)
else else
local src_meta = minetest.get_meta(src_pos) local src_meta = minetest.get_meta(src_pos)
src_inv = src_meta:get_inventory() src_inv = src_meta:get_inventory()
stack_id = mcl_util.select_stack(src_inv, src_list, hop_inv, hop_list, nil, 1) stack_id = mcl_util.select_stack(src_inv, src_list, hop_inv, hop_list)
end end
if stack_id ~= nil then if stack_id ~= nil then

View File

@ -168,7 +168,7 @@ end
function boat.on_activate(self, staticdata, dtime_s) function boat.on_activate(self, staticdata, dtime_s)
self.object:set_armor_groups({fleshy = 125}) self.object:set_armor_groups({fleshy = 100})
local data = minetest.deserialize(staticdata) local data = minetest.deserialize(staticdata)
if type(data) == "table" then if type(data) == "table" then
self._v = data.v self._v = data.v

View File

@ -6,6 +6,9 @@ local pool = {}
local tick = false local tick = false
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
pool[player:get_player_name()] = 0 pool[player:get_player_name()] = 0
end) end)
@ -109,55 +112,6 @@ local function disable_physics(object, luaentity, ignore_check, reset_movement)
end end
end end
local function try_object_pickup(player, inv, object, checkpos)
if not inv then return end
local le = object:get_luaentity()
-- Check magnet timer
if not (le._magnet_timer >= 0) then return end
if not (le._magnet_timer < item_drop_settings.magnet_time) then return end
-- Don't try to collect again
if le._removed then return end
-- Ignore if itemstring is not set yet
if le.itemstring == "" then return end
-- Add what we can to the inventory
local itemstack = ItemStack(le.itemstring)
local leftovers = inv:add_item("main", itemstack )
check_pickup_achievements(object, player)
if leftovers:is_empty() then
-- Destroy entity
-- This just prevents this section to be run again because object:remove() doesn't remove the item immediately.
le.target = checkpos
le._removed = true
-- Stop the object
object:set_velocity(vector.zero())
object:set_acceleration(vector.zero())
object:move_to(checkpos)
-- Update sound pool
local name = player:get_player_name()
pool[name] = ( pool[name] or 0 ) + 1
-- Make sure the object gets removed
minetest.after(0.25, function()
--safety check
if object and object:get_luaentity() then
object:remove()
end
end)
else
-- Update entity itemstring
le.itemstring = leftovers:to_string()
end
end
minetest.register_globalstep(function(_) minetest.register_globalstep(function(_)
tick = not tick tick = not tick
@ -168,17 +122,17 @@ minetest.register_globalstep(function(_)
local pos = player:get_pos() local pos = player:get_pos()
if tick == true and (pool[name] or 0) > 0 then if tick == true and pool[name] > 0 then
minetest.sound_play("item_drop_pickup", { minetest.sound_play("item_drop_pickup", {
pos = pos, pos = pos,
gain = 0.3, gain = 0.3,
max_hear_distance = 16, max_hear_distance = 16,
pitch = math.random(70, 110) / 100 pitch = math.random(70, 110) / 100
}) })
if (pool[name] or 0) > 6 then if pool[name] > 6 then
pool[name] = 6 pool[name] = 6
else else
pool[name] = (pool[name] or 1) - 1 pool[name] = pool[name] - 1
end end
end end
@ -192,7 +146,40 @@ minetest.register_globalstep(function(_)
object:get_luaentity() and object:get_luaentity().name == "__builtin:item" and object:get_luaentity()._magnet_timer object:get_luaentity() and object:get_luaentity().name == "__builtin:item" and object:get_luaentity()._magnet_timer
and (object:get_luaentity()._insta_collect or (object:get_luaentity().age > item_drop_settings.age)) then and (object:get_luaentity()._insta_collect or (object:get_luaentity().age > item_drop_settings.age)) then
try_object_pickup( player, inv, object, checkpos ) if object:get_luaentity()._magnet_timer >= 0 and
object:get_luaentity()._magnet_timer < item_drop_settings.magnet_time and inv and
inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then
-- Collection
if not object:get_luaentity()._removed then
-- Ignore if itemstring is not set yet
if object:get_luaentity().itemstring ~= "" then
inv:add_item("main", ItemStack(object:get_luaentity().itemstring))
check_pickup_achievements(object, player)
-- Destroy entity
-- This just prevents this section to be run again because object:remove() doesn't remove the item immediately.
object:get_luaentity().target = checkpos
object:get_luaentity()._removed = true
object:set_velocity(vector.zero())
object:set_acceleration(vector.zero())
object:move_to(checkpos)
pool[name] = pool[name] + 1
minetest.after(0.25, function()
--safety check
if object and object:get_luaentity() then
object:remove()
end
end)
end
end
end
elseif not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "mcl_experience:orb" then elseif not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "mcl_experience:orb" then
local entity = object:get_luaentity() local entity = object:get_luaentity()
entity.collector = player:get_player_name() entity.collector = player:get_player_name()

View File

@ -322,7 +322,7 @@ function mob_class:toggle_sit(clicker,p)
particle = "mobs_mc_wolf_icon_roam.png" particle = "mobs_mc_wolf_icon_roam.png"
self.order = "roam" self.order = "roam"
self.state = "stand" self.state = "stand"
self.walk_chance = 50 self.walk_chance = default_walk_chance
self.jump = true self.jump = true
self:set_animation("stand") self:set_animation("stand")
-- TODO: Add sitting model -- TODO: Add sitting model

View File

@ -325,19 +325,12 @@ function mcl_mobs.register_mob(name, def)
_spawner = def._spawner, _spawner = def._spawner,
} }
minetest.register_entity(name, setmetatable(final_def,mcl_mobs.mob_class_meta))
if minetest.get_modpath("doc_identifier") ~= nil then if minetest.get_modpath("doc_identifier") ~= nil then
doc.sub.identifier.register_object(name, "basics", "mobs") doc.sub.identifier.register_object(name, "basics", "mobs")
if def.unused ~= true then
doc.add_entry("mobs", name, {
name = def.description or name,
data = final_def,
})
end
end end
minetest.register_entity(name, setmetatable(final_def,mcl_mobs.mob_class_meta))
end -- END mcl_mobs.register_mob function end -- END mcl_mobs.register_mob function
@ -374,7 +367,7 @@ function mcl_mobs.register_arrow(name, def)
rotate = def.rotate, rotate = def.rotate,
on_punch = def.on_punch or function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage) on_punch = def.on_punch or function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage)
local vel = self.object:get_velocity():length() local vel = self.object:get_velocity():length()
self.object:set_velocity(dir * vel) self.object:set_velocity({x=dir.x * vel, y=dir.y * vel, z=dir.z * vel})
self._puncher = puncher self._puncher = puncher
end, end,
collisionbox = def.collisionbox or {0, 0, 0, 0, 0, 0}, collisionbox = def.collisionbox or {0, 0, 0, 0, 0, 0},

View File

@ -87,8 +87,7 @@ function mob_class:check_item_pickup()
end end
if self.pick_up then if self.pick_up then
for k,v in pairs(self.pick_up) do for k,v in pairs(self.pick_up) do
local itemstack = ItemStack(l.itemstring) if not player_near(p) and self.on_pick_up and l.itemstring:find(v) then
if not player_near(p) and self.on_pick_up and itemstack:get_name():find(v) then
local r = self.on_pick_up(self,l) local r = self.on_pick_up(self,l)
if r and r.is_empty and not r:is_empty() then if r and r.is_empty and not r:is_empty() then
l.itemstring = r:to_string() l.itemstring = r:to_string()

View File

@ -1,7 +1,6 @@
local S = minetest.get_translator(minetest.get_current_modname()) local S = minetest.get_translator(minetest.get_current_modname())
local axolotl = { local axolotl = {
description = S("Axolotl"),
type = "animal", type = "animal",
spawn_class = "axolotl", spawn_class = "axolotl",
can_despawn = true, can_despawn = true,

View File

@ -30,7 +30,6 @@ local S = minetest.get_translator(minetest.get_current_modname())
--################### --###################
local cod = { local cod = {
description = S("Cod"),
type = "animal", type = "animal",
spawn_class = "water_ambient", spawn_class = "water_ambient",
can_despawn = true, can_despawn = true,

View File

@ -136,7 +136,7 @@ mcl_mobs.register_mob("mobs_mc:creeper", {
}) })
mcl_mobs.register_mob("mobs_mc:creeper_charged", { mcl_mobs.register_mob("mobs_mc:creeper_charged", {
description = S("Charged Creeper"), description = S("Creeper"),
type = "monster", type = "monster",
spawn_class = "hostile", spawn_class = "hostile",
hp_min = 20, hp_min = 20,

View File

@ -30,7 +30,6 @@ local S = minetest.get_translator(minetest.get_current_modname())
--################### --###################
local dolphin = { local dolphin = {
description = S("Dolphin"),
type = "animal", type = "animal",
spawn_class = "water", spawn_class = "water",
can_despawn = true, can_despawn = true,

View File

@ -126,14 +126,13 @@ mcl_mobs.register_arrow("mobs_mc:fireball", {
end, end,
hit_mob = function(self, mob) hit_mob = function(self, mob)
local name = mob:get_luaentity().name
mob:punch(self.object, 1.0, { mob:punch(self.object, 1.0, {
full_punch_interval = 1.0, full_punch_interval = 1.0,
damage_groups = {fleshy = 6}, damage_groups = {fleshy = 6},
}, nil) }, nil)
mcl_mobs.mob_class.boom(self,self.object:get_pos(), 1, true) mcl_mobs.mob_class.boom(self,self.object:get_pos(), 1, true)
local ent = mob:get_luaentity() local ent = mob:get_luaentity()
if (not ent or ent.health <= 0) and self._puncher and name == "mobs_mc:ghast" then if not ent or ent.health <= 0 then
awards.unlock(self._puncher:get_player_name(), "mcl:fireball_redir_serv") awards.unlock(self._puncher:get_player_name(), "mcl:fireball_redir_serv")
end end
end, end,

View File

@ -30,7 +30,6 @@ for i=1,4 do
end end
mcl_mobs.register_mob("mobs_mc:glow_squid", { mcl_mobs.register_mob("mobs_mc:glow_squid", {
description = S("Glow Squid"),
type = "animal", type = "animal",
spawn_class = "water_underground", spawn_class = "water_underground",
can_despawn = true, can_despawn = true,

View File

@ -122,10 +122,10 @@ local horse = {
stand_speed = 25, stand_speed = 25,
stand_start = 0, stand_start = 0,
stand_end = 0, stand_end = 0,
walk_speed = 100, walk_speed = 25,
walk_start = 0, walk_start = 0,
walk_end = 40, walk_end = 40,
run_speed = 200, run_speed = 60,
run_start = 0, run_start = 0,
run_end = 40, run_end = 40,
}, },
@ -543,6 +543,11 @@ donkey.description = S("Donkey")
donkey.textures = {{"blank.png", "mobs_mc_donkey.png", "blank.png"}} donkey.textures = {{"blank.png", "mobs_mc_donkey.png", "blank.png"}}
donkey.spawn_in_group = 3 donkey.spawn_in_group = 3
donkey.spawn_in_group_min = 1 donkey.spawn_in_group_min = 1
donkey.animation = {
speed_normal = 25,
stand_start = 0, stand_end = 0,
walk_start = 0, walk_end = 40,
}
donkey.sounds = { donkey.sounds = {
random = "mobs_mc_donkey_random", random = "mobs_mc_donkey_random",
damage = "mobs_mc_donkey_hurt", damage = "mobs_mc_donkey_hurt",

View File

@ -16,13 +16,6 @@ local trading_items = {
{ itemstring = "mcl_throwing:ender_pearl", amount_min = 2, amount_max = 6 }, { itemstring = "mcl_throwing:ender_pearl", amount_min = 2, amount_max = 6 },
{ itemstring = "mcl_potions:fire_resistance", amount_min = 1, amount_max = 1 }, { itemstring = "mcl_potions:fire_resistance", amount_min = 1, amount_max = 1 },
{ itemstring = "mcl_potions:fire_resistance_splash", amount_min = 1, amount_max = 1 }, { itemstring = "mcl_potions:fire_resistance_splash", amount_min = 1, amount_max = 1 },
{ itemstring = "mcl_enchanting:book_enchanted", amount_min = 1, amount_max = 1 },
{ itemstring = "mcl_armor:boots_iron_enchanted", amount_min = 1, amount_max = 1 },
{ itemstring = "mcl_blackstone:blackstone", amount_min = 8, amount_max = 16 },
{ itemstring = "mcl_bows:arrow", amount_min = 6, amount_max = 12 },
{ itemstring = "mcl_core:crying_obsidian", amount_min = 1, amount_max = 1 },
{ itemstring = "mcl_fire:fire_charge", amount_min = 1, amount_max = 1 },
--{ itemstring = "FIXME:spectral_arrow", amount_min = 6, amount_max = 12 },
} }
local S = minetest.get_translator("mobs_mc") local S = minetest.get_translator("mobs_mc")
@ -149,18 +142,14 @@ local piglin = {
local c_pos = self.object:get_pos() local c_pos = self.object:get_pos()
if c_pos then if c_pos then
self.what_traded = trading_items[math.random(#trading_items)] self.what_traded = trading_items[math.random(#trading_items)]
local stack = ItemStack(self.what_traded.itemstring) for x = 1, math.random(self.what_traded.amount_min, self.what_traded.amount_max) do
stack:set_count(math.random(self.what_traded.amount_min, self.what_traded.amount_max)) local p = c_pos
if mcl_enchanting.is_enchanted(self.what_traded.itemstring) then local nn=minetest.find_nodes_in_area_under_air(vector.offset(c_pos,-1,-1,-1),vector.offset(c_pos,1,1,1),{"group:solid"})
local enchantment = "soul_speed" if nn and #nn > 0 then
mcl_enchanting.enchant(stack, enchantment, mcl_enchanting.random(nil, 1, mcl_enchanting.enchantments[enchantment].max_level)) p = vector.offset(nn[math.random(#nn)],0,1,0)
end
minetest.add_item(p, self.what_traded.itemstring)
end end
local p = c_pos
local nn=minetest.find_nodes_in_area_under_air(vector.offset(c_pos,-1,-1,-1),vector.offset(c_pos,1,1,1),{"group:solid"})
if nn and #nn > 0 then
p = vector.offset(nn[math.random(#nn)],0,1,0)
end
minetest.add_item(p, stack)
end end
end) end)
end end
@ -343,13 +332,8 @@ mcl_mobs.register_mob("mobs_mc:baby_zombified_piglin", baby_zombified_piglin)
-- Compatibility code. These were removed, and now are called zombie piglins. They don't spawn. -- Compatibility code. These were removed, and now are called zombie piglins. They don't spawn.
-- This is only to catch old cases. Maybe could be an alias? -- This is only to catch old cases. Maybe could be an alias?
local pigman_unused = table.copy(zombified_piglin) mcl_mobs.register_mob("mobs_mc:pigman", zombified_piglin)
pigman_unused.unused = true mcl_mobs.register_mob("mobs_mc:baby_pigman", baby_zombified_piglin)
local baby_pigman_unused = table.copy(baby_zombified_piglin)
baby_pigman_unused.unused = true
mcl_mobs.register_mob("mobs_mc:pigman", pigman_unused)
mcl_mobs.register_mob("mobs_mc:baby_pigman", baby_pigman_unused)
-- Piglin Brute -- -- Piglin Brute --

View File

@ -10,7 +10,6 @@ local S = minetest.get_translator(minetest.get_current_modname())
--################### --###################
local salmon = { local salmon = {
description = S("Salmon"),
type = "animal", type = "animal",
spawn_class = "water_ambient", spawn_class = "water_ambient",
can_despawn = true, can_despawn = true,

View File

@ -176,7 +176,7 @@ end
-- Slime -- Slime
local slime_big = { local slime_big = {
description = S("Slime - big"), description = S("Slime"),
type = "monster", type = "monster",
spawn_class = "hostile", spawn_class = "hostile",
group_attack = { "mobs_mc:slime_big", "mobs_mc:slime_small", "mobs_mc:slime_tiny" }, group_attack = { "mobs_mc:slime_big", "mobs_mc:slime_small", "mobs_mc:slime_tiny" },
@ -231,7 +231,6 @@ local slime_big = {
mcl_mobs.register_mob("mobs_mc:slime_big", slime_big) mcl_mobs.register_mob("mobs_mc:slime_big", slime_big)
local slime_small = table.copy(slime_big) local slime_small = table.copy(slime_big)
slime_small.description = S("Slime - small")
slime_small.sounds.base_pitch = 1.15 slime_small.sounds.base_pitch = 1.15
slime_small.hp_min = 4 slime_small.hp_min = 4
slime_small.hp_max = 4 slime_small.hp_max = 4
@ -249,7 +248,6 @@ slime_small.on_die = spawn_children_on_die("mobs_mc:slime_tiny", 0.6, 1.0)
mcl_mobs.register_mob("mobs_mc:slime_small", slime_small) mcl_mobs.register_mob("mobs_mc:slime_small", slime_small)
local slime_tiny = table.copy(slime_big) local slime_tiny = table.copy(slime_big)
slime_tiny.description = S("Slime - tiny")
slime_tiny.sounds.base_pitch = 1.3 slime_tiny.sounds.base_pitch = 1.3
slime_tiny.hp_min = 1 slime_tiny.hp_min = 1
slime_tiny.hp_max = 1 slime_tiny.hp_max = 1
@ -399,7 +397,7 @@ swamp_max)
-- Magma cube -- Magma cube
local magma_cube_big = { local magma_cube_big = {
description = S("Magma Cube - big"), description = S("Magma Cube"),
type = "monster", type = "monster",
spawn_class = "hostile", spawn_class = "hostile",
hp_min = 16, hp_min = 16,
@ -460,7 +458,6 @@ local magma_cube_big = {
mcl_mobs.register_mob("mobs_mc:magma_cube_big", magma_cube_big) mcl_mobs.register_mob("mobs_mc:magma_cube_big", magma_cube_big)
local magma_cube_small = table.copy(magma_cube_big) local magma_cube_small = table.copy(magma_cube_big)
magma_cube_small.description = S("Magma Cube - small")
magma_cube_small.sounds.jump = "mobs_mc_magma_cube_small" magma_cube_small.sounds.jump = "mobs_mc_magma_cube_small"
magma_cube_small.sounds.death = "mobs_mc_magma_cube_small" magma_cube_small.sounds.death = "mobs_mc_magma_cube_small"
magma_cube_small.hp_min = 4 magma_cube_small.hp_min = 4
@ -482,7 +479,6 @@ magma_cube_small.on_die = spawn_children_on_die("mobs_mc:magma_cube_tiny", 0.6,
mcl_mobs.register_mob("mobs_mc:magma_cube_small", magma_cube_small) mcl_mobs.register_mob("mobs_mc:magma_cube_small", magma_cube_small)
local magma_cube_tiny = table.copy(magma_cube_big) local magma_cube_tiny = table.copy(magma_cube_big)
magma_cube_tiny.description = S("Magma Cube - tiny")
magma_cube_tiny.sounds.jump = "mobs_mc_magma_cube_small" magma_cube_tiny.sounds.jump = "mobs_mc_magma_cube_small"
magma_cube_tiny.sounds.death = "mobs_mc_magma_cube_small" magma_cube_tiny.sounds.death = "mobs_mc_magma_cube_small"
magma_cube_tiny.sounds.base_pitch = 1.25 magma_cube_tiny.sounds.base_pitch = 1.25

View File

@ -11,7 +11,6 @@ local S = minetest.get_translator("mobs_mc")
local strider = { local strider = {
description = S("Strider"),
type = "animal", type = "animal",
passive = true, passive = true,
spawn_class = "passive", spawn_class = "passive",
@ -31,8 +30,6 @@ local strider = {
} }, } },
visual_size = {x=3, y=3}, visual_size = {x=3, y=3},
sounds = { sounds = {
eat = "mobs_mc_animal_eat_generic",
distance = 16,
}, },
jump = true, jump = true,
makes_footstep_sound = true, makes_footstep_sound = true,
@ -54,7 +51,6 @@ local strider = {
walk_start = 1, walk_start = 1,
walk_end = 20, walk_end = 20,
}, },
follow = { "mcl_crimson:warped_fungus" },
lava_damage = 0, lava_damage = 0,
fire_damage = 0, fire_damage = 0,
light_damage = 0, light_damage = 0,
@ -71,13 +67,8 @@ local strider = {
do_custom = function(self, dtime) do_custom = function(self, dtime)
if minetest.find_node_near(self.object:get_pos(), 2, {"mcl_core:lava_source","mcl_core:lava_flowing","mcl_nether:nether_lava_source","mcl_nether:nether_lava_flowing"}) then if minetest.find_node_near(self.object:get_pos(), 2, {"mcl_core:lava_source","mcl_core:lava_flowing","mcl_nether:nether_lava_source","mcl_nether:nether_lava_flowing"}) then
if self.driver then self.walk_velocity = 2
self.walk_velocity = 4 self.run_velocity = 4
self.run_velocity = 8
else
self.walk_velocity = 2
self.run_velocity = 4
end
self.base_texture[1] = "extra_mobs_strider.png" self.base_texture[1] = "extra_mobs_strider.png"
self.shaking = false self.shaking = false
else else
@ -131,7 +122,7 @@ local strider = {
local wielditem = clicker:get_wielded_item() local wielditem = clicker:get_wielded_item()
if wielditem:get_name() == "mcl_crimson:warped_fungus" then if wielditem:get_name() ~= "mcl_crimson:warped_fungus" then
if self:feed_tame(clicker, 1, true, true) then return end if self:feed_tame(clicker, 1, true, true) then return end
end end
@ -206,7 +197,6 @@ mcl_mobs.register_mob("mobs_mc:strider", strider)
-- Baby strider. -- Baby strider.
local baby_strider = table.copy(strider) local baby_strider = table.copy(strider)
baby_strider.description = S("Baby Strider")
baby_strider.collisionbox = {-.3, -0.01, -.3, .3, 0.94, .3} baby_strider.collisionbox = {-.3, -0.01, -.3, .3, 0.94, .3}
baby_strider.xp_min = 13 baby_strider.xp_min = 13
baby_strider.xp_max = 13 baby_strider.xp_max = 13
@ -216,7 +206,7 @@ textures = { {
} } } }
baby_strider.walk_velocity = 1.2 baby_strider.walk_velocity = 1.2
baby_strider.run_velocity = 2.4 baby_strider.run_velocity = 2.4
baby_strider.child = true baby_strider.child = 1
mcl_mobs.register_mob("mobs_mc:baby_strider", baby_strider) mcl_mobs.register_mob("mobs_mc:baby_strider", baby_strider)

View File

@ -58,7 +58,6 @@ local function set_textures(self)
end end
local tropical_fish = { local tropical_fish = {
description = S("Tropical Fish"),
type = "animal", type = "animal",
spawn_class = "water_ambient", spawn_class = "water_ambient",
can_despawn = true, can_despawn = true,

View File

@ -1989,17 +1989,6 @@ local trade_inventory = {
-- Otherwise, 20% chance to unlock if used freshly reset trade -- Otherwise, 20% chance to unlock if used freshly reset trade
unlock_stuff = true unlock_stuff = true
end end
-- calculate xp based on the price
local emeralds = 0
if wanted1:get_name() == "mcl_core:emerald" then
emeralds = wanted1:get_count()
elseif wanted2:get_name() == "mcl_core:emerald" then
emeralds = wanted2:get_count()
else
local offered = inv:get_stack("offered", 1)
emeralds = offered:get_name() == "mcl_core:emerald" and offered:get_count() or 0
end
local xp = 2 + math.ceil(emeralds / (64/4)) -- 1..64 emeralds = 3..6 xp
local update_formspec = false local update_formspec = false
if unlock_stuff then if unlock_stuff then
-- First-time trade unlock all trades and unlock next trade tier -- First-time trade unlock all trades and unlock next trade tier
@ -2011,7 +2000,6 @@ local trade_inventory = {
set_textures(trader) set_textures(trader)
update_max_tradenum(trader) update_max_tradenum(trader)
update_formspec = true update_formspec = true
xp = xp + 5
end end
for t=1, #trades do for t=1, #trades do
trades[t].locked = false trades[t].locked = false
@ -2022,7 +2010,6 @@ local trade_inventory = {
-- TODO: Replace by Regeneration I -- TODO: Replace by Regeneration I
trader.health = math.min(trader.hp_max, trader.health + 4) trader.health = math.min(trader.hp_max, trader.health + 4)
end end
mcl_experience.add_xp(player, xp)
trade.trade_counter = trade.trade_counter + 1 trade.trade_counter = trade.trade_counter + 1
mcl_log("Trade counter is: ".. trade.trade_counter) mcl_log("Trade counter is: ".. trade.trade_counter)
-- Semi-randomly lock trade for repeated trade (not if there's only 1 trade) -- Semi-randomly lock trade for repeated trade (not if there's only 1 trade)
@ -2060,7 +2047,6 @@ local trade_inventory = {
if update_formspec then if update_formspec then
show_trade_formspec(name, trader, tradenum) show_trade_formspec(name, trader, tradenum)
end end
else else
minetest.log("error", "[mobs_mc] Player took item from trader output but player_trading_with or player_tradenum is nil!") minetest.log("error", "[mobs_mc] Player took item from trader output but player_trading_with or player_tradenum is nil!")
end end

View File

@ -135,7 +135,6 @@ end
-- Tamed wolf (aka “dog”) -- Tamed wolf (aka “dog”)
local dog = table.copy(wolf) local dog = table.copy(wolf)
dog.description = S("Dog")
dog.can_despawn = false dog.can_despawn = false
dog.passive = true dog.passive = true
dog.hp_min = 20 dog.hp_min = 20

View File

@ -53,7 +53,7 @@ doc.data = {}
doc.data.categories = {} doc.data.categories = {}
doc.data.aliases = {} doc.data.aliases = {}
-- Default order (includes categories of other mods from the Docuentation System modpack) -- Default order (includes categories of other mods from the Docuentation System modpack)
doc.data.category_order = {"basics", "nodes", "tools", "craftitems", "advanced", "mobs"} doc.data.category_order = {"basics", "nodes", "tools", "craftitems", "advanced"}
doc.data.category_count = 0 doc.data.category_count = 0
doc.data.players = {} doc.data.players = {}

View File

@ -116,11 +116,7 @@ function doc_identifier.identify(itemstack, user, pointed_thing)
end end
-- A known registered object -- A known registered object
elseif ro then elseif ro then
if doc.entry_exists("mobs", le.name) then doc.show_entry(username, ro.category, ro.entry, true)
doc.show_entry(username, "mobs", le.name, true)
else
doc.show_entry(username, ro.category, ro.entry, true)
end
-- Undefined object (error) -- Undefined object (error)
elseif minetest.registered_entities[le.name] == nil then elseif minetest.registered_entities[le.name] == nil then
show_message(username, "error_unknown", le.name) show_message(username, "error_unknown", le.name)

View File

@ -1136,86 +1136,6 @@ doc.add_category("craftitems", {
end end
}) })
doc.add_category("mobs", {
name = S("Mobs"),
description = S("different mobs"),
build_formspec = function(data, playername)
if data then
local datastring = ""
if data.description then
datastring = datastring .. S("Description: @1", data.description)
datastring = newline2(datastring)
end
if data.type then
datastring = datastring .. S("Type: @1", data.type)
datastring = newline2(datastring)
end
if data.spawn_class then
datastring = datastring .. S("spawn class: @1", data.spawn_class)
datastring = newline2(datastring)
end
if data.jump then
datastring = datastring .. S("Can Jump")
datastring = newline2(datastring)
end
if data.fly then
datastring = datastring .. S("Can Fly")
datastring = newline2(datastring)
end
if data.drops then
count = 0
for _,item in ipairs(data.drops) do
count = count + 1
end
if count > 0 then
datastring = datastring .. S("drops: ")
datastring = newline(datastring)
for _,item in ipairs(data.drops) do
local itemDescription = ItemStack(item.name):get_short_description()
datastring = datastring .. itemDescription
datastring = newline(datastring)
end
datastring = newline2(datastring)
end
end
if data.follow then
datastring = datastring .. S("follows player when these items are held:")
datastring = newline(datastring)
if type(data.follow) == "string" then
datastring = datastring .. data.follow
datastring = newline(datastring)
else
for i=1, #data.follow do
local itemstring = data.follow[i]
local itemDescription = ItemStack(itemstring):get_short_description()
datastring = datastring .. itemDescription
datastring = newline(datastring)
end
end
datastring = newline2(datastring)
end
local formstring = doc.widgets.text(datastring, nil, nil, doc.FORMSPEC.ENTRY_WIDTH - 1.2)
return formstring
else
return "label[0,1;NO DATA AVALIABLE!]"
end
end
})
-- Register group definition stuff -- Register group definition stuff
-- More (user-)friendly group names to replace the rather technical names -- More (user-)friendly group names to replace the rather technical names
-- for better understanding -- for better understanding

View File

@ -106,31 +106,6 @@ local item_lists = {
"craftpreview", "craftpreview",
} }
local function init_data(name)
player_data[name] = {
filter = "",
pagenum = 1,
iX = sfinv_only and 8 or DEFAULT_SIZE,
items = init_items,
items_raw = init_items,
lang_code = M.get_player_information(name).lang_code or 'en',
}
end
local function get_player_data(name)
-- If the data alrady exists, use it
local data = player_data[name]
if data then return data end
-- Initialize player data if it doesn't exist
init_data(name)
local player = minetest.get_player_by_name(name)
local meta = player:get_meta()
local data = player_data[name]
data.inv_items = deserialize(meta:get_string("inv_items")) or {}
return data
end
local function table_merge(t, t2) local function table_merge(t, t2)
t, t2 = t or {}, t2 or {} t, t2 = t or {}, t2 or {}
local c = #t local c = #t
@ -649,7 +624,7 @@ local function get_recipe_fs(data, iY)
end end
local function make_formspec(name) local function make_formspec(name)
local data = get_player_data(name) local data = player_data[name]
local iY = sfinv_only and 4 or data.iX - 5 local iY = sfinv_only and 4 or data.iX - 5
local ipp = data.iX * iY local ipp = data.iX * iY
@ -856,6 +831,17 @@ local function get_inv_items(player)
return inv_items return inv_items
end end
local function init_data(name)
player_data[name] = {
filter = "",
pagenum = 1,
iX = sfinv_only and 8 or DEFAULT_SIZE,
items = init_items,
items_raw = init_items,
lang_code = M.get_player_information(name).lang_code or 'en',
}
end
local function reset_data(data) local function reset_data(data)
data.filter = "" data.filter = ""
data.pagenum = 1 data.pagenum = 1
@ -891,7 +877,7 @@ end
local function on_receive_fields(player, fields) local function on_receive_fields(player, fields)
local name = player:get_player_name() local name = player:get_player_name()
local data = get_player_data(name) local data = player_data[name]
for elem_name, def in pairs(formspec_elements) do for elem_name, def in pairs(formspec_elements) do
if fields[elem_name] and def.action then if fields[elem_name] and def.action then
@ -995,7 +981,7 @@ if sfinv_only then
on_enter = function(self, player, context) on_enter = function(self, player, context)
if next(recipe_filters) then if next(recipe_filters) then
local name = player:get_player_name() local name = player:get_player_name()
local data = get_player_data(name) local data = player_data[name]
data.items_raw = get_filtered_items(player) data.items_raw = get_filtered_items(player)
search(data) search(data)
@ -1019,7 +1005,7 @@ else
local name = user:get_player_name() local name = user:get_player_name()
if next(recipe_filters) then if next(recipe_filters) then
local data = get_player_data(name) local data = player_data[name]
data.items_raw = get_filtered_items(user) data.items_raw = get_filtered_items(user)
search(data) search(data)
end end
@ -1065,7 +1051,7 @@ if progressive_mode then
local function progressive_filter(recipes, player) local function progressive_filter(recipes, player)
local name = player:get_player_name() local name = player:get_player_name()
local data = get_player_data(name) local data = player_data[name]
if #data.inv_items == 0 then if #data.inv_items == 0 then
return {} return {}
@ -1090,7 +1076,7 @@ if progressive_mode then
for i = 1, #players do for i = 1, #players do
local player = players[i] local player = players[i]
local name = player:get_player_name() local name = player:get_player_name()
local data = get_player_data(name) local data = player_data[name]
local inv_items = get_inv_items(player) local inv_items = get_inv_items(player)
local diff = table_diff(inv_items, data.inv_items) local diff = table_diff(inv_items, data.inv_items)
@ -1109,7 +1095,12 @@ if progressive_mode then
mcl_craftguide.add_recipe_filter("Default progressive filter", progressive_filter) mcl_craftguide.add_recipe_filter("Default progressive filter", progressive_filter)
M.register_on_joinplayer(function(player) M.register_on_joinplayer(function(player)
get_player_data(player:get_player_name()) local name = player:get_player_name()
init_data(name)
local meta = player:get_meta()
local data = player_data[name]
data.inv_items = deserialize(meta:get_string("inv_items")) or {}
end) end)
local function save_meta(player) local function save_meta(player)
@ -1154,7 +1145,7 @@ end
function mcl_craftguide.show(name) function mcl_craftguide.show(name)
local player = get_player_by_name(name) local player = get_player_by_name(name)
if next(recipe_filters) then if next(recipe_filters) then
local data = get_player_data(name) local data = player_data[name]
data.items_raw = get_filtered_items(player) data.items_raw = get_filtered_items(player)
search(data) search(data)
end end

View File

@ -76,7 +76,6 @@ function tt.reload_itemstack_description(itemstack)
orig_desc = minetest.colorize(tt.NAME_COLOR, meta:get_string("name")) orig_desc = minetest.colorize(tt.NAME_COLOR, meta:get_string("name"))
end end
local desc = apply_snippets(orig_desc, itemstring, toolcaps or def.tool_capabilities, itemstack) local desc = apply_snippets(orig_desc, itemstring, toolcaps or def.tool_capabilities, itemstack)
if desc == def.description and meta:get_string("description") == "" then return end
meta:set_string("description", desc) meta:set_string("description", desc)
end end
end end

View File

@ -142,6 +142,7 @@ minetest.register_entity("mcl_experience:orb", {
delete_timer = 0, delete_timer = 0,
radius = 4, radius = 4,
on_activate = function(self, staticdata, dtime_s) on_activate = function(self, staticdata, dtime_s)
self.object:set_velocity(vector.new( self.object:set_velocity(vector.new(
math.random(-2,2)*math.random(), math.random(-2,2)*math.random(),
@ -151,14 +152,10 @@ minetest.register_entity("mcl_experience:orb", {
self.object:set_armor_groups({immortal = 1}) self.object:set_armor_groups({immortal = 1})
self.object:set_velocity({x = 0, y = 2, z = 0}) self.object:set_velocity({x = 0, y = 2, z = 0})
self.object:set_acceleration(gravity) self.object:set_acceleration(gravity)
local xp = tonumber(staticdata)
-- Assign 0 xp in case the entity was persisted even though it should not have been (static_save = false)
-- This was a minetest bug for a while: https://github.com/minetest/minetest/issues/14420
local xp = tonumber(staticdata) or 0
self._xp = xp self._xp = xp
size = xp_to_size(xp) size = xp_to_size(xp)
self.object:set_properties({
self.object:set_properties({
visual_size = {x = size, y = size}, visual_size = {x = size, y = size},
glow = 14, glow = 14,
}) })

View File

@ -204,8 +204,7 @@ local function init(player)
local playername = player:get_player_name() local playername = player:get_player_name()
minetest.create_detached_inventory("creative_" .. playername, { minetest.create_detached_inventory("creative_" .. playername, {
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
if minetest.is_creative_enabled(playername) and if minetest.is_creative_enabled(playername) then
from_list ~= to_list then
return count return count
else else
return 0 return 0
@ -542,6 +541,7 @@ function mcl_inventory.set_creative_formspec(player)
"style[" .. this_tab .. ";border=false;bgimg=;bgimg_pressed=;noclip=true]", "style[" .. this_tab .. ";border=false;bgimg=;bgimg_pressed=;noclip=true]",
"image[" .. offset[this_tab] .. ";1.5,1.44;" .. bg_img .. "]", "image[" .. offset[this_tab] .. ";1.5,1.44;" .. bg_img .. "]",
"item_image_button[" .. boffset[this_tab] .. ";1,1;" .. tab_icon[this_tab] .. ";" .. this_tab .. ";]", "item_image_button[" .. boffset[this_tab] .. ";1,1;" .. tab_icon[this_tab] .. ";" .. this_tab .. ";]",
"tooltip[blocks;" .. F(filtername[this_tab]) .. "]"
}) })
end end
@ -570,33 +570,20 @@ function mcl_inventory.set_creative_formspec(player)
listrings, listrings,
tab(name, "blocks") .. tab(name, "blocks"),
"tooltip[blocks;"..F(filtername["blocks"]).."]".. tab(name, "deco"),
tab(name, "deco") .. tab(name, "redstone"),
"tooltip[deco;"..F(filtername["deco"]).."]".. tab(name, "rail"),
tab(name, "redstone") .. tab(name, "misc"),
"tooltip[redstone;"..F(filtername["redstone"]).."]".. tab(name, "nix"),
tab(name, "rail") ..
"tooltip[rail;"..F(filtername["rail"]).."]"..
tab(name, "misc") ..
"tooltip[misc;"..F(filtername["misc"]).."]"..
tab(name, "nix") ..
"tooltip[nix;"..F(filtername["nix"]).."]"..
tab(name, "food") .. tab(name, "food"),
"tooltip[food;"..F(filtername["food"]).."]".. tab(name, "tools"),
tab(name, "tools") .. tab(name, "combat"),
"tooltip[tools;"..F(filtername["tools"]).."]".. tab(name, "mobs"),
tab(name, "combat") .. tab(name, "brew"),
"tooltip[combat;"..F(filtername["combat"]).."]".. tab(name, "matr"),
tab(name, "mobs") .. tab(name, "inv"),
"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"]).."]"
}) })
if name == "nix" then if name == "nix" then
@ -607,7 +594,6 @@ function mcl_inventory.set_creative_formspec(player)
formspec = formspec .. table.concat({ formspec = formspec .. table.concat({
"field[5.325,0.15;6.1,0.6;search;;" .. minetest.formspec_escape(filter) .. "]", "field[5.325,0.15;6.1,0.6;search;;" .. minetest.formspec_escape(filter) .. "]",
"field_close_on_enter[search;false]", "field_close_on_enter[search;false]",
"field_enter_after_edit[search;true]",
"set_focus[search;true]", "set_focus[search;true]",
}) })
end end

View File

@ -36,14 +36,9 @@ function mcl_inventory.register_survival_inventory_tab(def)
end end
local player_current_tab = {} local player_current_tab = {}
function get_player_tab(player)
local tab = player_current_tab[player] or "main"
player_current_tab[player] = tab
return tab
end
minetest.register_on_joinplayer(function(player, last_login) minetest.register_on_joinplayer(function(player, last_login)
get_player_tab(player) player_current_tab[player] = "main"
end) end)
minetest.register_on_leaveplayer(function(player, timed_out) minetest.register_on_leaveplayer(function(player, timed_out)
@ -189,7 +184,7 @@ function mcl_inventory.build_survival_formspec(player)
inv:set_width("craft", 2) inv:set_width("craft", 2)
inv:set_size("craft", 4) inv:set_size("craft", 4)
local tab = get_player_tab(player) local tab = player_current_tab[player]
local tab_def = nil local tab_def = nil
@ -218,7 +213,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end end
for _, d in ipairs(mcl_inventory.registered_survival_inventory_tabs) do for _, d in ipairs(mcl_inventory.registered_survival_inventory_tabs) do
if get_player_tab(player) == d.id and d.access(player) then if player_current_tab[player] == d.id and d.access(player) then
d.handle(player, fields) d.handle(player, fields)
return return
end end

View File

@ -16,31 +16,19 @@ local function offhand_get_count(player)
return mcl_offhand.get_offhand(player):get_count() return mcl_offhand.get_offhand(player):get_count()
end end
local function get_offhand(player) minetest.register_on_joinplayer(function(player, last_login)
-- Get offhand data if it already exists mcl_offhand[player] = {
local offhand = mcl_offhand[player]
if offhand then return offhand end
-- Otherwise initialize it
offhand = {
hud = {}, hud = {},
last_wear = offhand_get_wear(player), last_wear = offhand_get_wear(player),
last_count = offhand_get_count(player), last_count = offhand_get_count(player),
} }
mcl_offhand[player] = offhand
return offhand
end
minetest.register_on_joinplayer(function(player, last_login)
get_offhand(player)
end) end)
local function remove_hud(player, hud) local function remove_hud(player, hud)
local offhand = get_offhand(player) local offhand_hud = mcl_offhand[player].hud[hud]
local offhand_hud = offhand.hud[hud]
if offhand_hud then if offhand_hud then
player:hud_remove(offhand_hud) player:hud_remove(offhand_hud)
offhand.hud[hud] = nil mcl_offhand[player].hud[hud] = nil
end end
end end
@ -60,8 +48,7 @@ local function update_wear_bar(player, itemstack)
else else
color = {255, 511 - wear_i, 0} color = {255, 511 - wear_i, 0}
end end
local offhand = get_offhand(player) local wear_bar = mcl_offhand[player].hud.wear_bar
local wear_bar = offhand.hud.wear_bar
player:hud_change(wear_bar, "text", "mcl_wear_bar.png^[colorize:#" .. rgb_to_hex(color[1], color[2], color[3])) player:hud_change(wear_bar, "text", "mcl_wear_bar.png^[colorize:#" .. rgb_to_hex(color[1], color[2], color[3]))
player:hud_change(wear_bar, "scale", {x = 40 * wear_bar_percent, y = 3}) player:hud_change(wear_bar, "scale", {x = 40 * wear_bar_percent, y = 3})
player:hud_change(wear_bar, "offset", {x = -320 - (20 - player:hud_get(wear_bar).scale.x / 2), y = -13}) player:hud_change(wear_bar, "offset", {x = -320 - (20 - player:hud_get(wear_bar).scale.x / 2), y = -13})
@ -71,8 +58,7 @@ minetest.register_globalstep(function(dtime)
for _, player in pairs(minetest.get_connected_players()) do for _, player in pairs(minetest.get_connected_players()) do
local itemstack = mcl_offhand.get_offhand(player) local itemstack = mcl_offhand.get_offhand(player)
local offhand_item = itemstack:get_name() local offhand_item = itemstack:get_name()
local offhand = get_offhand(player) local offhand_hud = mcl_offhand[player].hud
local offhand_hud = offhand.hud
local item = minetest.registered_items[offhand_item] local item = minetest.registered_items[offhand_item]
if offhand_item ~= "" and item then if offhand_item ~= "" and item then
local item_texture = item.inventory_image .. "^[resize:" .. max_offhand_px .. "x" .. max_offhand_px local item_texture = item.inventory_image .. "^[resize:" .. max_offhand_px .. "x" .. max_offhand_px
@ -159,8 +145,7 @@ minetest.register_globalstep(function(dtime)
end end
elseif offhand_hud.slot then elseif offhand_hud.slot then
local offhand = get_offhand(player) for index, _ in pairs(mcl_offhand[player].hud) do
for index, _ in pairs(offhand.hud) do
remove_hud(player, index) remove_hud(player, index)
end end
end end

View File

@ -77,31 +77,16 @@ local function rotate(pos, node, user, mode, new_param2)
end end
local creative_dig = {}
local function destruct_bed(pos, oldnode) local function destruct_bed(pos, oldnode)
local node = oldnode or minetest_get_node_or_nil(pos) local node = oldnode or minetest_get_node_or_nil(pos)
if not node then return end if not node then return end
local pos2, node2, bottom = get_bed_next_node(pos, oldnode) local pos2, node2, bottom = get_bed_next_node(pos, oldnode)
-- Check creative dig flags and don't drop an item if the bed was dug by a player in
-- creative mode
local pos_hash = minetest.hash_node_position(pos)
local pos2_hash = minetest.hash_node_position(pos2)
local creative_mode = creative_dig[pos_hash] or creative_dig[pos2_hash]
if bottom then if bottom then
if node2 and string.sub(node2.name, -4) == "_top" then if node2 and string.sub(node2.name, -4) == "_top" then
minetest_remove_node(pos2) minetest_remove_node(pos2)
end end
-- Drop the bed only when removing the top to prevent duplication and only if
-- it wasn't dug by a player in creative mode
local bed_node_def = minetest.registered_nodes[node.name]
if bed_node_def and bed_node_def._mcl_beds_drop and not creative_mode then
local stack = ItemStack(bed_node_def._mcl_beds_drop)
minetest.add_item(pos2, stack)
end
else else
if node2 and string.sub(node2.name, -7) == "_bottom" then if node2 and string.sub(node2.name, -7) == "_bottom" then
minetest_remove_node(pos2) minetest_remove_node(pos2)
@ -109,29 +94,6 @@ local function destruct_bed(pos, oldnode)
end end
end end
local function dig_bed(pos, node, digger)
local pos_hash = minetest.hash_node_position(pos)
if digger then
local name = digger:get_player_name()
if minetest.is_protected(pos, name) then
minetest.record_protection_violation(pos, name)
return
end
-- Set creative dig flags to stop dropping items
if minetest.is_creative_enabled(name) then
creative_dig[pos_hash] = true
end
end
-- Trigger the destruct_bed function
minetest.remove_node(pos)
-- Clean up creative dig flag
creative_dig[pos_hash] = nil
end
local function kick_player_after_destruct(destruct_pos) local function kick_player_after_destruct(destruct_pos)
for name, player_bed_pos in pairs(mcl_beds.bed_pos) do for name, player_bed_pos in pairs(mcl_beds.bed_pos) do
if vector.distance(destruct_pos, player_bed_pos) < 0.1 then if vector.distance(destruct_pos, player_bed_pos) < 0.1 then
@ -164,26 +126,6 @@ if minetest.get_modpath("mcl_sounds") then
}) })
end end
local function place_bed(name, placer, pos, dir)
local botpos = vector_add(pos, minetest_facedir_to_dir(dir))
if minetest.is_protected(botpos, placer:get_player_name()) and
not minetest.check_player_privs(placer, "protection_bypass") then
minetest.record_protection_violation(botpos, placer:get_player_name())
return false
end
local botdef = minetest.registered_nodes[minetest_get_node(botpos).name]
if not botdef or not botdef.buildable_to then
return false
end
minetest.set_node(pos, {name = name .. "_bottom", param2 = dir})
minetest.set_node(botpos, {name = name .. "_top", param2 = dir})
return true
end
function mcl_beds.register_bed(name, def) function mcl_beds.register_bed(name, def)
local common_box = { local common_box = {
type = "fixed", type = "fixed",
@ -214,8 +156,7 @@ function mcl_beds.register_bed(name, def)
sounds = def.sounds or default_sounds, sounds = def.sounds or default_sounds,
selection_box = common_box, selection_box = common_box,
collision_box = common_box, collision_box = common_box,
_mcl_beds_drop = def.recipe and name or "", drop = def.recipe and name or "",
drop = "",
node_placement_prediction = "", node_placement_prediction = "",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
@ -248,23 +189,30 @@ function mcl_beds.register_bed(name, def)
return itemstack return itemstack
end end
-- Try to place in three directions: inline with the view and rotated to
-- the right and left
local dir = minetest.dir_to_facedir(placer:get_look_dir()) local dir = minetest.dir_to_facedir(placer:get_look_dir())
if place_bed(name, placer, pos, dir) or local botpos = vector_add(pos, minetest_facedir_to_dir(dir))
place_bed(name, placer, pos, (dir+1)%4) or
place_bed(name, placer, pos, (dir+3)%4) or if minetest.is_protected(botpos, placer:get_player_name()) and
place_bed(name, placer, pos, (dir+2)%4) then not minetest.check_player_privs(placer, "protection_bypass") then
-- Bed was places minetest.record_protection_violation(botpos, placer:get_player_name())
if not minetest.is_creative_enabled(placer:get_player_name()) then return itemstack
itemstack:take_item() end
end
local botdef = minetest.registered_nodes[minetest_get_node(botpos).name]
if not botdef or not botdef.buildable_to then
return itemstack
end
minetest.set_node(pos, {name = name .. "_bottom", param2 = dir})
minetest.set_node(botpos, {name = name .. "_top", param2 = dir})
if not minetest.is_creative_enabled(placer:get_player_name()) then
itemstack:take_item()
end end
return itemstack return itemstack
end, end,
after_destruct = destruct_bed, after_destruct = destruct_bed,
on_dig = dig_bed,
on_destruct = kick_player_after_destruct, on_destruct = kick_player_after_destruct,
@ -291,7 +239,7 @@ function mcl_beds.register_bed(name, def)
_mcl_hardness = 0.2, _mcl_hardness = 0.2,
_mcl_blast_resistance = 1, _mcl_blast_resistance = 1,
sounds = def.sounds or default_sounds, sounds = def.sounds or default_sounds,
drop = "", drop = def.recipe and name or "",
selection_box = common_box, selection_box = common_box,
collision_box = common_box, collision_box = common_box,
@ -302,7 +250,6 @@ function mcl_beds.register_bed(name, def)
on_rotate = rotate, on_rotate = rotate,
after_destruct = destruct_bed, after_destruct = destruct_bed,
on_dig = dig_bed,
}) })
minetest.register_alias(name, name .. "_bottom") minetest.register_alias(name, name .. "_bottom")

View File

@ -8,7 +8,7 @@ local is_sp = minetest.is_singleplayer()
local weather_mod = minetest.get_modpath("mcl_weather") local weather_mod = minetest.get_modpath("mcl_weather")
local explosions_mod = minetest.get_modpath("mcl_explosions") local explosions_mod = minetest.get_modpath("mcl_explosions")
local spawn_mod = minetest.get_modpath("mcl_spawn") local spawn_mod = minetest.get_modpath("mcl_spawn")
local pos_to_dim = minetest.get_modpath("mcl_worlds") and mcl_worlds.pos_to_dimension or function(pos) return "overworld" end local worlds_mod = minetest.get_modpath("mcl_worlds")
local function mcl_log (message) local function mcl_log (message)
mcl_util.mcl_log (message, "[Beds]") mcl_util.mcl_log (message, "[Beds]")
@ -38,16 +38,6 @@ local function is_night_skip_enabled()
return players_in_bed_setting() <= 100 return players_in_bed_setting() <= 100
end end
local function players_in_overworld(players)
local count = 0
for _, player in pairs(players) do
if player and pos_to_dim(player:get_pos()) == "overworld" then
count = count +1
end
end
return count
end
local function check_in_beds(players) local function check_in_beds(players)
if not players then if not players then
players = minetest.get_connected_players() players = minetest.get_connected_players()
@ -55,7 +45,7 @@ local function check_in_beds(players)
if player_in_bed <= 0 then if player_in_bed <= 0 then
return false return false
end end
return players_in_bed_setting() <= (player_in_bed * 100) / players_in_overworld(players) return players_in_bed_setting() <= (player_in_bed * 100) / #players
end end
-- These monsters do not prevent sleep -- These monsters do not prevent sleep
@ -216,10 +206,10 @@ local function lay_down(player, pos, bed_pos, state, skip)
return true return true
end end
local function update_formspecs(finished, players) local function update_formspecs(finished, ges)
local ges = players_in_overworld(players or minetest.get_connected_players()) local ges = ges or #minetest.get_connected_players()
local form_n = "size[12,5;true]" local form_n = "size[12,5;true]"
local all_in_bed = ges and players_in_bed_setting() <= (player_in_bed * 100) / ges or 0 local all_in_bed = players_in_bed_setting() <= (player_in_bed * 100) / ges
local night_skip = is_night_skip_enabled() local night_skip = is_night_skip_enabled()
local button_leave = "button_exit[4,3;4,0.75;leave;"..F(S("Leave bed")).."]" local button_leave = "button_exit[4,3;4,0.75;leave;"..F(S("Leave bed")).."]"
local button_abort = "button_exit[4,3;4,0.75;leave;"..F(S("Abort sleep")).."]" local button_abort = "button_exit[4,3;4,0.75;leave;"..F(S("Abort sleep")).."]"
@ -359,36 +349,25 @@ function mcl_beds.get_bed_bottom (pos)
return bed_bottom return bed_bottom
end end
local function recheck_in_beds()
if check_in_beds() then
update_formspecs(is_night_skip_enabled())
mcl_beds.sleep()
end
-- check again (a player can change the dimension)
if player_in_bed > 0 then
update_formspecs(false)
minetest.after(5, recheck_in_beds)
end
end
function mcl_beds.on_rightclick(pos, player, is_top) function mcl_beds.on_rightclick(pos, player, is_top)
-- Anti-Inception: Don't allow to sleep while you're sleeping -- Anti-Inception: Don't allow to sleep while you're sleeping
if player:get_meta():get_string("mcl_beds:sleeping") == "true" then if player:get_meta():get_string("mcl_beds:sleeping") == "true" then
return return
end end
local dim = pos_to_dim(pos) if worlds_mod then
if dim == "nether" or dim == "end" then local dim = mcl_worlds.pos_to_dimension(pos)
-- Bed goes BOOM in the Nether or End. if dim == "nether" or dim == "end" then
local node = minetest.get_node(pos) -- Bed goes BOOM in the Nether or End.
local dir = minetest.facedir_to_dir(node.param2) local node = minetest.get_node(pos)
local dir = minetest.facedir_to_dir(node.param2)
minetest.remove_node(pos) minetest.remove_node(pos)
minetest.remove_node(string.sub(node.name, -4) == "_top" and vector.subtract(pos, dir) or vector.add(pos, dir)) minetest.remove_node(string.sub(node.name, -4) == "_top" and vector.subtract(pos, dir) or vector.add(pos, dir))
if explosions_mod then if explosions_mod then
mcl_explosions.explode(pos, 5, {drop_chance = 1.0, fire = true}) mcl_explosions.explode(pos, 5, {drop_chance = 1.0, fire = true})
end
return
end end
return
end end
local name = player:get_player_name() local name = player:get_player_name()
local ppos = player:get_pos() local ppos = player:get_pos()
@ -406,13 +385,10 @@ function mcl_beds.on_rightclick(pos, player, is_top)
mcl_title.set(player, "actionbar", {text=message, color="white", stay=60}) mcl_title.set(player, "actionbar", {text=message, color="white", stay=60})
else -- someone just successfully entered a bed else -- someone just successfully entered a bed
local connected_players = minetest.get_connected_players() local connected_players = minetest.get_connected_players()
local ges = players_in_overworld(connected_players) local sleep_hud_message = S("@1/@2 players currently in bed.", player_in_bed, math.ceil(players_in_bed_setting() * #connected_players / 100))
local sleep_hud_message = S("@1/@2 players currently in bed.", player_in_bed, math.ceil(players_in_bed_setting() * ges / 100))
for _, player in pairs(connected_players) do for _, player in pairs(connected_players) do
-- only send message to players not sleeping and in the "overworld" if not mcl_beds.player[player:get_player_name()] then -- only send message to players not sleeping.
if not mcl_beds.player[player:get_player_name()] and pos_to_dim(player:get_pos()) == "overworld" then if mcl_title.params_get(player) then mcl_title.clear(player) end -- clear, old message is still being displayed
-- clear, old message is still being displayed
if mcl_title.params_get(player) then mcl_title.clear(player) end
mcl_title.set(player, "actionbar", {text=sleep_hud_message, color="white", stay=60}) mcl_title.set(player, "actionbar", {text=sleep_hud_message, color="white", stay=60})
end end
end end
@ -424,8 +400,13 @@ function mcl_beds.on_rightclick(pos, player, is_top)
update_formspecs(false) update_formspecs(false)
-- skip the night and let all players stand up -- skip the night and let all players stand up
if player_in_bed > 0 then if check_in_beds() then
minetest.after(5, recheck_in_beds) minetest.after(5, function()
if check_in_beds() then
update_formspecs(is_night_skip_enabled())
mcl_beds.sleep()
end
end)
end end
end end
@ -452,10 +433,15 @@ minetest.register_on_leaveplayer(function(player)
break break
end end
end end
if player_in_bed > 0 then if check_in_beds(players) then
minetest.after(5, recheck_in_beds) minetest.after(5, function()
if check_in_beds() then
update_formspecs(is_night_skip_enabled())
mcl_beds.sleep()
end
end)
end end
update_formspecs(false, players) update_formspecs(false, #players)
end) end)
local message_rate_limit = tonumber(minetest.settings:get("chat_message_limit_per_10sec")) or 8 --NEVER change this! if this was java, i would've declared it as final local message_rate_limit = tonumber(minetest.settings:get("chat_message_limit_per_10sec")) or 8 --NEVER change this! if this was java, i would've declared it as final

View File

@ -8,60 +8,36 @@ local S = minetest.get_translator(minetest.get_current_modname())
-- Function to allow harvesting honey and honeycomb from the beehive and bee nest. -- Function to allow harvesting honey and honeycomb from the beehive and bee nest.
local honey_harvest = function(pos, node, player, itemstack, pointed_thing) local honey_harvest = function(pos, node, player, itemstack, pointed_thing)
local inv = player:get_inventory() local inv = player:get_inventory()
local item = player:get_wielded_item() local shears = minetest.get_item_group(player:get_wielded_item():get_name(), "shears") > 0
local bottle = player:get_wielded_item():get_name() == "mcl_potions:glass_bottle"
local beehive = "mcl_beehives:beehive"
local is_creative = minetest.is_creative_enabled(player:get_player_name()) local is_creative = minetest.is_creative_enabled(player:get_player_name())
-- Determine the node name to replace the beehive with if harvest is successful
local beehive = "mcl_beehives:beehive"
if node.name == "mcl_beehives:beehive_5" then if node.name == "mcl_beehives:beehive_5" then
beehive = "mcl_beehives:beehive" beehive = "mcl_beehives:beehive"
elseif node.name == "mcl_beehives:bee_nest_5" then elseif node.name == "mcl_beehives:bee_nest_5" then
beehive = "mcl_beehives:bee_nest" beehive = "mcl_beehives:bee_nest"
end end
-- Check for a campfire within 5 blocks below the beehive
local campfire_area = vector.offset(pos, 0, -5, 0) local campfire_area = vector.offset(pos, 0, -5, 0)
local campfire = minetest.find_nodes_in_area(pos, campfire_area, "group:lit_campfire") local campfire = minetest.find_nodes_in_area(pos, campfire_area, "group:lit_campfire")
-- Player used a bottle if bottle then
if item:get_name() == "mcl_potions:glass_bottle" then
local honey = "mcl_honey:honey_bottle" local honey = "mcl_honey:honey_bottle"
if inv:room_for_item("main", honey) then if inv:room_for_item("main", honey) then
-- Replace the beehive with the version without honey or comb
node.name = beehive node.name = beehive
minetest.set_node(pos, node) minetest.set_node(pos, node)
-- Give honey bottle and take the empty bottle if survival mode
inv:add_item("main", "mcl_honey:honey_bottle") inv:add_item("main", "mcl_honey:honey_bottle")
if not is_creative then if not is_creative then
itemstack:take_item() itemstack:take_item()
end end
if not campfire[1] then mcl_util.deal_damage(player, 10) else awards.unlock(player:get_player_name(), "mcl:bee_our_guest") end
-- Hurt the player if there was no campfire, or give award if there was
if not campfire[1] then
mcl_util.deal_damage(player, 10)
else
awards.unlock(player:get_player_name(), "mcl:bee_our_guest")
end
end end
elseif shears then
-- Player used shears
elseif minetest.get_item_group(item:get_name(), "shears") > 0 then
-- Give honeycomb
minetest.add_item(pos, "mcl_honey:honeycomb 3") minetest.add_item(pos, "mcl_honey:honeycomb 3")
-- Replace the beehive with the version without honey or comb
node.name = beehive node.name = beehive
minetest.set_node(pos, node) minetest.set_node(pos, node)
-- Hurt the player if there was no campfire
if not campfire[1] then mcl_util.deal_damage(player, 10) end if not campfire[1] then mcl_util.deal_damage(player, 10) end
-- Add wear to the shears
if not is_creative then
mcl_util.use_item_durability(item, 1)
return item
end
end end
end end
@ -215,18 +191,6 @@ minetest.register_craft({
}, },
}) })
minetest.register_craft({
type = "fuel",
recipe = "group:bee_nest",
burntime = 15,
})
minetest.register_craft({
type = "fuel",
recipe = "group:beehive",
burntime = 15,
})
-- Temporary ABM to update honey levels -- Temporary ABM to update honey levels
minetest.register_abm({ minetest.register_abm({
label = "Update Beehive Honey Levels", label = "Update Beehive Honey Levels",

View File

@ -475,11 +475,8 @@ minetest.register_node("mcl_books:bookshelf", {
_mcl_hoppers_on_try_push = function(pos, hop_pos, hop_inv, hop_list) _mcl_hoppers_on_try_push = function(pos, hop_pos, hop_inv, hop_list)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
local function filter(stack) return inv, "main", mcl_util.select_stack(hop_inv, hop_list, inv, "main",
return minetest.get_item_group(stack:get_name(), "book") == 1 or function(stack) return minetest.get_item_group(stack:get_name(), "book") == 1 or stack:get_name() == "mcl_enchanting:book_enchanted" end)
stack:get_name() == "mcl_enchanting:book_enchanted"
end
return inv, "main", mcl_util.select_stack(hop_inv, hop_list, inv, "main", filter, 1)
end, end,
}) })

View File

@ -379,27 +379,16 @@ end
local function hoppers_on_try_push(pos, hop_pos, hop_inv, hop_list) local function hoppers_on_try_push(pos, hop_pos, hop_inv, hop_list)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
if math.abs(pos.y - hop_pos.y) > math.abs(pos.x - hop_pos.x) and math.abs(pos.y - hop_pos.y) > math.abs(pos.z - hop_pos.z) then
if math.abs(pos.y - hop_pos.y) > math.abs(pos.x - hop_pos.x) and math.abs(pos.y - hop_pos.y) > math.abs(pos.z - hop_pos.z) return inv, "input", mcl_util.select_stack(hop_inv, hop_list, inv, "input",
then function(stack) return minetest.get_item_group(stack:get_name(), "brewitem") == 1 and minetest.get_item_group(stack:get_name(), "bottle") == 0 end)
local function filter(stack)
return minetest.get_item_group(stack:get_name(), "brewitem") == 1 and
minetest.get_item_group(stack:get_name(), "bottle") == 0
end
return inv, "input", mcl_util.select_stack(hop_inv, hop_list, inv, "input", filter, 1)
else else
local filter = function(stack) local stack = mcl_util.select_stack(hop_inv, hop_list, inv, "fuel", function(stack) return stack:get_name() == "mcl_mobitems:blaze_powder" end)
return stack:get_name() == "mcl_mobitems:blaze_powder"
end
local stack = mcl_util.select_stack(hop_inv, hop_list, inv, "fuel", filter, 1 )
if stack then if stack then
return inv, "fuel", stack return inv, "fuel", stack
else else
local function filter(stack) return inv, "stand", mcl_util.select_stack(hop_inv, hop_list, inv, "stand",
return minetest.get_item_group(stack:get_name(), "bottle") == 1 function(stack) return minetest.get_item_group(stack:get_name(), "bottle") == 1 end)
end
return inv, "stand", mcl_util.select_stack(hop_inv, hop_list, inv, "stand", filter, 1)
end end
end end
end end

View File

@ -26,9 +26,3 @@ minetest.register_craft({
{ "group:wood", "group:wood", "" }, { "group:wood", "group:wood", "" },
} }
}) })
minetest.register_craft({
type = "fuel",
recipe = "mcl_cartography_table:cartography_table",
burntime = 15,
})

View File

@ -2,8 +2,6 @@
local planks = "mcl_cherry_blossom:cherrywood" local planks = "mcl_cherry_blossom:cherrywood"
local logs = "mcl_cherry_blossom:cherrytree" local logs = "mcl_cherry_blossom:cherrytree"
local stripped_logs = "mcl_cherry_blossom:stripped_cherrytree" local stripped_logs = "mcl_cherry_blossom:stripped_cherrytree"
local wood = "mcl_cherry_blossom:cherrytree_bark"
local stripped_wood = "mcl_cherry_blossom:stripped_cherrytree_bark"
minetest.register_craft({ minetest.register_craft({
output = "mcl_cherry_blossom:cherrytree_bark 3", output = "mcl_cherry_blossom:cherrytree_bark 3",
@ -28,27 +26,6 @@ minetest.register_craft({
} }
}) })
minetest.register_craft({
output = "mcl_cherry_blossom:cherrywood 4",
recipe = {
{ wood },
}
})
minetest.register_craft({
output = "mcl_cherry_blossom:cherrywood 4",
recipe = {
{ stripped_logs },
}
})
minetest.register_craft({
output = "mcl_cherry_blossom:cherrywood 4",
recipe = {
{ stripped_wood },
}
})
minetest.register_craft({ minetest.register_craft({
output = "mcl_cherry_blossom:cherry_door 3", output = "mcl_cherry_blossom:cherry_door 3",
recipe = { recipe = {

View File

@ -760,7 +760,7 @@ local function register_chest(basename, desc, longdesc, usagehelp, tt_help, tile
_mcl_hoppers_on_try_push = function(pos, hop_pos, hop_inv, hop_list) _mcl_hoppers_on_try_push = function(pos, hop_pos, hop_inv, hop_list)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
local stack_id = mcl_util.select_stack(hop_inv, hop_list, inv, "main", nil, 1) local stack_id = mcl_util.select_stack(hop_inv, hop_list, inv, "main")
if stack_id ~= nil then if stack_id ~= nil then
return inv, "main", stack_id return inv, "main", stack_id
end end
@ -768,7 +768,7 @@ local function register_chest(basename, desc, longdesc, usagehelp, tt_help, tile
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "left") local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "left")
local meta_other = minetest.get_meta(pos_other) local meta_other = minetest.get_meta(pos_other)
local inv_other = meta_other:get_inventory() local inv_other = meta_other:get_inventory()
stack_id = mcl_util.select_stack(hop_inv, hop_list, inv_other, "main", nil, 1) stack_id = mcl_util.select_stack(hop_inv, hop_list, inv_other, "main")
return inv_other, "main", stack_id return inv_other, "main", stack_id
end, end,
}) })
@ -955,13 +955,13 @@ local function register_chest(basename, desc, longdesc, usagehelp, tt_help, tile
local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "right") local pos_other = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "right")
local meta_other = minetest.get_meta(pos_other) local meta_other = minetest.get_meta(pos_other)
local inv_other = meta_other:get_inventory() local inv_other = meta_other:get_inventory()
local stack_id = mcl_util.select_stack(hop_inv, hop_list, inv_other, "main", nil, 1) local stack_id = mcl_util.select_stack(hop_inv, hop_list, inv_other, "main")
if stack_id ~= nil then if stack_id ~= nil then
return inv_other, "main", stack_id return inv_other, "main", stack_id
end end
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
stack_id = mcl_util.select_stack(hop_inv, hop_list, inv, "main", nil, 1) stack_id = mcl_util.select_stack(hop_inv, hop_list, inv, "main")
return inv, "main", stack_id return inv, "main", stack_id
end, end,
}) })
@ -1522,7 +1522,7 @@ for color, desc in pairs(boxtypes) do
_mcl_hoppers_on_try_push = function(pos, hop_pos, hop_inv, hop_list) _mcl_hoppers_on_try_push = function(pos, hop_pos, hop_inv, hop_list)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
return inv, "main", mcl_util.select_stack(hop_inv, hop_list, inv, "main", mcl_chests.is_not_shulker_box, 1) return inv, "main", mcl_util.select_stack(hop_inv, hop_list, inv, "main", mcl_chests.is_not_shulker_box)
end, end,
}) })

View File

@ -238,7 +238,7 @@ minetest.register_node("mcl_composters:composter", {
_mcl_hoppers_on_try_push = function(pos, hop_pos, hop_inv, hop_list) _mcl_hoppers_on_try_push = function(pos, hop_pos, hop_inv, hop_list)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
return inv, "src", mcl_util.select_stack(hop_inv, hop_list, inv, "src", hopper_push_condition, 1) return inv, "src", mcl_util.select_stack(hop_inv, hop_list, inv, "src", hopper_push_condition)
end, end,
_mcl_hoppers_on_after_push = function(pos) _mcl_hoppers_on_after_push = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
@ -293,7 +293,7 @@ local function register_filled_composter(level)
_mcl_hoppers_on_try_push = function(pos, hop_pos, hop_inv, hop_list) _mcl_hoppers_on_try_push = function(pos, hop_pos, hop_inv, hop_list)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
return inv, "src", mcl_util.select_stack(hop_inv, hop_list, inv, "src", hopper_push_condition, 1) return inv, "src", mcl_util.select_stack(hop_inv, hop_list, inv, "src", hopper_push_condition)
end, end,
_mcl_hoppers_on_after_push = function(pos) _mcl_hoppers_on_after_push = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)

View File

@ -164,12 +164,6 @@ minetest.register_node("mcl_core:deadbush", {
_mcl_hardness = 0, _mcl_hardness = 0,
}) })
minetest.register_craft({
type = "fuel",
recipe = "mcl_core:deadbush",
burntime = 5,
})
minetest.register_node("mcl_core:barrier", { minetest.register_node("mcl_core:barrier", {
description = S("Barrier"), description = S("Barrier"),
_doc_items_longdesc = S("Barriers are invisible walkable blocks. They are used to create boundaries of adventure maps and the like. Monsters and animals won't appear on barriers, and fences do not connect to barriers. Other blocks can be built on barriers like on any other block."), _doc_items_longdesc = S("Barriers are invisible walkable blocks. They are used to create boundaries of adventure maps and the like. Monsters and animals won't appear on barriers, and fences do not connect to barriers. Other blocks can be built on barriers like on any other block."),

View File

@ -5,8 +5,8 @@ local modpath = minetest.get_modpath(modname)
-- by debiankaios -- by debiankaios
-- adapted for mcl2 by cora -- adapted for mcl2 by cora
local wood_slab_groups = {handy = 1, axey = 1, material_wood = 1, wood_slab = 1} local wood_slab_groups = {handy = 1, axey = 1, flammable = 3, material_wood = 1, fire_encouragement = 5, fire_flammability = 20, wood_slab = 1}
local wood_stair_groups = {handy = 1, axey = 1, material_wood = 1, wood_stairs = 1} local wood_stair_groups = {handy = 1, axey = 1, flammable = 3, material_wood = 1, fire_encouragement = 5, fire_flammability = 20, wood_stairs = 1}
local function generate_warped_tree(pos) local function generate_warped_tree(pos)
minetest.place_schematic(pos,modpath.."/schematics/warped_fungus_1.mts","random",nil,false,"place_center_x,place_center_z") minetest.place_schematic(pos,modpath.."/schematics/warped_fungus_1.mts","random",nil,false,"place_center_x,place_center_z")
@ -463,7 +463,7 @@ minetest.register_craft({
minetest.register_node("mcl_crimson:warped_hyphae_wood", { minetest.register_node("mcl_crimson:warped_hyphae_wood", {
description = S("Warped Hyphae Wood"), description = S("Warped Hyphae Wood"),
tiles = {"mcl_crimson_warped_hyphae_wood.png"}, tiles = {"mcl_crimson_warped_hyphae_wood.png"},
groups = {handy = 5,axey = 1, wood=1,building_block = 1, material_wood = 1}, groups = {handy = 5,axey = 1, flammable = 3, wood=1,building_block = 1, material_wood = 1, fire_encouragement = 5, fire_flammability = 20},
sounds = mcl_sounds.node_sound_wood_defaults(), sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_hardness = 2, _mcl_hardness = 2,
}) })
@ -478,27 +478,6 @@ minetest.register_craft({
}, },
}) })
minetest.register_craft({
output = "mcl_crimson:warped_hyphae_wood 4",
recipe = {
{"mcl_crimson:warped_hyphae_bark"},
},
})
minetest.register_craft({
output = "mcl_crimson:warped_hyphae_wood 4",
recipe = {
{"mcl_crimson:stripped_warped_hyphae"},
},
})
minetest.register_craft({
output = "mcl_crimson:warped_hyphae_wood 4",
recipe = {
{"mcl_crimson:stripped_warped_hyphae_bark"},
},
})
minetest.register_craft({ minetest.register_craft({
output = "mcl_crimson:warped_nylium 2", output = "mcl_crimson:warped_nylium 2",
recipe = { recipe = {
@ -691,27 +670,6 @@ minetest.register_craft({
}, },
}) })
minetest.register_craft({
output = "mcl_crimson:crimson_hyphae_wood 4",
recipe = {
{"mcl_crimson:crimson_hyphae_bark"},
},
})
minetest.register_craft({
output = "mcl_crimson:crimson_hyphae_wood 4",
recipe = {
{"mcl_crimson:stripped_crimson_hyphae"},
},
})
minetest.register_craft({
output = "mcl_crimson:crimson_hyphae_wood 4",
recipe = {
{"mcl_crimson:stripped_crimson_hyphae_bark"},
},
})
minetest.register_craft({ minetest.register_craft({
output = "mcl_crimson:crimson_nylium 2", output = "mcl_crimson:crimson_nylium 2",
recipe = { recipe = {
@ -757,7 +715,7 @@ mcl_doors:register_door("mcl_crimson:crimson_door", {
_doc_items_longdesc = S("Wooden doors are 2-block high barriers which can be opened or closed by hand and by a redstone signal."), _doc_items_longdesc = S("Wooden doors are 2-block high barriers which can be opened or closed by hand and by a redstone signal."),
_doc_items_usagehelp = S("To open or close a wooden door, rightclick it or supply its lower half with a redstone signal."), _doc_items_usagehelp = S("To open or close a wooden door, rightclick it or supply its lower half with a redstone signal."),
inventory_image = "mcl_crimson_crimson_door.png", inventory_image = "mcl_crimson_crimson_door.png",
groups = {handy=1,axey=1, material_wood=1}, groups = {handy=1,axey=1, material_wood=1, flammable=-1},
_mcl_hardness = 3, _mcl_hardness = 3,
_mcl_blast_resistance = 3, _mcl_blast_resistance = 3,
tiles_bottom = "mcl_crimson_crimson_door_bottom.png", tiles_bottom = "mcl_crimson_crimson_door_bottom.png",
@ -772,7 +730,7 @@ mcl_doors:register_trapdoor("mcl_crimson:crimson_trapdoor", {
tile_front = "mcl_crimson_crimson_trapdoor.png", tile_front = "mcl_crimson_crimson_trapdoor.png",
tile_side = "mcl_crimson_crimson_trapdoor_side.png", tile_side = "mcl_crimson_crimson_trapdoor_side.png",
wield_image = "mcl_crimson_crimson_trapdoor.png", wield_image = "mcl_crimson_crimson_trapdoor.png",
groups = {handy=1,axey=1, mesecon_effector_on=1, material_wood=1}, groups = {handy=1,axey=1, mesecon_effector_on=1, material_wood=1, flammable=-1},
_mcl_hardness = 3, _mcl_hardness = 3,
_mcl_blast_resistance = 3, _mcl_blast_resistance = 3,
sounds = mcl_sounds.node_sound_wood_defaults(), sounds = mcl_sounds.node_sound_wood_defaults(),
@ -783,7 +741,7 @@ mcl_fences.register_fence_and_fence_gate(
S("Crimson Fence"), S("Crimson Fence"),
S("Crimson Fence Gate"), S("Crimson Fence Gate"),
"mcl_crimson_crimson_fence.png", "mcl_crimson_crimson_fence.png",
{handy=1,axey=1,fence_wood=1}, {handy=1,axey=1, flammable=2,fence_wood=1, fire_encouragement=5, fire_flammability=20},
minetest.registered_nodes["mcl_crimson:crimson_hyphae"]._mcl_hardness, minetest.registered_nodes["mcl_crimson:crimson_hyphae"]._mcl_hardness,
minetest.registered_nodes["mcl_crimson:crimson_hyphae"]._mcl_blast_resistance, minetest.registered_nodes["mcl_crimson:crimson_hyphae"]._mcl_blast_resistance,
{"group:fence_wood"}, {"group:fence_wood"},
@ -795,7 +753,7 @@ mcl_doors:register_door("mcl_crimson:warped_door", {
_doc_items_longdesc = S("Wooden doors are 2-block high barriers which can be opened or closed by hand and by a redstone signal."), _doc_items_longdesc = S("Wooden doors are 2-block high barriers which can be opened or closed by hand and by a redstone signal."),
_doc_items_usagehelp = S("To open or close a wooden door, rightclick it or supply its lower half with a redstone signal."), _doc_items_usagehelp = S("To open or close a wooden door, rightclick it or supply its lower half with a redstone signal."),
inventory_image = "mcl_crimson_warped_door.png", inventory_image = "mcl_crimson_warped_door.png",
groups = {handy=1,axey=1, material_wood=1}, groups = {handy=1,axey=1, material_wood=1, flammable=-1},
_mcl_hardness = 3, _mcl_hardness = 3,
_mcl_blast_resistance = 3, _mcl_blast_resistance = 3,
tiles_bottom = "mcl_crimson_warped_door_bottom.png", tiles_bottom = "mcl_crimson_warped_door_bottom.png",
@ -810,7 +768,7 @@ mcl_doors:register_trapdoor("mcl_crimson:warped_trapdoor", {
tile_front = "mcl_crimson_warped_trapdoor.png", tile_front = "mcl_crimson_warped_trapdoor.png",
tile_side = "mcl_crimson_warped_trapdoor_side.png", tile_side = "mcl_crimson_warped_trapdoor_side.png",
wield_image = "mcl_crimson_warped_trapdoor.png", wield_image = "mcl_crimson_warped_trapdoor.png",
groups = {handy=1,axey=1, mesecon_effector_on=1, material_wood=1}, groups = {handy=1,axey=1, mesecon_effector_on=1, material_wood=1, flammable=-1},
_mcl_hardness = 3, _mcl_hardness = 3,
_mcl_blast_resistance = 3, _mcl_blast_resistance = 3,
sounds = mcl_sounds.node_sound_wood_defaults(), sounds = mcl_sounds.node_sound_wood_defaults(),
@ -821,7 +779,7 @@ mcl_fences.register_fence_and_fence_gate(
S("Warped Fence"), S("Warped Fence"),
S("Warped Fence Gate"), S("Warped Fence Gate"),
"mcl_crimson_warped_fence.png", "mcl_crimson_warped_fence.png",
{handy=1,axey=1,fence_wood=1}, {handy=1,axey=1, flammable=2,fence_wood=1, fire_encouragement=5, fire_flammability=20},
minetest.registered_nodes["mcl_crimson:warped_hyphae"]._mcl_hardness, minetest.registered_nodes["mcl_crimson:warped_hyphae"]._mcl_hardness,
minetest.registered_nodes["mcl_crimson:warped_hyphae"]._mcl_blast_resistance, minetest.registered_nodes["mcl_crimson:warped_hyphae"]._mcl_blast_resistance,
{"group:fence_wood"}, {"group:fence_wood"},

View File

@ -182,10 +182,6 @@ local function apply_bone_meal(pointed_thing, user)
local n = minetest.get_node(pos) local n = minetest.get_node(pos)
if n.name == "" then return false end if n.name == "" then return false end
if mcl_util.check_area_protection(pos, pointed_thing.above, user) then
return false
end
for _, func in pairs(mcl_dye.bone_meal_callbacks) do for _, func in pairs(mcl_dye.bone_meal_callbacks) do
if func(pointed_thing, user) then if func(pointed_thing, user) then
return true return true

View File

@ -74,7 +74,6 @@ local end_rod_def = {
light_source = minetest.LIGHT_MAX, light_source = minetest.LIGHT_MAX,
sunlight_propagates = true, sunlight_propagates = true,
groups = { dig_immediate=3, deco_block=1, destroy_by_lava_flow=1, end_rod=1 }, groups = { dig_immediate=3, deco_block=1, destroy_by_lava_flow=1, end_rod=1 },
use_texture_alpha = "clip",
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
@ -154,7 +153,6 @@ for num, row in ipairs(colored_end_rods) do
def.description = desc def.description = desc
def._doc_items_longdesc = nil def._doc_items_longdesc = nil
def._doc_items_create_entry = false def._doc_items_create_entry = false
def.use_texture_alpha = "clip"
local side_tex local side_tex
if name == "pink" then if name == "pink" then
def.tiles[1] = def.tiles[1] .. "^(" .. def.tiles[1] .. end_rod_mask .. "^[multiply:" .. name .. "^[hsl:0:300)" def.tiles[1] = def.tiles[1] .. "^(" .. def.tiles[1] .. end_rod_mask .. "^[multiply:" .. name .. "^[hsl:0:300)"

View File

@ -23,10 +23,4 @@ minetest.register_craft({
{ "group:wood", "group:wood", "" }, { "group:wood", "group:wood", "" },
{ "group:wood", "group:wood", "" }, { "group:wood", "group:wood", "" },
} }
}) })
minetest.register_craft({
type = "fuel",
recipe = "mcl_fletching_table:fletching_table",
burntime = 15,
})

View File

@ -195,7 +195,6 @@ def_clover.tiles = { "mcl_flowers_clover.png" }
def_clover.inventory_image = "mcl_flowers_clover_inv.png" def_clover.inventory_image = "mcl_flowers_clover_inv.png"
def_clover.wield_image = "mcl_flowers_clover_inv.png" def_clover.wield_image = "mcl_flowers_clover_inv.png"
def_clover.drop = nil def_clover.drop = nil
def_clover.use_texture_alpha = "clip"
def_clover.selection_box = { def_clover.selection_box = {
type = "fixed", type = "fixed",
fixed = { -4/16, -0.5, -4/16, 4/16, 0, 4/16 }, fixed = { -4/16, -0.5, -4/16, 4/16, 0, 4/16 },
@ -211,7 +210,6 @@ def_4l_clover.mesh = "mcl_clover_4leaf.obj"
def_4l_clover.tiles = { "mcl_flowers_fourleaf_clover.png" } def_4l_clover.tiles = { "mcl_flowers_fourleaf_clover.png" }
def_4l_clover.inventory_image = "mcl_flowers_fourleaf_clover_inv.png" def_4l_clover.inventory_image = "mcl_flowers_fourleaf_clover_inv.png"
def_4l_clover.wield_image = "mcl_flowers_fourleaf_clover_inv.png" def_4l_clover.wield_image = "mcl_flowers_fourleaf_clover_inv.png"
def_4l_clover.use_texture_alpha = "clip"
minetest.register_node("mcl_flowers:fourleaf_clover", def_4l_clover) minetest.register_node("mcl_flowers:fourleaf_clover", def_4l_clover)
@ -270,7 +268,6 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im
end end
-- Sunflower mesh and tiles -- Sunflower mesh and tiles
local top_drawtype, bottom_drawtype local top_drawtype, bottom_drawtype
local alpha = nil
local bottom_tiles = {} local bottom_tiles = {}
if not mesh then if not mesh then
top_drawtype = "plantlike" top_drawtype = "plantlike"
@ -280,7 +277,6 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im
top_drawtype = "airlike" top_drawtype = "airlike"
bottom_drawtype = "mesh" bottom_drawtype = "mesh"
bottom_tiles = bottom_img bottom_tiles = bottom_img
alpha = "clip"
end end
-- Bottom -- Bottom
minetest.register_node("mcl_flowers:"..name, { minetest.register_node("mcl_flowers:"..name, {
@ -302,7 +298,6 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im
_mcl_shears_drop = shears_drop, _mcl_shears_drop = shears_drop,
_mcl_fortune_drop = fortune_drop, _mcl_fortune_drop = fortune_drop,
node_placement_prediction = "", node_placement_prediction = "",
use_texture_alpha = alpha,
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { -selbox_radius, -0.5, -selbox_radius, selbox_radius, 0.5, selbox_radius }, fixed = { -selbox_radius, -0.5, -selbox_radius, selbox_radius, 0.5, selbox_radius },
@ -402,7 +397,6 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im
palette = palette, palette = palette,
walkable = false, walkable = false,
buildable_to = false, buildable_to = false,
use_texture_alpha = alpha,
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = { -selbox_radius, -0.5, -selbox_radius, selbox_radius, selbox_top_height, selbox_radius }, fixed = { -selbox_radius, -0.5, -selbox_radius, selbox_radius, selbox_top_height, selbox_radius },

View File

@ -466,9 +466,9 @@ function mcl_furnaces.hoppers_on_try_push(pos, hop_pos, hop_inv, hop_list)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
if math.abs(pos.y - hop_pos.y) > math.abs(pos.x - hop_pos.x) and math.abs(pos.y - hop_pos.y) > math.abs(pos.z - hop_pos.z) then if math.abs(pos.y - hop_pos.y) > math.abs(pos.x - hop_pos.x) and math.abs(pos.y - hop_pos.y) > math.abs(pos.z - hop_pos.z) then
return inv, "src", mcl_util.select_stack(hop_inv, hop_list, inv, "src", nil, 1) return inv, "src", mcl_util.select_stack(hop_inv, hop_list, inv, "src")
else else
return inv, "fuel", mcl_util.select_stack(hop_inv, hop_list, inv, "fuel", mcl_util.is_fuel, 1) return inv, "fuel", mcl_util.select_stack(hop_inv, hop_list, inv, "fuel", mcl_util.is_fuel)
end end
end end

View File

@ -32,68 +32,6 @@ local mcl_hoppers_formspec = table.concat({
"listring[current_player;main]", "listring[current_player;main]",
}) })
local function straight_hopper_act(pos, node, active_object_count, active_count_wider)
local timer = minetest.get_node_timer(pos)
if timer:is_started() then
--Pause if already recived item this tick
return
end
timer:start(1.0)
-- Move from internal inventory to dst first
local dst_pos = vector.offset(pos, 0, -1, 0)
local dst_node = minetest.get_node(dst_pos)
local dst_name = dst_node.name
local dst_def = minetest.registered_nodes[dst_name]
if dst_def and dst_def._mcl_hopper_act then
dst_def._mcl_hopper_act( dst_pos, dst_node, active_object_count, active_count_wider )
end
mcl_util.hopper_push(pos, dst_pos)
local src_pos = vector.offset(pos, 0, 1, 0)
mcl_util.hopper_pull(pos, src_pos)
end
local function bent_hopper_act(pos, node, active_object_count, active_object_count_wider)
local timer = minetest.get_node_timer(pos)
if timer:is_started() then
--Pause if already recived item this tick
return
end
timer:start(1.0)
-- Check if we are empty
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local empty = inv:is_empty("main")
-- Determine to which side the hopper is facing, get nodes
local face = minetest.get_node(pos).param2
local dst_pos = {}
if face == 0 then
dst_pos = vector.offset(pos, -1, 0, 0)
elseif face == 1 then
dst_pos = vector.offset(pos, 0, 0, 1)
elseif face == 2 then
dst_pos = vector.offset(pos, 1, 0, 0)
elseif face == 3 then
dst_pos = vector.offset(pos, 0, 0, -1)
end
local dst_node = minetest.get_node(dst_pos)
local dst_name = dst_node.name
local dst_def = minetest.registered_nodes[dst_name]
if dst_def and dst_def._mcl_hopper_act then
dst_def._mcl_hopper_act( dst_pos, dst_node, active_object_count, active_object_count_wider )
end
if not empty then
mcl_util.hopper_push(pos, dst_pos)
end
local src_pos = vector.offset(pos, 0, 1, 0)
mcl_util.hopper_pull(pos, src_pos)
end
-- Downwards hopper (base definition) -- Downwards hopper (base definition)
---@type node_definition ---@type node_definition
@ -268,7 +206,6 @@ def_hopper_enabled.mesecons = {
end, end,
}, },
} }
def_hopper_enabled._mcl_hopper_act = straight_hopper_act
minetest.register_node("mcl_hoppers:hopper", def_hopper_enabled) minetest.register_node("mcl_hoppers:hopper", def_hopper_enabled)
@ -418,7 +355,6 @@ def_hopper_side_enabled.mesecons = {
end, end,
}, },
} }
def_hopper_side_enabled._mcl_hopper_act = bent_hopper_act
minetest.register_node("mcl_hoppers:hopper_side", def_hopper_side_enabled) minetest.register_node("mcl_hoppers:hopper_side", def_hopper_side_enabled)
---@type node_definition ---@type node_definition
@ -623,7 +559,24 @@ minetest.register_abm({
neighbors = { "group:container" }, neighbors = { "group:container" },
interval = 1.0, interval = 1.0,
chance = 1, chance = 1,
action = straight_hopper_act, action = function(pos, node, active_object_count, active_object_count_wider)
if minetest.get_node_timer(pos):is_started() then
return
end
-- Move from internal inventory to dst first
local dst_pos = vector.offset(pos, 0, -1, 0)
local pushed = mcl_util.hopper_push(pos, dst_pos)
local src_pos = vector.offset(pos, 0, 1, 0)
mcl_util.hopper_pull(pos, src_pos)
local dst_node = minetest.get_node(dst_pos)
if pushed and (dst_node.name == "mcl_hoppers:hopper" or dst_node.name == "mcl_hoppers:hopper_side") then
--Pause destination hopper
minetest.get_node_timer(dst_pos):start(1.0)
end
end,
}) })
-- Register push/pull for "bent" hopper -- Register push/pull for "bent" hopper
@ -633,7 +586,35 @@ minetest.register_abm({
neighbors = { "group:container" }, neighbors = { "group:container" },
interval = 1.0, interval = 1.0,
chance = 1, chance = 1,
action = bent_hopper_act, action = function(pos, node, active_object_count, active_object_count_wider)
if minetest.get_node_timer(pos):is_started() then
--Pause if already recived item this tick
return
end
-- Determine to which side the hopper is facing, get nodes
local face = minetest.get_node(pos).param2
local dst_pos = {}
if face == 0 then
dst_pos = vector.offset(pos, -1, 0, 0)
elseif face == 1 then
dst_pos = vector.offset(pos, 0, 0, 1)
elseif face == 2 then
dst_pos = vector.offset(pos, 1, 0, 0)
elseif face == 3 then
dst_pos = vector.offset(pos, 0, 0, -1)
end
local pushed = mcl_util.hopper_push(pos, dst_pos)
local src_pos = vector.offset(pos, 0, 1, 0)
mcl_util.hopper_pull(pos, src_pos)
local dst_node = minetest.get_node(dst_pos)
if pushed and (dst_node.name == "mcl_hoppers:hopper" or dst_node.name == "mcl_hoppers:hopper_side") then
--Pause destination hopper
minetest.get_node_timer(dst_pos):start(1.0)
end
end,
}) })
minetest.register_craft({ minetest.register_craft({

View File

@ -638,7 +638,7 @@ function mcl_itemframes.create_base_definitions()
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
sunlight_propagates = true, sunlight_propagates = true,
groups = { dig_immediate = 3, deco_block = 1, dig_by_piston = 1, container = 1, attached_node_facedir = 1 }, groups = { dig_immediate = 3, deco_block = 1, dig_by_piston = 1, container = 1, }, -- attached_node_facedir = 1 }, -- allows for more placement options.
sounds = mcl_sounds.node_sound_defaults(), sounds = mcl_sounds.node_sound_defaults(),
node_placement_prediction = "", node_placement_prediction = "",

View File

@ -76,7 +76,8 @@ local lectern_def = {
if wdir == 0 then if wdir == 0 then
return itemstack return itemstack
-- IE., no Hanging Lecterns for you! -- IE., no Hanging Lecterns for you!
else end
if wdir == 1 then
-- (only make standing nodes...) -- (only make standing nodes...)
-- Determine the rotation based on player's yaw -- Determine the rotation based on player's yaw
local yaw = pi * 2 - placer:get_look_horizontal() local yaw = pi * 2 - placer:get_look_horizontal()
@ -135,11 +136,5 @@ minetest.register_craft({
} }
}) })
minetest.register_craft({
type = "fuel",
recipe = "mcl_lectern:lectern",
burntime = 15,
})
-- Base Aliases. -- Base Aliases.
minetest.register_alias("lectern", "mcl_lectern:lectern") minetest.register_alias("lectern", "mcl_lectern:lectern")

View File

@ -26,9 +26,3 @@ minetest.register_craft({
{ "group:wood", "group:wood", "" }, { "group:wood", "group:wood", "" },
} }
}) })
minetest.register_craft({
type = "fuel",
recipe = "mcl_loom:loom",
burntime = 15,
})

View File

@ -399,39 +399,12 @@ minetest.register_craft({
} }
}) })
minetest.register_craft({
output = "mcl_mangrove:mangrove_wood 4",
recipe = {
{"mcl_mangrove:mangrove_tree_bark"},
}
})
minetest.register_craft({
output = "mcl_mangrove:mangrove_wood 4",
recipe = {
{"mcl_mangrove:mangrove_stripped"},
}
})
minetest.register_craft({
output = "mcl_mangrove:mangrove_wood 4",
recipe = {
{"mcl_mangrove:mangrove_stripped_bark"},
}
})
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "group:fence_wood", recipe = "group:fence_wood",
burntime = 15, burntime = 15,
}) })
minetest.register_craft({
type = "fuel",
recipe = "mcl_mangrove:mangrove_roots",
burntime = 15,
})
local adjacents = { local adjacents = {
vector.new(1,0,0), vector.new(1,0,0),
vector.new(-1,0,0), vector.new(-1,0,0),

View File

@ -4,7 +4,10 @@
--- DateTime: 10/14/22 4:05 PM --- DateTime: 10/14/22 4:05 PM
--- ---
--local logging = minetest.settings:get_bool("mcl_logging_mcl_signs",true)
local DEBUG = minetest.settings:get_bool("mcl_logging_mcl_signs", false) -- special debug setting. local DEBUG = minetest.settings:get_bool("mcl_logging_mcl_signs", false) -- special debug setting.
if DEBUG then if DEBUG then
minetest.log("action", "[mcl_signs] Signs API Loading") minetest.log("action", "[mcl_signs] Signs API Loading")
end end
@ -112,6 +115,9 @@ mcl_signs.registered_signs = {}
mcl_signs.registered_signs.wall_signs = {} mcl_signs.registered_signs.wall_signs = {}
mcl_signs.registered_signs.standing_signs = {} mcl_signs.registered_signs.standing_signs = {}
mcl_signs.registered_signs.hanging_signs = {} -- unused. prepping for future use. mcl_signs.registered_signs.hanging_signs = {} -- unused. prepping for future use.
-- DEFINE SIGN BASE TYPES
mcl_signs.wall_standard = {} -- initialize
mcl_signs.standing_standard = {} -- initialize
function mcl_signs.build_signs_info() function mcl_signs.build_signs_info()
local n = 23 / 56 - 1 / 128 -- some required magic number from the original code. local n = 23 / 56 - 1 / 128 -- some required magic number from the original code.
@ -135,110 +141,37 @@ function mcl_signs.build_signs_info()
end end
-- DEFINE SIGN BASE TYPES -- wall signs' & hanging signs' base (definition)
local common_definition = { mcl_signs.wall_standard = {
_mcl_hardness = 1, description = S("Sign"),
_mcl_blast_resistance = 1, _tt_help = S("Can be written"),
stack_max = 16, _doc_items_longdesc = S("Signs can be written and come in two variants: Wall sign and sign on a sign post. Signs can be placed on the top and the sides of other blocks, but not below them."),
sounds = node_sounds, _doc_items_usagehelp = S("After placing the sign, you can write something on it. You have 4 lines of text with up to 15 characters for each line; anything beyond these limits is lost. Not all characters are supported. The text can not be changed once it has been written; you have to break and place the sign again. Can be colored and made to glow."),
groups = mcl_signs.sign_groups, inventory_image = "mcl_signs_default_sign.png",
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
drawtype = "mesh",
paramtype = "light",
tiles = { "mcl_signs_sign.png" },
sunlight_propagates = true,
walkable = false, walkable = false,
is_ground_content = false, is_ground_content = false,
wield_image = "mcl_signs_default_sign.png",
node_placement_prediction = "",
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "wallmounted",
drawtype = "mesh",
mesh = "mcl_signs_signonwallmount.obj",
selection_box = { type = "wallmounted", wall_side = { -0.5, -7 / 28, -0.5, -23 / 56, 7 / 28, 0.5 } },
tiles = { "mcl_signs_sign.png" },
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
groups = mcl_signs.sign_groups,
stack_max = 16,
sounds = node_sounds,
on_rightclick = function (pos, node, clicker, itemstack, pointed_thing) on_timer = function(pos)
if DEBUG then
minetest.log("verbose", "[mcl_signs] Sign Right Click event.")
end
-- make sure player is clicking
if not clicker or not clicker:is_player() then
return
end
local item = clicker:get_wielded_item()
local iname = item:get_name()
local protected = mcl_util.check_position_protection(pos, clicker)
if node and not protected then
if DEBUG then
minetest.log("verbose", "[mcl_signs] Sign Right Click event on valid node.")
end
-- handle glow from glow_ink_sac *first*
if (iname == "mcl_mobitems:glow_ink_sac") then
clicker:set_wielded_item(item)
local success = mcl_signs:glow_sign(pos)
if success then
if DEBUG then
minetest.log("verbose", "[mcl_signs] Sign Glow Success.")
end
itemstack:take_item()
end
return
end
-- check the wielded item to make sure that it is a dye.
local txt_color = mcl_signs:get_color_for_sign(iname)
if txt_color ~= "false" then
clicker:set_wielded_item(item)
local success = mcl_signs:color_sign(pos, txt_color)
-- "mcl_dye:black" is a special case: it makes the sign's lettering black AND removes glow.
if (iname == "mcl_dye:black") then
success = mcl_signs:glow_sign(pos, true)
if success and DEBUG then
minetest.log("verbose", "[mcl_signs] Sign Glow removal Success.")
end
end
if success then
if DEBUG then
minetest.log("verbose", "[mcl_signs] Sign Color Success.")
end
itemstack:take_item()
end
return
end
-- No modifier item in hand, open the sign for edition
local old_text = minetest.get_meta(pos):get_string("text")
mcl_signs:show_formspec(clicker, pos, old_text)
end
end,
on_destruct = function(pos)
mcl_signs:destruct_sign(pos)
end,
-- Not Useless Code. this force updates the sign.
on_punch = function(pos, node, puncher)
mcl_signs:update_sign(pos)
end,
}
-- wall signs' & hanging signs' base (definition)
mcl_signs.wall_standard = table.copy(common_definition)
mcl_signs.wall_standard.description = S("Sign")
mcl_signs.wall_standard._tt_help = S("Can be written")
mcl_signs.wall_standard._doc_items_longdesc = S("Signs can be written and come in two variants: Wall sign and sign on a sign post. Signs can be placed on the top and the sides of other blocks, but not below them.")
mcl_signs.wall_standard._doc_items_usagehelp = S("After placing the sign, you can write something on it. You have 4 lines of text with up to 15 characters for each line; anything beyond these limits is lost. Not all characters are supported. The text can not be changed once it has been written; you have to break and place the sign again. Can be colored and made to glow.")
mcl_signs.wall_standard.inventory_image = "mcl_signs_default_sign.png"
mcl_signs.wall_standard.wield_image = "mcl_signs_default_sign.png"
mcl_signs.wall_standard.node_placement_prediction = ""
mcl_signs.wall_standard.paramtype2 = "wallmounted"
mcl_signs.wall_standard.mesh = "mcl_signs_signonwallmount.obj"
mcl_signs.wall_standard.selection_box = { type = "wallmounted", wall_side = { -0.5, -7 / 28, -0.5, -23 / 56, 7 / 28, 0.5 } }
mcl_signs.wall_standard.on_timer = function(pos)
-- fix for /ClearObjects -- fix for /ClearObjects
mcl_signs:update_sign(pos) mcl_signs:update_sign(pos)
-- note: update_sign decides to keep the timer running based on if there is text. -- note: update_sign decides to keep the timer running based on if there is text.
-- This prevents every sign from having a timer, when not needed. -- This prevents every sign from having a timer, when not needed.
end end,
mcl_signs.wall_standard.on_place = function(itemstack, placer, pointed_thing)
on_place = function(itemstack, placer, pointed_thing)
local above = pointed_thing.above local above = pointed_thing.above
local under = pointed_thing.under local under = pointed_thing.under
@ -259,6 +192,9 @@ mcl_signs.wall_standard.on_place = function(itemstack, placer, pointed_thing)
end end
local wdir = minetest.dir_to_wallmounted(dir) local wdir = minetest.dir_to_wallmounted(dir)
--local placer_pos = placer:get_pos()
local fdir = minetest.dir_to_facedir(dir) local fdir = minetest.dir_to_facedir(dir)
local sign_info local sign_info
@ -336,10 +272,18 @@ mcl_signs.wall_standard.on_place = function(itemstack, placer, pointed_thing)
minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true) minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true)
mcl_signs:show_formspec(placer, place_pos, "") mcl_signs:show_formspec(placer, place_pos)
return itemstack return itemstack
end end,
mcl_signs.wall_standard.on_rotate = function(pos, node, user, mode) on_destruct = function(pos)
mcl_signs:destruct_sign(pos)
end,
-- Not Useless Code. force updates the sign.
on_punch = function(pos, node, puncher)
mcl_signs:update_sign(pos)
end,
on_rotate = function(pos, node, user, mode)
if mode == screwdriver.ROTATE_FACE then if mode == screwdriver.ROTATE_FACE then
local r = screwdriver.rotate.wallmounted(pos, node, mode) local r = screwdriver.rotate.wallmounted(pos, node, mode)
node.param2 = r node.param2 = r
@ -349,21 +293,105 @@ mcl_signs.wall_standard.on_rotate = function(pos, node, user, mode)
else else
return false return false
end end
end end,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
if DEBUG then
minetest.log("verbose", "[mcl_signs] Wall_Sign Right Click event.")
end
-- make sure player is clicking
if not clicker or not clicker:is_player() then
return
end
local item = clicker:get_wielded_item()
local iname = item:get_name()
local protected = mcl_util.check_position_protection(pos, clicker)
if node and not protected then
if DEBUG then
minetest.log("verbose", "[mcl_signs] Wall_Sign Right Click event on valid node.")
end
-- handle glow from glow_ink_sac *first*
if (iname == "mcl_mobitems:glow_ink_sac") then
clicker:set_wielded_item(item)
local success = mcl_signs:glow_sign(pos)
if success then
if DEBUG then
minetest.log("verbose", "[mcl_signs] Sign Glow Success.")
end
itemstack:take_item()
end
return
end
-- "mcl_dye:black" is a special case: it makes the sign's lettering black AND removes glow.
if (iname == "mcl_dye:black") then
clicker:set_wielded_item(item)
local success = mcl_signs:glow_sign(pos, true)
mcl_signs:color_sign(pos, mcl_colors.BLACK)
if success then
if DEBUG then
minetest.log("verbose", "[mcl_signs] Sign Glow removal Success.")
end
itemstack:take_item()
end
return
end
-- check the wielded item to make sure that it is a dye.
local txt_color = mcl_signs:get_color_for_sign(iname)
if txt_color ~= "false" then
clicker:set_wielded_item(item)
local success = mcl_signs:color_sign(pos, txt_color)
if success then
if DEBUG then
minetest.log("verbose", "[mcl_signs] Sign Color Success.")
end
itemstack:take_item()
end
end
end
end,
_mcl_hardness = 1,
_mcl_blast_resistance = 1,
}
-- standing sign base (definition) -- standing sign base (definition)
mcl_signs.standing_standard = table.copy(common_definition) mcl_signs.standing_standard = {
mcl_signs.standing_standard.paramtype2 = "facedir" paramtype = "light",
mcl_signs.standing_standard.mesh = "mcl_signs_sign.obj" use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
mcl_signs.standing_standard.selection_box = { type = "fixed", fixed = { -0.2, -0.5, -0.2, 0.2, 0.5, 0.2 } } sunlight_propagates = true,
mcl_signs.standing_standard.drop = "mcl_signs:wall_sign" walkable = false,
mcl_signs.standing_standard.on_timer = function(pos) is_ground_content = false,
paramtype2 = "facedir",
drawtype = "mesh",
mesh = "mcl_signs_sign.obj",
selection_box = { type = "fixed", fixed = { -0.2, -0.5, -0.2, 0.2, 0.5, 0.2 } },
tiles = { "mcl_signs_sign.png" },
groups = mcl_signs.sign_groups,
drop = "mcl_signs:wall_sign",
stack_max = 16,
sounds = node_sounds,
on_destruct = function(pos)
mcl_signs:destruct_sign(pos)
end,
on_timer = function(pos)
-- fix for /ClearObjects -- fix for /ClearObjects
mcl_signs:update_sign(pos) mcl_signs:update_sign(pos)
minetest.get_node_timer(pos):start(40.0) minetest.get_node_timer(pos):start(40.0)
end end,
mcl_signs.standing_standard.on_rotate = function(pos, node, user, mode)
-- Not Useless Code. this force updates the sign.
on_punch = function(pos, node, puncher)
mcl_signs:update_sign(pos)
end,
on_rotate = function(pos, node, user, mode)
if mode == screwdriver.ROTATE_FACE then if mode == screwdriver.ROTATE_FACE then
node.name = "mcl_signs:standing_sign22_5" node.name = "mcl_signs:standing_sign22_5"
minetest.swap_node(pos, node) minetest.swap_node(pos, node)
@ -372,7 +400,60 @@ mcl_signs.standing_standard.on_rotate = function(pos, node, user, mode)
end end
mcl_signs:update_sign(pos, nil, nil, true) mcl_signs:update_sign(pos, nil, nil, true)
return true return true
end end,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
if DEBUG then
minetest.log("verbose", "[mcl_signs] Standing_Sign Right Click event.")
end
-- make sure player is clicking
if not clicker or not clicker:is_player() then
return
end
local item = clicker:get_wielded_item()
local iname = item:get_name()
local protected = mcl_util.check_position_protection(pos, clicker)
if node and not protected then
-- handle glow from glow_ink_sac *first*
if DEBUG then
minetest.log("verbose", "[mcl_signs] Standing_Sign Right Click event on valid node.")
end
if (iname == "mcl_mobitems:glow_ink_sac") then
clicker:set_wielded_item(item)
local success = mcl_signs:glow_sign(pos)
if success then
if DEBUG then
minetest.log("verbose", "[mcl_signs] Sign Glow Success.")
end
itemstack:take_item()
end
return
end
-- check the wielded item to make sure that it is a dye.
local txt_color = mcl_signs:get_color_for_sign(iname)
if txt_color ~= "false" then
clicker:set_wielded_item(item)
local success = mcl_signs:color_sign(pos, txt_color)
if success then
if DEBUG then
minetest.log("verbose", "[mcl_signs] Sign Color Success.")
end
itemstack:take_item()
end
end
end
end,
_mcl_hardness = 1,
_mcl_blast_resistance = 1,
}
-- HELPER FUNCTIONS' VARIABLES -- HELPER FUNCTIONS' VARIABLES
local sign_glow = 6 local sign_glow = 6
@ -582,7 +663,7 @@ function mcl_signs.register_sign (modname, color, _name, ttsign)
minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true) minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true)
mcl_signs:show_formspec(placer, place_pos, "") mcl_signs:show_formspec(placer, place_pos)
return itemstack return itemstack
end end
@ -835,7 +916,7 @@ function mcl_signs.register_sign_custom (modname, _name, tiles, color, inventory
minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true) minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true)
mcl_signs:show_formspec(placer, place_pos, "") mcl_signs:show_formspec(placer, place_pos)
return itemstack return itemstack
end end
minetest.register_node(":mcl_signs:wall_sign" .. _name, new_sign) minetest.register_node(":mcl_signs:wall_sign" .. _name, new_sign)
@ -1071,7 +1152,7 @@ function mcl_signs.reregister_sign (modname, color, _name, ttsign)
minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true) minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true)
mcl_signs:show_formspec(placer, place_pos, "") mcl_signs:show_formspec(placer, place_pos)
return itemstack return itemstack
end end
@ -1320,7 +1401,7 @@ function mcl_signs.reregister_sign_custom (modname, _name, tiles, color, invento
minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true) minetest.sound_play({ name = "default_place_node_hard", gain = 1.0 }, { pos = place_pos }, true)
mcl_signs:show_formspec(placer, place_pos, "") mcl_signs:show_formspec(placer, place_pos)
return itemstack return itemstack
end end
minetest.override_item("mcl_signs:wall_sign" .. _name, new_sign) minetest.override_item("mcl_signs:wall_sign" .. _name, new_sign)
@ -1802,7 +1883,7 @@ function mcl_signs:update_sign(pos, fields, sender, force_remove, text_color)
return false return false
end end
local text = meta:get_string("text", "") local text = meta:get_string("text", "")
if fields and fields.text then if fields and (text == "" and fields.text) then
meta:set_string("text", fields.text) meta:set_string("text", fields.text)
text = fields.text text = fields.text
end end
@ -1959,13 +2040,11 @@ function mcl_signs:update_sign(pos, fields, sender, force_remove, text_color)
end end
function mcl_signs:show_formspec(player, pos, old_text) function mcl_signs:show_formspec(player, pos)
minetest.show_formspec( minetest.show_formspec(
player:get_player_name(), player:get_player_name(),
"mcl_signs:set_text_" .. pos.x .. "_" .. pos.y .. "_" .. pos.z, "mcl_signs:set_text_" .. pos.x .. "_" .. pos.y .. "_" .. pos.z,
"size[6,3]textarea[0.25,0.25;6,1.5;text;" .. F(S("Enter sign text:")) .. ";".. F(old_text) .. "]" .. "size[6,3]textarea[0.25,0.25;6,1.5;text;" .. F(S("Enter sign text:")) .. ";]label[0,1.5;" .. F(S("Maximum line length: 15")) .. "\n" .. F(S("Maximum lines: 4")) .. "]button_exit[0,2.5;6,1;submit;" .. F(S("Done")) .. "]"
"label[0,1.5;" .. F(S("Maximum line length: 15")) ..
"\n" .. F(S("Maximum lines: 4")) .. "]button_exit[0,2.5;6,1;submit;" .. F(S("Done")) .. "]"
) )
end end

View File

@ -257,12 +257,6 @@ minetest.register_craft({
}, },
}) })
minetest.register_craft({
type = "fuel",
recipe = "mcl_smithing_table:table",
burntime = 15,
})
-- this is the exact same as mcl_smithing_table.upgrade_item_netherite , in case something relies on the old function -- this is the exact same as mcl_smithing_table.upgrade_item_netherite , in case something relies on the old function
function mcl_smithing_table.upgrade_item(itemstack) function mcl_smithing_table.upgrade_item(itemstack)
return mcl_smithing_table.upgrade_item_netherite(itemstack) return mcl_smithing_table.upgrade_item_netherite(itemstack)

View File

@ -1,28 +0,0 @@
# ```vl_hollow_logs```
This mod registers hollow logs derived from normal logs.
Hollow logs mostly have a decorative function, but some of them can be used in recipes. Changes may appear soon.
## Functions:
### ```vl_hollow_logs.register_hollow_log(defs)```
This is the function that registers the hollow trunk.
For a hollow log to be registered, the <span style="color:firebrick"> defs </span> parameter must be a table that contains up to 5 values, which are, in this order, the <span style="color:firebrick"> itemstring </span> of the hollow log, the <span style="color:firebrick"> itemstring </span> of the stripped hollow log, the <span style="color:firebrick"> description </span> of the hollow log, the <span style="color:firebrick"> description </span> of the stripped hollow log and, optionally, a <span style="color:turquoise"> boolean </span> to inform whether this trunk is NOT flammable. If the hollow log is defined as flammable, it becomes part of the <span style="color:springgreen"> hollow_log_flammable </span> group, which allows the log to be used as fuel for furnaces and also allows it to be an ingredient for chacoal.
Examples:
```lua
-- Flammable
{"tree", "stripped_oak", "Hollow Oak Log", "Stripped Hollow Oak Log"}
-- Not flammable
{"crimson_hyphae", "stripped_crimson_hyphae", "Hollow Crimson Stem", "Stripped Hollow Crimson Stem", true}
```
### ```vl_hollow_logs.register_craft(material, result)```
This function records the crafting recipe for a hollow log based on its non-hollow variant.
This function also defines a recipe for the stonecutter. The <span style="color:firebrick"> material </span> and <span style="color:firebrick"> result </span> parameters must be, respectively, the <span style="color:firebrick"> complete itemstring </span> of the source material and the (partial) <span style="color:firebrick"> itemstring </span> of the result. See the following examples:
```lua
vl_hollow_logs.register_craft("mcl_core:tree", "tree")
vl_hollow_logs.register_craft("mcl_crimson:stripped_crimson_hyphae", "stripped_crimson_hyphae")
```

View File

@ -1,112 +0,0 @@
local modpath = minetest.get_modpath(minetest.get_current_modname())
local S = minetest.get_translator(minetest.get_current_modname())
vl_hollow_logs = {}
--- Function to register a hollow log. See API.md to learn how to use this function.
---@param defs table {name:string, stripped_name>string, desc:string, stripped_desc:string, not_flammable:boolean|nil}
function vl_hollow_logs.register_hollow_log(defs)
if not defs or #defs < 4 then
error("Incomplete definition provided")
end
for i = 1, 4 do
if type(defs[i]) ~= "string" then
error("defs["..i.."] must be a string")
end
end
if defs[5] and type(defs[5]) ~= "boolean" then
error("defs[5] must be a boolean if present")
end
local modname = minetest.get_current_modname()
if #defs > 5 then
minetest.log("warning", "[vl_hollow_logs] unused vars passed, dumping the table")
minetest.log("warning", "from mod " .. modname .. ": " .. dump(defs))
end
local name = defs[1]
local stripped_name = defs[2]
local desc = defs[3]
local stripped_desc = defs[4]
local collisionbox = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, -0.375},
{-0.5, -0.5, -0.5, -0.375, 0.5, 0.5},
{0.375, -0.5, -0.5, 0.5, 0.5, 0.5},
{-0.5, -0.5, 0.375, 0.5, 0.5, 0.5},
}
}
local groups = {axey = 1, building_block = 1, handy = 1, hollow_log = 1}
if not defs[5] then
groups = table.insert(groups, {fire_encouragement = 5, fire_flammability = 5, flammable = 2, hollow_log_burnable = 1})
end
minetest.register_node(modname .. ":"..name.."_hollow", {
collision_box = collisionbox,
description = S(desc),
drawtype = "mesh",
groups = groups,
mesh = "vl_hollow_logs_log.obj",
on_place = mcl_util.rotate_axis,
paramtype = "light",
paramtype2 = "facedir",
use_texture_alpha = "clip",
sounds = mcl_sounds.node_sound_wood_defaults(),
sunlight_propagates = true,
tiles = {modname .. "_"..name..".png"},
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
_mcl_stripped_variant = modname .. ":stripped_"..name.."_hollow"
})
minetest.register_node(modname .. ":"..stripped_name.."_hollow", {
collision_box = collisionbox,
description = S(stripped_desc),
drawtype = "mesh",
groups = groups,
mesh = "vl_hollow_logs_log.obj",
on_place = mcl_util.rotate_axis,
paramtype = "light",
paramtype2 = "facedir",
use_texture_alpha = "clip",
sounds = mcl_sounds.node_sound_wood_defaults(),
sunlight_propagates = true,
tiles = {modname .. "_stripped_"..name..".png"},
_mcl_blast_resistance = 2,
_mcl_hardness = 2
})
end
vl_hollow_logs.logs = {
{"acaciatree", "stripped_acacia", "Hollow Acacia Log", "Stripped Hollow Acacia Log"},
{"birchtree", "stripped_birch", "Hollow Birch Log", "Stripped Hollow Birch Log"},
{"darktree", "stripped_dark_oak", "Hollow Dark Oak Log", "Stripped Hollow Dark Oak Log"},
{"jungletree", "stripped_jungle", "Hollow Jungle Log", "Stripped Hollow Jungle Log"},
{"sprucetree", "stripped_spruce", "Hollow Spruce Log", "Stripped Hollow Spruce Log"},
{"tree", "stripped_oak", "Hollow Oak Log", "Stripped Hollow Oak Log"}
}
if minetest.get_modpath("mcl_cherry_blossom") then
table.insert(vl_hollow_logs.logs, {"cherrytree", "stripped_cherrytree", "Hollow Cherry Log", "Stripped Hollow Cherry Log"})
end
if minetest.get_modpath("mcl_mangrove") then
table.insert(vl_hollow_logs.logs, {"mangrove_tree", "mangrove_stripped", "Hollow Mangrove Log", "Stripped Hollow Mangrove Log"})
end
if minetest.get_modpath("mcl_crimson") then
table.insert(vl_hollow_logs.logs, {"crimson_hyphae", "stripped_crimson_hyphae", "Hollow Crimson Stem", "Stripped Hollow Crimson Stem", true})
table.insert(vl_hollow_logs.logs, {"warped_hyphae", "stripped_warped_hyphae", "Hollow Warped Stem", "Stripped Hollow Warped Stem", true})
end
for _, defs in pairs(vl_hollow_logs.logs) do
vl_hollow_logs.register_hollow_log(defs)
end
dofile(modpath.."/recipes.lua")

View File

@ -1,21 +0,0 @@
# textdomain: mcl_hollow_logs
Hollow Acacia Log=
Hollow Birch Log=
Hollow Cherry Log=
Hollow Dark Oak Log=
Hollow Jungle Log=
Hollow Mangrove Log=
Hollow Oak Log=
Hollow Spruce Log=
Hollow Crimson Stem=
Hollow Warped Stem=
Stripped Hollow Acacia Log=
Stripped Hollow Birch Log=
Stripped Hollow Cherry Log=
Stripped Hollow Dark Oak Log=
Stripped Hollow Jungle Log=
Stripped Hollow Mangrove Log=
Stripped Hollow Oak Log=
Stripped Hollow Spruce Log=
Stripped Hollow Crimson Stem=
Stripped Hollow Warped Stem=

View File

@ -1,21 +0,0 @@
# textdomain: mcl_hollow_logs
Hollow Acacia Log=Tronco Oco de Acácia
Hollow Birch Log=Tronco Oco de Bétula
Hollow Cherry Log=Tronco Oco de Cerejeira
Hollow Dark Oak Log=Tronco Oco de Carvalho Escuro
Hollow Jungle Log=Tronco Oco da Selva
Hollow Mangrove Log=Tronco Oco de Mangue
Hollow Oak Log=Tronco Oco de Carvalho
Hollow Spruce Log=Tronco Oco de Pinheiro
Hollow Crimson Stem=Caule Oco Carmesim
Hollow Warped Stem=Caule Oco Distorcido
Stripped Hollow Acacia Log=Tronco Oco Descascado de Acácia
Stripped Hollow Birch Log=Tronco Oco Descascado de Bétula
Stripped Hollow Cherry Log=Tronco Oco Descascado de Cerejeira
Stripped Hollow Dark Oak Log=Tronco Oco Descascado de Carvalho Escuro
Stripped Hollow Jungle Log=Tronco Oco Descascado da Selva
Stripped Hollow Mangrove Log=Tronco Oco Descascado de Mangue
Stripped Hollow Oak Log=Tronco Oco Descascado de Carvalho
Stripped Hollow Spruce Log=Tronco Oco Descascado de Pinheiro
Stripped Hollow Crimson Stem=Caule Oco Descascado Carmesim
Stripped Hollow Warped Stem=Caule Oco Descascado Distorcido

View File

@ -1,4 +0,0 @@
name = vl_hollow_logs
depends = mcl_core, mcl_sounds, mcl_util
optional_depends = mcl_cherry_blossom, mcl_crimson, mcl_mangrove
author = JoseDouglas26

View File

@ -1,54 +0,0 @@
# Blender 3.6.7
# www.blender.org
o hollow_log
v -0.312500 -0.500000 0.312500
v -0.312500 0.500000 0.312500
v -0.312500 -0.500000 -0.312500
v -0.312500 0.500000 -0.312500
v 0.312500 -0.500000 0.312500
v 0.312500 0.500000 0.312500
v 0.312500 -0.500000 -0.312500
v 0.312500 0.500000 -0.312500
v -0.500000 -0.500000 -0.500000
v -0.500000 -0.500000 0.500000
v -0.500000 0.500000 0.500000
v -0.500000 0.500000 -0.500000
v 0.500000 -0.500000 -0.500000
v 0.500000 0.500000 -0.500000
v 0.500000 -0.500000 0.500000
v 0.500000 0.500000 0.500000
vn -1.0000 -0.0000 -0.0000
vn -0.0000 -0.0000 -1.0000
vn 1.0000 -0.0000 -0.0000
vn -0.0000 -0.0000 1.0000
vn -0.0000 -1.0000 -0.0000
vn -0.0000 1.0000 -0.0000
vt 0.380952 0.000000
vt 0.380952 1.000000
vt 0.000000 1.000000
vt 0.000000 0.000000
vt 0.619048 0.000000
vt 0.619048 1.000000
vt 0.928571 0.187500
vt 0.928571 0.812500
vt 1.000000 1.000000
vt 1.000000 -0.000000
vt 0.690476 0.187500
vt 0.690476 0.812500
s 0
f 10/1/1 11/2/1 12/3/1 9/4/1
f 9/1/2 12/2/2 14/3/2 13/4/2
f 13/1/3 14/2/3 16/3/3 15/4/3
f 15/1/4 16/2/4 11/3/4 10/4/4
f 7/5/4 8/6/4 4/2/4 3/1/4
f 5/5/1 6/6/1 8/2/1 7/1/1
f 3/7/5 1/8/5 10/9/5 9/10/5
f 2/8/6 4/7/6 12/10/6 11/9/6
f 7/11/5 3/7/5 9/10/5 13/5/5
f 4/7/6 8/11/6 14/5/6 12/10/6
f 5/12/5 7/11/5 13/5/5 15/6/5
f 8/11/6 6/12/6 16/6/6 14/5/6
f 1/8/5 5/12/5 15/6/5 10/9/5
f 6/12/6 2/8/6 11/9/6 16/6/6
f 3/5/3 4/6/3 2/2/3 1/1/3
f 1/5/2 2/6/2 6/2/2 5/1/2

View File

@ -1,48 +0,0 @@
function vl_hollow_logs.register_craft(material, result)
minetest.register_craft({
output = "vl_hollow_logs:"..result.."_hollow 4",
recipe = {
{"", material, ""},
{material, "", material},
{"", material, ""}
},
type = "shaped"
})
mcl_stonecutter.register_recipe(material, "vl_hollow_logs:"..result.."_hollow", 1)
end
for _, defs in pairs(vl_hollow_logs.logs) do
local mod, material, stripped_material
local name = defs[1]
local stripped_name = defs[2]
if name:find("cherry") then
mod = "mcl_cherry_blossom:"
elseif name:find("mangrove") then
mod = "mcl_mangrove:"
elseif name:find("hyphae") then
mod = "mcl_crimson:"
else
mod = "mcl_core:"
end
material = mod..name
stripped_material = mod..stripped_name
vl_hollow_logs.register_craft(material, name)
vl_hollow_logs.register_craft(stripped_material, stripped_name)
end
minetest.register_craft({
burntime = 10,
recipe = "group:hollow_log_burnable",
type = "fuel",
})
minetest.register_craft({
cooktime = 5,
output = "mcl_core:charcoal_lump",
recipe = "group:hollow_log_burnable",
type = "cooking"
})

View File

@ -406,16 +406,13 @@ local function dungeons_nodes(minp, maxp, blockseed)
local pr = PseudoRandom(blockseed) local pr = PseudoRandom(blockseed)
for a=1, attempts do for a=1, attempts do
local dim = dungeonsizes[pr:next(1, #dungeonsizes)] local dim = dungeonsizes[pr:next(1, #dungeonsizes)]
local x = pr:next(minp.x, maxp.x-dim.x-1)
if ymin <= ymax - dim.y - 1 then local y = pr:next(ymin , ymax -dim.y-1)
local x = pr:next(minp.x, maxp.x-dim.x-1) local z = pr:next(minp.z, maxp.z-dim.z-1)
local y = pr:next(ymin , ymax -dim.y-1) local p1 = {x=x,y=y,z=z}
local z = pr:next(minp.z, maxp.z-dim.z-1) local p2 = {x = x+dim.x+1, y = y+dim.y+1, z = z+dim.z+1}
local p1 = {x=x,y=y,z=z} minetest.log("verbose","[mcl_dungeons] size=" ..minetest.pos_to_string(dim) .. ", emerge from "..minetest.pos_to_string(p1) .. " to " .. minetest.pos_to_string(p2))
local p2 = {x = x+dim.x+1, y = y+dim.y+1, z = z+dim.z+1} emerge_area(p1, p2, ecb_spawn_dungeon, {p1=p1, p2=p2, dim=dim, pr=pr})
minetest.log("verbose","[mcl_dungeons] size=" ..minetest.pos_to_string(dim) .. ", emerge from "..minetest.pos_to_string(p1) .. " to " .. minetest.pos_to_string(p2))
emerge_area(p1, p2, ecb_spawn_dungeon, {p1=p1, p2=p2, dim=dim, pr=pr})
end
end end
end end

View File

@ -57,7 +57,6 @@ end
-- Variables for each player, to handle delayed eating -- Variables for each player, to handle delayed eating
mcl_hunger.eat_internal = {} mcl_hunger.eat_internal = {}
mcl_hunger.eat_anim_hud = {}
-- Set per player internal variables for delayed eating -- Set per player internal variables for delayed eating
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
@ -82,7 +81,6 @@ minetest.register_on_joinplayer(function(player)
_custom_do_delayed = false, -- If true, then will execute only _custom_wrapper after holding RMB or LMB within a delay specified by mcl_hunger.EATING_DELAY (Use to bypass minetest.do_item_eat entirely) _custom_do_delayed = false, -- If true, then will execute only _custom_wrapper after holding RMB or LMB within a delay specified by mcl_hunger.EATING_DELAY (Use to bypass minetest.do_item_eat entirely)
} }
playerphysics.remove_physics_factor(player, "speed", "mcl_hunger:eating_speed") playerphysics.remove_physics_factor(player, "speed", "mcl_hunger:eating_speed")
player:hud_set_flags({wielditem = true})
end) end)
-- Clear when player leaves -- Clear when player leaves
@ -90,7 +88,6 @@ minetest.register_on_leaveplayer(function(player)
local name = player:get_player_name() local name = player:get_player_name()
mcl_hunger.eat_internal[name] = nil mcl_hunger.eat_internal[name] = nil
mcl_hunger.eat_anim_hud[name] = nil
end) end)
dofile(modpath.."/api.lua") dofile(modpath.."/api.lua")
@ -123,21 +120,11 @@ mcl_hunger.poison_hunger = {} -- food poisoning, increasing hunger
-- HUD -- HUD
local function init_hud(player) local function init_hud(player)
local name = player:get_player_name()
hb.init_hudbar(player, "hunger", mcl_hunger.get_hunger(player)) hb.init_hudbar(player, "hunger", mcl_hunger.get_hunger(player))
if mcl_hunger.debug then if mcl_hunger.debug then
hb.init_hudbar(player, "saturation", mcl_hunger.get_saturation(player), mcl_hunger.get_hunger(player)) hb.init_hudbar(player, "saturation", mcl_hunger.get_saturation(player), mcl_hunger.get_hunger(player))
hb.init_hudbar(player, "exhaustion", mcl_hunger.get_exhaustion(player)) hb.init_hudbar(player, "exhaustion", mcl_hunger.get_exhaustion(player))
end end
mcl_hunger.eat_anim_hud[name] = player:hud_add({
hud_elem_type = "image",
text = "blank.png",
position = {x = 0.5, y = 1},
scale = {x = -25, y = -45},
alignment = {x = 0, y = -1},
offset = {x = 0, y = -30},
z_index = -200,
})
end end
-- HUD updating functions for Debug Mode. No-op if not in Debug Mode -- HUD updating functions for Debug Mode. No-op if not in Debug Mode
@ -208,8 +195,6 @@ local eat_effects_cooldown = {}
local function clear_eat_internal_and_timers(player, player_name) local function clear_eat_internal_and_timers(player, player_name)
playerphysics.remove_physics_factor(player, "speed", "mcl_hunger:eating_speed") playerphysics.remove_physics_factor(player, "speed", "mcl_hunger:eating_speed")
player:hud_set_flags({wielditem = true})
player:hud_change(mcl_hunger.eat_anim_hud[player_name], "text", "blank.png")
mcl_hunger.eat_internal[player_name] = { mcl_hunger.eat_internal[player_name] = {
is_eating = false, is_eating = false,
is_eating_no_padding = false, is_eating_no_padding = false,
@ -314,20 +299,13 @@ minetest.register_globalstep(function(dtime)
playerphysics.add_physics_factor(player, "speed", "mcl_hunger:eating_speed", mcl_hunger.EATING_WALK_SPEED) playerphysics.add_physics_factor(player, "speed", "mcl_hunger:eating_speed", mcl_hunger.EATING_WALK_SPEED)
player:hud_set_flags({wielditem = false})
local itemstackdef = current_itemstack:get_definition()
local wield_image = itemstackdef.wield_image
if not wield_image or wield_image == "" then wield_image = itemstackdef.inventory_image end
player:hud_change(mcl_hunger.eat_anim_hud[player_name], "text", wield_image)
player:hud_change(mcl_hunger.eat_anim_hud[player_name], "offset", {x = 0, y = 50*math.sin(10*eat_tick_timers[player]+math.random())-50})
if eat_effects_cooldown[player] > 0.2 then if eat_effects_cooldown[player] > 0.2 then
eat_effects_cooldown[player] = 0 eat_effects_cooldown[player] = 0
if not mcl_hunger.eat_internal[player_name].user then if not mcl_hunger.eat_internal[player_name].user then
mcl_hunger.eat_internal[player_name].user = player mcl_hunger.eat_internal[player_name].user = player
end end
if not mcl_hunger.eat_internal[player_name].itemname then if not mcl_hunger.eat_internal[player_name].itemname then
mcl_hunger.eat_internal[player_name].itemname = current_itemstack:get_name() mcl_hunger.eat_internal[player_name].itemname = current_itemstack:get_name()
end end
@ -379,8 +357,6 @@ minetest.register_globalstep(function(dtime)
elseif eat_start_timers[player] and eat_start_timers[player] > 0.2 then elseif eat_start_timers[player] and eat_start_timers[player] > 0.2 then
playerphysics.remove_physics_factor(player, "speed", "mcl_hunger:eating_speed") playerphysics.remove_physics_factor(player, "speed", "mcl_hunger:eating_speed")
player:hud_set_flags({wielditem = true})
player:hud_change(mcl_hunger.eat_anim_hud[player_name], "text", "blank.png")
mcl_hunger.eat_internal[player_name].is_eating_no_padding = false mcl_hunger.eat_internal[player_name].is_eating_no_padding = false
elseif eat_start_timers[player] and eat_start_timers[player] > mcl_hunger.EATING_TOUCHSCREEN_DELAY_PADDING then elseif eat_start_timers[player] and eat_start_timers[player] > mcl_hunger.EATING_TOUCHSCREEN_DELAY_PADDING then

View File

@ -38,19 +38,9 @@ local player_sneak = {}
local player_visible = {} local player_visible = {}
mcl_player.player_attached = {} mcl_player.player_attached = {}
local function get_player_textures(name)
local textures = player_textures[name]
if textures then return textures end
local textures = { "character.png", "blank.png", "blank.png" }
player_textures[name] = textures
return textures
end
function mcl_player.player_get_animation(player) function mcl_player.player_get_animation(player)
local name = player:get_player_name() local name = player:get_player_name()
local textures = get_player_textures(name) local textures = player_textures[name]
if not player_visible[name] then if not player_visible[name] then
textures = table.copy(textures) textures = table.copy(textures)
@ -73,7 +63,7 @@ end
local function update_player_textures(player) local function update_player_textures(player)
local name = player:get_player_name() local name = player:get_player_name()
local textures = get_player_textures(name) local textures = player_textures[name]
if not player_visible[name] then if not player_visible[name] then
textures = table.copy(textures) textures = table.copy(textures)
@ -135,21 +125,18 @@ end
function mcl_player.player_set_skin(player, texture) function mcl_player.player_set_skin(player, texture)
local name = player:get_player_name() local name = player:get_player_name()
local textures = get_player_textures(name) player_textures[name][1] = texture
textures[1] = texture
update_player_textures(player) update_player_textures(player)
end end
function mcl_player.player_get_skin(player) function mcl_player.player_get_skin(player)
local name = player:get_player_name() local name = player:get_player_name()
local textures = get_player_textures(name) return player_textures[name][1]
return textures[1]
end end
function mcl_player.player_set_armor(player, texture) function mcl_player.player_set_armor(player, texture)
local name = player:get_player_name() local name = player:get_player_name()
local textures = get_player_textures(name) player_textures[name][2] = texture
textures[2] = texture
update_player_textures(player) update_player_textures(player)
end end
@ -164,7 +151,7 @@ function mcl_player.get_player_formspec_model(player, x, y, w, h, fsname)
local name = player:get_player_name() local name = player:get_player_name()
local model = player_model[name] local model = player_model[name]
local anim = models[model].animations[player_anim[name]] local anim = models[model].animations[player_anim[name]]
local textures = get_player_textures(name) local textures = player_textures[name]
if not player_visible[name] then if not player_visible[name] then
textures = table.copy(textures) textures = table.copy(textures)
textures[1] = "blank.png" textures[1] = "blank.png"
@ -192,7 +179,7 @@ minetest.register_on_joinplayer(function(player)
local name = player:get_player_name() local name = player:get_player_name()
mcl_player.player_attached[name] = false mcl_player.player_attached[name] = false
player_visible[name] = true player_visible[name] = true
get_player_textures(name) player_textures[name] = { "character.png", "blank.png", "blank.png" }
--player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30) --player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30)
-- player:set_fov(86.1) -- see <https://minecraft.gamepedia.com/Options#Video_settings>>>> -- player:set_fov(86.1) -- see <https://minecraft.gamepedia.com/Options#Video_settings>>>>

View File

@ -59,50 +59,6 @@ mcl_skins = {
player_formspecs = {}, player_formspecs = {},
} }
local player_skins = mcl_skins.player_skins
local function get_player_skins(player)
local player_skins = player_skins[player]
if player_skins then return player_skins end
local skin = player:get_meta():get_string("mcl_skins:skin")
if skin then
skin = minetest.deserialize(skin)
end
if skin then
if not mcl_skins.texture_to_simple_skin[skin.simple_skins_id] then
skin.simple_skins_id = nil
end
mcl_skins.player_skins[player] = skin
else
if math.random() > 0.5 then
skin = table.copy(mcl_skins.template1)
else
skin = table.copy(mcl_skins.template2)
end
mcl_skins.player_skins[player] = skin
end
mcl_skins.player_formspecs[player] = {
active_tab = "skin",
page_num = 1
}
if #mcl_skins.simple_skins > 0 then
local skin_id = tonumber(player:get_meta():get_string("mcl_skins:skin_id"))
if skin_id and mcl_skins.simple_skins[skin_id] then
local texture = mcl_skins.simple_skins[skin_id].texture
local player_skins = get_player_skins(player)
player_skins.simple_skins_id = texture
end
end
mcl_skins.save(player)
mcl_skins.update_player_skin(player)
return mcl_skins.player_skins[player]
end
function mcl_skins.register_item(item) function mcl_skins.register_item(item)
assert(mcl_skins[item.type], "Skin item type " .. item.type .. " does not exist.") assert(mcl_skins[item.type], "Skin item type " .. item.type .. " does not exist.")
@ -204,7 +160,7 @@ function mcl_skins.update_player_skin(player)
return return
end end
local skin = get_player_skins(player) local skin = mcl_skins.player_skins[player]
local skinval = mcl_skins.compile_skin(skin) local skinval = mcl_skins.compile_skin(skin)
if not skin.cape then skin.cape = "blank.png" end if not skin.cape then skin.cape = "blank.png" end
@ -230,7 +186,39 @@ end
-- Load player skin on join -- Load player skin on join
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
get_player_skins(player) local skin = player:get_meta():get_string("mcl_skins:skin")
if skin then
skin = minetest.deserialize(skin)
end
if skin then
if not mcl_skins.texture_to_simple_skin[skin.simple_skins_id] then
skin.simple_skins_id = nil
end
mcl_skins.player_skins[player] = skin
else
if math.random() > 0.5 then
skin = table.copy(mcl_skins.template1)
else
skin = table.copy(mcl_skins.template2)
end
mcl_skins.player_skins[player] = skin
end
mcl_skins.player_formspecs[player] = {
active_tab = "skin",
page_num = 1
}
if #mcl_skins.simple_skins > 0 then
local skin_id = tonumber(player:get_meta():get_string("mcl_skins:skin_id"))
if skin_id and mcl_skins.simple_skins[skin_id] then
local texture = mcl_skins.simple_skins[skin_id].texture
mcl_skins.player_skins[player].simple_skins_id = texture
end
end
mcl_skins.save(player)
mcl_skins.update_player_skin(player)
end) end)
minetest.register_on_leaveplayer(function(player) minetest.register_on_leaveplayer(function(player)
@ -257,7 +245,7 @@ end
function mcl_skins.show_formspec(player, active_tab, page_num) function mcl_skins.show_formspec(player, active_tab, page_num)
local formspec_data = mcl_skins.player_formspecs[player] local formspec_data = mcl_skins.player_formspecs[player]
local skin = get_player_skins(player) local skin = mcl_skins.player_skins[player]
formspec_data.active_tab = active_tab formspec_data.active_tab = active_tab
local page_count = calculate_page_count(active_tab, player) local page_count = calculate_page_count(active_tab, player)
@ -567,8 +555,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
mcl_skins.show_formspec(player, active_tab, page_num) mcl_skins.show_formspec(player, active_tab, page_num)
return true return true
elseif fields.nocape then elseif fields.nocape then
local player_skins = get_player_skins(player) mcl_skins.player_skins[player].cape = "blank.png"
player_skins.cape = "blank.png"
mcl_skins.update_player_skin(player) mcl_skins.update_player_skin(player)
mcl_armor.update(player) --update elytra cape mcl_armor.update(player) --update elytra cape
mcl_skins.show_formspec(player, active_tab, page_num) mcl_skins.show_formspec(player, active_tab, page_num)
@ -577,8 +564,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
for cape_index = ((page_num - 1) * 5) + 1, math.min(#mcl_skins.cape, page_num * 5) do for cape_index = ((page_num - 1) * 5) + 1, math.min(#mcl_skins.cape, page_num * 5) do
local cape = mcl_skins.cape[cape_index] local cape = mcl_skins.cape[cape_index]
if fields[cape.name] then if fields[cape.name] then
local player_skins = get_player_skins(player) mcl_skins.player_skins[player].cape = cape.mask -- the actual overlay image
player_skins.cape = cape.mask -- the actual overlay image
mcl_skins.update_player_skin(player) mcl_skins.update_player_skin(player)
mcl_armor.update(player) --update elytra cape mcl_armor.update(player) --update elytra cape
mcl_skins.show_formspec(player, active_tab, page_num) mcl_skins.show_formspec(player, active_tab, page_num)
@ -594,7 +580,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end end
end end
local skin = get_player_skins(player) local skin = mcl_skins.player_skins[player]
if not skin then return true end if not skin then return true end
if fields.next_page then if fields.next_page then

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 B

After

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 830 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 862 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 723 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 606 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 745 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 848 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 543 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 874 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 910 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 979 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 797 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 463 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 916 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1018 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 983 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 997 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 790 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 635 B

View File

@ -338,17 +338,17 @@ Source path,Source file,Target file,xs,ys,xl,yl,xt,yt,Blacklisted?
/assets/minecraft/textures/block,mycelium_top.png,mcl_core_mycelium_top.png,,,,,,, /assets/minecraft/textures/block,mycelium_top.png,mcl_core_mycelium_top.png,,,,,,,
/assets/minecraft/textures/block,red_sand.png,mcl_core_red_sand.png,,,,,,, /assets/minecraft/textures/block,red_sand.png,mcl_core_red_sand.png,,,,,,,
/assets/minecraft/textures/block,red_sandstone_bottom.png,mcl_core_red_sandstone_bottom.png,,,,,,, /assets/minecraft/textures/block,red_sandstone_bottom.png,mcl_core_red_sandstone_bottom.png,,,,,,,
/assets/minecraft/textures/block,cut_red_sandstone.png,mcl_core_red_sandstone_smooth.png,,,,,,, /assets/minecraft/textures/block,cut_red_sandstone.png,mcl_core_red_sandstone_carved.png,,,,,,,
/assets/minecraft/textures/block,red_sandstone.png,mcl_core_red_sandstone_normal.png,,,,,,, /assets/minecraft/textures/block,red_sandstone.png,mcl_core_red_sandstone_normal.png,,,,,,,
/assets/minecraft/textures/block,chiseled_red_sandstone.png,mcl_core_red_sandstone_carved.png,,,,,,, /assets/minecraft/textures/block,chiseled_red_sandstone.png,mcl_core_red_sandstone_smooth.png,,,,,,,
/assets/minecraft/textures/block,red_sandstone_top.png,mcl_core_red_sandstone_top.png,,,,,,, /assets/minecraft/textures/block,red_sandstone_top.png,mcl_core_red_sandstone_top.png,,,,,,,
/assets/minecraft/textures/block,redstone_ore.png,mcl_core_redstone_ore.png,,,,,,, /assets/minecraft/textures/block,redstone_ore.png,mcl_core_redstone_ore.png,,,,,,,
/assets/minecraft/textures/item,sugar_cane.png,mcl_core_reeds.png,,,,,,, /assets/minecraft/textures/item,sugar_cane.png,mcl_core_reeds.png,,,,,,,
/assets/minecraft/textures/block,sandstone_bottom.png,mcl_core_sandstone_bottom.png,,,,,,, /assets/minecraft/textures/block,sandstone_bottom.png,mcl_core_sandstone_bottom.png,,,,,,,
/assets/minecraft/textures/block,cut_sandstone.png,mcl_core_sandstone_carved.png,,,,,,,
/assets/minecraft/textures/block,chiseled_sandstone.png,mcl_core_sandstone_normal.png,,,,,,,
/assets/minecraft/textures/block,cut_sandstone.png,mcl_core_sandstone_smooth.png,,,,,,, /assets/minecraft/textures/block,cut_sandstone.png,mcl_core_sandstone_smooth.png,,,,,,,
/assets/minecraft/textures/block,chiseled_sandstone.png,mcl_core_sandstone_carved.png,,,,,,, /assets/minecraft/textures/block,sandstone.png,mcl_core_sandstone_top.png,,,,,,,
/assets/minecraft/textures/block,sandstone.png,mcl_core_sandstone_normal.png,,,,,,,
/assets/minecraft/textures/block,sandstone_top.png,mcl_core_sandstone_top.png,,,,,,,
/assets/minecraft/textures/block,slime_block.png,mcl_core_slime.png,,,,,,, /assets/minecraft/textures/block,slime_block.png,mcl_core_slime.png,,,,,,,
/assets/minecraft/textures/block,smooth_stone.png,mcl_core_stonebrick_carved.png,,,,,,, /assets/minecraft/textures/block,smooth_stone.png,mcl_core_stonebrick_carved.png,,,,,,,
/assets/minecraft/textures/block,cracked_stone_bricks.png,mcl_core_stonebrick_cracked.png,,,,,,, /assets/minecraft/textures/block,cracked_stone_bricks.png,mcl_core_stonebrick_cracked.png,,,,,,,
@ -1151,28 +1151,15 @@ Source path,Source file,Target file,xs,ys,xl,yl,xt,yt,Blacklisted?
/assets/minecraft/textures/block,redstone_dust_line1.png,redstone_redstone_dust_line1.png,,,,,,, /assets/minecraft/textures/block,redstone_dust_line1.png,redstone_redstone_dust_line1.png,,,,,,,
/assets/minecraft/textures/block,attached_melon_stem.png,mcl_farming_melon_stem_connected.png,,,,,,, /assets/minecraft/textures/block,attached_melon_stem.png,mcl_farming_melon_stem_connected.png,,,,,,,
/assets/minecraft/textures/block,melon_stem.png,mcl_farming_melon_stem_disconnected.png,,,,,,, /assets/minecraft/textures/block,melon_stem.png,mcl_farming_melon_stem_disconnected.png,,,,,,,
/assets/minecraft/textures/entity/signs,acacia.png,mcl_signs_acacia_sign.png,,,,,,, /assets/minecraft/textures/entity/signs,acacia.png,mcl_signs_sign_acacia.png,,,,,,,
/assets/minecraft/textures/entity/signs,bamboo.png,mcl_bamboo_bamboo_sign.png,,,,,,, /assets/minecraft/textures/entity/signs,bamboo.png,mcl_bamboo_bamboo_sign.png,,,,,,,
/assets/minecraft/textures/entity/signs,birch.png,mcl_signs_birch_sign.png,,,,,,,
/assets/minecraft/textures/entity/signs,cherry.png,mcl_cherry_blossom_sign.png,,,,,,, /assets/minecraft/textures/entity/signs,cherry.png,mcl_cherry_blossom_sign.png,,,,,,,
/assets/minecraft/textures/entity/signs,crimson.png,mcl_signs_crimson_sign.png,,,,,,,
/assets/minecraft/textures/entity/signs,dark_oak.png,mcl_signs_sign_dark.png,,,,,,, /assets/minecraft/textures/entity/signs,dark_oak.png,mcl_signs_sign_dark.png,,,,,,,
/assets/minecraft/textures/entity/signs,jungle.png,mcl_signs_jungle_sign.png,,,,,,,
/assets/minecraft/textures/entity/signs,mangrove.png,mcl_signs_mangrove_sign.png,,,,,,,
/assets/minecraft/textures/entity/signs,oak.png,mcl_signs_sign.png,,,,,,, /assets/minecraft/textures/entity/signs,oak.png,mcl_signs_sign.png,,,,,,,
/assets/minecraft/textures/entity/signs,spruce.png,mcl_signs_spruce_sign.png,,,,,,,
/assets/minecraft/textures/entity/signs,warped.png,mcl_signs_warped_sign.png,,,,,,,
/assets/minecraft/textures/item,acacia_sign.png,mcl_signs_acacia_sign_inv.png,,,,,,,
/assets/minecraft/textures/item,bamboo_sign.png,mcl_bamboo_bamboo_sign_wield.png,,,,,,, /assets/minecraft/textures/item,bamboo_sign.png,mcl_bamboo_bamboo_sign_wield.png,,,,,,,
/assets/minecraft/textures/item,birch_sign.png,mcl_signs_birch_sign_inv.png,,,,,,, /assets/minecraft/textures/item,cherry_sign.png,mcl_cherry_blossom_sign_inv.png,,,,,,,
/assets/minecraft/textures/item,cherry_sign.png,mcl_cherry_blossom_inv.png,,,,,,, /assets/minecraft/textures/item,dark_oak_sign.png,mcl_signs_default_sign_dark.png,,,,,,,
/assets/minecraft/textures/item,crimson_sign.png,mcl_signs_crimson_sign_inv.png,,,,,,,
/assets/minecraft/textures/item,dark_oak_sign.png,mcl_signs_default_dark.png,,,,,,,
/assets/minecraft/textures/item,jungle_sign.png,mcl_signs_jungle_sign_inv.png,,,,,,,
/assets/minecraft/textures/item,mangrove_sign.png,mcl_signs_mangrove_sign_inv.png,,,,,,,
/assets/minecraft/textures/item,oak_sign.png,mcl_signs_default_sign.png,,,,,,, /assets/minecraft/textures/item,oak_sign.png,mcl_signs_default_sign.png,,,,,,,
/assets/minecraft/textures/item,spruce_sign.png,mcl_signs_spruce_sign_inv.png,,,,,,,
/assets/minecraft/textures/item,warped_sign.png,mcl_signs_warped_sign_inv.png,,,,,,,
/assets/minecraft/textures/entity,banner_base.png,mcl_banners_banner_base.png,,,,,,, /assets/minecraft/textures/entity,banner_base.png,mcl_banners_banner_base.png,,,,,,,
/assets/minecraft/textures/entity/banner,base.png,mcl_banners_base.png,,,,,,, /assets/minecraft/textures/entity/banner,base.png,mcl_banners_base.png,,,,,,,
/assets/minecraft/textures/block,nether_portal.png,mcl_portals_portal.png,,,,,,, /assets/minecraft/textures/block,nether_portal.png,mcl_portals_portal.png,,,,,,,

1 Source path Source file Target file xs ys xl yl xt yt Blacklisted?
338 /assets/minecraft/textures/block mycelium_top.png mcl_core_mycelium_top.png
339 /assets/minecraft/textures/block red_sand.png mcl_core_red_sand.png
340 /assets/minecraft/textures/block red_sandstone_bottom.png mcl_core_red_sandstone_bottom.png
341 /assets/minecraft/textures/block cut_red_sandstone.png mcl_core_red_sandstone_smooth.png mcl_core_red_sandstone_carved.png
342 /assets/minecraft/textures/block red_sandstone.png mcl_core_red_sandstone_normal.png
343 /assets/minecraft/textures/block chiseled_red_sandstone.png mcl_core_red_sandstone_carved.png mcl_core_red_sandstone_smooth.png
344 /assets/minecraft/textures/block red_sandstone_top.png mcl_core_red_sandstone_top.png
345 /assets/minecraft/textures/block redstone_ore.png mcl_core_redstone_ore.png
346 /assets/minecraft/textures/item sugar_cane.png mcl_core_reeds.png
347 /assets/minecraft/textures/block sandstone_bottom.png mcl_core_sandstone_bottom.png
348 /assets/minecraft/textures/block cut_sandstone.png mcl_core_sandstone_carved.png
349 /assets/minecraft/textures/block chiseled_sandstone.png mcl_core_sandstone_normal.png
350 /assets/minecraft/textures/block cut_sandstone.png mcl_core_sandstone_smooth.png
351 /assets/minecraft/textures/block chiseled_sandstone.png sandstone.png mcl_core_sandstone_carved.png mcl_core_sandstone_top.png
/assets/minecraft/textures/block sandstone.png mcl_core_sandstone_normal.png
/assets/minecraft/textures/block sandstone_top.png mcl_core_sandstone_top.png
352 /assets/minecraft/textures/block slime_block.png mcl_core_slime.png
353 /assets/minecraft/textures/block smooth_stone.png mcl_core_stonebrick_carved.png
354 /assets/minecraft/textures/block cracked_stone_bricks.png mcl_core_stonebrick_cracked.png
1151 /assets/minecraft/textures/block redstone_dust_line1.png redstone_redstone_dust_line1.png
1152 /assets/minecraft/textures/block attached_melon_stem.png mcl_farming_melon_stem_connected.png
1153 /assets/minecraft/textures/block melon_stem.png mcl_farming_melon_stem_disconnected.png
1154 /assets/minecraft/textures/entity/signs acacia.png mcl_signs_acacia_sign.png mcl_signs_sign_acacia.png
1155 /assets/minecraft/textures/entity/signs bamboo.png mcl_bamboo_bamboo_sign.png
/assets/minecraft/textures/entity/signs birch.png mcl_signs_birch_sign.png
1156 /assets/minecraft/textures/entity/signs cherry.png mcl_cherry_blossom_sign.png
/assets/minecraft/textures/entity/signs crimson.png mcl_signs_crimson_sign.png
1157 /assets/minecraft/textures/entity/signs dark_oak.png mcl_signs_sign_dark.png
/assets/minecraft/textures/entity/signs jungle.png mcl_signs_jungle_sign.png
/assets/minecraft/textures/entity/signs mangrove.png mcl_signs_mangrove_sign.png
1158 /assets/minecraft/textures/entity/signs oak.png mcl_signs_sign.png
/assets/minecraft/textures/entity/signs spruce.png mcl_signs_spruce_sign.png
/assets/minecraft/textures/entity/signs warped.png mcl_signs_warped_sign.png
/assets/minecraft/textures/item acacia_sign.png mcl_signs_acacia_sign_inv.png
1159 /assets/minecraft/textures/item bamboo_sign.png mcl_bamboo_bamboo_sign_wield.png
1160 /assets/minecraft/textures/item birch_sign.png cherry_sign.png mcl_signs_birch_sign_inv.png mcl_cherry_blossom_sign_inv.png
1161 /assets/minecraft/textures/item cherry_sign.png dark_oak_sign.png mcl_cherry_blossom_inv.png mcl_signs_default_sign_dark.png
/assets/minecraft/textures/item crimson_sign.png mcl_signs_crimson_sign_inv.png
/assets/minecraft/textures/item dark_oak_sign.png mcl_signs_default_dark.png
/assets/minecraft/textures/item jungle_sign.png mcl_signs_jungle_sign_inv.png
/assets/minecraft/textures/item mangrove_sign.png mcl_signs_mangrove_sign_inv.png
1162 /assets/minecraft/textures/item oak_sign.png mcl_signs_default_sign.png
/assets/minecraft/textures/item spruce_sign.png mcl_signs_spruce_sign_inv.png
/assets/minecraft/textures/item warped_sign.png mcl_signs_warped_sign_inv.png
1163 /assets/minecraft/textures/entity banner_base.png mcl_banners_banner_base.png
1164 /assets/minecraft/textures/entity/banner base.png mcl_banners_base.png
1165 /assets/minecraft/textures/block nether_portal.png mcl_portals_portal.png

View File

@ -122,9 +122,6 @@ def convert_textures(make_texture_pack, dry_run, verbose, base_dir, tex_dir, tem
description_file.write(description) description_file.write(description)
description_file.close() description_file.close()
# Create override file
shutil.copyfile("override.txt", target_dir("/", make_texture_pack, output_dir, output_dir_name, mineclone2_path) + "/override.txt")
# Create preview image (screenshot.png) # Create preview image (screenshot.png)
os.system("convert -size 300x200 canvas:transparent "+target_dir("/", make_texture_pack, output_dir, output_dir_name, mineclone2_path) + "/screenshot.png") os.system("convert -size 300x200 canvas:transparent "+target_dir("/", make_texture_pack, output_dir, output_dir_name, mineclone2_path) + "/screenshot.png")
os.system("composite "+base_dir+"/pack.png "+target_dir("/", make_texture_pack, output_dir, output_dir_name, mineclone2_path) + "/screenshot.png -gravity center "+target_dir("/", make_texture_pack, output_dir, output_dir_name, mineclone2_path) + "/screenshot.png") os.system("composite "+base_dir+"/pack.png "+target_dir("/", make_texture_pack, output_dir, output_dir_name, mineclone2_path) + "/screenshot.png -gravity center "+target_dir("/", make_texture_pack, output_dir, output_dir_name, mineclone2_path) + "/screenshot.png")

View File

@ -1,57 +0,0 @@
Signs:
mcl_signs:wall_sign_warped_hyphae_wood inventory mcl_signs_warped_sign_inv.png
mcl_signs:wall_sign_warped_hyphae_wood wield mcl_signs_warped_sign_inv.png
mcl_signs:wall_sign_warped_hyphae_wood all mcl_signs_warped_sign.png
mcl_signs:standing_sign_warped_hyphae_wood all mcl_signs_warped_sign.png
mcl_signs:standing_sign22_5_warped_hyphae_wood all mcl_signs_warped_sign.png
mcl_signs:standing_sign45_warped_hyphae_wood all mcl_signs_warped_sign.png
mcl_signs:standing_sign67_5_warped_hyphae_wood all mcl_signs_warped_sign.png
mcl_signs:wall_sign_c rimson_hyphae_wood inventory mcl_signs_crimson_sign_inv.png
mcl_signs:wall_sign_crimson_hyphae_wood wield mcl_signs_crimson_sign_inv.png
mcl_signs:wall_sign_crimson_hyphae_wood all mcl_signs_crimson_sign.png
mcl_signs:standing_sign_crimson_hyphae_wood all mcl_signs_crimson_sign.png
mcl_signs:standing_sign22_5_crimson_hyphae_wood all mcl_signs_crimson_sign.png
mcl_signs:standing_sign45_crimson_hyphae_wood all mcl_signs_crimson_sign.png
mcl_signs:standing_sign67_5_crimson_hyphae_wood all mcl_signs_crimson_sign.png
mcl_signs:wall_sign_acaciawood inventory mcl_signs_acacia_sign_inv.png
mcl_signs:wall_sign_acaciawood wield mcl_signs_acacia_sign_inv.png
mcl_signs:wall_sign_acaciawood all mcl_signs_acacia_sign.png
mcl_signs:standing_sign_acaciawood all mcl_signs_acacia_sign.png
mcl_signs:standing_sign22_5_acaciawood all mcl_signs_acacia_sign.png
mcl_signs:standing_sign45_acaciawood all mcl_signs_acacia_sign.png
mcl_signs:standing_sign67_5_acaciawood all mcl_signs_acacia_sign.png
mcl_signs:wall_sign_birchwood inventory mcl_signs_birch_sign_inv.png
mcl_signs:wall_sign_birchwood wield mcl_signs_birch_sign_inv.png
mcl_signs:wall_sign_birchwood all mcl_signs_birch_sign.png
mcl_signs:standing_sign_birchwood all mcl_signs_birch_sign.png
mcl_signs:standing_sign22_5_birchwood all mcl_signs_birch_sign.png
mcl_signs:standing_sign45_birchwood all mcl_signs_birch_sign.png
mcl_signs:standing_sign67_5_birchwood all mcl_signs_birch_sign.png
mcl_signs:wall_sign_junglewood inventory mcl_signs_jungle_sign_inv.png
mcl_signs:wall_sign_junglewood wield mcl_signs_jungle_sign_inv.png
mcl_signs:wall_sign_junglewood all mcl_signs_jungle_sign.png
mcl_signs:standing_sign_junglewood all mcl_signs_jungle_sign.png
mcl_signs:standing_sign22_5_junglewood all mcl_signs_jungle_sign.png
mcl_signs:standing_sign45_junglewood all mcl_signs_jungle_sign.png
mcl_signs:standing_sign67_5_junglewood all mcl_signs_jungle_sign.png
mcl_signs:wall_sign_mangrove_wood inventory mcl_signs_mangrove_sign_inv.png
mcl_signs:wall_sign_mangrove_wood wield mcl_signs_mangrove_sign_inv.png
mcl_signs:wall_sign_mangrove_wood all mcl_signs_mangrove_sign.png
mcl_signs:standing_sign_mangrove_wood all mcl_signs_mangrove_sign.png
mcl_signs:standing_sign22_5_mangrove_wood all mcl_signs_mangrove_sign.png
mcl_signs:standing_sign45_mangrove_wood all mcl_signs_mangrove_sign.png
mcl_signs:standing_sign67_5_mangrove_wood all mcl_signs_mangrove_sign.png
mcl_signs:wall_sign_sprucewood inventory mcl_signs_spruce_sign_inv.png
mcl_signs:wall_sign_sprucewood wield mcl_signs_spruce_sign_inv.png
mcl_signs:wall_sign_sprucewood all mcl_signs_spruce_sign.png
mcl_signs:standing_sign_sprucewood all mcl_signs_spruce_sign.png
mcl_signs:standing_sign22_5_sprucewood all mcl_signs_spruce_sign.png
mcl_signs:standing_sign45_sprucewood all mcl_signs_spruce_sign.png
mcl_signs:standing_sign67_5_sprucewood all mcl_signs_spruce_sign.png