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

Method checkLightFor

src/main/java/net/minecraft/world/World.java:2843–2977  ·  view source on GitHub ↗
(EnumSkyBlock lightType, BlockPos pos)

Source from the content-addressed store, hash-verified

2841 }
2842
2843 public boolean checkLightFor(EnumSkyBlock lightType, BlockPos pos)
2844 {
2845 if (!this.isAreaLoaded(pos, 17, false))
2846 {
2847 return false;
2848 }
2849 else
2850 {
2851 int i = 0;
2852 int j = 0;
2853 this.theProfiler.startSection("getBrightness");
2854 int k = this.getLightFor(lightType, pos);
2855 int l = this.getRawLight(pos, lightType);
2856 int i1 = pos.getX();
2857 int j1 = pos.getY();
2858 int k1 = pos.getZ();
2859
2860 if (l > k)
2861 {
2862 this.lightUpdateBlockList[j++] = 133152;
2863 }
2864 else if (l < k)
2865 {
2866 this.lightUpdateBlockList[j++] = 133152 | k << 18;
2867
2868 while (i < j)
2869 {
2870 int l1 = this.lightUpdateBlockList[i++];
2871 int i2 = (l1 & 63) - 32 + i1;
2872 int j2 = (l1 >> 6 & 63) - 32 + j1;
2873 int k2 = (l1 >> 12 & 63) - 32 + k1;
2874 int l2 = l1 >> 18 & 15;
2875 BlockPos blockpos = new BlockPos(i2, j2, k2);
2876 int i3 = this.getLightFor(lightType, blockpos);
2877
2878 if (i3 == l2)
2879 {
2880 this.setLightFor(lightType, blockpos, 0);
2881
2882 if (l2 > 0)
2883 {
2884 int j3 = MathHelper.abs_int(i2 - i1);
2885 int k3 = MathHelper.abs_int(j2 - j1);
2886 int l3 = MathHelper.abs_int(k2 - k1);
2887
2888 if (j3 + k3 + l3 < 17)
2889 {
2890 BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
2891
2892 for (EnumFacing enumfacing : EnumFacing.values())
2893 {
2894 int i4 = i2 + enumfacing.getFrontOffsetX();
2895 int j4 = j2 + enumfacing.getFrontOffsetY();
2896 int k4 = k2 + enumfacing.getFrontOffsetZ();
2897 blockpos$mutableblockpos.func_181079_c(i4, j4, k4);
2898 int l4 = Math.max(1, this.getBlockState(blockpos$mutableblockpos).getBlock().getLightOpacity());
2899 i3 = this.getLightFor(lightType, blockpos$mutableblockpos);
2900

Callers 3

checkLightMethod · 0.95

Calls 15

isAreaLoadedMethod · 0.95
getLightForMethod · 0.95
getRawLightMethod · 0.95
setLightForMethod · 0.95
abs_intMethod · 0.95
func_181079_cMethod · 0.95
getBlockStateMethod · 0.95
westMethod · 0.95
eastMethod · 0.95
downMethod · 0.95
upMethod · 0.95
northMethod · 0.95

Tested by

no test coverage detected