public void onTick(){
  int prevLight=lightLevel;
  lightLevel=getLightFromItemStack(player.getCurrentEquippedItem());
  for (  ItemStack armor : player.inventory.armorInventory) {
    lightLevel=Math.max(lightLevel,getLightFromItemStack(armor));
  }
  if (prevLight != 0 && lightLevel != prevLight) {
    lightLevel=0;
  }
 else {
    if (player.isBurning()) {
      lightLevel=15;
    }
  }
  if (!enabled && lightLevel > 0) {
    enableLight();
  }
 else   if (enabled && lightLevel < 1) {
    disableLight();
  }
}

public void onTick ( ) { int prevLight = lightLevel ; lightLevel = getLightFromItemStack ( player . getCurrentEquippedItem ( ) ) ; for ( ItemStack armor : player . inventory . armorInventory ) { lightLevel = Math . max ( lightLevel , getLightFromItemStack ( armor ) ) ; } if ( prevLight != 0 && lightLevel != prevLight ) { lightLevel = 0 ; } else { if ( player . isBurning ( ) ) { lightLevel = 15 ; } } if ( ! enabled && lightLevel > 0 ) { enableLight ( ) ; } else if ( enabled && lightLevel < 1 ) { disableLight ( ) ; } }
since they are idynamiclightsource instances , they will already receive updates ! why do we need to do this ? because player entities can change equipment and we really don ' t want this method in an onupdate tick , way too expensive . so we put it in a seperate thread !
