Why is get light level always return 0

Started by ydydxhg on Fri, 05/15/2020 - 08:13

Topic category: Advanced modding

Last seen on 11:46, 25. May 2020
Joined Apr 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Why is get light level always return 0
Fri, 05/15/2020 - 08:13

I am creating a procedure to determine if the light level of a block is less than 8, so i will place a torch to avoid mob spawning...

but it seems like the method returns the light value that the block is projecting.... e.g. get light level of a torch block is 14, and the block directly above it is 0.

what is the correct way of achieving this goal?

Check light level of…
Fri, 05/15/2020 - 08:32

Check light level of location above your block (y + 1) if your block blocks light

Last seen on 11:46, 25. May 2020
Joined Apr 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
in my particular case, its…
Fri, 05/15/2020 - 08:45

in my particular case, its in a cave/underground where i am mining, the block above the block is mostly likely to be solid and blocking the light. which is why i need to workout whether to place a torch if:

1, i am on a solid block (x, y, z)

2, the lighting condition of the bloc (x,y,z) is too dark  

 

my current logic (or i would like to achieve) is:

dig block (x, y, z),

check lighting condition of (x, y, z), if lighting is good, i.e. from light source from nearby torch or lava, go on

else, put a torch on top of (x, y, z), which will be air as just digged out. 
 

 

Then you will need to check…
Fri, 05/15/2020 - 09:12

Then you will need to check for light in all directions one block away from the current block

Last seen on 11:46, 25. May 2020
Joined Apr 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
i see, thanks for the help
Fri, 05/15/2020 - 11:15

i see, thanks for the help