MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / getRawLight

Method getRawLight

src/main/java/net/minecraft/world/World.java:2790–2841  ·  view source on GitHub ↗

gets the light level at the supplied position

(BlockPos pos, EnumSkyBlock lightType)

Source from the content-addressed store, hash-verified

2788 * gets the light level at the supplied position
2789 */
2790 private int getRawLight(BlockPos pos, EnumSkyBlock lightType)
2791 {
2792 if (lightType == EnumSkyBlock.SKY && this.canSeeSky(pos))
2793 {
2794 return 15;
2795 }
2796 else
2797 {
2798 Block block = this.getBlockState(pos).getBlock();
2799 int i = lightType == EnumSkyBlock.SKY ? 0 : block.getLightValue();
2800 int j = block.getLightOpacity();
2801
2802 if (j >= 15 && block.getLightValue() > 0)
2803 {
2804 j = 1;
2805 }
2806
2807 if (j < 1)
2808 {
2809 j = 1;
2810 }
2811
2812 if (j >= 15)
2813 {
2814 return 0;
2815 }
2816 else if (i >= 14)
2817 {
2818 return i;
2819 }
2820 else
2821 {
2822 for (EnumFacing enumfacing : EnumFacing.values())
2823 {
2824 BlockPos blockpos = pos.offset(enumfacing);
2825 int k = this.getLightFor(lightType, blockpos) - j;
2826
2827 if (k > i)
2828 {
2829 i = k;
2830 }
2831
2832 if (i >= 14)
2833 {
2834 return i;
2835 }
2836 }
2837
2838 return i;
2839 }
2840 }
2841 }
2842
2843 public boolean checkLightFor(EnumSkyBlock lightType, BlockPos pos)
2844 {

Callers 1

checkLightForMethod · 0.95

Calls 8

canSeeSkyMethod · 0.95
getBlockStateMethod · 0.95
getLightValueMethod · 0.95
getLightOpacityMethod · 0.95
getLightForMethod · 0.95
valuesMethod · 0.80
getBlockMethod · 0.65
offsetMethod · 0.45

Tested by

no test coverage detected