Jump to content

Recommended Posts

Posted (edited)

I'm having some trouble getting the correct light value at the players coordinates.
 

Double playerX = Minecraft.getMinecraft().thePlayer.posX;
Double playerY = Minecraft.getMinecraft().thePlayer.posY;
Double playerZ = Minecraft.getMinecraft().thePlayer.posZ;
int playerlightlevel = Minecraft.getMinecraft().theWorld.getBlockLightValue(playerX.intValue(), playerY.intValue(), playerZ.intValue());
System.out.println("Light Level modifier is " + playerlightlevel);

 

In full daylight outdoors this returns 15 to console as expected, however if there is a block at eye level next to and behind the player (not on top) the value returns 0, even though F3 Screen shows 15 still.

 

See:

http://imgur.com/a/1JzVV

 

This code occurs inside a LivingUpdateEvent and triggers once every tick, but slowing the rate at which its checked did not help either.  Also checking at y-1 did not effect it, except the requirement for it to output zero is that you needed to stand three blocks deep instead of two.

 

Being that it's after 3 am maybe it's just me missing something simple, but how can I get the same light value as the one registered in the f3 screen?

 

Edit: Here is the whole class: http://pastebin.com/UWt6m62A

Edited by ignatio
  • Guest locked this topic
Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.