Merge pull request #294 from mikeprimm/hdrender

Handle snow lighting special case
This commit is contained in:
mikeprimm 2011-07-19 15:45:59 -07:00
commit b277663705

View File

@ -102,21 +102,28 @@ public class IsoHDPerspective implements HDPerspective {
*/ */
public final int getSkyLightLevel() { public final int getSkyLightLevel() {
int ll; int ll;
BlockStep ls = mapiter.unstepPosition(); BlockStep ls;
/* Some blocks are light blocking, but not fully blocking - this sucks */ /* Some blocks are light blocking, but not fully blocking - this sucks */
switch(mapiter.getBlockTypeID()) { switch(mapiter.getBlockTypeID()) {
case 53: /* Wood stairs */ case 53: /* Wood stairs */
case 44: /* Slabs */ case 44: /* Slabs */
case 67: /* Cobblestone stairs */ case 67: /* Cobblestone stairs */
ls = mapiter.unstepPosition();
mapiter.stepPosition(BlockStep.Y_PLUS); /* Look above */ mapiter.stepPosition(BlockStep.Y_PLUS); /* Look above */
ll = mapiter.getBlockSkyLight(); ll = mapiter.getBlockSkyLight();
mapiter.stepPosition(BlockStep.Y_MINUS); mapiter.stepPosition(BlockStep.Y_MINUS);
mapiter.stepPosition(ls);
break; break;
case 78: /* Snow */
ll = mapiter.getBlockSkyLight();
break;
default: default:
ls = mapiter.unstepPosition();
ll = mapiter.getBlockSkyLight(); ll = mapiter.getBlockSkyLight();
mapiter.stepPosition(ls);
break; break;
} }
mapiter.stepPosition(ls);
return ll; return ll;
} }
/** /**
@ -124,21 +131,27 @@ public class IsoHDPerspective implements HDPerspective {
*/ */
public final int getEmittedLightLevel() { public final int getEmittedLightLevel() {
int ll; int ll;
BlockStep ls = mapiter.unstepPosition(); BlockStep ls;
/* Some blocks are light blocking, but not fully blocking - this sucks */ /* Some blocks are light blocking, but not fully blocking - this sucks */
switch(mapiter.getBlockTypeID()) { switch(mapiter.getBlockTypeID()) {
case 53: /* Wood stairs */ case 53: /* Wood stairs */
case 44: /* Slabs */ case 44: /* Slabs */
case 67: /* Cobblestone stairs */ case 67: /* Cobblestone stairs */
ls = mapiter.unstepPosition();
mapiter.stepPosition(BlockStep.Y_PLUS); /* Look above */ mapiter.stepPosition(BlockStep.Y_PLUS); /* Look above */
ll = mapiter.getBlockEmittedLight(); ll = mapiter.getBlockEmittedLight();
mapiter.stepPosition(BlockStep.Y_MINUS); mapiter.stepPosition(BlockStep.Y_MINUS);
mapiter.stepPosition(ls);
break; break;
case 78: /* Snow */
ll = mapiter.getBlockEmittedLight();
break;
default: default:
ls = mapiter.unstepPosition();
ll = mapiter.getBlockEmittedLight(); ll = mapiter.getBlockEmittedLight();
mapiter.stepPosition(ls);
break; break;
} }
mapiter.stepPosition(ls);
return ll; return ll;
} }
/** /**