[SPIGOT-3021] Incorrect lightLevelFromSky() for blocks. Created: 18/Jan/17  Updated: 18/Jan/17  Resolved: 18/Jan/17

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: sync667 Assignee: Unassigned
Resolution: Invalid Votes: 0
Labels: blocks, bug
Environment:

CraftBukkit version git-Spigot-7d78b81-775f1e1 (MC: 1.11.2) (Implementing API version 1.11.2-R0.1-SNAPSHOT)

Debian 8

Java 8 



 Description   

I try to use function lightLevelFromSky() on block. Basiclly function return always 0 same with normal getLightLevel(). Only get > 0 when block is connected direct with torch and then all results are hight and sometimes when they are just above a torch.

 

 



 Comments   
Comment by sync667 [ 18/Jan/17 ]

Ohh ok i understand, but maybe some notation in docs to this method so other won't miss the point of what they can achieve with it. Thanks @md_5 like always

Comment by md_5 [ 18/Jan/17 ]

The sky light on a block will be always be 0.
You want the sky light above a block - ie: it only makes sense to get the skylight of transparent or AIR blocks.

Comment by sync667 [ 18/Jan/17 ]

I need to check if any block face in on sky light. So i was wondering if methods above check that on all faces because thinks it should. 

But what is a difference of this:  player.getLocation().getBlock().getLightFromSky() with this  player.getTargetBlock((Set<Material>) null, 6).getLocation().getBlock().getLightFromSky(). When we use location class so nothing should different.

Comment by md_5 [ 18/Jan/17 ]

You probably want: Block.getRelative( BlockFace.UP).getLightFromSky()

Comment by sync667 [ 18/Jan/17 ]

player.sendMessage("LO5:" + player.getLocation().getBlock().getLightFromSky()); - works

player.sendMessage("LO:" + player.getTargetBlock((Set<Material>) null, 6).getLightFromSky()); - not
player.sendMessage("LO:" + player.getTargetBlock((Set<Material>) null, 6).getLocation().getBlock().getLightFromSky()); - not

Comment by sync667 [ 18/Jan/17 ]

Edit: If i will use method form block model not accessed from event it's works. So just when i use for ex. BlockPlaceEvent and getBlock and then light level it's won't work.

Generated at Fri Mar 14 15:12:55 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.