Skip to content

Commit

Permalink
Merge pull request #123 from jan64/master
Browse files Browse the repository at this point in the history
Fixed error when spawning non-mob entities in a peaceful world
  • Loading branch information
tigerw committed Mar 10, 2015
2 parents 4938bb6 + 539ad33 commit 12826af
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions difficulties.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ local IsEntityBlockedInPeaceful =
["cZombie"] = true,
["cZombiePigman"] = true,
["cSpider"] = true,
["cCaveSpider"] = true,
["cEnderman"] = true,
["cEnderDragon"] = true,
["cSkeleton"] = true,
Expand All @@ -94,8 +95,9 @@ local IsEntityBlockedInPeaceful =
}

function OnSpawningEntity(World, Entity)
if (GetWorldDifficulty(World) == 0) then
return IsEntityBlockedInPeaceful[Entity:GetClass()]
local Ent = tolua.cast(Entity, "cEntity")
if (GetWorldDifficulty(World) == 0 and Ent:IsMob() == true) then
return IsEntityBlockedInPeaceful[Ent:GetClass()]
end
return false
end

0 comments on commit 12826af

Please sign in to comment.