code:
-- GHOST BY FREEGAMERS.ORG, RESTLESS, FOLLOWS PLAYERS
-- DESCRIPTION: A spirit that wanders due to an unproper burial. Is not physical. Will haunt players until they are properly memoralized.
-- TODO: FIGURE OUT HOW TO WORK WITH LADDERS AND SHAFTS
mobs:register_mob('mobs_creatures:restless_ghost', {
	type = "monster",
	passive = false,
	group_attack = true,
	attack_type = "dogfight",
	reach = 2,
	damage = 0,
	hp_min = 10,
	hp_max = 10,
	armor = 100,
	knock_back = false,
        collisionbox = {0.0,-1.0,0.0, 0.0,0.0,0.0},
        visual = "mesh",
        mesh = "mobs_character.b3d",
        textures = {
                {"mobs_creatures_ghost.png"},
        },
	blood_amount = 0,
	makes_footstep_sound = false,
	sounds = {
		random = "mobs_creatures_ghost_random",
		 death = "mobs_creatures_ghost_death",
--		attack = "mobs_creatures_ghost_attack", -- disabling this because it gets really annoying.
		damage = "mobs_creatures_ghost_damage",
		warcry = "mobs_creatures_ghost_warcry",
	},
	walk_velocity = 1,
	run_velocity = 4,
	jump = true,
	fly = true,
	floats = true,
	suffocation = false,
	view_range = 32,
	drops = {
	},
--	stay_near = {nodes = "mesecraft_bones:bones", chance = 4}, -- Will search for its bones and attempt to bury itself. (restless ghost just follows players)
	follow = "mesecraft_bones:bones",	-- Will follow players holding bones.
	lava_damage = 0,
	water_damage = 0,
	light_damage = 0,
	fall_damage = 0,
        animation = {
                speed_normal = 0,
                speed_run = 79,
                stand_start = 0,
                stand_end = 79,
                walk_start = 0,
                walk_end = 79,
                run_start = 0,
                run_end = 79,
                punch_start = 0,
                punch_end = 79,
        },
	do_custom = function(self, pos)	-- ghosts will stay to haunt if there is no proper burial (gravestone) or if bones are still present.
		local checkpos = self.object:getpos()
		local gravecheck = minetest.find_node_near(checkpos, 8, {"group:gravestone"})
		local bonecheck = minetest.find_node_near(checkpos, 8 ,{"mesecraft_bones:bones"})
		if gravecheck == nil then				-- ghost stays to haunt
			return
		elseif bonecheck == nil and gravecheck ~= nil then	-- ghost can pass on
			minetest.sound_play({name = "mobs_creatures_ghost_warcry", gain = 1.0}, {pos=checkpos, max_hear_distance = 12})
			minetest.add_particlespawner({
			            amount = 10,
			            time = 1.0,
			            minpos = checkpos,
			            maxpos = checkpos,
			            minvel = {x=-0, y=-0, z=-0},
			            maxvel = {x=1, y=1, z=1},
			            minacc = {x=-0.3,y=3,z=-0.3},
			            maxacc = {x=0.5,y=5,z=0.5},
			            minexptime = 1,
			            maxexptime = 5,
			            minsize = 1,
			            maxsize = 3,
			            collisiondetection = false,
			            texture="default_item_smoke.png"
			        })
		        self.object:remove()
		end
		-- If the ghost is not in air, then it can go through walls and fly (so he doesnt fall through the ground).
		if minetest.get_node(checkpos).name ~= "air" then
			self.collisionbox = {0,0,0,0,0,0}
		end
	end,
})

--Spawn Eggs
mobs:register_egg("mobs_creatures:restless_ghost", "Restless Ghost Spawn Egg", "wool_white.png", 1)

--Spawn Functions
mobs:spawn_specific("mobs_creatures:restless_ghost", {"mesecraft_bones:bones"}, {"air"}, 0, 7, 600, 100, 2, -30912, 30912, false)


code:
--License for code WTFPL and otherwise stated in license.
mobs:register_mob("mobs_creatures:giant_bat", {
	type = "monster",
	passive = false,
        knock_back = false,
	hp_min = 50,
	hp_max = 50,
	attack_type = "dogfight",
	damage = 12,
	reach = 2,
	armor = 175,
	collisionbox = {-0.5, -0.02, -0.5, 0.5, 1.6, 0.5},
	visual = "mesh",
	mesh = "mobs_creatures_bat.b3d",
	textures = {
		{"mobs_creatures_bat.png"},
	},
	visual_size = {x=4, y=4},
	sounds = {
		random = "mobs_creatures_bat_random",
		attack = "mobs_creatures_bat_attack",
		damage = "mobs_creatures_bat_damage",
		death = "mobs_creatures_bat_death",
		jump = "mobs_creatures_bat_jump",
		attack = "mobs_creatures_bat_attack",
		distance = 16,
	},
	walk_velocity = 2.5,
	run_velocity = 4.0,
	stand_chance = 10,
	-- TODO: Hang upside down
	animation = {
		walk_speed = 80, stand_speed = 80, run_speed = 80,
		stand_start = 0,		stand_end = 40,
		walk_start = 0,		walk_end = 40,
		run_start = 0,		run_end = 40,
	},
	water_damage = 1,
	lava_damage = 4,
	light_damage = 0,
	fall_damage = 0,
	view_range = 16,
	fly = true,
	fly_in = "air",
})

-- Spawning

--[[ If the game has been launched between the 20th of October and the 3rd of November system time,
-- the maximum spawn light level is increased. ]]
local date = os.date("*t")
local maxlight
if (date.month == 10 and date.day >= 20) or (date.month == 11 and date.day <= 3) then
	maxlight = 6
else
	maxlight = 3
end

-- Spawn on solid blocks at or below Sea level and the selected light level
mobs:spawn_specific("mobs_creatures:giant_bat", {"group:stone"}, {"air"}, 0, 7, 480, 25000, 2, -6500, -500)

-- spawn eggs
mobs:register_egg("mobs_creatures:giant_bat", "Giant Bat Spawn Egg", "wool_black.png", 1)

repo_name: korkut/MeseCraft

license: mit


code:
--TODO ADD POISON
--TODO ADD JUMPS AND CLIMBS
-- declare velocity for spider crawl function
local get_velocity = function(self)

        local v = self.object:get_velocity()

        return (v.x * v.x + v.z * v.z) ^ 0.5
end
-- REGISTER WEB EXPLOSION FUNCTION
function explosion_web(pos, webtype)
    pos.y = round(pos.y)
    for i=pos.x-1, pos.x+1, 1 do
        for j=pos.y-3, pos.y, 1 do
            for k=pos.z-1, pos.z+1, 1 do
                -- TODO 0 check, why are we operating on two positions?
                local p = {x=i,y=j,z=k}
                local k = {x=i,y=j+1,z=k}
                local current = minetest.env:get_node(p).name
                local ontop  = minetest.env:get_node(k).name
                if current == "air" then
                --if not nssm.unswappable_node(p) then -- replaces to many nodes
                    minetest.set_node(p, {name=webtype})
                end
            end
        end
    end
end

--register spider mob
mobs:register_mob("mobs_creatures:giant_cave_spider", {
	type = "monster",
	knock_back = false,
	attack_animals = true,
	attack_nps = true,
	pathfinding = 1,
	hp_min = 100,
	hp_max = 100,
    	armor = 100,
	collisionbox = {-0.7, -0.01, -0.7, 0.7, 1.4, 0.7},
	textures = {
		{"mobs_creatures_spider.png"},
		{"mobs_creatures_spider_2.png"},
	},
	visual_size = {x=4,y=4},
	visual = "mesh",
	mesh = "mobs_creatures_spider.b3d",
	makes_footstep_sound = false,
	view_range = 8,
	walk_velocity = 1,
	run_velocity = 3,
	damage = 50,
	drops = {
		{name = "mobs_creatures:spiderweb", chance = 1, min = 1, max = 4,},
		{name = "mobs:meat_raw", chance = 1, min = 1, max = 8,}
	},
	water_damage = 0,
	lava_damage = 5,
	light_damage = 0,
	attack_type = "dogshoot",
	arrow = "mobs_creatures:spiderweb_ball",
	shoot_interval = 2.5,
	shoot_offset = 1,
	dogshoot_switch = 1,
	dogshoot_count_max = 1.8,
	animation = {
	        stand_speed = 10,
	        walk_speed = 25,
		run_speed = 50,
		stand_start = 20,
	        stand_end = 40,
		walk_start = 0,
	        walk_end = 20,
		run_start = 0,
	        run_end = 20,
	},
	jump = true,
	step = 1,
       	sounds = {
                random = "mobs_creatures_spider_random",
                jump = "mobs_creatures_spider_jump",
                death = "mobs_creatures_spider_death",
                distance = 16,
        },
	-- custom function to make spiders climb vertical facings
	do_custom = function(self, dtime)

		-- quarter second timer
		self.spider_timer = (self.spider_timer or 0) + dtime
		if self.spider_timer < 0.25 then
			return
		end
		self.spider_timer = 0

		-- need to be stopped to go onwards
		if get_velocity(self) > 0.2 then
			self.disable_falling = false
			return
		end

		local pos = self.object:get_pos()
		local yaw = self.object:get_yaw()

		pos.y = pos.y + self.collisionbox[2] - 0.2

		local dir_x = -math.sin(yaw) * (self.collisionbox[4] + 0.5)
		local dir_z = math.cos(yaw) * (self.collisionbox[4] + 0.5)
		local nod = minetest.get_node_or_nil({
			x = pos.x + dir_x,
			y = pos.y + 0.5,
			z = pos.z + dir_z
		})

		-- get current velocity
		local v = self.object:get_velocity()

		-- can only climb solid facings
		if not nod or not minetest.registered_nodes[nod.name]
		or not minetest.registered_nodes[nod.name].walkable then
			self.disable_falling = nil
			v.y = 0
			self.object:set_velocity(v)
			return
		end

--print ("----", nod.name, self.disable_falling, dtime)

		-- turn off falling if attached to facing
		self.disable_falling = true

		-- move up facing
		v.y = self.jump_height
		mobs:set_animation(self, "jump")
		self.object:set_velocity(v)
	end
})
-- REGISTER WEB BALL ARROW
mobs:register_arrow("mobs_creatures:spiderweb_ball", {
    visual = "sprite",
    visual_size = {x = 2, y = 2},
    textures = {"mobs_creatures_items_spiderweb.png"},
    velocity = 12,
    -- direct hit
    hit_player = function(self, player)
        local p = player:getpos()
        explosion_web(p, "mobs_creatures:spiderweb")
    end,
    hit_mob = function(self, player)
        player:punch(self.object, 1.0, {
            full_punch_interval = 1.0,
            damage_groups = {fleshy = 10},
        }, nil)
    end,

    hit_node = function(self, pos, node)
        explosion_web(pos, "mobs_creatures:spiderweb")
    end
})

--API Template: mobs:spawn_specfic(name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height, day_toggle, on_spawn)
mobs:spawn_specific("mobs_creatures:giant_cave_spider", { "group:cracky", "group:crumbly", "group:shovely", "group:pickaxey", "mobs_creatures:spiderweb", "df_mapitems:dirt_with_cave_moss", "default:dirt"}, {"air"}, 0, 7, 240, 8000, 6, -6500, -500)
mobs:register_egg("mobs_creatures:giant_cave_spider", "Giant Cave Spider Spawn Egg", "wool_black.png", 1)


code:
-- Gold Man by FreeGamers.org
-- Skin by DerDonut1

-- REGISTER DIAMOND MAN
mobs:register_mob("mobs_creatures:gold_man", {
	type = "monster",
	passive = false,
	attack_type = "dogfight",
	reach = 2,
	damage = 15,
	hp_min = 30,
	hp_max = 30,
	armor = 100,
        collisionbox = {-0.4, -1, -0.4, 0.4, 0.8, 0.4},
        visual = "mesh",
        mesh = "mobs_character.b3d",
        textures = {
                {"mobs_creatures_gold_man.png"},
        },
	makes_footstep_sound = true,
	sounds = {
		random = "mobs_creatures_stone_man_random",
		damage = "default_dig_metal",
		attack = "default_dug_metal",
		jump = "default_metal_footstep",
		death = "default_dug_metal",
	},
        blood_texture = "default_gold_block.png",
	walk_velocity = 1,
	run_velocity = 2,
	jump_height = 1,
	stepheight = 1.1,
	floats = 0,
	view_range = 12,
	drops = {
		{name = "default:gold_lump", chance = 10, min = 0, max = 2},
	},
	water_damage = 0,
	lava_damage = 5,
	light_damage = 0,
        suffocation = false,
        knock_back = false,
        animation = {
                speed_normal = 30,
                speed_run = 30,
                stand_start = 0,
                stand_end = 79,
                walk_start = 168,
                walk_end = 187,
                run_start = 168,
                run_end = 187,
                punch_start = 200,
                punch_end = 219,
        },
	immune_to = {
		{"default:pick_wood", 0}, -- wooden pick doesnt hurt gold man
		{"default:pick_stone", 4}, -- picks deal more damage to gold man
		{"default:pick_bronze", 5},
		{"default:pick_steel", 5},
		{"default:pick_mese", 6},
		{"default:pick_diamond", 7},
	},
    on_die = function(self, pos) -- on die, spawn particles.
        minetest.add_particlespawner({
            amount = 100,
            time = 0.1,
            minpos = {x=pos.x-1, y=pos.y-1, z=pos.z-1},
            maxpos = {x=pos.x+1, y=pos.y+1, z=pos.z+1},
            minvel = {x=-0, y=-0, z=-0},
            maxvel = {x=1, y=1, z=1},
            minacc = {x=-0.5,y=5,z=-0.5},
            maxacc = {x=0.5,y=5,z=0.5},
            minexptime = 0.1,
            maxexptime = 1,
            minsize = 1,
            maxsize = 2,
            collisiondetection = false,
            texture="default_gold_block.png"
        })
        self.object:remove()
    end,
})

-- Spawning Parameters
mobs:spawn_specific("mobs_creatures:gold_man", {"group:cracky", "group:crumbly", "group:shovely", "group:pickaxey"}, {"air", "mine_gas:gas"}, 0, 7, 600, 4000, 1, -9500, -6500)

-- Register Spawn Egg
mobs:register_egg("mobs_creatures:gold_man", "Gold Man Spawn Egg", "default_gold_block.png", 1)


code:
-- TODO: Add drops, mese-based trading npc.
-- GREY CIVILIAN ALIEN
mobs:register_mob("mobs_creatures:grey_civilian", {
   type = "animal",
   passive = true,
   runaway = true,
   damage = 3,
   reach = 2,
   attack_type = "dogfight",
   hp_min = 15,
   hp_max = 15,
   armor = 100,
   collisionbox = {-0.35,-0.85,-0.35, 0.35,0.70,0.35},
   visual = "mesh",
   mesh = "mobs_character.b3d",
   textures = {
      {"mobs_creatures_grey_civilian.png"},
   },
   blood_amount = 8,
   visual_size = {x=0.9, y=0.9},
   makes_footstep_sound = true,
   walk_velocity = 2,
   run_velocity = 2.5,
   floats = 1,
   jump = true,
   sounds = {
                distance = "16",
                random = "mobs_creatures_grey_civilian_random",
                attack = "mobs_creatures_grey_attack",
		war_cry = "mobs_creatures_grey_civilian_warcry",
                damage = "mobs_creatures_grey_damage",
                death = "mobs_creatures_grey_death",
   },
   drops = {
--      {name = "default:coal_lump", chance = 1, min = 1, max = 2},
   },
   water_damage = 1,
   lava_damage = 1,
   light_damage = 0,
   view_range = 12,
   animation = {
          speed_normal = 30,
          speed_run = 30,
          stand_start = 0,
          stand_end = 79,
          walk_start = 168,
          walk_end = 187,
          run_start = 168,
          run_end = 187,
          punch_start = 200,
          punch_end = 219,
        },
})
--Spawn Functions
mobs:spawn_specific("mobs_creatures:grey_civilian", {"default:gravel", "default:stone"}, {"vacuum:vacuum"}, 0, 16, 240, 1600, 4, 3000, 3200)

-- Register Spawn Egg
mobs:register_egg("mobs_creatures:grey_civilian", "Grey Civilian Spawn Egg", "default_stone.png", 1)

-------- CREDITS & ATTRIBUTIONS --------
-- Concept and implementation by FreeGamers.org
-- Texture by The Founder
-- Sounds by JarAxe - https://freesound.org/people/JarAxe/packs/13148/


code:
-- TODO: Add own projectile texture, add drops
-- GREY ALIEN ENLISTED
mobs:register_mob("mobs_creatures:grey_enlisted", {
   type = "monster",
   passive = false,
   damage = 3,
   reach = 2,
   attack_type = "dogshoot",
   shoot_interval = 2,
   dogshoot_switch = 1,
   dogshoot_count = 1,
   dogshoot_count_max = 2.1,
   arrow = "mobs_creatures:a_greys_energy_pistol",
   shoot_offset = 1.5,
   hp_min = 15,
   hp_max = 15,
   armor = 50,
   collisionbox = {-0.35,-0.85,-0.35, 0.35,0.70,0.35},
   visual = "mesh",
   mesh = "mobs_character.b3d",
   textures = {
      {"mobs_creatures_grey_enlisted.png"},
   },
   blood_amount = 8,
   visual_size = {x=0.9, y=0.9},
   makes_footstep_sound = true,
   walk_velocity = 2,
   run_velocity = 2.5,
   floats = 1,
   jump = true,
   sounds = {
                distance = "16",
                random = "mobs_creatures_grey_enlisted_random",
                attack = "mobs_creatures_grey_attack",
                shoot_attack = "mobs_creatures_grey_enlisted_shoot",
		war_cry = "mobs_creatures_grey_enlisted_warcry",
                damage = "mobs_creatures_grey_damage",
                death = "mobs_creatures_grey_death",
   },
   drops = {
--      {name = "default:coal_lump", chance = 1, min = 1, max = 2},
   },
   water_damage = 5,
   lava_damage = 10,
   light_damage = 0,
   view_range = 12,
   animation = {
          speed_normal = 30,
          speed_run = 30,
          stand_start = 0,
          stand_end = 79,
          walk_start = 168,
          walk_end = 187,
          run_start = 168,
          run_end = 187,
          punch_start = 200,
          punch_end = 219,
        },
})
--Spawn Functions
mobs:spawn_specific("mobs_creatures:grey_enlisted", {"default:gravel"}, {"vacuum:vacuum"}, 0, 16, 480, 2400, 2, 3200, 3400, false)

-- Register Spawn Egg
mobs:register_egg("mobs_creatures:grey_enlisted", "Grey Enlisted Spawn Egg", "default_stone.png", 1)

-- PROJECTILE ENERGY PISTOL
mobs:register_arrow("mobs_creatures:a_greys_energy_pistol", {
   visual = "sprite",
   visual_size = {x = 5.0, y = 0.5},
   textures = {"mobs_creatures_arrow_plasmaball.png"},
   velocity = 10,
   glow = 5,
   tail = 1, -- enable tail
   tail_texture = "mobs_creatures_arrow_plasmaball.png",
   hit_player = function(self, player)
      player:punch(self.object, 1.0, {
         full_punch_interval = 1.0,
         damage_groups = {fleshy = 20},
      }, nil)
       minetest.sound_play({name = "mobs_creatures_common_shoot_plasmaball_hit", gain = 1.0}, {pos=player:getpos(), max_hear_distance = 12})
   end,

   hit_mob = function(self, player)
      player:punch(self.object, 1.0, {
         full_punch_interval = 1.0,
         damage_groups = {fleshy = 20},
      }, nil)
   end,

   hit_node = function(self, pos, node)
      minetest.sound_play({name = "mobs_creatures_common_shoot_plasmaball_hit", gain = 1.0}, {pos=pos, max_hear_distance = 12})
      self.object:remove()
   end,
})

-------- CREDITS & ATTRIBUTIONS --------
-- Concept and implementation by FreeGamers.org
-- Texture by The Founder
-- Sounds by JarAxe - https://freesound.org/people/JarAxe/packs/13148/


code:
-- HELLBARON BY D00MED
mobs:register_mob("mobs_creatures:hellbaron", {
   type = "monster",
   passive = false,
   attacks_monsters = true,
   damage = 15,
   reach = 2,
   attack_type = "dogshoot",
   shoot_interval = 2.5,
        dogshoot_switch = 2,
        dogshoot_count = 0,
        dogshoot_count_max =5,
   arrow = "mobs_creatures:a_hellbaron_plasmaball",
   hp_min = 100,
   hp_max = 100,
   armor = 85,
   visual = "mesh",
   mesh = "mobs_character.b3d",
   collisionbox = {-0.5,-1.5,-0.5, 0.5,1.2,0.5},
   visual_size = {x=1.5, y=1.5},
   textures = {
      {"mobs_creatures_hellbaron.png"},
   },
   knock_back = false,
   makes_footstep_sound = true,
   walk_velocity = 2,
   run_velocity = 3,
   jump = true,
   sounds = {
                distance = "16",
                random = "mobs_creatures_hellbaron_random",
                war_cry = "mobs_creatures_hellbaron_warcry",
                attack = "mobs_creatures_common_attack_claw",
                shoot_attack = "mobs_creatures_common_shoot_plasmaball",
	        damage = "mobs_creatures_pinky_damage",
                death = "mobs_creatures_hellbaron_death",
   },
   drops = {
      {name = "mobs_creatures:bone", chance = 1, min = 1, max = 5},
   },
   water_damage = 0,
   lava_damage = 0,
   light_damage = 0,
   view_range = 12,
   animation = {
	        speed_normal = 30,
	        speed_run = 45,
	        stand_start = 0,
	        stand_end = 79,
	        walk_start = 168,
	        walk_end = 187,
	        run_start = 168,
	        run_end = 187,
	        punch_start = 200,
	        punch_end = 219,
    },
})
--HELLBARON PROJECTILE
mobs:register_arrow("mobs_creatures:a_hellbaron_plasmaball", {
   visual = "sprite",
   visual_size = {x = 1, y = 1},
   textures = {"mobs_creatures_arrow_plasmaball.png"},
   velocity = 14,
   glow = 5,
   tail = 1, -- enable tail
   tail_texture = "mobs_creatures_arrow_plasmaball_trail.png",

   hit_player = function(self, player)
      player:punch(self.object, 1.0, {
         full_punch_interval = 1.0,
         damage_groups = {fleshy = 15},
      }, nil)
       minetest.sound_play({name = "mobs_creatures_common_shoot_plasmaball_hit", gain = 1.0}, {pos=player:getpos(), max_hear_distance = 12})
   end,

   hit_mob = function(self, player)
      player:punch(self.object, 1.0, {
         full_punch_interval = 1.0,
         damage_groups = {fleshy = 15},
      }, nil)
   end,
   hit_node = function(self, pos, node)
       minetest.sound_play({name = "mobs_creatures_common_shoot_plasmaball_hit", gain = 1.0}, {pos=pos, max_hear_distance = 12})
      self.object:remove()
   end,
})
-- REGISTER SPAWN PARAMETERS
mobs:spawn_specific("mobs_creatures:hellbaron", {"nether:sand", "default:lava_source", "nether:glowstone"},{"air"}, 0, 20, 480, 2000, -31920, -16000)

-- REGISTER SPAWN EGG
mobs:register_egg("mobs_creatures:hellbaron", "Hellbaron Spawn Egg", "default_dirt.png", 1)


code:
-- IMP
mobs:register_mob("mobs_creatures:imp", {
   type = "monster",
   passive = false,
   damage = 15,
   reach = 2,
   attack_type = "dogshoot",
   shoot_interval = 2.5,
        dogshoot_switch = 2,
        dogshoot_count = 2,
        dogshoot_count_max =5,
   arrow = "mobs_creatures:an_imp_fireball",
   shoot_offset = 1.5,
   hp_min = 20,
   hp_max = 20,
   armor = 100,
   collisionbox = {-0.35,-1.0,-0.35, 0.35,0.8,0.35},
   visual = "mesh",
   mesh = "mobs_character.b3d",
   textures = {
      {"mobs_creatures_imp.png"},
   },
   visual_size = {x=1, y=1},
   makes_footstep_sound = true,
   walk_velocity = 2,
   run_velocity = 3,
   jump = true,
   sounds = {
                distance = "20",
                random = "mobs_creatures_imp_random",
                war_cry = "mobs_creatures_imp_warcry",
                attack = "mobs_creatures_common_attack_claw",
                shoot_attack = "mobs_creatures_common_shoot_fireball",
                damage = "mobs_creatures_zombie_damage",
                death = "mobs_creatures_imp_death",
   },
   drops = {
--      {name = "default:coal_lump", chance = 1, min = 1, max = 2},
   },
   water_damage = 2,
   lava_damage = 0,
   light_damage = 0,
   view_range = 20,
   animation = {
          speed_normal = 30,
          speed_run = 30,
          stand_start = 0,
          stand_end = 79,
          walk_start = 168,
          walk_end = 187,
          run_start = 168,
          run_end = 187,
          punch_start = 200,
          punch_end = 219,
          shoot_start = 200,
          shoot_end = 219,
        },
})
--REGISTER ARROW: IMP PROJECTILE
mobs:register_arrow("mobs_creatures:an_imp_fireball", {
   visual = "sprite",
   visual_size = {x = 1, y = 1},
   textures = {"mobs_creatures_arrow_fireball.png"},
   velocity = 8,
   glow = 5,
   tail = 1, -- enable trail
   tail_texture = "mobs_creatures_arrow_fireball_trail.png",
   hit_player = function(self, player)
      player:punch(self.object, 1.0, {
         full_punch_interval = 1.0,
         damage_groups = {fleshy = 15},
      }, nil)
       minetest.sound_play({name = "mobs_creatures_common_shoot_fireball_hit", gain = 1.0}, {pos=player:getpos(), max_hear_distance = 12})
   end,

   hit_mob = function(self, player)
      player:punch(self.object, 1.0, {
         full_punch_interval = 1.0,
         damage_groups = {fleshy = 15},
      }, nil)
       minetest.sound_play({name = "mobs_creatures_common_shoot_fireball_hit", gain = 1.0}, {pos=pos, max_hear_distance = 12})
   end,

   hit_node = function(self, pos, node)
       minetest.sound_play({name = "mobs_creatures_common_shoot_fireball_hit", gain = 1.0}, {pos=pos, max_hear_distance = 12})
      self.object:remove()
   end,
})

-- REGISTER SPAWN PARAMETERS
mobs:spawn_specific("mobs_creatures:imp", {"nether:rack"}, {"air"}, 0, 16, 240, 1000, 6, -30912, -16000)

-- REGISTER SPAWN EGG
mobs:register_egg("mobs_creatures:imp", "Imp Spawn Egg", "default_dirt.png", 1)


code:
-- Iron Man by FreeGamers.org

-- REGISTER DIAMOND MAN
mobs:register_mob("mobs_creatures:iron_man", {
	type = "monster",
	passive = false,
	attack_type = "dogfight",
	reach = 2,
	damage = 15,
	hp_min = 30,
	hp_max = 30,
	armor = 100,
        collisionbox = {-0.4, -1, -0.4, 0.4, 0.8, 0.4},
        visual = "mesh",
        mesh = "mobs_character.b3d",
        textures = {
                {"mobs_creatures_iron_man.png"},
        },
	makes_footstep_sound = true,
	sounds = {
		random = "mobs_creatures_stone_man_random",
		damage = "default_dig_metal",
		attack = "default_dug_metal",
		jump = "default_metal_footstep",
		death = "default_dug_metal",
	},
        blood_texture = "default_steel_block.png",
	walk_velocity = 1,
	run_velocity = 2,
	jump_height = 1,
	stepheight = 1.1,
	floats = 0,
	view_range = 12,
	drops = {
		{name = "default:iron_lump", chance = 10, min = 0, max = 2},
	},
	water_damage = 0,
	lava_damage = 5,
	light_damage = 0,
        suffocation = false,
        knock_back = false,
        animation = {
                speed_normal = 30,
                speed_run = 30,
                stand_start = 0,
                stand_end = 79,
                walk_start = 168,
                walk_end = 187,
                run_start = 168,
                run_end = 187,
                punch_start = 200,
                punch_end = 219,
        },
	immune_to = {
		{"default:pick_wood", 0}, -- wooden pick doesnt hurt iron man
		{"default:pick_stone", 4}, -- picks deal more damage to iron
		{"default:pick_bronze", 5},
		{"default:pick_steel", 5},
		{"default:pick_mese", 6},
		{"default:pick_diamond", 7},
	},
    on_die = function(self, pos) -- on die, spawn particles.
        minetest.add_particlespawner({
            amount = 100,
            time = 0.1,
            minpos = {x=pos.x-1, y=pos.y-1, z=pos.z-1},
            maxpos = {x=pos.x+1, y=pos.y+1, z=pos.z+1},
            minvel = {x=-0, y=-0, z=-0},
            maxvel = {x=1, y=1, z=1},
            minacc = {x=-0.5,y=5,z=-0.5},
            maxacc = {x=0.5,y=5,z=0.5},
            minexptime = 0.1,
            maxexptime = 1,
            minsize = 1,
            maxsize = 2,
            collisiondetection = false,
            texture="default_steel_block.png"
        })
        self.object:remove()
	-- Release gas on death.
        if minetest.get_node(pos).name == "air" then
                minetest.set_node(pos, {name = "mine_gas:gas"})
        end
        self.object:remove()
    end,

})

-- Spawning Parameters
mobs:spawn_specific("mobs_creatures:iron_man", {"group:cracky", "group:crumbly", "group:shovely", "group:pickaxey"}, {"air", "mine_gas:gas"}, 0, 7, 480, 6000, 1, -9500, -6500)

-- Register Spawn Egg
mobs:register_egg("mobs_creatures:iron_man", "Iron Man Spawn Egg", "default_steel_block.png", 1)


code:
-- TODO: Make them mountable/rideable and tameable.
-- Inspired by Dwarf Fortress. Texture and model come from "horror" mod by D00Med.
mobs:register_mob("mobs_creatures:jabberer", {
   type = "monster",
   passive = false,
   attacks_monsters = true,
   knock_back = false,
   damage = 12,
   reach = 3,
   attack_type = "dogfight",
   hp_min = 100,
   hp_max = 100,
   armor = 100,
   collisionbox = {-0.5, -0, -0.6, 0.6, 1.6, 0.6},
   visual = "mesh",
   mesh = "mobs_creatures_jabberer.b3d",
   textures = {
      {"mobs_creatures_jabberer.png"},
   },

   blood_amount = 80,
   visual_size = {x=3, y=3},
   makes_footstep_sound = true,
   walk_velocity = 2,
   run_velocity = 3,
   jump = true,
   drops = {
      {name = "mobs:meat_raw", chance = 1, min = 5, max = 15},
      {name = "mobs_creatures:bone", chance = 1, min = 5, max = 25},
      {name = "mobs_creatures:feather", chance = 1, min = 1, max = 1},
      {name = "mobs:leather", chance = 1, min = 1, max = 10},
   },
   sounds = {
           random = "mobs_creatures_jabberer_random",
           death = "mobs_creatures_jabberer_death",
	   damage = "mobs_creatures_jabberer_damage",
	   attack = "mobs_creatures_jabberer_attack",
           distance = 16,
        },

   water_damage = 0,
   lava_damage = 10,
   light_damage = 0,
   view_range = 12,
   animation = {
      speed_normal = 10,
      speed_run = 20,
      walk_start = 42,
      walk_end = 62,
      stand_start = 1,
      stand_end = 11,
      run_start = 42,
      run_end = 62,
      punch_start = 20,
      punch_end = 35,
   },
})
-- Spawn Egg
mobs:register_egg("mobs_creatures:jabberer", "Jabberer Spawn Egg", "default_dirt.png", 1)

-- Spawning parameters
mobs:spawn_specific("mobs_creatures:jabberer", {"group:stone"}, {"air"}, 0, 7, 480, 12000, 1, -9500, -3500)

-- ATTRIBUTION
-- random sound MinigunFiend - https://freesound.org/people/MinigunFiend/sounds/175206/
-- attack sound dinodilopho - https://freesound.org/people/dinodilopho/sounds/263530/
-- death sound fabianacarmonas - https://freesound.org/people/fabianacarmonas/sounds/491462/
-- damage sound Ragu21- https://freesound.org/people/Ragu21/sounds/342162/


code:
-- Kangaroo by FreeGamers.org
-- Originally from "Procoptodon" by ElCeejo (base mob, texture, and model).
mobs:register_mob("mobs_creatures:kangaroo", {
	type = "animal",
	hp_min = 28,
	hp_max = 28,
	armor = 140,
	passive = false,
	walk_velocity = 2.5,
	run_velocity = 4,
        walk_chance = 10,
        jump = true,
        jump_height = 4,
        stepheight = 2,
        runaway = false,
        pushable = true,
        view_range = 8,
        damage = 7,
	fear_height = 13,
	fall_speed = -8,
	fall_damage = 5,
	water_damage = 3,
	lava_damage = 5,
	light_damage = 0,
        suffocation = false,
        floats = 1,
	follow = {"default:bush_leaves"},
        reach = 3,
        owner_loyal = true,
	attack_type = "dogfight",
	pathfinding = 0,
	makes_footstep_sound = true,
	sounds = {
		random = "mobs_creatures_kangaroo",
	},
	drops = {
		{name = "mobs:meat_raw", chance = 1, min = 6, max = 9},
		{name = "mobs:leather", chance = 1, min = 2, max = 3},
		{name = "mobs_creatures:bone", chance = 1, min = 1, max = 2},
	},
	visual = "mesh",
	visual_size = {x=6, y=6},
	collisionbox = {-0.5, -0.8, -0.5, 0.5, 0.4, 0.5},
	textures = {
		{"mobs_creatures_kangaroo.png"},
	},
	child_texture = {
		{"mobs_creatures_kangaroo_child.png"},
	},
	mesh = "mobs_creatures_kangaroo.b3d",
	animation = {
		speed_normal = 40,
		speed_sprint = 85,
		stand_start = 50,
		stand_end = 140,
		walk_start = 1,
		walk_end = 40,
		punch_start = 150,
		punch_end = 180,
		punch_loop = false,
	},

	on_rightclick = function(self, clicker)

		-- feed or tame
		if mobs:feed_tame(self, clicker, 8, true, true) then return end
		if mobs:protect(self, clicker) then return end

		if self.owner == "" then
			self.owner = clicker:get_player_name()
		else
			if self.order == "follow" then
				self.order = "stand"
			else
				self.order = "follow"

			end

		end

	end,

	do_custom = function(self, dtime)

	if self.child == true then

	self.type = "animal"
	self.passive = true
        self.attack_animals = false
	self.walk_velocity = 0.7
	self.run_velocity = 0.7
			return
		end
	end,
-- Make Kangaroo Poop.
        function(self, dtime)
                self.egg_timer = (self.egg_timer or 0) + dtime
                if self.egg_timer < 10 then
                       return
                end
                self.egg_timer = 0

                if self.child
                or math.random(1, 100) > 1 then
                        return
                end

                local pos = self.object:get_pos()

                minetest.add_item(pos, "mobs_creatures:poop_turd")

                minetest.sound_play("mobs_creatures_common_poop", {
                        pos = pos,
                        gain = 1.0,
                        max_hear_distance = 8,
                })
        end,
})

-- Spawn Egg
mobs:register_egg("mobs_creatures:kangaroo", "Kangaroo Spawn Egg", "default_dry_grass.png", 1)

-- Spawn Parameters, spawns in Savannah near dry grass or air during the day.
mobs:spawn_specific("mobs_creatures:kangaroo", {"default:dry_dirt_with_dry_grass"}, {"group:dry_grass"}, 7, 16, 240, 2000, 6, 1, 150, true)


code:
-- MAGMA MAN
-- Texture by conrod456

mobs:register_mob("mobs_creatures:magma_man", {
   type = "monster",
   passive = false,
   attacks_monsters = false,
   damage = 20,
   reach = 2,
   attack_type = "dogfight",
   hp_min = 30,
   hp_max = 30,
   armor = 25,
   knock_back = false,
   collisionbox = {-0.35,-1.0,-0.35, 0.35,0.8,0.35},
   visual = "mesh",
   mesh = "mobs_character.b3d",
   textures = {
  	    {"mobs_creatures_magma_man.png"},
   },
   animation = {
        speed_normal = 30,
        speed_run = 30,
        stand_start = 0,
        stand_end = 79,
        walk_start = 168,
        walk_end = 187,
        run_start = 168,
        run_end = 187,
        punch_start = 200,
        punch_end = 219,
   },
   blood_amount = 60,
   blood_texture = "default_obsidian.png",
   makes_footstep_sound = true,
   walk_velocity = 1,
   run_velocity = 2,
   jump = true,
   fly = false,
   drops = {
	{ name = "default:obsidian", chance = 1, min = 1, max = 4 },
   },
   water_damage = 0,
   lava_damage = 0,
   light_damage = 0,
   view_range = 16,
   sounds = {
	death = "default_cool_lava",
        random = "mobs_creatures_dirt_man_random",
	jump = "default_hard_footstep",
	attack = "default_place_node_hard",
	damage = "default_dug_node",
   },
   drops = {
--		{name = "mobs_creatures:ash", chance = 1, min = 1, max = 4}
	},
   do_custom = function(self)
		-- if standing in water, remove replace with air play steam.
		local pos = self.object:getpos()
		if minetest.get_node(pos).name == "default:water_source" or minetest.get_node(pos).name == "default:water_flowing" or minetest.get_node(pos).name == "default:river_water_source" or minetest.get_node(pos).name == "default:river_water_flowing" or minetest.get_node(pos).name == "default:snow" or minetest.get_node(pos).name == "default:ice" then
			minetest.add_particlespawner({
				amount = 1,
				time = 1,
				minpos = pos,
				maxpos = pos,
				minvel = {x=-1, y=0, z=-1},
				maxvel = {x=1, y=1, z=1},
				minacc = {x=0, y=2, z=0},
				maxacc = {x=0, y=2, z=0},
				minexptime = 1,
				maxexptime = 2,
				minsize = 4,
				maxsize = 8,
				collisiondetection = false,
				vertical = false,
				texture = "smoke_puff.png",
			})
		      	minetest.sound_play({name = "default_cool_lava", gain = 1.0}, {pos=pos, max_hear_distance = 16})
			minetest.set_node(pos, {name = "air"})
		else
			return
		end
    end,
    on_die = function(self, pos) -- on die, spawn particles.
        if minetest.get_node(pos).name == "air" then
                minetest.set_node(pos, {name = "default:lava_source"})
        end
        minetest.add_particlespawner({
            amount = 100,
            time = 0.1,
            minpos = {x=pos.x-1, y=pos.y-1, z=pos.z-1},
            maxpos = {x=pos.x+1, y=pos.y+1, z=pos.z+1},
            minvel = {x=-0, y=-0, z=-0},
            maxvel = {x=1, y=1, z=1},
            minacc = {x=-0.5,y=5,z=-0.5},
            maxacc = {x=0.5,y=5,z=0.5},
            minexptime = 0.1,
            maxexptime = 1,
            minsize = 1,
            maxsize = 3,
            collisiondetection = false,
            texture="default_obsidian.png"
        })
        self.object:remove()
    end,
})
-- REGISTER SPAWN PARAMETERS
mobs:spawn_specific("mobs_creatures:magma_man", {"default:cobblestone", "default:stone", "magma_conduits:hot_cobble", "magma_conduits:glow_obsidian","magma_conduits:stone", "group:stone"}, {"default:lava_flowing", "default:lava_source"}, 0, 16, 480, 6000, 1, -12499,-6500)

-- REGISTER SPAWN EGG
mobs:register_egg("mobs_creatures:magma_man", "Magma Man Spawn Egg", "default_lava.png", 1)


code:
-- MANCUBUS
mobs:register_mob("mobs_creatures:mancubus", {
   type = "monster",
   passive = false,
   reach = 2,
   attack_type = "shoot",
   shoot_interval = 4.0,
   arrow = "mobs_creatures:a_mancubus_rocket",
   shoot_offset = 1,
   hp_min = 50,
   hp_max = 50,
   armor = 100,
   collisionbox = {-0.95,-2.0,-0.95, 0.95,1.6,0.95},
   visual = "mesh",
   mesh = "mobs_character.b3d",
   textures = {
      {"mobs_creatures_mancubus.png"},
   },
   visual_size = {x=3, y=2},
   makes_footstep_sound = true,
   walk_velocity = 1,
   run_velocity = 1.5,
   knock_back = false,
   jump = true,
   sounds = {
                distance = "20",
                random = "mobs_creature_mancubus_random",
                war_cry = "mobs_creatures_mancubus_warcry",
                shoot_attack = "mobs_creatures_cyberdemon_shoot",
                damage = "mobs_creatures_pinky_damage",
                death = "doom_mancubus_death",
   },
   drops = {
      {name = "mobs:meat_raw", chance = 1, min = 1, max = 5},
      {name = "bweapons_hitech_pack:missile", chance = 1, min = 1, max = 6},
   },
   water_damage = 0,
   lava_damage = 0,
   light_damage = 0,
   view_range = 12,
        animation = {
                speed_normal = 30,
                speed_run = 45,
                stand_start = 0,
                stand_end = 79,
                walk_start = 168,
                walk_end = 187,
                run_start = 168,
                run_end = 187,
                punch_start = 200,
                punch_end = 219,
                shoot_start = 200,
                shoot_end = 219,
        },
})
-- REGISTER PROJECTILE
mobs:register_arrow("mobs_creatures:a_mancubus_rocket", {
   visual = "sprite",
   visual_size = {x = 1, y = 1},
   textures = {"mobs_creatures_arrow_rocket.png"},
   velocity = 12,
   tail = 1, -- enable tail
   glow = 5,
   tail_texture = "mobs_creatures_arrow_rocket_trail.png",

   hit_player = function(self, player)
      player:punch(self.object, 1.0, {
         full_punch_interval = 1.0,
         damage_groups = {fleshy = 15},
      }, nil)
   end,

   hit_mob = function(self, player)
      player:punch(self.object, 1.0, {
         full_punch_interval = 1.0,
         damage_groups = {fleshy = 15},
      }, nil)
   end,

   hit_node = function(self, pos, node)
	if minetest.get_node(pos).name ~= "default:cobble" then
	      mobs:explosion(pos, 2, 2, 2)
	end
   end,
})

-- REGISTER SPAWN PARAMETERS
mobs:spawn_specific("mobs_creatures:mancubus", {"nether:sand","nether:glowstone","default:lava_source"}, {"air"}, 0, 16, 480, 3000, 4, -30912, -16000)

-- REGISTER SPAWN EGG
mobs:register_egg("mobs_creatures:mancubus", "Mancubus Spawn Egg", "default_sand.png", 1)


code:
-- MOOSHROOM
mobs:register_mob("mobs_creatures:mooshroom", {
        type = "animal",
        hp_min = 10,
        hp_max = 10,
        collisionbox = {-0.45, -0.01, -0.45, 0.45, 1.39, 0.45},
        visual = "mesh",
        mesh = "mobs_creatures_cow.b3d",
        textures = { {"mobs_creatures_mooshroom.png", "mobs_creatures_mooshroom_red_mushroom.png"}, },
        visual_size = {x=2.8, y=2.8},
        makes_footstep_sound = true,
        walk_velocity = 1,
        drops = {
                {name = "mobs:meat_raw", chance = 1, min = 1, max = 3,},
                {name = "mobs:leather",chance = 1,min = 0,max = 2,},
        },
        water_damage = 1,
        lava_damage = 5,
        light_damage = 0,
        runaway = true,
        sounds = {
                random = "mobs_creatures_cow_random",
                death = "mobs_creatures_cow_damage",
                damage = "mobs_creatures_cow_damage",
                jump = "mobs_creatures_cow_jump",
                distance = 16,
        },
        animation = {
                stand_speed = 25, walk_speed = 25, run_speed = 50,
                stand_start = 0,                stand_end = 0,
                walk_start = 0,         walk_end = 40,
                run_start = 0,          run_end = 40,
        },
        follow = "farming:wheat",
        replace_rate = 10,
        replace_what = {
                {"group:grass", "air", 0},
                {"default:dirt_with_grass", "default:dirt", -1}
        },
        on_rightclick = function(self, clicker)
                if mobs:feed_tame(self, clicker, 1, true, true) then return end
                if mobs:protect(self, clicker) then return end

                if self.child then
                        return
                end
                local item = clicker:get_wielded_item()
                -- Use shears to get mushrooms and turn mooshroom into cow
                if item:get_name() == "mobs:shears" then
                        local pos = self.object:getpos()
                        minetest.sound_play("shears", {pos = pos})
                        minetest.add_item({x=pos.x, y=pos.y+1.4, z=pos.z}, "flowers:mushroom_red" .. " 5")

                        local oldyaw = self.object:getyaw()
                        self.object:remove()
                        local cow = minetest.add_entity(pos, "mobs_creatures:cow")
                        cow:setyaw(oldyaw)
                -- Use bucket to milk
                elseif item:get_name() == "mesecraft_bucket:bucket_empty" and clicker:get_inventory() then
                        local inv = clicker:get_inventory()
                        inv:remove_item("main", "mesecraft_bucket:bucket_empty")
                        -- If room, add milk to inventory, otherwise drop as item
                        if inv:room_for_item("main", {name= "mobs_creatures:milk_bucket"}) then
                                clicker:get_inventory():add_item("main", "mobs_creatures:milk_bucket")
                                local pos = self.object:getpos()
                                minetest.sound_play("mobs_creatures_cow_milk", {
                                pos = pos,
                                gain = 1.0,
                                max_hear_distance = 8,
                                })

                        else
                                local pos = self.object:getpos()
                                pos.y = pos.y + 0.5
                                minetest.add_item(pos, {name = "mobs_creatures:milk_bucket"})
                                minetest.sound_play("mobs_creatures_cow_milk", {
                                pos = pos,
                                gain = 1.0,
                                max_hear_distance = 8,
                                })

                        end
                -- Use bowl to get mushroom stew
                elseif item:get_name() == "ethereal:bowl" and clicker:get_inventory() then
                        local inv = clicker:get_inventory()
                        inv:remove_item("main", "ethereal:bowl")
                        -- If room, add mushroom stew to inventory, otherwise drop as item
                        if inv:room_for_item("main", {name="ethereal:hearty_stew"}) then
                                clicker:get_inventory():add_item("main", "ethereal:hearty_stew")
                        else
                                local pos = self.object:getpos()
                                pos.y = pos.y + 0.5
                                minetest.add_item(pos, {name = "ethereal:hearty_stew"})
                        end
                end
                mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
        end,
})

-- Register Spawn Mooshroom
if minetest.get_modpath("ethereal") then
	mobs:spawn_specific("mobs_creatures:mooshroom", "ethereal:mushroom_dirt", {"air"}, 9, 15, 120, 8000, 5, 0, 200)
end

-- Register Mooshroom Spawn Egg
mobs:register_egg("mobs_creatures:mooshroom", "Mooshroom Spawn Egg", "wool_red.png", 1)


code:
-- Simplified by FreeGamers.org
--License for code WTFPL and otherwise stated in readmes
--################### OCELOT AND CAT from mc_mobs--###################

local pr = PseudoRandom(os.time()*12)

-- Returns true if the item is food (taming) for the cat/ocelot
local is_food = function(itemstring)
	for f=1, #mobs_mc.follow.ocelot do
		if itemstring == mobs_mc.follow.ocelot[f] then
			return true
		elseif string.sub(itemstring, 1, 6) == "group:" and minetest.get_item_group(itemstring, string.sub(itemstring, 7, -1)) ~= 0 then
			return true
		end
	end
	return false
end

-- Ocelot
local ocelot = {
	type = "animal",
	hp_min = 10,
	hp_max = 10,
	collisionbox = {-0.3, -0.01, -0.3, 0.3, 0.69, 0.3},
	visual = "mesh",
	mesh = "mobs_creatures_cat.b3d",
	textures = {"mobs_creatures_cat_ocelot.png"},
	visual_size = {x=2.0, y=2.0},
	makes_footstep_sound = true,
	walk_chance = 70,
	walk_velocity = 1,
	run_velocity = 3,
	floats = 1,
	runaway = true,
        runaway_from = {"player"},
	water_damage = 0,
	lava_damage = 4,
	light_damage = 0,
	fall_damage = 0,
	fear_height = 4,
	sounds = {
		random = "mobs_creatures_ocelot_random",
		damage = "mobs_creatures_ocelot_pain",
		distance = 16,
	},
	animation = {
		speed_normal = 25,		speed_run = 50,
		stand_start = 0,		stand_end = 0,
		walk_start = 0,		walk_end = 40,
		run_start = 0,		run_end = 40,
	},
	follow = {"mobs_creatures:milk_bucket", "mobs_creatures:milk_glass", "mobs_creatures:chicken_raw", "mobs_creatures:chicken_cooked", "mobs_creatures:cod_raw", "mobs_creatures:cod_cooked", "mobs_creatures:clownfish_raw", "mobs_creatures:clownfish_cooked", "mobs_creatures:rabbit_raw", "mobs_creatures:rabbit_cooked", "mobs_creatures:salmon_raw", "mobs_creatures:salmon_cooked",},
	view_range = 12,
	passive = true,
	attack_type = "dogfight",
	pathfinding = 1,
	damage = 2,
	reach = 1,
	attack_animals = true,
	specific_attack = { "mobs_creatures:chicken" },
-- FROM WOLF
	on_rightclick = function(self, clicker)
		-- Can't tame a kitten. Sorry.
		if self.child then return end
		-- Try to tame ocelot (intentionally does NOT use mobs:feed_tame)
		local item = clicker:get_wielded_item()
		if item:get_name() == "mobs_creatures:rotten_flesh" or minetest.get_item_group(item:get_name(), "food_meat_raw") == 1 or minetest.get_item_group(item:get_name(), "food_meat") == 1 or minetest.get_item_group(item:get_name(), "food_chicken") == 1 or minetest.get_item_group(item:get_name(), "food_chicken_raw") == 1 or minetest.get_item_group(item:get_name(), "food_fish_raw") == 1 or minetest.get_item_group(item:get_name(), "food_fish") == 1 or minetest.get_item_group(item:get_name(), "food_milk") == 1 or minetest.get_item_group(item:get_name(), "food_milk_glass") == 1 then
		-- Don't take items in creative mode.
			if not minetest.settings:get_bool("creative_mode") then
					item:take_item()
					clicker:set_wielded_item(item)
				end
			-- 1/3 chance of getting tamed
			if pr:next(1, 3) == 1 then
				local yaw = self.object:get_yaw()
				local cat = minetest.add_entity(self.object:getpos(), "mobs_creatures:cat")
				cat:set_yaw(yaw)
				local ent = cat:get_luaentity()
				ent.owner = clicker:get_player_name()
				ent.tamed = true
				self.object:remove()
				return
			end
		end
	end,
}

mobs:register_mob("mobs_creatures:ocelot", ocelot)

-- Cat
local cat = table.copy(ocelot)
cat.textures = {{"mobs_creatures_cat_black.png"}, {"mobs_creatures_cat_red.png"}, {"mobs_creatures_cat_siamese.png"}}
cat.owner = ""
cat.order = "roam" -- "sit" or "roam"
cat.owner_loyal = true
cat.tamed = true
cat.runaway = false
-- Automatically teleport cat to owner
cat.do_custom = function(dist, teleport_check_interval)
		return function(self, dtime)
		-- No teleportation if no owner or if sitting
		if not self.owner or self.order == "sit" then
			return
		end
		if not teleport_check_interval then
			teleport_check_interval = 4
		end
		if not dist then
			dist = 8
		end
		if self._teleport_timer == nil then
			self._teleport_timer = teleport_check_interval
			return
		end
		self._teleport_timer = self._teleport_timer - dtime
		if self._teleport_timer <= 0 then
			self._teleport_timer = teleport_check_interval
			local mob_pos = self.object:getpos()
			local owner = minetest.get_player_by_name(self.owner)
			if not owner then
				-- No owner found, no teleportation
				return
			end
			local owner_pos = owner:getpos()
			local dist_from_owner = vector.distance(owner_pos, mob_pos)
			if dist_from_owner > dist then
				-- Check for nodes below air in a 5×1×5 area around the owner position
				local check_offsets = table.copy(offsets)
				-- Attempt to place mob near player. Must be placed on walkable node below a non-walkable one. Place inside that air node.
				while #check_offsets > 0 do
					local r = pr:next(1, #check_offsets)
					local telepos = vector.add(owner_pos, check_offsets[r])
					local telepos_below = {x=telepos.x, y=telepos.y-1, z=telepos.z}
					table.remove(check_offsets, r)
					-- Long story short, spawn on a platform
					if minetest.registered_nodes[minetest.get_node(telepos).name].walkable == false and
							minetest.registered_nodes[minetest.get_node(telepos_below).name].walkable == true then
						-- Correct position found! Let's teleport.
						self.object:setpos(telepos)
						return
					end
				end
			end
		end
	end
end
cat.on_rightclick = function(self, clicker)
	-- restore health when fed.
        local item = clicker:get_wielded_item()
	if item:get_name() == "mobs_creatures:rotten_flesh" or minetest.get_item_group(item:get_name(), "food_meat_raw") == 1 or minetest.get_item_group(item:get_name(), "food_meat") == 1 or minetest.get_item_group(item:get_name(), "food_chicken") == 1 or minetest.get_item_group(item:get_name(), "food_chicken_raw") == 1 or minetest.get_item_group(item:get_name(), "food_fish_raw") == 1 or minetest.get_item_group(item:get_name(), "food_fish") == 1 or minetest.get_item_group(item:get_name(), "food_milk") == 1 or minetest.get_item_group(item:get_name(), "food_milk_glass") == 1 then
                local hp = self.health
                local hp_add = 5
                local new_hp = hp + hp_add
		if new_hp > self.hp_max then
                        new_hp = self.hp_max
                end
		if not minetest.settings:get_bool("creative_mode") then
	                        item:take_item()
	                        clicker:set_wielded_item(item)
	        end
		self.health = new_hp
	        return
	end
	if mobs:feed_tame(self, clicker, 1, true, false) then return end
	if mobs:capture_mob(self, clicker, 0, 60, 5, false, nil) then return end
	if mobs:protect(self, clicker) then return end
	-- if its a kitten do nothing.
	if self.child then return end

	-- Toggle sitting order

	if not self.owner or self.owner == "" then
		-- Huh? This cat has no owner? Let's fix this! This should never happen.
		self.owner = clicker:get_player_name()
	end

	if not self.order or self.order == "" or self.order == "sit" then
		self.order = "roam"
		self.walk_chance = default_walk_chance
		self.jump = true
	else
		-- “Sit!”
		-- TODO: Add sitting model
		self.order = "sit"
		self.walk_chance = 0
		self.jump = false
	end

end

mobs:register_mob("mobs_creatures:cat", cat)

-- Spawn ocelot
mobs:spawn({
	name = "mobs_creatures:ocelot",
	nodes = {"default:dirt_with_rainforest_litter", "default:jungleleaves", "default:junglewood"},
	neighbors = {"air"},
	light_max = 20,
	light_min = 0,
	chance = 2500,
	active_object_count = 2,
	min_height = 1,
	max_height = 5,
	on_spawn = function(self, pos)
		--[[ Note: Minecraft has a 1/3 spawn failure rate.
		In this mod it is emulated by reducing the spawn rate accordingly (see above). ]]
		-- 1/7 chance to spawn 2 ocelot kittens
		if pr:next(1,7) == 1 then
			-- Turn object into a child
			local make_child = function(object)
				local ent = object:get_luaentity()
				object:set_properties({
					visual_size = { x = ent.base_size.x/2, y = ent.base_size.y/2 },
					collisionbox = {
						ent.base_colbox[1]/2,
						ent.base_colbox[2]/2,
						ent.base_colbox[3]/2,
						ent.base_colbox[4]/2,
						ent.base_colbox[5]/2,
						ent.base_colbox[6]/2,
					}
				})
				ent.child = true
			end

			-- Possible spawn offsets, two of these will get selected
			local k = 0.7
			local offsets = {
				{ x=k, y=0, z=0 },
				{ x=-k, y=0, z=0 },
				{ x=0, y=0, z=k },
				{ x=0, y=0, z=-k },
				{ x=k, y=0, z=k },
				{ x=k, y=0, z=-k },
				{ x=-k, y=0, z=k },
				{ x=-k, y=0, z=-k },
			}
			for i=1, 2 do
				local o = pr:next(1, #offsets)
				local offset = offsets[o]
				local child_pos = vector.add(pos, offsets[o])
				table.remove(offsets, o)
				make_child(minetest.add_entity(child_pos, "mobs_creatures:ocelot"))
			end
		end
	end,
})

-- spawn eggs
-- FIXME: The spawn icon shows a cat texture, not an ocelot texture
mobs:register_egg("mobs_creatures:ocelot", "Ocelot Spawn Egg", "wool_orange.png", 1)
mobs:register_egg("mobs_creatures:cat", "Cat Spawn Egg", "wool_orange.png", 1)


code:
-- Panda by AspireMint (CC BY-SA 3.0)

mobs:register_mob("mobs_creatures:panda", {
stepheight = 0.6,
	type = "animal",
	passive = false,
	attack_type = "dogfight",
	group_attack = false,
	owner_loyal = true,
	attack_npcs = false,
	reach = 2,
	damage = 3,
	hp_min = 10,
	hp_max = 24,
	armor = 200,
	collisionbox = {-0.4, -0.45, -0.4, 0.4, 0.45, 0.4},
	visual = "mesh",
	mesh = "mobs_creatures_panda.b3d",
	textures = {
		{"mobs_creatures_panda.png"},
	},
	makes_footstep_sound = true,
	sounds = {
		random = "mobs_creatures_panda_random",
		attack = "mobs_creatures_panda_random",
	},
	walk_chance = 25,
	walk_velocity = 0.5,
	run_velocity = 1.5,
	jump = false,
	jump_height = 6,
	follow = {"ethereal:bamboo"},
	view_range = 8,
	drops = {
		{name = "mobs:meat_raw", chance = 1, min = 1, max = 2},
	},
	water_damage = 0,
	lava_damage = 5,
	light_damage = 0,
	fear_height = 6,
	animation = {
		speed_normal = 15,
		stand_start = 130,
		stand_end = 270,
		stand1_start = 0,
		stand1_end = 0,
		stand2_start = 1,
		stand2_end = 1,
		stand3_start = 2,
		stand3_end = 2,
		walk_start = 10,
		walk_end = 70,
		run_start = 10,
		run_end = 70,
		punch_start = 80,
		punch_end = 120,
		-- 0 = rest, 1 = hiding (covers eyes), 2 = surprised
	},
	on_rightclick = function(self, clicker)

		if mobs:feed_tame(self, clicker, 20, true, true) then return end
		if mobs:protect(self, clicker) then return end
		if mobs:capture_mob(self, clicker, 0, 5, 50, false, nil) then return end
	end,
})

if minetest.get_modpath("ethereal") then

	mobs:spawn({
		name = "mobs_creatures:panda",
		nodes = {"ethereal:bamboo_dirt"},
		neighbors = {"group:grass"},
		min_light = 14,
		interval = 60,
		chance = 8000, -- 15000
		min_height = 10,
		max_height = 80,
		day_toggle = true,
	})
end

mobs:register_egg("mobs_creatures:panda", "Panda", "wool_white.png", 1)


code:
--MCmobs v0.4
--maikerumine
--made for MC like Survival game
--License for code WTFPL and otherwise stated in readmes
--###################
--################### PARROT
--###################
mobs:register_mob("mobs_creatures:parrot", {
	type = "animal",
	passive = true,
	hp_min = 6,
	hp_max = 6,
	collisionbox = {-0.25, -0.01, -0.25, 0.25, 0.89, 0.25},
	visual = "mesh",
	mesh = "mobs_creatures_parrot.b3d",
	textures = {{"mobs_creatures_parrot_blue.png"},{"mobs_creatures_parrot_green.png"},{"mobs_creatures_parrot_grey.png"},{"mobs_creatures_parrot_red_blue.png"},{"mobs_creatures_parrot_yellow_blue.png"}},
	visual_size = {x=3, y=3},
	walk_velocity = 4,
	run_velocity = 6,
	drops = {
		{name = "mobs_creatures:chicken_feather",
		chance = 2,
		min = 0,
		max = 2,},
	},
    	animation = {
		stand_speed = 40,
		walk_speed = 40,
		stand_start = 60,
		stand_end = 80,
		walk_start = 60,
		walk_end = 80,
		--run_start = 0,
		--run_end = 20,
		--fly_start = 30,
		--fly_end = 45,
	},
	water_damage = 0,
	lava_damage = 4,
	light_damage = 0,
	step_height = 0,
	fall_damage = 0,
	fall_speed = 0,
	attack_type = "dogfight",
	floats = 1,
	fly = true,
	view_range = 16,
	follow = { "farming:seed_wheat", "farming:seed_cotton" },
	on_rightclick = function(self, clicker)
		if self._doomed then return end
		local item = clicker:get_wielded_item()
		-- Feed to tame, but not breed
		if mobs:feed_tame(self, clicker, 1, false, true) then return end
		if mobs:protect(self, clicker) then return end
		if mobs:capture_mob(self, clicker, 0, 50, 80, false, nil) then return end
	end,

})

-- Spawn disabled because parrots are not very smart.
mobs:spawn_specific("mobs_creatures:parrot", {"default:dirt_with_rainforest_litter", "default:jungleleaves", "default:junglewood"}, {"air"}, 0, 15, 240, 4000, 4, 10, 120)

-- spawn eggs
mobs:register_egg("mobs_creatures:parrot", "Parrot", "wool_red.png", 1)


code:
-- Original mod created by D00Med

-- Register the penguin mob.
mobs:register_mob("mobs_creatures:penguin", {
	stepheight = 0.6,
	type = "animal",
	passive = true,
	reach = 1,
	hp_min = 5,
	hp_max = 10,
	armor = 200,
	collisionbox = {-0.2, -0.0, -0.2,  0.2, 0.5, 0.2},
	visual = "mesh",
	mesh = "mobs_creatures_penguin.b3d",
	visual_size = {x = 0.25, y = 0.25},
	textures = {
		{"mobs_creatures_penguin.png"},
	},
	sounds = {},
	makes_footstep_sound = true,
	walk_velocity = 1,
	run_velocity = 2,
	runaway = true,
	jump = false,
	stepheight = 1.1,
	drops = {
		{name = "mobs:meat_raw", chance = 1, min = 1, max = 1},
	},
	water_damage = 0,
	lava_damage = 4,
	light_damage = 0,
	fear_height = 2,
	animation = {
		speed_normal = 15,
		stand_start = 1,
		stand_end = 20,
		walk_start = 25,
		walk_end = 45,
		fly_start = 75, -- swim animation
		fly_end = 95,
		-- 50-70 is slide/water idle
	},
	fly_in = {"default:water_source", "default:water_flowing"},
	floats = 0,
--	follow = {"ethereal:fish_raw", "mobs_fish:clownfish", "mobs_fish:tropical"},
	view_range = 5,

	on_rightclick = function(self, clicker)

		-- feed or tame
		if mobs:feed_tame(self, clicker, 4, false, true) then return end
		if mobs:protect(self, clicker) then return end
		if mobs:capture_mob(self, clicker, 5, 50, 80, false, nil) then return end
	end,
})

-- Register Spawning Parameters
mobs:spawn_specific("mobs_creatures:penguin", {"default:ice", "default:dirt_with_snow"}, {"air"}, 7, 16, 240, 480, 0, 50, true)

-- Register Spawning Egg
mobs:register_egg("mobs_creatures:penguin", "Penguin", "default_snow.png", 1)


code:
--License for code WTFPL and otherwise stated in readmes
mobs:register_mob("mobs_creatures:pig", {
	type = "animal",
	runaway = true,
	hp_min = 10,
	hp_max = 10,
	collisionbox = {-0.45, -0.01, -0.45, 0.45, 0.865, 0.45},
	visual = "mesh",
	mesh = "mobs_creatures_pig.b3d",
	textures = {{
		"blank.png", -- baby
		"mobs_creatures_pig.png", -- base
		"blank.png", -- saddle
	}},
	visual_size = {x=2.5, y=2.5},
	makes_footstep_sound = true,
	walk_velocity = 1,
	run_velocity = 3,
	drops = {
		{name = "mobs_creatures:pork_raw", chance = 1, min = 1, max = 3,},
	},
	water_damage = 1,
	lava_damage = 4,
	light_damage = 0,
	fear_height = 2,
	jump = false,
	stepheight = 0.75,
	knock_back = false,
	sounds = {
		random = "mobs_creatures_pig_random",
		death = "mobs_creatures_pig_death",
		distance = 16,
	},
	animation = {
		stand_speed = 40,
		walk_speed = 40,
		run_speed = 50,
		stand_start = 0,
		stand_end = 0,
		walk_start = 0,
		walk_end = 40,
		run_start = 0,
		run_end = 40,
	},
	follow = "default:apple",
	view_range = 5,
	on_rightclick = function(self, clicker)
		if not clicker or not clicker:is_player() then
			return
		end

		local wielditem = clicker:get_wielded_item()
		-- Feed pig
		if wielditem:get_name() ~= "default:apple" then
			if mobs:feed_tame(self, clicker, 1, true, true) then return end
		end
		if mobs:protect(self, clicker) then return end

		if self.child then
			return
		end
	end,
})
-- Spawn parameters.
mobs:spawn_specific("mobs_creatures:pig", {"default:dirt_with_grass","ethereal:prairie_dirt"}, {"air"}, 9, 15, 240, 3000, 3, 1, 20, true)

-- spawn eggs
mobs:register_egg("mobs_creatures:pig", "Pig Spawn Egg", "wool_pink.png", 1)


code:
-- PINKY DEMON BY D00M3D
-- SOUNDS FROM FREEDOOM.

mobs:register_mob("mobs_creatures:pinky", {
   type = "monster",
   passive = false,
   damage = 15,
   reach = 2,
   attack_type = "dogfight",
   hp_min = 30,
   hp_max = 30,
   armor = 75,
   collisionbox = {-0.8, -0, -0.8, 0.8, 1.9, 0.8},
   visual = "mesh",
   mesh = "mobs_creatures_pinky.b3d",
   textures = {
      {"mobs_creatures_pinky.png"},
   },
   visual_size = {x=3, y=3},
   makes_footstep_sound = true,
   walk_velocity = 2,
   run_velocity = 3.75,
   knock_back = false,
   jump = true,
   sounds = {
                distance = "20",
                random = "mobs_creatures_pinky_random",
                war_cry = "mobs_creatures_pinky_warcry",
                attack = "mobs_creatures_pinky_attack",
                damage = "mobs_creatures_pinky_damage",
                death = "mobs_creatures_pinky_death",
   },
   drops = {
      {name = "mobs:meat_raw", chance = 2, min = 2, max = 3},
      {name = "mobs_creatures:bone", chance = 1, min = 1, max = 5},
   },
   water_damage = 0,
   lava_damage = 0,
   light_damage = 0,
   view_range = 16,
   animation = {
      speed_normal = 20,
      speed_run = 30,
      walk_start = 1,
      walk_end = 20,
      stand_start = 20,
      stand_end = 40,
      run_start = 1,
      run_end = 20,
      punch_start = 40,
      punch_end = 60,
   },
})
-- REGISTER SPAWN: PINKY
mobs:spawn_specific("mobs_creatures:pinky", {"nether:rack","nether:brick"}, {"air"}, 0, 16, 240, 4000, 2, -30912, -16000)

-- REGISTER SPAWN EGG: PINKY
mobs:register_egg("mobs_creatures:pinky", "Pinky Spawn Egg", "wool_pink.png", 1)


code:
--License for code WTFPL and otherwise stated in readmes
mobs:register_mob("mobs_creatures:polar_bear", {
	type = "animal",
	runaway = false,
	passive = false,
	stepheight = 1.2,
	hp_min = 50,
	hp_max = 50,
	collisionbox = {-0.7, -0.01, -0.7, 0.7, 1.39, 0.7},
	visual = "mesh",
	mesh = "mobs_creatures_polarbear.b3d",
	textures = {
		{"mobs_creatures_polarbear.png"},
	},
	visual_size = {x=3.0, y=3.0},
	makes_footstep_sound = true,
	damage = 7,
	reach = 2,
	walk_velocity = 1.2,
	run_velocity = 2.4,
	group_attack = true,
	attack_type = "dogfight",
	drops = {
		{name = "mobs:meat_raw", chance = 1, min = 1, max = 2,},
	},
	water_damage = 0,
	floats = 1,
	lava_damage = 5,
	light_damage = 0,
	fear_height = 4,
	sounds = {
		random = "mobs_creatures_polarbear_random",
		damage = "mobs_creatures_polarbear_damage",
		attack = "mobs_creatures_polarbear_attack",
		jump = "mobs_creatures_polarbear_jump",
		death = "mobs_creatures_polarbear_death",
		distance = 16,
	},
	animation = {
		speed_normal = 25,		speed_run = 50,
		stand_start = 0,		stand_end = 0,
		walk_start = 0,		walk_end = 40,
		run_start = 0,		run_end = 40,
	},

	view_range = 16,
})

-- spawn
mobs:spawn_specific("mobs_creatures:polar_bear", {"default:snowblock", "default:dirt_with_snow"}, {"air"}, 0, 15, 240, 2000, 2, 1,15)

-- spawn egg
mobs:register_egg("mobs_creatures:polar_bear", "Polar Bear", "wool_white.png", 1)


code:
--License for code WTFPL and otherwise stated in readmes
mobs:register_mob("mobs_creatures:rabbit",{
	type = "animal",
	passive = true,
	reach = 1,
	hp_min = 3,
	hp_max = 3,
	collisionbox = {-0.2, -0.01, -0.2, 0.2, 0.49, 0.2},
	visual = "mesh",
	mesh = "mobs_creatures_rabbit.b3d",
	textures = {
        {"mobs_creatures_rabbit_brown.png"},
        {"mobs_creatures_rabbit_gold.png"},
        {"mobs_creatures_rabbit_white.png"},
        {"mobs_creatures_rabbit_white_splotched.png"},
        {"mobs_creatures_rabbit_salt.png"},
        {"mobs_creatures_rabbit_black.png"},
	{"mobs_creatures_rabbit_toast.png"},
	},
	visual_size = {x=1.5, y=1.5},
	sounds = {
	random = "mobs_creatures_rabbit_random",
	jump = "mobs_creatures_rabbit_jump",
	damage = "mobs_creatures_rabbit_pain",
	death = "mobs_creatures_rabbit_death",
	},
	makes_footstep_sound = false,
	walk_velocity = 1,
	run_velocity = 4,
	floats = 1,
	runaway = true,
        runaway_from = {"player"},
	jump = true,
	drops = {
		{name = "mobs_creatures:rabbit_raw", chance = 1, min = 0, max = 1},
		{name = "mobs_creatures:rabbit_hide", chance = 1, min = 0, max = 1},
	},
	water_damage = 4,
	lava_damage = 4,
	light_damage = 0,
	fear_height = 4,
	animation = {
		speed_normal = 25,		speed_run = 50,
		stand_start = 0,		stand_end = 0,
		walk_start = 0,		walk_end = 20,
		run_start = 0,		run_end = 20,
	},
	-- Follow (yellow) dangelions, carrots and golden carrots
	follow = {"default:apple","farming:carrot"},
	view_range = 8,
	-- Eat carrots and reduce their growth stage by 1
	replace_rate = 10,
	replace_what = {
                -- Farming Redo carrots
                {"farming:carrot_8", "farming:carrot_7", 0},
                {"farming:carrot_7", "farming:carrot_6", 0},
                {"farming:carrot_6", "farming:carrot_5", 0},
                {"farming:carrot_5", "farming:carrot_4", 0},
                {"farming:carrot_4", "farming:carrot_3", 0},
                {"farming:carrot_3", "farming:carrot_2", 0},
                {"farming:carrot_2", "farming:carrot_1", 0},
                {"farming:carrot_1", "air", 0},
		},
	on_rightclick = function(self, clicker)
		-- Feed, tame protect or capture
		if mobs:feed_tame(self, clicker, 1, true, true) then return end
		if mobs:protect(self, clicker) then return end
		if mobs:capture_mob(self, clicker, 0, 50, 80, false, nil) then return end
	end,
})
-- Mob spawning rules.
-- Different skins depending on spawn location

local spawn = {
	name = "mobs_creatures:rabbit",
	neighbors = {"air"},
	chance = 8000,
	active_object_count = 5,
	min_light = 3,
	max_light = 15,
	min_height = 1,
	max_height = 200,
}
local spawn_desert = table.copy(spawn)
spawn_desert.nodes = {"default:desert_sand", "group:sand"}
spawn_desert.on_spawn = function(self, pos)
	local texture = "mobs_creatures_rabbit_gold.png"
	self.base_texture = {"mobs_creatures_rabbit_gold.png"}
	self.object:set_properties({textures = self.base_texture})
end
mobs:spawn(spawn_desert)

local spawn_snow = table.copy(spawn)
spawn_snow.nodes = {"default:snow", "default:snowblock", "default:dirt_with_snow"}
spawn_snow.on_spawn = function(self, pos)
	local texture
	local r = math.random(1, 100)
	-- 80% white fur
	if r <= 80 then
		texture = "mobs_creatures_rabbit_white.png"
	-- 20% black and white fur
	else
		texture = "mobs_creatures_rabbit_white_splotched.png"
	end
	self.base_texture = { texture }
	self.object:set_properties({textures = self.base_texture})
end
mobs:spawn(spawn_snow)

local spawn_grass = table.copy(spawn)
spawn_grass.nodes = {"default:dirt_with_grass","ethereal:prairie_dirt"}
spawn_grass.on_spawn = function(self, pos)
	local texture
	local r = math.random(1, 100)
	-- 50% brown fur
	if r <= 50 then
		texture = "mobs_creatures_rabbit_brown.png"
	-- 40% salt fur
	elseif r <= 90 then
		texture = "mobs_creatures_rabbit_salt.png"
	-- 10% black fur
	else
		texture = "mobs_creatures_rabbit_black.png"
	end
	self.base_texture = { texture }
	self.object:set_properties({textures = self.base_texture})
end
mobs:spawn(spawn_grass)

-- Spawn egg
mobs:register_egg("mobs_creatures:rabbit", "Rabbit Spawn Egg", "wool_brown.png", 1)


code:
-- Rat by PilzAdam (B3D model by sirrobzeroone)
--TODO SOUND
mobs:register_mob("mobs_creatures:rat", {
	stepheight = 0.6,
	type = "animal",
	passive = true,
	hp_min = 1,
	hp_max = 4,
	armor = 200,
	collisionbox = {-0.2, -1, -0.2, 0.2, -0.8, 0.2},
	visual = "mesh",
        visual_size = {x=1,y=1},
	mesh = "mobs_creatures_rat.b3d",
	textures = {
		{"mobs_creatures_rat.png"},
		{"mobs_creatures_rat2.png"},
	},
	makes_footstep_sound = false,
	sounds = {
		random = "mobs_creatures_rat_random",
	},
	walk_velocity = 1,
	run_velocity = 2,
	runaway = true,
        runaway_from = {"player"},
	jump = true,
	water_damage = 0,
	lava_damage = 4,
	light_damage = 0,
	fear_height = 2,
	on_rightclick = function(self, clicker)
		mobs:capture_mob(self, clicker, 50, 90, 0, true, "mobs_creatures:rat")
	end,
})

local function rat_spawn(self, pos)
	self = self:get_luaentity()
	print (self.name, pos.x, pos.y, pos.z)
	self.hp_max = 100
	self.health = 100
end

mobs:spawn({
	name = "mobs_creatures:rat",
	nodes = {"default:stone"},
	min_light = 3,
	max_light = 16,
	interval = 60,
	chance = 4000,
	max_height = 0,
--	on_spawn = rat_spawn,
})

mobs:register_egg("mobs_creatures:rat", "Rat", "wool_grey.png", 1)

-- cooked rat, yummy!
minetest.register_craftitem("mobs_creatures:rat_cooked", {
	description = "Cooked Rat",
	inventory_image = "mobs_creatures_items_rat_cooked.png",
	on_use = minetest.item_eat(3),
	groups = {food_rat = 1, flammable = 2},
})

minetest.register_craft({
	type = "cooking",
	output = "mobs_creatures:rat_cooked",
	recipe = "mobs_creatures:rat",
	cooktime = 5,
})


code:
-- REPTILIAN ELITE ALIEN BY FREEGAMERS.ORG
-- TODO, ACID SPIT ATTACK texture, Blood Texture, drops, credits, spit sounds and hit sounds
mobs:register_mob('mobs_creatures:reptilian_elite', {
	type = "monster",
	passive = false,
	attack_type = "dogshoot",
	shoot_interval = 2.5,
	dogshoot_switch = 2,
	dogshoot_count = 0,
	dogshoot_count_max =5,
	arrow = "mobs_creatures:reptilian_acid_spit",
	shoot_offset = 1.5,
	reach = 3,
	damage = 15,
	hp_min = 30,
	hp_max = 30,
	armor = 50,
	knock_back = false,
        collisionbox = {-0.5,-1.5,-0.5, 0.5,1.2,0.5},
        visual = "mesh",
        mesh = "mobs_character.b3d",
	visual_size = {x=1.5, y=1.5},
        textures = {
                {"mobs_creatures_reptilian_elite.png"},
        },
	blood_texture = "mobs_blood.png",
	makes_footstep_sound = true,
	sounds = {
		random ="mobs_creatures_reptilian_elite_random",
		attack = "mobs_creatures_bogeyman_attack",
		damage = "mobs_creatures_crocodile_damage",
		death = "mobs_creatures_crocodile_death",
		distance = 32,
	},
	walk_velocity = 2.0,
	run_velocity = 3.5,
	jump = true,
	floats = true,
	suffocation = false,
	view_range = 16,
	drops = {
	{name = "mobs:meat_raw", chance = 1, min = 1, max = 1},
	},
	lava_damage = 3,
	water_damage = 0,
	light_damage = 0,
	fall_damage = 2,
        animation = {
                speed_normal = 30,
                speed_run = 45,
                stand_start = 0,
                stand_end = 79,
                walk_start = 168,
                walk_end = 187,
                run_start = 168,
                run_end = 187,
                punch_start = 200,
                punch_end = 219,
        },
})
-- Spawn Parameters, Anywhere on the moon.
mobs:spawn_specific("mobs_creatures:reptilian_elite",{"default:gravel"},{"vacuum:vacuum"},0,7,960,4000,2,3000,3300,false)

--Spawn Eggs
mobs:register_egg("mobs_creatures:reptilian_elite", "Reptilian Elite Spawn Egg", "mobs_meat_raw.png", 1)

--REPTILIAN ACID SPIT PROJECTILE
mobs:register_arrow("mobs_creatures:reptilian_acid_spit", {
   visual = "sprite",
   visual_size = {x = 0.5, y = 0.5},
   textures = {"mobs_creatures_arrow_poisonball.png"},
   velocity = 7,
   glow = 5,
   tail = 1, -- enable tail
   tail_texture = "mobs_creatures_poisonball_trail.png",
   hit_player = function(self, player)
      player:punch(self.object, 1.0, {
         full_punch_interval = 1.0,
         damage_groups = {fleshy = 8},
      }, nil)
   end,

   hit_mob = function(self, player)
      player:punch(self.object, 1.0, {
         full_punch_interval = 1.0,
         damage_groups = {fleshy = 8},
      }, nil)
   end,

   hit_node = function(self, pos, node)
      self.object:remove()
   end,
})

-------- CREDITS & ATTRIBUTIONS --------
-- Concept and implementation by FreeGamers.org
-- Texture by OpportunisticMilk
-- Sounds by JarAxe - https://freesound.org/people/JarAxe/packs/13148/


code:
--###################
--################### SALMON
--###################
-- from mc_mobs

mobs:register_mob("mobs_creatures:salmon", {
	type = "animal",
	passive = true,
	runaway = true,
	runaway_from = {"player"},
	stepheight = 0.1,
	hp_min = 3,
	hp_max = 3,
	armor = 200,
	collisionbox = {-0.35, -0.01, -0.35, 0.35, 1, 0.35},
	visual = "mesh",
	mesh = "mobs_creatures_salmon.b3d",
	textures = {
		{"mobs_creatures_salmon.png"},
	},
	visual_size = {x=3, y=3},
        drops = {
               {name = "mobs_creatures:salmon_raw", chance = 1, min = 1, max = 1},
               {name = "bonemeal:bonemeal", chance = 20, min = 1, max = 1},
        },
	walk_velocity = 0.6,
	run_velocity = 2.75,
	jump = false,
	makes_footstep_sound = false,
	fly = true,
	fly_in = "default:water_source",
	fall_speed = 0,
	view_range = 6,
	water_damage = 0,
	lava_damage = 10,
	light_damage = 0,
	animation = {
	        stand_speed = 25,
	        walk_speed = 25,
		run_speed = 50,
		stand_start = 0,
	        stand_end = 20,
		walk_start = 0,
	        walk_end = 20,
		run_start = 0,
	        run_end = 20,
	},
})

-- Register spawning conditions. -- spawns in cold and mild areas.
mobs:spawn_specific("mobs_creatures:salmon", {"default:sand_with_kelp", "default:ice", "default:snow", "default:wood", "default:tree","decorations_sea:seagrass_01", "decorations_sea:seagrass_03", "decorations_sea:seashell_01_node", "decorations_sea:seashell_02_node", "decorations_sea:seashell_03_node"}, {"default:water_flowing", "default:water_source"}, 1, 16, 60, 100, 16, -200, -1)

-- Register spawn egg.
mobs:register_egg("mobs_creatures:salmon", "Salmon Spawn Egg", "default_water.png", 1)


code:
-- "Sand Camo" skin by "Gangster1643"
-- Sand Monster by PilzAdam

mobs:register_mob("mobs_creatures:sand_man", {
	type = "monster",
	passive = false,
	attack_type = "dogfight",
	reach = 2,
	damage = 4,
	hp_min = 4,
	hp_max = 20,
	armor = 100,
        collisionbox = {-0.35,-1.0,-0.35, 0.35,0.8,0.35},
	visual = "mesh",
	mesh = "mobs_character.b3d",
	textures = {
		{"mobs_creatures_sand_man.png"},
	},
	blood_texture = "default_desert_sand.png",
	makes_footstep_sound = true,
	sounds = {
		random = "mobs_creatures_sand_man_random",
		damage = "default_sand_footstep",
		jump = "default_sand_footstep",
		attack = "default_sand_footstep",
		death = "default_item_smoke",
	},
	walk_velocity = 1.5,
	run_velocity = 4,
	view_range = 8, --15
	jump = true,
	floats = 0,
	drops = {
		{name = "default:desert_sand", chance = 1, min = 3, max = 5},
	},
	water_damage = 3,
	lava_damage = 4,
	light_damage = 0,
	fear_height = 4,
        animation = {
                speed_normal = 30,
                speed_run = 30,
                stand_start = 0,
                stand_end = 79,
                walk_start = 168,
                walk_end = 187,
                run_start = 168,
                run_end = 187,
                punch_start = 200,
                punch_end = 219,
        },
	immune_to = {
		{"default:shovel_wood", 3}, -- shovels deal more damage to sand monster
		{"default:shovel_stone", 3},
		{"default:shovel_bronze", 4},
		{"default:shovel_steel", 4},
		{"default:shovel_mese", 5},
		{"default:shovel_diamond", 7},
	},
    on_die = function(self, pos) -- on die, spawn particles.
        minetest.add_particlespawner({
            amount = 100,
            time = 0.1,
            minpos = {x=pos.x-1, y=pos.y-1, z=pos.z-1},
            maxpos = {x=pos.x+1, y=pos.y+1, z=pos.z+1},
            minvel = {x=-0, y=-0, z=-0},
            maxvel = {x=1, y=1, z=1},
            minacc = {x=-0.5,y=5,z=-0.5},
            maxacc = {x=0.5,y=5,z=0.5},
            minexptime = 0.1,
            maxexptime = 1,
            minsize = 1,
            maxsize = 3,
            collisiondetection = false,
            texture="default_desert_sand.png"
        })
        self.object:remove()
    end,
})

-- Register Spawn Parameters
mobs:spawn_specific("mobs_creatures:sand_man", {"default:sand", "default:desert_sand"}, {"air"}, 0, 7, 480, 1200, 2, -500, 100, false)

-- Register Spawn Egg
mobs:register_egg("mobs_creatures:sand_man", "Sand Man Spawn Egg", "default_desert_sand.png", 1)


code:
-- LARGE SHARK
-- revert to old model and texture.
mobs:register_mob("mobs_creatures:shark", {
	type = "monster",
	attack_type = "dogfight",
	damage = 15,
	reach = 3,
	hp_min = 10,
	hp_max = 10,
	armor = 150,
	collisionbox = {-0.75, -0.5, -0.75, 0.75, 0.5, 0.75},
	visual = "mesh",
	mesh = "mobs_creatures_shark.b3d",
	rotate = 90,
	textures = 	{"mobs_creatures_shark.png"},
	sounds = {
	        attack = "mobs_creatures_shark_attack",
	        damage = "mobs_creatures_shark_damage",
	        death = "mobs_creatures_shark_death",
        },
	makes_footstep_sound = false,
	walk_velocity = 2,
	run_velocity = 3,
	fly = true,
	fly_in = "default:water_source",
	fall_speed = -1,
	rotate = 270,
	view_range = 15,
	water_damage = 0,
	lava_damage = 10,
	light_damage = 0,
	animation = {
		walk_speed = 40,
		run_speed = 80,
		fly_speed = 40,
		walk_start = 1,
		walk_end = 59,
		run_start = 1,
		run_end = 59,
		fly_start = 1,
		fly_end = 59,
	},
	jump = false,
	stepheight = 0.1,
	drops = {
		{name = "mobs:meat_raw", chance = 1, min = 1, max = 3},
	},
})
--name, nodes, neighbours, minlight, maxlight, interval, chance, active_object_count, min_height, max_height
mobs:spawn_specific("mobs_creatures:shark", {"default:sand_with_kelp", "default:wood", "default:tree", "default:coral_brown", "default:coral_orange","default:coral_cyan","default:coral_green","default:coral_pink", "decorations_sea:coral_01", "decorations_sea:coral_02", "decorations_sea:coral_03", "decorations_sea:coral_04", "decorations_sea:coral_05", "decorations_sea:coral_06", "decorations_sea:coral_07", "decorations_sea:coral_08", "decorations_sea:coral_plantlike_01", "decorations_sea:coral_plantlike_02", "decorations_sea:coral_plantlike_03", "decorations_sea:coral_plantlike_04", "decorations_sea:coral_plantlike_05", "decorations_sea:seagrass_01", "decorations_sea:seagrass_02", "decorations_sea:seagrass_03", "decorations_sea:seashell_01_node", "decorations_sea:seashell_02_node", "decorations_sea:seashell_03_node"}, {"default:water_flowing","default:water_source"}, 1, 16, 120, 250, 3, -200, -3)
mobs:register_egg("mobs_creatures:shark", "Shark Spawn Egg", "default_water.png", 1)


code:
--License for code WTFPL and otherwise stated in readmes
--###################
--################### SHEEP
--###################

-- Register the mob with the API.
mobs:register_mob("mobs_creatures:sheep", {
	type = "animal",
	hp_min = 8,
	hp_max = 8,
	collisionbox = {-0.45, -0.01, -0.45, 0.45, 1.29, 0.45},
	visual = "mesh",
	visual_size = {x=3, y=3},
	mesh = "mobs_creatures_sheep_fur.b3d",
	gotten_mesh = "mobs_creatures_sheep_naked.b3d",
	textures = {
		{"mobs_creatures_sheep.png^mobs_creatures_sheep_fur.png"}
	},
	makes_footstep_sound = true,
	walk_velocity = 1,
	drops = {
		{name = "mobs_creatures:mutton_raw", chance = 1, min = 1, max = 2,},
		{name = "wool:white", chance = 1, min = 1, max = 1,},
	},
	water_damage = 1,
	lava_damage = 4,
	light_damage = 0,
	fear_height = 4,
	sounds = {
		random = "mobs_creatures_sheep",
		death = "mobs_creatures_sheep",
		damage = "mobs_creatures_sheep",
		distance = 16,
	},
	animation = {
		speed_normal = 25,		speed_run = 50,
		stand_start = 40,		stand_end = 80,
		walk_start = 0,		walk_end = 40,
		run_start = 0,		run_end = 40,
	},
	follow = "farming:wheat",
	view_range = 12,

	-- Eat grass
	replace_rate = 20,
	replace_what = {
		-- Grass Block
		{ "default:dirt_with_grass", "default:dirt", -1 },
		-- “Tall Grass”
		{ "default:grass_5", "air", 0 },
		{ "default:grass_4", "air", 0 },
		{ "default:grass_3", "air", 0 },
		{ "default:grass_2", "air", 0 },
		{ "default:grass_1", "air", 0 },
	},
	-- Properly regrow wool after eating grass
	on_replace = function(self, pos, oldnode, newnode)
		self.gotten = false
		self.drops = {
			{name = "mobs_creatures:mutton_raw", chance = 1, min = 1, max = 2,},
			{name = "wool:white", chance = 1, min = 1, max = 2,},
		}
		self.object:set_properties({
		mesh = "mobs_creatures_sheep_fur.b3d",
	})
	end,
	-- Set random color on spawn
	on_rightclick = function(self, clicker)
		local item = clicker:get_wielded_item()
		if mobs:feed_tame(self, clicker, 1, true, true) then return end
		if mobs:protect(self, clicker) then return end
		if item:get_name() == "mobs:shears" and not self.gotten then
			self.gotten = true
			local pos = self.object:getpos()
			minetest.sound_play("shears", {pos = pos})
			pos.y = pos.y + 0.5
			minetest.add_item(pos, ItemStack("wool:white "..math.random(1,3)))
			self.object:set_properties({
				mesh = "mobs_creatures_sheep_naked.b3d",
			})
			if not minetest.settings:get_bool("creative_mode") then
				item:add_wear(276)
				clicker:get_inventory():set_stack("main", clicker:get_wield_index(), item)
			end
			self.drops = {
				{name = "mobs_creatures:mutton_raw", chance = 1, min = 1, max = 2,},
			}
			return
		end
		if mobs:capture_mob(self, clicker, 0, 5, 70, false, nil) then return end
	end,
})
-- Spawn Parameters
mobs:spawn_specific("mobs_creatures:sheep", {"default:dirt_with_grass", "default:dirt_with_dry_grass"}, {"air"}, 6, 15, 480, 480, 2, 2, 150)
-- Spawn Eggs
mobs:register_egg("mobs_creatures:sheep", "Sheep Spawn Egg", "wool_white.png", 1)


code:
--SKELETON ARCHER
-- TODO: Add arrows dropping. Make sure shoot switch works OK.
--REGISTER ARROW SHOT
mobs:register_arrow("mobs_creatures:skeleton_archer_arrow", {
   visual = "sprite",
   visual_size = {x = 0.75, y = 0.75},
--   collisionbox = {-1/8,-1/8,-1/8, 1/8,1/8,1/8},
   textures = {"mobs_creatures_arrow_arrow.png"},
   velocity = 10,
   tail = 1, -- enable tail
   expire = 0.25,
   glow = 5,
   tail_texture = "mobs_creatures_arrow_arrow_trail.png",
   tail_size = 3,
   hit_player = function(self, player)
      player:punch(self.object, 1.0, {
         full_punch_interval = 1.0,
         damage_groups = {fleshy = 10},
      }, nil)
       minetest.sound_play({name = "mobs_creatures_common_shoot_arrow_hit", gain = 1.0}, {pos=player:getpos(), max_hear_distance = 12})
   end,

   hit_mob = function(self, player)
      player:punch(self.object, 1.0, {
         full_punch_interval = 1.0,
         damage_groups = {fleshy = 10},
      }, nil)
   end,
   hit_node = function(self, pos, node)
      minetest.sound_play({name = "mobs_creatures_common_shoot_arrow_hit", gain = 1.0}, {pos=pos, max_hear_distance = 12})
--      minetest.add_entity(pos, "bweapons_bows_pack:arrow") 	--Needs to not be added at pos, but rather right before.
      self.object:remove()
   end,
})
-- REGISTER SKELETON ARCHER
mobs:register_mob("mobs_creatures:skeleton_archer", {
	type = "monster",
	hp_min = 20,
	hp_max = 20,
	collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.98, 0.3},
	group_attack = true,
	visual = "mesh",
	mesh = "mobs_creatures_skeleton.b3d",
	textures = {
		{"mobs_creatures_skeleton.png^mobs_creatures_skeleton_bow.png"},
	},
	visual_size = {x=3, y=3},
	makes_footstep_sound = true,
	sounds = {
		random = "mobs_creatures_skeleton_random",
		death = "mobs_creatures_skeleton_death",
		damage = "mobs_creatures_skeleton_damage",
		shoot_attack = "mobs_creatures_common_shoot_arrow",
		attack = "mobs_creatures_skeleton_attack",
		jump = "mobs_creatures_skeleton_jump",
		distance = 16,
	},
	walk_chance = 25,
	walk_velocity = 1.2,
	run_velocity = 2.4,
	damage = 5,
	reach = 1,
	drops = {
		{name = "bweapons_bows_pack:arrow", chance = 1, min = 0, max = 5,},
		{name = "mobs_creatures:bone", chance = 1, min = 0, max = 5,},
		{name = "bweapons_bows_pack:wooden_bow", chance = 12, min = 1, max = 1,},
	},
	animation = {
		stand_start = 0,
		stand_end = 40,
		stand_speed = 5,
		walk_start = 40,
		walk_end = 60,
	        walk_speed = 15,
		run_start = 40,
		run_end = 60,
		run_speed = 30,
	        shoot_start = 70,
	        shoot_end = 90,
	        punch_start = 70,
	        punch_end = 90,
	        die_start = 120,
	        die_end = 130,
		die_loop = false,
	},
	water_damage = 1,
	lava_damage = 4,
	light_damage = 4,
	view_range = 12,
	fear_height = 4,
	attack_type = "dogshoot",
	arrow = "mobs_creatures:skeleton_archer_arrow",
	shoot_interval = 2.5,
	shoot_offset = 1,
	dogshoot_swith = 1,
	dogshoot_count_max = 1.8,
	shoot_offset = 1,
	blood_amount = 0,
})

-- Overworld spawn
mobs:spawn_specific("mobs_creatures:skeleton_archer", {"group:cracky", "group:crumbly", "group:shovely", "group:pickaxey"}, {"air"}, 0, 16, 240, 8000, 1, -16000, 100)

-- spawn eggs
mobs:register_egg("mobs_creatures:skeleton_archer", "Skeleton Archer Spawn Egg", "wool_white.png", 1)


code:
-- Skeleton Fighter
mobs:register_mob("mobs_creatures:skeleton_fighter", {
	type = "monster",
	hp_min = 20,
	hp_max = 20,
	pathfinding = 1,
	group_attack = true,
	collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.98, 0.3},
	visual = "mesh",
	mesh = "mobs_creatures_skeleton_fighter.b3d",
	textures = {
		{"mobs_creatures_skeleton.png^mobs_creatures_skeleton_fighter_sword.png"},
	},
	visual_size = {x=3, y=3},
	makes_footstep_sound = true,
        sounds = {
                random = "mobs_creatures_skeleton_random",
                death = "mobs_creatures_skeleton_death",
                damage = "mobs_creatures_skeleton_damage",
                shoot_attack = "mobs_creatures_skeleton_shoot",
                attack = "mobs_creatures_skeleton_attack",
                jump = "mobs_creatures_skeleton_jump",
                distance = 16,
        },
	walk_velocity = 1.2,
	run_velocity = 2.4,
	damage = 10,
	reach = 2,
	drops = {
		{name = "mobs_creatures:bone", chance = 1, min = 0, max = 2,},
		{name = "default:stone_sword", chance = 5, min = 0, max = 1,},
	},
	animation = {
		stand_start = 0,
		stand_end = 40,
		stand_speed = 5,
		walk_start = 40,
		walk_end = 60,
		walk_speed = 15,
		run_start = 40,
		run_end = 60,
		run_speed = 30,
		shoot_start = 70,
		shoot_end = 90,
		punch_start = 70,
		punch_end = 90,
		die_start = 120,
		die_end = 130,
		die_loop = false,
		-- Not supported yet
		hurt_start = 100,
		hurt_end = 120,
	},
	water_damage = 0,
	lava_damage = 0,
	light_damage = 5,
	view_range = 16,
	attack_type = "dogfight",
	shoot_interval = 2.5,
	shoot_offset = 1,
	dogshoot_switch = 1,
	dogshoot_count_max =0.5,
	blood_amount = 0,
	fear_height = 4,
})

--spawn
mobs:spawn_specific("mobs_creatures:skeleton_fighter", {"group:cracky", "group:crumbly", "group:shovely", "group:pickaxey"}, {"air"}, 0, 7, 960, 1000, 2, -500, -100)

-- spawn eggs
mobs:register_egg("mobs_creatures:skeleton_fighter", "Skeleton Fighter Spawn Egg", "wool_white.png", 1)


code:
-- LOST SOUL BY DOOM3D
-- SOUNDS FROM FREEDOOM

mobs:register_mob("mobs_creatures:skull", {
   type = "monster",
   passive = false,
   damage = 10,
   reach = 2,
   attack_type = "dogfight",
   hp_min = 20,
   hp_max = 20,
   armor = 100,
   collisionbox = {-0.2, -0.05, -0.2, 0.2, 0.75, 0.2},
   visual = "mesh",
   mesh = "mobs_creatures_skull.b3d",
   textures = {
      {"mobs_creatures_skull.png"},
   },
   visual_size = {x=1.5, y=1.5},
   makes_footstep_sound = true,
   sounds = {
                distance = "20",
                random = "mobs_creatures_skull_random",
                war_cry = "mobs_creatures_skull_warcry",
                attack = "mobs_creatures_skull_attack",
                damage = "mobs_creature_pinky_damage",
                death = "mobs_creatures_skull_death",
   },
   walk_velocity = 2,
   run_velocity = 4,
   jump = true,
   fly = true,
   do_custom = function(self)
		local apos = self.object:getpos()
                part = minetest.add_particlespawner({
                        8, --amount
                        0.3, --time
                        {x=apos.x-0.3, y=apos.y+0.6, z=apos.z-0.3}, --minpos
                        {x=apos.x+0.3, y=apos.y+0.6, z=apos.z+0.3}, --maxpos
                        {x=-0, y=-0, z=-0}, --minvel
                        {x=0, y=0, z=0}, --maxvel
                        {x=0,y=1.5,z=0}, --minacc
                        {x=0.5,y=1.5,z=0.5}, --maxacc
                        1, --minexptime
                        1, --maxexptime
                       2, --minsize
                        3, --maxsize
                        false, --collisiondetection
                        "mobs_creatures_arrow_fireball_trail.png" --texture
                })
   end,
   fall_speed = 0,
   stepheight = 10,
   water_damage = 0,
   lava_damage = 0,
   light_damage = 0,
   view_range = 16,
   glow = 6,
   animation = {
      speed_normal = 10,
      speed_run = 20,
      walk_start = 20,
      walk_end = 40,
      stand_start = 1,
      stand_end = 20,
      run_start = 20,
      run_end = 40,
      punch_start = 40,
      punch_end = 65,
   },
})

-- REGISTER SPAWN PARAMETERS
mobs:spawn_specific("mobs_creatures:skull", {"nether:sand", "nether:glowstone", "default:lava_source"}, {"air"}, 0, 16, 480, 4000, 5, -30912, -16000)

-- REGISTER SPAWN EGG
mobs:register_egg("mobs_creatures:skull", "Skull Spawn Egg", "wool_orange.png", 1)


code:
--###################
--################### Snapper
--###################
-- from mc mobs (tropicalfishB)
-- TODO: Drops, color textures.
mobs:register_mob("mobs_creatures:snapper", {
	type = "animal",
	passive = true,
	runaway = true,
        runaway_from = {"player"},
	stepheight = 0.1,
	hp_min = 3,
	hp_max = 3,
	armor = 200,
	collisionbox = {-0.35, -0.01, -0.35, 0.35, 0.5, 0.35},
	visual = "mesh",
	mesh = "mobs_creatures_snapper.b3d",
    textures = {
        { "mobs_creatures_snapper_1.png"},
	{ "mobs_creatures_snapper_2.png"},
        { "mobs_creatures_snapper_3.png"},
        { "mobs_creatures_snapper_4.png"},
        { "mobs_creatures_snapper_5.png"},
        { "mobs_creatures_snapper_6.png"},
	},
	visual_size = {x=3, y=3},
        drops = {
               {name = "mobs_creatures:snapper_raw", chance = 1, min = 1, max = 1},
               {name = "bonemeal:bonemeal", chance = 20, min = 1, max = 1},
        },
	walk_velocity = 0.6,
	run_velocity = 2.75,
	jump = false,
	fly = true,
	fly_in = "default:water_source",
	fall_speed = 0,
	view_range = 6,
	water_damage = 0,
	lava_damage = 10,
	light_damage = 0,
	animation = {
	        stand_speed = 25,
	        walk_speed = 25,
		run_speed = 50,
		stand_start = 0,
	        stand_end = 20,
		walk_start = 0,
	        walk_end = 20,
		run_start = 0,
	        run_end = 20,
	},
})
-- Register spawning conditions. -- spawns in tropical and warm, near coral.
mobs:spawn_specific("mobs_creatures:snapper",      {"default:wood", "default:tree", "default:coral_brown", "default:coral_orange","default:coral_cyan","default:coral_green","default:coral_pink", "decorations_sea:seagrass_02", "decorations_sea:seagrass_03", "decorations_sea:seagrass_05", "decorations_sea:seagrass_06", "decorations_sea:coral_plantlike_01", "decorations_sea:coral_plantlike_02", "decorations_sea:coral_plantlike_03", "decorations_sea:coral_plantlike_04", "decorations_sea:coral_plantlike_05"}, {"default:water_flowing","default:water_source"}, 1, 16, 120, 120, 16, -200, -1)
-- Register spawn egg.
mobs:register_egg("mobs_creatures:snapper", "Snapper Spawn Egg", "default_water.png", 1)


code:
--Snowman from mc_mobs by maikerumine
-- TODO make egg craftable?, make water freeze into ice? maybe change him to NPC nonpassive

local snow_trail_frequency = 0.5 -- Time in seconds for checking to add a new snow trail

local mobs_griefing = true

-- SNOWBALL ARROW FOR ATTACKS
mobs:register_arrow("mobs_creatures:snowmans_snowball", {
	visual = "sprite",
	visual_size = {x=.5, y=.5},
	textures = {"default_snowball.png"},
	velocity = 8,
	   hit_player = function(self, player)
	      player:punch(self.object, 1.0, {
		 full_punch_interval = 1.0,
		 damage_groups = {fleshy = 9},
	      }, nil)
	       minetest.sound_play({name = "default_snow_footstep", gain = 1.0}, {pos=player:getpos(), max_hear_distance = 8})
	   end,

	   hit_mob = function(self, player)
	      player:punch(self.object, 1.0, {
		 full_punch_interval = 1.0,
		 damage_groups = {fleshy = 9},
	      }, nil)
	   end,

	   hit_node = function(self, pos, node)
	       minetest.sound_play({name = "default_snow_footstep", gain = 1.0}, {pos=pos, max_hear_distance = 8})
	      self.object:remove()
	   end,
	})

mobs:register_mob("mobs_creatures:snowman", {
	type = "monster",
	hp_min = 20,
	hp_max = 20,
	pathfinding = 1,
	view_range = 12,
	light_damage = 1,
	fall_damage = 0,
	water_damage = 4,
	lava_damage = 20,
	attacks_monsters = true,
	collisionbox = {-0.35, -0.01, -0.35, 0.35, 1.89, 0.35},
	visual = "mesh",
	mesh = "mobs_creatures_snowman.b3d",
	textures = {
		{"mobs_creatures_snowman.png^transparent_pixel.png"},
	},
	drops = {
	{ name = "default:snow", chance = 1, min = 0, max = 4 },
	{ name = "farming:carrot", chance = 4, min = 1, max = 1 },
	{ name = "default:stick", chance = 2, min = 1, max = 2 },
	{ name = "default:coal_lump", chance = 4, min = 1, max = 4},
	},
	sounds = {
		        random = "default_snow_footstep",
		        war_cry = "default_snow_footstep",
			jump = "default_snow_footstep",
		        shoot_attack = "default_snow_footstep",
		        damage = "default_snow_footstep",
		        death = "default_snow_footstep",
	   },
	visual_size = {x=3, y=3},
	walk_velocity = 0.6,
	run_velocity = 2,
	jump = true,
	makes_footstep_sound = true,
	attack_type = "shoot",
	arrow = "mobs_creatures:snowmans_snowball",
	shoot_interval = 2,
	shoot_offset = 1,
	animation = {
		speed_normal = 25,
		speed_run = 50,
		stand_start = 20,
		stand_end = 40,
		walk_start = 0,
		walk_end = 20,
		run_start = 0,
		run_end = 20,
		die_start = 40,
		die_end = 50,
		die_loop = false,
	},
	blood_amount = 0,
	immune_to = {
		{"default:shovel_wood", 3}, -- shovels deal more damage to snowman.
		{"default:shovel_stone", 3},
		{"default:shovel_bronze", 4},
		{"default:shovel_steel", 4},
		{"default:shovel_mese", 5},
		{"default:shovel_diamond", 7},
	},
	do_custom = function(self, dtime)
		if not mobs_griefing then
			return
		end
		-- Leave a trail of top snow behind.
		-- This is done in do_custom instead of just using replace_what because with replace_what,
		-- the top snop may end up floating in the air.
		if not self._snowtimer then
			self._snowtimer = 0
			return
		end
		self._snowtimer = self._snowtimer + dtime
		if self.health > 0 and self._snowtimer > snow_trail_frequency then
			self._snowtimer = 0
			local pos = self.object:getpos()
			local below = {x=pos.x, y=pos.y-1, z=pos.z}
			local def = minetest.registered_nodes[minetest.get_node(pos).name]
			-- Node at snow golem's position must be replacable
			if def and def.buildable_to then
				-- Node below must be walkable
				-- and a full cube (this prevents oddities like top snow on top snow, lower slabs, etc.)
				local belowdef = minetest.registered_nodes[minetest.get_node(below).name]
				if belowdef and belowdef.walkable and (belowdef.node_box == nil or belowdef.node_box.type == "regular") then
					-- Place top snow
					minetest.set_node(pos, {name = "default:snow"})
				end
			end
		end
	end,
	on_die = function(self, pos) -- on die, spawn a fire:permanent flame.
		        minetest.add_particlespawner({
			    amount = 100,
			    time = 0.1,
			    minpos = {x=pos.x-1, y=pos.y-1, z=pos.z-1},
			    maxpos = {x=pos.x+1, y=pos.y+1, z=pos.z+1},
			    minvel = {x=-0, y=-0, z=-0},
			    maxvel = {x=1, y=1, z=1},
			    minacc = {x=-0.5,y=5,z=-0.5},
			    maxacc = {x=0.5,y=5,z=0.5},
			    minexptime = 0.1,
			    maxexptime = 1,
			    minsize = 1,
			    maxsize = 3,
			    collisiondetection = false,
			    texture="default_snowball.png"
			})
		if minetest.get_node(pos).name == "air" then
		        minetest.set_node(pos, {name = "default:snow"})
		end
		self.object:remove()
	    end,
})
-- Spawn Parameters
mobs:spawn_specific("mobs_creatures:snowman", {"default:snow", "default:snowblock", "default:dirt_with_snow"},{"air"},0,7,240,4000,2,-10,200)

-- Spawn Egg
mobs:register_egg("mobs_creatures:snowman", "Snowman", "default_snow.png", 1)


code:
-- declare velocity for spider crawl function
local get_velocity = function(self)

	local v = self.object:get_velocity()

	return (v.x * v.x + v.z * v.z) ^ 0.5
end

--register spider mob
mobs:register_mob("mobs_creatures:spider", {
	type = "animal",
	passive = true,
	runaway = true,
	hp_min = 1,
	hp_max = 5,
    	armor = 200,
	collisionbox = {-0.08, -0.01, -0.1, 0.1, 0.17, 0.1},
	textures = {
                {"mobs_creatures_spider.png"},
                {"mobs_creatures_spider_2.png"},
        },
	visual_size = {x=0.5,y=0.5},
	visual = "mesh",
	mesh = "mobs_creatures_spider.b3d",
	makes_footstep_sound = false,
	view_range = 16,
	walk_velocity = 0.5,
	run_velocity = 1.5,
	damage = 1,
	water_damage = 5,
	lava_damage = 5,
	light_damage = 0,
	attack_type = "dogfight",
	animation = {
	        stand_speed = 10,
	        walk_speed = 25,
		run_speed = 50,
		stand_start = 20,
	        stand_end = 40,
		walk_start = 0,
	        walk_end = 20,
		run_start = 0,
	        run_end = 20,
	},
	jump = true,
	step = 1,
	-- custom function to make spiders climb vertical facings
	do_custom = function(self, dtime)

		-- quarter second timer
		self.spider_timer = (self.spider_timer or 0) + dtime
		if self.spider_timer < 0.25 then
			return
		end
		self.spider_timer = 0

		-- need to be stopped to go onwards
		if get_velocity(self) > 0.2 then
			self.disable_falling = false
			return
		end

		local pos = self.object:get_pos()
		local yaw = self.object:get_yaw()

		pos.y = pos.y + self.collisionbox[2] - 0.2

		local dir_x = -math.sin(yaw) * (self.collisionbox[4] + 0.5)
		local dir_z = math.cos(yaw) * (self.collisionbox[4] + 0.5)
		local nod = minetest.get_node_or_nil({
			x = pos.x + dir_x,
			y = pos.y + 0.5,
			z = pos.z + dir_z
		})

		-- get current velocity
		local v = self.object:get_velocity()

		-- can only climb solid facings
		if not nod or not minetest.registered_nodes[nod.name]
		or not minetest.registered_nodes[nod.name].walkable then
			self.disable_falling = nil
			v.y = 0
			self.object:set_velocity(v)
			return
		end

--print ("----", nod.name, self.disable_falling, dtime)

		-- turn off falling if attached to facing
		self.disable_falling = true

		-- move up facing
		v.y = self.jump_height
		mobs:set_animation(self, "jump")
		self.object:set_velocity(v)
	end
})
--API Template: mobs:spawn_specfic(name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height, day_toggle, on_spawn)
mobs:spawn_specific("mobs_creatures:spider", { "group:cracky", "group:crumbly", "group:shovely", "group:pickaxey" }, {"air"}, 0, 7, 960, 2000, 1, -28000, 150)
mobs:register_egg("mobs_creatures:spider", "Spider Spawn Egg", "wool_black.png", 1)


code:
-- Stone Monster original concept by PilzAdam
-- Stone Golem Skin by Leostereo
-- Simplified by FreeGamers.org
-- Register Mob
mobs:register_mob("mobs_creatures:stone_man", {
	type = "monster",
	passive = false,
	attack_type = "dogfight",
	reach = 2,
	damage = 10,
	hp_min = 30,
	hp_max = 30,
	armor = 50,
        collisionbox = {-0.4, -1, -0.4, 0.4, 0.8, 0.4},
        visual = "mesh",
        mesh = "mobs_character.b3d",
        textures = {
                {"mobs_creatures_stone_man.png"},
        },
	makes_footstep_sound = true,
	sounds = {
		random = "mobs_creatures_stone_man_random",
		jump = "default_hard_footstep",
		damage = "default_hard_footstep",
		attack = "default_hard_footstep",
		death = "default_dug_node",
	},
        blood_texture = "default_stone.png",
	walk_velocity = 1,
	run_velocity = 2,
	jump_height = 1,
	stepheight = 1.1,
	floats = 0,
	view_range = 10,
	drops = {
		{name = "default:stone", chance = 1, min = 1, max = 2},
	},
	water_damage = 0,
	lava_damage = 1,
	light_damage = 0,
        animation = {
                speed_normal = 30,
                speed_run = 30,
                stand_start = 0,
                stand_end = 79,
                walk_start = 168,
                walk_end = 187,
                run_start = 168,
                run_end = 187,
                punch_start = 200,
                punch_end = 219,
        },
	immune_to = {
		{"default:pick_wood", 0}, -- wooden pick doesnt hurt stone monster
		{"default:pick_stone", 4}, -- picks deal more damage to stone monster
		{"default:pick_bronze", 5},
		{"default:pick_steel", 5},
		{"default:pick_mese", 6},
		{"default:pick_diamond", 7},
	},
    on_die = function(self, pos) -- on die, spawn particles.
        minetest.add_particlespawner({
            amount = 100,
            time = 0.1,
            minpos = {x=pos.x-1, y=pos.y-1, z=pos.z-1},
            maxpos = {x=pos.x+1, y=pos.y+1, z=pos.z+1},
            minvel = {x=-0, y=-0, z=-0},
            maxvel = {x=1, y=1, z=1},
            minacc = {x=-0.5,y=5,z=-0.5},
            maxacc = {x=0.5,y=5,z=0.5},
            minexptime = 0.1,
            maxexptime = 1,
            minsize = 1,
            maxsize = 2,
            collisiondetection = false,
            texture="default_stone.png"
        })
        self.object:remove()
    end,
})

-- Spawning Parameters
mobs:spawn_specific("mobs_creatures:stone_man", {"default:stone", "default:desert_stone"}, {"air"}, 0, 7, 960, 2000, 1, -500, 100, false)

-- Register Spawn Egg
mobs:register_egg("mobs_creatures:stone_man", "Stone Man Spawn Egg", "default_stone.png", 1)