Cuberite Forum

Full Version: SkyLight Detection with cLineBlockTracer
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi!

I want to try to solve the zombies burning in a cave issue, so I thought I'll use lineblocktracer to trace upwards until the height of the chunk is reached. I was wondering what the correct syntax for it is?

Apparently it takes a World, a Callback, and 6 doubles. In zombie.cpp, I have:

Code:
#include LineblockTracer.h

...

*callback I copied from World.cpp*
cLineBlockTracer::Trace(GetWorld(), Callback, GetPosX, GetPosY, GetPosZ, GetPosX, *value for chunk height, how can I use cChunk::Height here?*, GetPosZ)

However, it tells me that the overloaded function doesn't have the correct argument list. Why is this? Thanks!
Why use such a heavy caliber to solve this simple issue?

Just query the SkyLight value at the block coords, if it is 15, the block is fully day-lit.
Would it not be easy to check if the Y Pos is equal or higher then cChunk::Height?
Wait, you can check the block light value of a block? Awesome!

So, how would I do it?Tongue
cWorld::GetBlockSkyLight(BlockX, BlockY, BlockZ) or
cWorld::GetBlockBlockLight(BlockX, BlockY, BlockZ)
(yes its GetBlockBlockLight)
Shouldn't it be getblockskylight?
Yes I already editted my post Wink
Thanks, I'll try them all.
The only problem with light is that it may go out of sync with the world contents for short whiles - when the player places blocks, for example, the light is not recalculated immediately; it will be recalculated on a different thread in a little while. So it is possible for the light values to actually be wrong. I don't think it matters for most practical purposes, just be aware of that Smile