use new hashing functions

This commit is contained in:
kno10 2025-01-16 22:18:06 +01:00 committed by the-real-herowl
parent 9472017fdb
commit df08ba7e82
2 changed files with 5 additions and 3 deletions
mods
ENTITIES/mobs_mc
ITEMS/mcl_enchanting

View file

@ -22,8 +22,10 @@ local function is_slime_chunk(pos)
if not pos then return end -- no position given
if slime_ratio == 0 then return end -- no slime chunks
if slime_ratio <= 1 then return true end -- slime everywhere
local bpos = vector.new(floor(pos.x / MAPBLOCK_SIZE), slime_3d_chunks and floor(pos.y / MAPBLOCK_SIZE) or 0, floor(pos.z / MAPBLOCK_SIZE))
return PcgRandom(minetest.hash_node_position(bpos) + world_seed):next(0,1e9)/1e9 * slime_ratio < 1
local x = floor(pos.x / MAPBLOCK_SIZE)
local y = slime_3d_chunks and floor(pos.y / MAPBLOCK_SIZE) or 0
local z = floor(pos.z / MAPBLOCK_SIZE)
return mcl_util.hash_pos(x, y, z, world_seed) / 0x100000000 * slime_ratio < 1
end
-- Returns a function that spawns children in a circle around pos.

View file

@ -2,7 +2,7 @@ local groupcaps_cache = {}
-- Compute a hash value.
function compute_hash(value)
return string.sub(minetest.sha1(minetest.serialize(value)), 1, 8)
return bit.tohex(mcl_util.djb2_hash(minetest.serialize(value)))
end
-- Get the groupcaps and hash for an enchanted tool. If this function is called