From d344e574de0f2ac3786f05db0167c1e71e135673 Mon Sep 17 00:00:00 2001 From: LogicParrot Date: Sun, 17 Jan 2016 16:09:25 +0200 Subject: Spiders now friendly at daylight, new cChunk functions --- src/Mobs/Spider.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/Mobs/Spider.cpp') diff --git a/src/Mobs/Spider.cpp b/src/Mobs/Spider.cpp index a9da28750..a5f0d6a89 100644 --- a/src/Mobs/Spider.cpp +++ b/src/Mobs/Spider.cpp @@ -5,7 +5,7 @@ #include "../World.h" #include "../Entities/Player.h" - +#include "../Chunk.h" cSpider::cSpider(void) : @@ -35,17 +35,22 @@ void cSpider::GetDrops(cItems & a_Drops, cEntity * a_Killer) -void cSpider::EventSeePlayer(cEntity * a_Entity) +void cSpider::EventSeePlayer(cEntity * a_Entity, cChunk & a_Chunk) { if (!GetWorld()->IsChunkLighted(GetChunkX(), GetChunkZ())) { - GetWorld()->QueueLightChunk(GetChunkX(), GetChunkZ()); return; } - if (!static_cast(a_Entity)->IsGameModeCreative() && (GetWorld()->GetBlockBlockLight(this->GetPosition()) <= 9)) + PREPARE_REL_AND_CHUNK(GetPosition(), a_Chunk); + if (!RelSuccess) + { + return; + } + + if (!static_cast(a_Entity)->IsGameModeCreative() && (Chunk->GetSkyLightAltered(Rel.x, Rel.y, Rel.z) <= 9)) { - super::EventSeePlayer(a_Entity); + super::EventSeePlayer(a_Entity, a_Chunk); } } -- cgit v1.2.3