Enderman will take nodes only below air

This commit is contained in:
Wuzzy 2020-12-07 00:49:46 +01:00
parent 42155c6bdc
commit 9b9ee66b00

View file

@ -364,7 +364,7 @@ mobs:register_mob("mobs_mc:enderman", {
self._take_place_timer = 0 self._take_place_timer = 0
self._next_take_place_time = math.random(place_frequency_min, place_frequency_max) self._next_take_place_time = math.random(place_frequency_min, place_frequency_max)
local pos = self.object:get_pos() local pos = self.object:get_pos()
local takable_nodes = minetest.find_nodes_in_area({x=pos.x-2, y=pos.y-1, z=pos.z-2}, {x=pos.x+2, y=pos.y+1, z=pos.z+2}, mobs_mc.enderman_takable) local takable_nodes = minetest.find_nodes_in_area_under_air({x=pos.x-2, y=pos.y-1, z=pos.z-2}, {x=pos.x+2, y=pos.y+1, z=pos.z+2}, mobs_mc.enderman_takable)
if #takable_nodes >= 1 then if #takable_nodes >= 1 then
local r = pr:next(1, #takable_nodes) local r = pr:next(1, #takable_nodes)
local take_pos = takable_nodes[r] local take_pos = takable_nodes[r]